<!--{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 href="javascript:;">营销管理</a><span lay-separator="">/</span>
      <a><cite>站内通知</cite></a>
    </div>
  </div>
  <!--//top end -->
  
  <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">UID：</div>
        <div class="layui-input-inline input-100">
          <input type="text" name="suserid" id="suserid" class="layui-input" value="<!--{if $suserid > 0}--><!--{$suserid}--><!--{/if}-->" />
        </div>
      </div>
      <div class="layui-inline">
        <div class="layui-form-label">用户名：</div>
        <div class="layui-input-inline input-150">
          <input type="text" name="susername" id="susername" class="layui-input" value="<!--{$susername}-->" />
        </div>
      </div>
      <div class="layui-inline">
        <div class="layui-form-label">消息内容：</div>
        <div class="layui-input-inline input-150">
          <input type="text" name="scontent" id="scontent" class="layui-input" value="<!--{$scontent}-->" />
        </div>
      </div>
      <div class="layui-inline">
        <div class="layui-form-label">阅读状态：</div>
        <div class="layui-input-inline input-100">
          <select name="sflag" id="sflag">
            <option value="">=全部=</option>
            <option value="1"<!--{if $sflag == '1'}--> selected<!--{/if}-->>未读</option>
            <option value="2"<!--{if $sflag == '2'}--> selected<!--{/if}-->>已读</option>
          </select>
        </div>
      </div>
      
      <div class="layui-inline">
        <button class="layui-btn layui-btn-sm search" id="but_submit_search2" name="btn_search" 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" f="handle-array" data-form="myform">
          <i class="layui-icon layui-icon-delete"></i>
          <span>删除选定</span>
        </div>
        <a href="javascript:;" class="btn add fl add_line" f="pop_send_msg" data-uid="">
          <i class="layui-icon layui-icon-friends"></i>
          <span>发送通知</span>
        </a>
        <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=batch" class="btn add fl">
          <i class="layui-icon layui-icon-group"></i>
          <span>群发通知</span>
        </a>
      </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="4%"></th>
          <th width="8%">ID</th>
          <th width="5%">头像</th>
          <th width="15%">接收用户</th>
          <th width="14%">时间</th>
          <th width="6%">状态</th>
          <th width="15%">标题</th>
          <th>消息</th>
          <th width="12%">操作</th>
        </tr>
      </thead>
      <!--{if empty($msg)}-->
      <tr>
        <td class="text_center" colspan="9">没有符合条件的信息！</td>
      </tr>
      <!--{else}-->
      <!--{foreach $msg as $volist}-->
      <tr>
        <td class="check text_center">
          <input type="checkbox" name="id[]" lay-skin="primary" value="<!--{$volist.msgid}-->" />
        </td>
        <td class="text_center">
          <!--{$volist.msgid}-->
        </td>
        </td>
        <td class="text_center drop" valign="middle">
          <!--{if $volist.userid > 0}-->
          <!--{if !empty($volist.headimg)}-->
          <div class="down">
            <div><img src="<!--{$volist.headimg}-->" width="20px" height="20px" f="viewimg" /></div>
            <div class="sub">
              <img src="<!--{$volist.headimg}-->"/>
            </div>
          </div>
          <!--{/if}-->
          <!--{else}-->
          --
          <!--{/if}-->
        </td>
        <td class="text_center">
          <!--{if $volist.userid > 0}-->
          <!--{$volist.username}-->&nbsp;&nbsp;&nbsp;(uid:<!--{$volist.userid}-->)<br />
          <!--{$volist.age}-->岁 <!--{hook mod="var" item="gender" type="text" value=$volist.gender}--> 
          <!--{hook mod="var" item="marry" type="text" value=$volist.marry}--> 
          <!--{area type="text" value=$volist.dist2}-->
          <!--{else}-->
          --
          <!--{/if}-->
        </td>
        <td class="text_center" valign="middle"><!--{$volist.sendtime|date_format:"%Y-%m-%d %H:%M:%S"}--></td>
        <td class="text_center" valign="middle">
          <!--{if $volist.readflag == '1'}-->
          <font color="green">已读</font>
          <!--{else}-->
          <font color="gray">未读</font>
          <!--{/if}-->
        </td>
        <td valign="middle"><!--{$volist.title}--></td>
        <td valign="middle"><!--{$volist.content|filterhtml:50}-->...</td>
        <td class="text_center" valign="middle">
         <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=view&id=<!--{$volist.msgid}-->&<!--{$comeurl}-->" class="layui-btn layui-btn-normal layui-btn-xs">查看</a>
         <a href="javascript:;" f="handle-one" data-url="<!--{$oefile}-->&c=<!--{$c}-->&a=del&id[]=<!--{$volist.msgid}-->&<!--{$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>
<!--{/if}-->

<!--{if $a == 'view'}-->
<div class="layui-fluid oe_fluid">
  <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 href="javascript:;">营销管理</a><span lay-separator="">/</span>
      <a href="<!--{$oefile}-->&c=<!--{$c}-->">站内通知</a><span lay-separator="">/</span>
      <a><cite>查看通知</cite></a>
    </div>
    <div class="oe_tool_bar ft">
      <a href="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->" class="layui-btn layui-btn-sm layui-btn-primary layui-btn-radius">
        <span>返回列表</span>
      </a>
    </div>
  </div>
  <div class="layui-card oe_table_edit">
    <div class="layui-card-header">查看通知</div>
    <div class="layui-card-body">
      <table class="oe_tbl_form layui-form">
        <tbody>
          <tr>
            <th width="15%">用户：<span class="f_red"></span></th>
            <td width="85%">
            <!--{if $msg.userid > 0}-->
            <!--{$msg.username}-->&nbsp;&nbsp;(uid:<!--{$msg.userid}-->) <br />
            <!--{$msg.age}-->岁 <!--{hook mod="var" item="gender" type="text" value=$msg.gender}--> 
            <!--{hook mod="var" item="marry" type="text" value=$msg.marry}--> 
            <!--{area type="text" value=$msg.dist1}--> <!--{area type="text" value=$msg.dist2}-->
            <!--{else}-->
            --
            <!--{/if}-->
            </td>
          </tr>

          <tr>
            <th>发送时间：<span class="f_red"></span></th>
            <td><!--{$msg.sendtime|date_format:"%Y-%m-%d %H:%M:%S"}--></td>
          </tr>
          <tr>
            <th>消息标题：<span class="f_red"></span></th>
            <td><!--{$msg.title}--></td>
          </tr>

          <tr>
            <th>消息内容：<span class="f_red"></span> </th>
            <td><!--{$msg.content}--></td>
          </tr>
        </tbody>
      </table>
    </div>
  </div> 
</div>
<!--{/if}-->

<!--{if $a == "send"}-->
<div class="layui-fluid oe_fluid" style="padding-top:10px;">

  <div class="layui-card">
    <div class="layui-card-header">发送站内通知</div>
    <div class="layui-card-body">
      <table class="oe_tbl_form layui-form">
        <tr>
          <th width="25%"><font color="red">*</font>接收用户：</th>
          <td width="75%">
            <input type="text" name="userid" id="userid" class="layui-input input-150" placeholder="请输入用户UID" value="<!--{if $uid > 0}--><!--{$uid}--><!--{/if}-->" />
            <!--{if $uid > 0}-->
            <!--{$user.username}-->/uid:<!--{$user.userid}-->
            <!--{else}-->
            --
            <!--{/if}-->
          </td>
        </tr>
        <tr>
          <th><font color="red">*</font>标&#12288;&#12288;题：</th>
          <td>
            <input type="text" name="title" id="title" class="layui-input" style="width:80%;" placeholder="请输入标题" />
          </td>
        </tr>
        <tr>
          <th><font color="red">*</font>通知内容：</th>
          <td>
            <textarea name="content" id="content" class="layui-textarea" style="width:80%;height:130px;" placeholder="请输入通知内容"></textarea>
          </td>
        </tr>
      </table>
    </div>
  </div>

  
  <div class="oe_tbl_form_btn">
    <button class="layui-btn" id="but_submit_post" lay-submit lay-filter="sendform">
      确定发送
      <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
    </button>
  </div>
  
</div>

<script type="text/javascript">
$(function(){
    layui.use('form', function(){
        $form = layui.form;
        //发送...
        $form.on('submit(sendform)', function(data){
            $obj_id = data.elem.getAttribute("id");
            if (!$("#"+$obj_id).hasClass("forbid_submit")) {
                
                $userid = $("#userid").val();
                $title = $("#title").val();
                $content = $("#content").val();
                
                if ($userid.length == 0) {
                    layer.msg("请输入用户UID");
                    return false;
                }
                if ($title.length == 0) {
                    layer.msg("请输入标题");
                    return false;
                }
                if ($content.length == 0) {
                    layer.msg("请输入内容");
                    return false;
                }
                
                $("#"+$obj_id).addClass("forbid_submit");
                if ($("#"+$obj_id).find("span").length > 0) {
                    $("#"+$obj_id).find("span").show();
                }
                
                $.ajax({
                    type: "POST",
                    url: "<!--{$oefile}-->&c=<!--{$c}-->",
                    cache: false,
                    data: {
                        a:"savesend", userid:$userid, 
                        title:$title, content:$content, r:get_rndnum(8)
                    },
                    dataType: "json",
                    success: function($data) {
                        $json = eval($data);
                        $response = $json.response;
                        $result = $json.result;
                        if ($response == '1') {
                            layer.msg("发送成功");
                            setTimeout(function(){
                              window.location.reload();
                            }, 600);
                        }
                        else {
                            if ($result.length == 0) {
                                $result = "发送失败，请检查";
                            }
                            layer.msg($result);
                        }
                        $("#"+$obj_id).removeClass("forbid_submit");
                        if ($("#"+$obj_id).find("span").length > 0) {
                            $("#"+$obj_id).find("span").hide();
                        }
                
                    },
                    error: function() {
                        layer.msg("系统繁忙，请稍后再试");
                        $("#"+$obj_id).removeClass("forbid_submit");
                        if ($("#"+$obj_id).find("span").length > 0) {
                            $("#"+$obj_id).find("span").hide();
                        }
                    }
                });
            }
        });   
    });
    
});
</script>
<!--{/if}-->


<!--{if $a == "batch"}-->
<div class="layui-fluid oe_fluid">
  <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 href="javascript:;">营销管理</a><span lay-separator="">/</span>
      <a href="javascript:;">站内通知</a><span lay-separator="">/</span>
      <a><cite>批量发消息</cite></a>
    </div>
    <div class="oe_tool_bar ft">
      <a href="<!--{$oefile}-->&c=<!--{$c}-->" class="layui-btn layui-btn-sm layui-btn-primary layui-btn-radius">
        <span>返回列表</span>
      </a>
    </div>
  </div>
  <div class="layui-card oe_table_edit">
    <div class="layui-card-header">筛选会员</div>
    <div class="layui-card-body">
      <table class="oe_tbl_form layui-form">
        <tr>
          <th>性别：<span class="f_red"></span></th>
          <td colspan="3">
            <div class="tbl_select input-100">
              <select name="sgender" id="sgender">
                <option value="">全部</option>
                <option value="2">女会员</option>
                <option value="1">男会员</option>
              </select>
            </div>
          </td>
        </tr>
        
        <tr>
          <th>地区：<span class="f_red"></span></th>
          <td colspan="3">
            <div class="layui-input-inline input-120">
              <!--{assign var="distlist" value=vo_list("mod={area} where={v.parentid='0'} orderby={v.orders ASC}")}-->
              <select name="sdist1" id="sdist1" lay-filter="area" data-depth="1" data-name="sdist" data-text="=请选择=">
                <option value="">=请选择=</option>
                <!--{foreach $distlist as $val}-->
                <option value="<!--{$val.areaid}-->"><!--{$val.areaname}--></option>
                <!--{/foreach}-->
              </select>
            </div>
            <div class="layui-input-inline input-120" id="json_sdist2">
              <select name="sdist2" id="sdist2" lay-filter="area">
                <option value="">=请选择=</option>
              </select>
            </div>
            <div class="layui-input-inline input-120" id="json_sdist3">
              <select name="sdist3" id="sdist3" lay-filter="area">
                <option value="">=请选择=</option>
              </select>
            </div>
          </td>
        </tr>
        
        <tr>
          <th width="15%">年龄：<span class="f_red"></span></th>
          <td width="35%">
            <div class="tbl_input input-100"><input type="text" name="sage" id="sage" class="layui-input" /></div> - 
            <div class="tbl_input input-100"><input type="text" name="eage" id="eage" class="layui-input" /></div>岁
          </td>
          <th width="15%">身高：<span class="f_red"></span></th>
          <td width="35%">
            <div class="tbl_input input-100"><input type="text" name="sheight" id="sheight" class="layui-input" /></div> - 
            <div class="tbl_input input-100"><input type="text" name="eheight" id="eheight" class="layui-input" /></div>CM
          </td>
        </tr>
        <tr>
          <th>婚况：<span class="f_red"></span></th>
          <td>
            <div class="tbl_select input-100">            
              <!--{hook mod="var" item="marry" name="smarry" type="select" text="不限"}-->
            </div>
          </td>
          <th>学历：<span class="f_red"></span></th>
          <td>
            <div class="tbl_select input-100">
              <!--{hook mod="var" item="education" name="seducation" type="select" text="不限"}-->
            </div>
          </td>
        </tr>
        <tr>
          <th>职业：<span class="f_red"></span></th>
          <td>
            <div class="tbl_select input-100">
              <!--{hook mod="var" item="job" name="sjob" type="select" text="不限"}-->
            </div>
          </td>
          <th>购车：<span class="f_red"></span></th>
          <td>
            <div class="tbl_select input-100">
              <!--{hook mod="var" item="car" name="scar" type="select" text="不限"}-->
            </div>
          </td>
        </tr>
        <tr>
          <th>住房：<span class="f_red"></span></th>
          <td>
            <div class="tbl_select input-100">
              <!--{hook mod="var" item="house" name="shouse" type="select" text="不限"}-->
            </div>
          </td>
          <th>类型：<span class="f_red"></span></th>
          <td>
            <div class="tbl_select input-100">
              <!--{hook mod="var" item="sort" name="ssort" type="select" text="不限"}-->
            </div>
          </td>
        </tr>
        <tr>
          <th>生肖：<span class="f_red"></span></th>
          <td>
            <div class="tbl_select input-100">
              <!--{hook mod="var" item="lunar" name="slunar" type="select" text="不限"}-->
            </div>
          </td>
          <th>星座：<span class="f_red"></span></th>
          <td>
            <div class="tbl_select input-100">
              <!--{hook mod="var" item="astro" name="sastro" type="select" text="不限"}-->
            </div>
          </td>
        </tr>

        <tr>
          <th>头像：<span class="f_red"></span></th>
          <td>
            <div class="tbl_select input-100">
              <select name="sheadflag" id="sheadflag">
                <option value="">不限</option>
                <option value="1">通过</option>
                <option value="2">待审</option>
                <option value="3">未通过</option>
                <option value="4">无</option>
              </select>
            </div>
          </td>
          <th>独白：<span class="f_red"></span></th>
          <td>
            <div class="tbl_select input-100">
              <select name="sintroflag" id="sintroflag">
                <option value="">不限</option>
                <option value="1">通过</option>
                <option value="2">待审</option>
                <option value="3">未通过</option>
                <option value="4">无</option>
              </select>
            </div>
          </td>
        </tr>
        <tr>
          <th>状态：<span class="f_red"></span></th>
          <td>
            <div class="tbl_select input-100">
              <select name="sflag" id="sflag">
                <option value="">不限</option>
                <option value="1">通过</option>
                <option value="2">未通过</option>
                <option value="3">待审核</option>
              </select>
            </div>
          </td>
          <th>会员等级：<span class="f_red"></span></th>
          <td>
            <div class="tbl_select input-100">
              <!--{hook mod="group" type="select" name="sgroupid" text="不限"}-->
            </div>
          </td>
        </tr>
        
        <tr>
          <th>身份认证：<span class="f_red"></span></th>
          <td>
            <div class="tbl_select input-100">
              <select name="sidrz" id="sidrz">
                <option value="">不限</option>
                <option value="1">已认证</option>
                <option value="2">未认证</option>
              </select>
            </div>
          </td>
          <th>手机认证：<span class="f_red"></span></th>
          <td>
            <div class="tbl_select input-100">
              <select name="smobilerz" id="smobilerz">
                <option value="">不限</option>
                <option value="1">已认证</option>
                <option value="2">未认证</option>
              </select>
            </div>
          </td>
        </tr>
        
      </table>
    </div>
    <div class="layui-card-header">站内消息内容</div>
    <div class="layui-card-body">
      <table class="oe_tbl_form layui-form">
        <tr>
          <th width="15%"><span class="require">*</span>标题：</th>
          <td>
            <input type="text" name="title" id="title" class="layui-input" style="width:40%;" />
          </td>
        </tr>
        <tr>
          <th><span class="require">*</span>内容：</th>
          <td>
            <textarea name="content" id="content" class="layui-textarea" style="width:40%;height:100px;"></textarea>
          </td>
        </tr>
        <tr>
          <td></td>
          <td> 
            <button type="button" id="btn_save" class="layui-btn">确定发送</button>&nbsp;&nbsp;&nbsp;
            <span id="tips_submit"></span>
          </td>
        </tr>
      </table>
    </div>
  </div>
</div>

<script type="text/javascript">
$(function(){

    //批量发送
    $(document).on("click", "#btn_save", function(){
        $("#tips_submit").html("");

        $sgender = $("#sgender").val();
        $sdist1 = $("#sdist1").val();
        $sdist2 = $("#sdist2").val();
        if (typeof($sdist2) == "undefined") {
            $sdist2 = "0";
        }
        $sdist3 = $("#sdist3").val();
        if (typeof($sdist3) == "undefined") {
            $sdist3 = "0";
        }
        $sdist4 = $("#sdist4").val();
        if (typeof($sdist4) == "undefined") {
            $sdist4 = "0";
        }

        $sage = $("#sage").val();
        $eage = $("#eage").val();
        $sheight = $("#sheight").val();
        $eheight = $("#eheight").val();

        $smarry = $("#smarry").val();
        $seducation = $("#seducation").val();
        $sjob = $("#sjob").val();
        $scar = $("#scar").val();
        $shouse = $("#shouse").val();
        $ssort = $("#ssort").val();
        $slunar = $("#slunar").val();
        $sastro = $("#sastro").val();
        
        $sheadflag = $("#sheadflag").val();
        $sintroflag = $("#sintroflag").val();
        $sflag = $("#sflag").val();
        $sgroupid = $("#sgroupid").val();
        
        $sidrz = $("#sidrz").val();
        $smobilerz = $("#smobilerz").val();

        
        $title = $("#title").val();
        $content = $("#content").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=msg",
            cache: false,
            data: {
                a:"savebatch", sgender:$sgender, sdist1:$sdist1, sdist2:$sdist2, sdist3:$sdist3, sdist4:$sdist4, 
                sage:$sage, eage:$eage, sheight:$sheight, eheight:$eheight, smarry:$smarry, seducation:$seducation, 
                sjob:$sjob, scar:$scar, shouse:$shouse, ssort:$ssort, slunar:$slunar, sastro:$sastro, 
                sheadflag:$sheadflag, sintroflag:$sintroflag, sflag:$sflag, sgroupid:$sgroupid, 
                sidrz:$sidrz, smobilerz:$smobilerz, 
                title:$title, content:$content, 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}-->
<script type="text/javascript">
  jQuery(".drop").slide({ type:"menu", titCell:".down", targetCell:".sub",effect:"slideDown",delayTime:100,triggerTime:0,returnDefault:true});
</script>
</body>
</html>