<!--{include file="<!--{$oetplpath}-->block_head.tpl"}-->

<!--{if $a == "run"}-->
<div class="layui-fluid oe_fluid">

  <form class="layui-form" id="mysearch" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post">
  <div class="oe_breadcrumb_box clearfix">
    <div class="layui-breadcrumb fl" lay-filter="breadcrumb" style="visibility: visible;">
      <a href="javascript:;">会员管理</a><span lay-separator="">/</span>
      <a><cite>微信粉丝</cite></a>
    </div>
    
  </div>
  
  <div class="oe_searchbar layui-form">
    <div class="more_search_open"></div>
    <div class="layui-form-item">
   
      <div class="layui-inline">
        <div class="layui-form-label">微信昵称：</div>
        <div class="layui-input-inline input-120">
          <input type="text" name="snickname" id="snickname" class="layui-input" value="<!--{$snickname}-->" />
        </div>
      </div>
      <div class="layui-inline">
        <div class="layui-form-label">微信编号：</div>
        <div class="layui-input-inline input-120">
          <input type="text" name="sopenid" id="sopenid" class="layui-input" value="<!--{$sopenid}-->" />
        </div>
      </div>
      <div class="layui-inline">
        <div class="layui-form-label">注册会员：</div>
        <div class="layui-input-inline input-100">
          <select name="suser" id="suser">
            <option value="">不限</option>
            <option value="1"<!--{if $suser == '1'}--> selected<!--{/if}-->>已注册</option>
            <option value="2"<!--{if $suser == '2'}--> selected<!--{/if}-->>未注册</option>
          </select>
        </div>
      </div>
      
      <!--{if isset($config.app.union)}-->
      <div class="layui-inline">
        <div class="layui-form-label">注册红娘：</div>
        <div class="layui-input-inline input-100">
          <select name="sunion" id="sunion">
            <option value="">不限</option>
            <option value="1"<!--{if $sunion == '1'}--> selected<!--{/if}-->>已注册</option>
            <option value="2"<!--{if $sunion == '2'}--> selected<!--{/if}-->>未注册</option>
          </select>
        </div>
      </div>
      <!--{/if}-->
      
      <div class="layui-inline">
        <button class="layui-btn layui-btn-sm search" id="but_submit_search2" lay-submit lay-filter="searchform2">
          <i class="layui-icon layui-icon-search"></i>
          搜索
          <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
        </button>
      </div>
    </div>
  </div>
  <!--//search End -->
  </form>

  <div class="oe_table_wrap layui-form">
    <div class="oe_tbl_tool clearfix">
      <div class="oe_gnbar clearfix">
        <div class="select btn fl">
          <input type="checkbox" name="allid[]" lay-skin="primary" title="全选" lay-filter="selectAll">
        </div>
        <div class="btn del fl del_line" f="handle-array" data-form="myform">
          <i class="layui-icon layui-icon-delete"></i>
          <span>删除</span>
        </div>
      </div>
      
      <div class="oe_tongji_bar clearfix current">
        <span><b><!--{$total}--></b> 条记录</span>
      </div>
    </div>
    <form class="layui-form" id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post">
    <input type="hidden" name="a" id="a" value="del" />
    <table class="layui-table">
      <thead>
        <tr>
          <th width="2%">选</th>
          <th width="6%">ID</th>
          <th width="4%">头像</th>
          <th width="10%">昵称</th>
          <th width="4%">性别</th>
          <th width="7%">地区</th>
          <th>编码</th>
          <th width="5%">状态</th>
          <th width="8%">关注时间</th>
          <th width="10%">关联手机</th>
          <th width="8%">注册红娘</th>
          <th width="8%">注册会员</th>
          <th width="6%">推荐人</th>
          <th width="6%">操作</th>
        </tr>
      </thead>
      <!--{if empty($wxfans)}-->
      <tr>
        <td class="text_center" colspan="15">没有符合条件的信息</td>
      </tr>
      <!--{else}-->
      <!--{foreach $wxfans as $volist}-->
      <tr>
        <td class="check text_center">
          <input type="checkbox" name="id[]" lay-skin="primary" value="<!--{$volist.scid}-->" />
        </td>
        <td class="text_center">
          <!--{$volist.scid}-->
        </td>
        <td class="text_center drop">
          <!--{if !empty($volist.headimgurl)}-->
          <div class="down">
            <div><img src="<!--{$urlpath}-->tpl/static/images/loading_img.png" data-src="<!--{$volist.headimgurl}-->" width="20px" height="20px" preload="0" f="zoom_avatar"  /></div>
            <div class="sub">
              <img src="<!--{$urlpath}-->tpl/static/images/loading_img.png" data-src="<!--{$volist.headimgurl}-->" f="viewimg" />
            </div>
          </div>
          <!--{else}-->
          --
          <!--{/if}-->
        </td>
        <td class="text_center"><!--{$volist.nickname}--></td>
        <td class="text_center">
          <!--{if $volist.gender == '1'}-->
          <i class="iconfont icon-nan" title="男"></i>
          男
          <!--{elseif $volist.gender == '2'}-->
          <i class="iconfont icon-nv" title="女"></i>
          女
          <!--{else}-->
          --
          <!--{/if}-->
        </td>
        <td class="text_center"><!--{$volist.province}--> <!--{$volist.city}--></td>
        <td class="text_center"<!--{if $volist.signtime>0}--> title="最后会话：<!--{$volist.signtime|date_format:"%Y-%m-%d %H:%M:%S"}-->"<!--{/if}-->><!--{$volist.openid}--></td>
        <td class="text_center">
          <!--{if $volist.subscribe == 1}-->
          <font color="green">已关注</font>
          <!--{else}-->
          <font color="gray">未关注</font>
          <!--{/if}-->
        </td>
        
        <!--//9.11.12 -->
        <!--{if $volist.canceltime>0}-->
        <td class="text_center" title="取消时间：<!--{$volist.canceltime|date_format:"%Y-%m-%d %H:%M:%S"}-->">
        <!--{else}-->
        <td class="text_center">
        <!--{/if}-->
        
        
          <!--{$volist.addtime|date_format:"%Y-%m-%d"}--><br />
          <!--{$volist.addtime|date_format:"%H:%M:%S"}-->
        </td>
        <td class="text_center">
          <!--{assign var="moblist" value=vo_list("mod={guest} where={v.wxopenid='<!--{$volist.openid}-->'} num={100}")}-->
          <!--{if !empty($moblist)}-->
          <!--{foreach $moblist as $val}-->
          <!--{$val.mobile}-->
          <!--{/foreach}-->
          <!--{else}-->
          --
          <!--{/if}-->
        </td>
        
        <td class="text_center">
          <!--{if isset($config.app.union)}-->
          <!--{if !empty($volist.unionname)}-->
          <!--{$volist.unionname}-->
          <!--{else}-->
          --
          <!--{/if}-->
          <!--{/if}-->
        </td>
        
        <!--{if $volist.binduid > 0}-->
        <td class="text_center">
          <!--{if !empty($volist.user)}-->
          <a href="<!--{$urlpath}-->index.php?c=home&a=detail&id=<!--{$volist.user.userid}-->" target="_blank">
          <img src="<!--{$volist.user.headimg}-->" width="20" height="20" f="viewimg" />
          <!--{$volist.user.username}--><br /> uid:<!--{$volist.user.userid}-->
          </a>
          <!--{/if}-->
        </td>
        <!--{else}-->
        <td class="text_center">
          <font color="red">未注册</font><br />
          <!--{if $volist.subscribe == '1'}-->
          提醒<span id="tiptimes_<!--{$volist.scid}-->"><!--{$volist.tiptimes}--></span>次<br />
          <!--{if $volist.lasttip > 0}-->
          <!--{$volist.lasttip|date_format:"%Y/%m/%d %H:%M:%S"}-->
          <!--{/if}-->
          <!--{/if}-->
        </td>
        <!--{/if}-->
        
        <td class="text_center">
          <!--{if isset($config.app.union)}-->
          <!--{if $volist.fromunid > 0}-->
          <!--{hook mod="meipo" type="text" value=$volist.fromunid}-->
          <!--{else}-->
          --
          <!--{/if}-->
          <!--{else}-->
          --
          <!--{/if}-->
        </td>
        <td class="text_center" style="line-height:35px;">
          <!--{if $volist.binduid == 0 && $volist.subscribe == '1'}-->
          <a href="javascript:;" class="layui-btn layui-btn-xs" f="but_send_tip" data-id="<!--{$volist.scid}-->">提醒注册</a>
          <br />
          <!--{/if}-->
          <a href="javascript:;" f="handle-one" data-text="确定要删除吗？一旦执行不可恢复" data-url="<!--{$oefile}-->&c=<!--{$c}-->&a=del&id[]=<!--{$volist.scid}-->&<!--{$comeurl}-->" class="layui-btn layui-btn-xs layui-btn-danger">删除粉丝</a>
          
        </td>
      </tr>
      <!--{/foreach}-->
      <!--{/if}-->
    </table>
    </form>
    
    <div class="oe_page_box"><!--{$showpage}--></div>
    
  </div>
  
</div>
<script type="text/javascript">
$(function(){
    //提醒注册...
    $(document).on("click", "[f='but_send_tip']", function(){
        $id = $(this).attr("data-id");
        $type = $(this).attr("data-type");
        $url = "<!--{$oefile}-->&c=<!--{$c}-->&a=tipreg&id="+$id+"&datatype=ajax";

        $.ajax({
            type: "POST",
            url: $url,
            cache: false,
            data: {
                r:get_rndnum(8)
            },
            dataType: "json",
            success: function($data) {
                $json = eval($data);
                $response = $json.response;
                $result = $json.result;
                if ($response == "1") {
                    layer.msg("已发送提醒");
                    $nums = parseInt($("#tiptimes_"+$id).html());
                    $("#tiptimes_"+$id).html($nums+1);
                }
                else {
                    if ($result.length > 0) {
                        layer.msg($result);
                    }
                    else {
                        layer.msg("提醒失败，请检查是否开启微信消息提醒，或者用户未关注公众号");
                    }
                }
            },
            error: function() {
                layer.msg("系统繁忙，请稍后再试");
            }
        });          
    });
    
    //预载图片 9.11.24
    preload_img();
});
</script>
<!--{/if}-->

<!--{if $a == "send"}-->
<div class="layui-fluid oe_fluid" style="padding-top:10px;">
  <div class="layui-card">
  
    <div class="layui-card-body">
      <table class="oe_tbl_form layui-form">
        <tr>
          <th width="20%">所选ID：</th>
          <td width="80%"><span><!--{$ids}--></span></td>
        </tr>
        <tr>
          <th><font color="red">*</font> 通知标题：</th>
          <td>
            <input type="text" name="title" id="title" class="layui-input input-400" placeholder="例：注册会员通知" />
          </td>
        </tr>
        <tr>
          <th><font color="red">*</font> 通知内容：</th>
          <td>
            <textarea name="content" id="content" class="layui-textarea" style="width:400px;height:100px;" placeholder="例：感谢您关注我们公众号，你还没注册会员哦，点击立即注册。"></textarea>
          </td>
        </tr>
        <tr>
          <th>跳转链接：</th>
          <td>
            <input type="text" name="url" id="url" class="layui-input input-400" />
            <br />
            快速选择：
            
            <a href="javascript:;" f="but_sel_url" data-url="{siteurl}index.php?m=wap&nofollow=1">首页</a>，
            <a href="javascript:;" f="but_sel_url" data-url="{siteurl}index.php?m=wap&c=passport&a=reg&nofollow=1">注册页</a>，
            <a href="javascript:;" f="but_sel_url" data-url="{siteurl}index.php?m=wap&c=passport&a=login&nofollow=1">登录页</a>，
            <a href="javascript:;" f="but_sel_url" data-url="{siteurl}index.php?m=wap&c=user&nofollow=1">会员页</a>，
            <a href="javascript:;" f="but_sel_url" data-url="{siteurl}index.php?m=wap&c=party&nofollow=1">活动页</a>，
            <a href="javascript:;" f="but_sel_url" data-url="{siteurl}index.php?m=wap&c=cp&nofollow=1">个人中心</a>
            <br />
            <span class="text_tip_inline">(填写手机版的URL链接，不填写默认为首页)</span>
          </td>
        </tr>
        <tr>
          <td></td>
          <td> 
            <button type="button" id="but_send_post" f="but_send_post" class="layui-btn">确定发送</button>
            &#12288;&#12288;
            <span id="tips_submit"></span>
          </td>
        </tr>
      </table>
    </div>
  </div>
  
</div>
<script type="text/javascript">
$(function(){
    //选择链接....
    $(document).on("click", "[f='but_sel_url']", function(){
        $url = $(this).attr("data-url");
        $("#url").val($url);
    });
    
    //批量发送
    $(document).on("click", "#but_send_post", function(){
        $("#tips_submit").html("");
    
        $title = $("#title").val();
        $content = $("#content").val();
        $url = $("#url").val();

        if ($title.length == 0) {
            layer.msg("请填写通知标题");
            return false;
        }
        if ($content.length == 0) {
            layer.msg("请填写通知内容");
            return false;
        }
        
        $("#tips_submit").html("发送中，请耐心等待...");
        
        $.ajax({
            type: "POST",
            url: _OECPFILE+"&c=wxfans",
            data: {
                a:"savesend", title:$title, content:$content, url:$url, ids:"<!--{$ids}-->", r:get_rndnum(8)
            },
            dataType: "json",
            success: function(data) {
                $json = eval(data);
                $response = $json.response;
                $result = $json.result;
                if ($response == '1') {
                    $("#tips_submit").html("<font color='green'>发送成功，发送数量："+$result+"</font>");
                }
                else {
                    if ($result.length == 0) {
                        $result = "发送失败，请检查是否开启微信模板消息";
                    }
                    $("#tips_submit").html("<font color='red'>"+$result+"</font>");
                }
            },
            error: function() {
                layer.msg("系统繁忙，请稍后再试！");
            }
        });
    });

});
</script>
<!--{/if}-->
</body>
</html>