<!--{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">&nbsp;UID：</div>
        <div class="layui-input-inline">
          <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 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 type="text" name="struename" id="struename" class="layui-input" value="<!--{$struename}-->" />
        </div>
      </div>
      
    </div>
    
    <div class="layui-form-item">
    
      <div class="layui-inline">
        <div class="layui-form-label">日志：</div>
        <div class="layui-input-inline">
          <input type="text" name="stext" id="stext" class="layui-input" value="<!--{$stext}-->" />
        </div>
      </div>
      
      <div class="layui-inline">
        <div class="layui-form-label">日&#12288;期：</div>
        <div class="layui-input-inline input-120">
          <input type="text" name="sdate" id="sdate" class="layui-input" placeholder="年-月-日" value="<!--{$sdate}-->" /> 
        </div>
        <div class="layui-form-label">-</div>
        <div class="layui-input-inline input-120">
          <input type="text" name="edate" id="edate" class="layui-input" placeholder="年-月-日" value="<!--{$edate}-->" />
        </div>
      </div>
      <script type="text/javascript">
      layui.use('laydate', function(){
          $laydate = layui.laydate;
          $laydate.render({
              elem: "#sdate"
          });
          $laydate.render({
              elem: "#edate"
          });
      });
      </script>
      <div class="layui-inline">
        <button class="layui-btn layui-btn-sm search" id="but_submit_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">
        <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=add" class="btn add fl del_line">
          <i class="layui-icon layui-icon-add-1"></i>
          <span>添加畅聊</span>
        </a>
      </div>
      <div class="oe_tongji_bar clearfix current">
        <span><b><!--{$total}--></b> 条记录</span>
      </div>
    </div>
  
    <table class="layui-table">
      <thead>
        <tr>
          <th width="8%">ID</th>
          <th width="9%">UID</th>
          <th width="9%">用户名</th>
          <th width="8%">姓名</th>
          <th width="15%">发生时间</th>
          <th width="10%">增加(次)</th>
          <th width="10%">减少(次)</th>
          <th width="10%">剩余(次)</th>
          <th>日志</th>
        </tr> 
      </thead>
      
      <!--{if empty($chattimes)}-->
      <tr>
        <td colspan="9" class="text_center">没有符合条件的信息</td>
      </tr>
      <!--{else}-->
      <!--{foreach $chattimes as $volist}-->
      <tr>
        <td class="text_center"><!--{$volist.actionid}--></td>
        <td class="text_center"><!--{$volist.userid}--></td>
        <td class="text_center">
          <!--{$volist.username}-->
        </td>
        <td class="text_center">
          <!--{$volist.truename}-->
        </td>
        <td class="text_center">
          <!--{$volist.actiontime|date_format:"%Y-%m-%d %H:%M:%S"}-->
        </td>
        <td>
          <!--{if $volist.actiontype == '1'}-->
          <font color="red">+<!--{doubleval($volist.times)}--></font>
          <!--{/if}-->
        </td>
        <td class="text_center">
          <!--{if $volist.actiontype == '2'}-->
          <font color="green">-<!--{doubleval($volist.times)}--></font>
          <!--{/if}-->
        </td>
        <td class="text_center">
          <!--{$volist.remain}-->
        </td>
        <td><!--{$volist.logcont}--></td>
      </tr>
      <!--{/foreach}-->
      <!--{/if}-->
    </table>
    <div class="oe_page_box"><!--{$showpage}--></div>

  </div>
</div>
<!--{/if}-->


<!--{if $a == "add"}-->
<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><cite>添加畅聊</cite></a>
    </div>
    <div class="oe_tool_bar ft">
      <button class="layui-btn layui-btn-sm layui-btn-radius" id="but_submit_post2" lay-submit lay-filter="addform">
        添加保存
        <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
      </button>
      <span class="layui-btn layui-btn-sm layui-btn-primary layui-btn-radius">
        <a href="<!--{$oefile}-->&c=<!--{$c}-->">&lt;&lt;返回上一页</a>
      </span>
    </div> 
  </div>

  <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="15%"><font color="red">*</font>用户UID：</th>
          <td width="85%">
            <input type="text" name="userid" id="userid" class="layui-input input-200" placeholder="请输入用户UID" /> 
            <a href="javascript:;" f="select_user" data-inputid="userid" class="oe_ico_blue">选择会员</a>
            &nbsp;&nbsp;&nbsp;
            <span id="userid_tips"></span>
          </td>
        </tr>

        <tr>
          <th><font color="red">*</font>动作：</th>
          <td>
            <div class="input-200">
            <select name="actiontype" id="actiontype">
              <option value="">请选择</option>
              <option value="1">增加</option>
              <option value="2">减少</option>
            </select>
            </div>
          </td>
        </tr>
        <tr>
          <th><font color="red">*</font>次数：</th>
          <td>
            <input type="text" name="times" id="times" class="layui-input input-200" placeholder="请输入次数" />
            &nbsp;<span class="text_tip_inline">次</span>
          </td>
        </tr>
        <tr>
          <th><font color="red">*</font>备注说明：</th>
          <td><textarea name="logcont" id="logcont" class="layui-textarea" style="width:50%;height:90px;" 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="addform">
      添加保存
      <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(addform)', function(data){
            $obj_id = data.elem.getAttribute("id");
            if (!$("#"+$obj_id).hasClass("forbid_submit")) {
            
                $userid = $("#userid").val();
                if ($userid.length == 0) {
                    layer.msg("请输入用户UID");
                    return false;
                }
                $actiontype = $("#actiontype").val();
                if ($actiontype.length == 0) {
                    layer.msg("请选择动作");
                    return false;
                }
                $times = $("#times").val();
                if ($times.length == 0) {
                    layer.msg("请输入次数");
                    return false;
                }
                $logcont = $("#logcont").val();
                if ($logcont.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:"saveadd", userid:$userid, actiontype:$actiontype, times:$times, 
                        logcont:$logcont, 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();
                            }, 800);
                        }
                        else {
                            if ($result.length > 0) {
                                layer.msg($result);
                            }
                            else {
                                layer.msg("操作失败");
                            }
                            $("#"+$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}-->

</body>
</html>