<!--{include file="<!--{$oetplpath}-->block_head.tpl"}-->
<div class="layui-fluid oe_fluid">
  <!--//menu nav End -->
  <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:;">VIP会员</a><span lay-separator=""></span>
    </div>
  </div>
  <!--//Top End -->

  <!--{if $a == "run"}-->
  <form class="layui-form" id="mysearch" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post">
  <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">
          <!--//9.10.12 -->
          <!--{assign var="distlist" value=vo_list("mod={area0} 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}-->"<!--{if $sdist1 == $val.areaid}--> selected<!--{/if}-->><!--{$val.areaname}--></option>
            <!--{/foreach}-->
          </select>
        </div>
        <div class="layui-input-inline input-120" id="json_sdist2">
          <!--{if $sdist1 > 0}-->
          <!--{assign var="distlist2" value=vo_list("mod={area} where={v.parentid='<!--{$sdist1}-->'}")}-->
          <select name="sdist2" id="sdist2" lay-filter="area" data-depth="2" data-name="sdist" data-text="=请选择=">
            <option value="">=请选择=</option>
            <!--{foreach $distlist2 as $val}-->
            <option value="<!--{$val.areaid}-->"<!--{if $sdist2 == $val.areaid}--> selected<!--{/if}-->><!--{$val.areaname}--></option>
            <!--{/foreach}-->
          </select>
          <!--{else}-->
          <select name="sdist2" id="sdist2" lay-filter="area">
            <option value="">=请选择=</option>
          </select>
          <!--{/if}-->
        </div>
        <div class="layui-input-inline input-120" id="json_sdist3">
          <!--{if $sdist2 > 0}-->
          <!--{assign var="distlist3" value=vo_list("mod={area} where={v.parentid='<!--{$sdist2}-->'}")}-->
          <select name="sdist3" id="sdist3" lay-filter="area" data-depth="3" data-name="sdist" data-text="=请选择=">
            <option value="">=请选择=</option>
            <!--{foreach $distlist3 as $val}-->
            <option value="<!--{$val.areaid}-->"<!--{if $sdist3 == $val.areaid}--> selected<!--{/if}-->><!--{$val.areaname}--></option>
            <!--{/foreach}-->
          </select>
          <!--{else}-->
          <select name="sdist3" id="sdist3" lay-filter="area">
            <option value="">=请选择=</option>
          </select>
          <!--{/if}-->
        </div>
        <div class="layui-input-inline input-120" id="json_sdist4">
          <!--{if $sdist3 > 0}-->
          <!--{assign var="distlist4" value=vo_list("mod={area} where={v.parentid='<!--{$sdist3}-->'}")}-->
          <select name="sdist4" id="sdist4" lay-filter="area" data-depth="4" data-name="sdist" data-text="=请选择=">
            <option value="">=请选择=</option>
            <!--{foreach $distlist4 as $val}-->
            <option value="<!--{$val.areaid}-->"<!--{if $sdist4 == $val.areaid}--> selected<!--{/if}-->><!--{$val.areaname}--></option>
            <!--{/foreach}-->
          </select>
          <!--{else}-->
          <select name="sdist4" id="sdist4" lay-filter="area">
            <option value="">=请选择=</option>
          </select>
          <!--{/if}-->
        </div>
      </div>
      
      <div class="layui-inline">
        <div class="layui-form-label">性别：</div>
        <div class="layui-input-inline input-100">
          <!--{hook mod="var" item="gender" name="sgender" type="select" text="不限" value=$sgender}-->
        </div>
      </div>    
    </div>
    
    
    <div class="layui-form-item">
      <div class="layui-inline">
        <div class="layui-form-label">会&nbsp;员UID：</div>
        <div class="layui-input-inline input-120">
          <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">&nbsp;用&nbsp;户&nbsp;名：</div>
        <div class="layui-input-inline input-120">
          <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-120">
          <input type="text" name="struename" id="struename" class="layui-input" value="<!--{$struename}-->" />
        </div>
      </div>
      <div class="layui-inline">
        <div class="layui-form-label">手机：</div>
        <div class="layui-input-inline input-120">
          <input type="text" name="smobile" id="smobile" class="layui-input" value="<!--{$smobile}-->" />
        </div>
      </div>
      
    </div>
    
    <div class="layui-form-item">
      <div class="layui-inline">
        <div class="layui-form-label">会员组别：</div>
        <div class="layui-input-inline input-120">
          <!--{assign var="grouplist" value=vo_list("mod={group} where={v.groupid>1}")}-->
          <select name="sgroupid" id="sgroupid">
            <option value="">不限</option>
            <!--{foreach $grouplist as $volist}-->
            <option value="<!--{$volist.groupid}-->"<!--{if $volist.groupid == $sgroupid}--> selected<!--{/if}-->><!--{$volist.groupname}--></option>
            <!--{/foreach}-->
          </select>
        </div>
      </div>
      <div class="layui-inline">
        <div class="layui-form-label">服务状态：</div>
        <div class="layui-input-inline input-120">
          <select name="stime" id="stime">
            <option value="">不限</option>
            <option value="1"<!--{if $stime == '1'}--> selected<!--{/if}-->>正常</option>
            <option value="2"<!--{if $stime == '2'}--> selected<!--{/if}-->>到期</option>
          </select>
        </div>
      </div>
      <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">
        <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=add" class="btn add fl del_line">
          <i class="layui-icon layui-icon-add-1"></i>
          <span>添加VIP会员</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="7%">UID</th>
          <th width="4%">头像</th>
          <th width="13%">用户名</th>
          <th width="7%">姓名</th>
          <th width="5%">性别</th>
          <th width="5%">年龄</th>
          <th width="5%">身高</th>
          <th width="6%">婚况</th>
          <th width="8%">所在地</th>
          <th width="13%">开始时间</th>
          <th width="8%">等级</th>
          <th width="14%">到期时间</th>
          <th>操作</th>
        </tr>
      </thead>
      <!--{if empty($vipuser)}-->
      <tr>
        <td class="text_center" colspan="13">没有符合条件的信息</td>
      </tr>
      <!--{else}-->
      <!--{foreach $vipuser as $volist}-->
      <tr>
        <td class="text_center"><a href="<!--{$urlpath}-->index.php?c=home&a=detail&id=<!--{$volist.userid}-->" target="_blank"><!--{$volist.userid}--></a></td>
        
        <td class="text_center drop">
          <!--{if !empty($volist.headimg)}-->
          <div class="down">
            <div><img src="<!--{$urlpath}-->tpl/static/images/loading_img.png" data-src="<!--{$volist.headimg_0}-->" 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.headimg}-->" f="viewimg" />
            </div>
          </div>
          <!--{else}-->
          --
          <!--{/if}-->
        </td>
        <td class="text_center">
          <a href="<!--{$oefile}-->&c=user&a=view&id=<!--{$volist.userid}-->"><!--{$volist.username}--></a>
        </td>
        <td class="text_center"><!--{$volist.truename}--></td>
        <td class="text_center">
          <!--{if $volist.gender=='1'}-->
          <i class="iconfont icon-nan" title="男"></i>
          <!--{else}-->
          <i class="iconfont icon-nv" title="女"></i>
          <!--{/if}-->
          <!--{hook mod="var" item="gender" type="text" value=$volist.gender}-->
        </td>
        <td class="text_center"><!--{$volist.age}--></td>
        <td class="text_center"><!--{$volist.height}--></td>
        <td class="text_center"><!--{hook mod="var" item="marry" type="text" value=$volist.marry}--></td>
        <td class="text_center">
          <!--{area type="text" value=$volist.dist2}--> 
        </td>
        <td class="text_center">
          <!--{if $volist.vipstime>0}-->
          <!--{$volist.vipstime|date_format:"%Y/%m/%d %H:%M:%S"}-->
          <!--{else}-->
          <!--{$volist.vipstime|date_format:"%Y/%m/%d %H:%M:%S"}-->
          <!--{/if}-->
        </td>
        <td class="text_center"><!--{hook mod="group" type="text" value=$volist.groupid}--></td>
        <td class="text_center">
           <!--{if $volist.vipetime > 0}-->
           <!--{if $volist.vipetime > $time}-->
           <font color="green"><!--{$volist.vipetime|date_format:"%Y/%m/%d %H:%M:%S"}--></font>
           <!--{else}-->
           <font color="red"><!--{$volist.vipetime|date_format:"%Y/%m/%d %H:%M:%S"}--></font>
           <!--{/if}-->
           <!--{else}-->
           --
           <!--{/if}-->
        </td>
        <td class="text_center">
          <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=edit&id=<!--{$volist.userid}-->&<!--{$comeurl}-->" class="layui-btn layui-btn-xs layui-btn-normal">编辑</a>
        </td>
      </tr>
      <!--{/foreach}-->
      <!--{/if}-->
    </table>
    </form>
    <div class="oe_page_box"><!--{$showpage}--></div>
  </div>
  <script type="text/javascript">
  $(function(){
      //预载图片 9.10.12
      preload_img();
  });
  </script>
  <!--{/if}-->
  
  <!--{if $a == 'add'}-->
  <div class="layui-card oe_table_edit">
    <div class="layui-card-header">
      添加VIP会员
      <a href="<!--{$oefile}-->&c=<!--{$c}-->" class="layui-btn layui-btn-sm layui-btn-primary layui-btn-radius oe_btn_back">&lt;&lt;返回上一页</a>
    </div>
    
    <form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->" method="post" />
    <input type="hidden" name="a" id="a" value="saveedit" />
    <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%">
            <div class="tbl_input input-200">
              <input type="text" name="id" id="id" class="layui-input" placeholder="请输入会员UID" />
             </div>
            &nbsp;&nbsp;<span id="id_tips"></span>&nbsp;&nbsp;
            <a href="javascript:;" f="select_user" data-inputid="id" class="oe_ico_blue">选择会员</a>
          </td>
        </tr>
        <tr>
          <th><font color="red">*</font> 会员等级：</th>
          <td>
            <div class="tbl_input input-200">
              <!--{assign var="grouplist" value=vo_list("mod={group} where={v.flag='1'} orderby={v.orders ASC}")}-->
              <select name="groupid" id="groupid">
                <option value="">不限</option>
                <!--{foreach $grouplist as $volist}-->
                <option value="<!--{$volist.groupid}-->"><!--{$volist.groupname}--></option>
                <!--{/foreach}-->
              </select>
            </div>
          </td>
        </tr>
        <tr>
          <th><font color="red">*</font> 到期时间：</th>
          <td>
            <div class="tbl_input input-200">
              <input type="text" name="vipetime" id="vipetime" class="layui-input" value="" placeholder="请设置到期时间" />
            </div>
            <script type="text/javascript">
            layui.use('laydate', function(){
                $laydate = layui.laydate;
                $laydate.render({
                    elem: '#vipetime',
                    type: 'datetime'
                });
            });
            </script>
          </td>
        </tr>
        <tr>
          <th>其他：</th>
          <td>
            <input type="checkbox" lay-skin="primary" name="transpower" id="transpower" value="1" checked title="同步组权限" />
            <br />
            <span class="text_tip_inline">(同步组权限，将该会员所属当前选定组的全部权限打开)</span>
          </td>
        </tr>
      </table>
    </div>
    </form>
  </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>
  
  <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")) {
              
                  if ($("#id").val().length  == 0) {
                      layer.msg("请填写会员UID");
                      return false;
                  }
                  if ($("#groupid").val().length  == 0) {
                      layer.msg("请选择会员等级");
                      return false;
                  }
                  if ($("#vipetime").val().length  == 0) {
                      layer.msg("请设置到期时间");
                      return false;
                  }
                  
                  
                  $("#"+$obj_id).addClass("forbid_submit");
                  if ($("#"+$obj_id).find("span").length > 0) {
                      $("#"+$obj_id).find("span").show();
                  }
                  $("#myform").submit();
              }
          });   
      });
      
  });
  </script>
  <!--{/if}-->
  
  
  <!--{if $a == 'edit'}-->
  <div class="layui-card oe_table_edit">
    <div class="layui-card-header">
      编辑VIP会员
      <a href="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->" class="layui-btn layui-btn-sm layui-btn-primary layui-btn-radius oe_btn_back">&lt;&lt;返回上一页</a>
    </div>
    
    <form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->" method="post" />
    <input type="hidden" name="a" id="a" value="saveedit" />
    <input type="hidden" name="id" id="id" value="<!--{$id}-->" />
    <div class="layui-card-body">
      <table class="oe_tbl_form layui-form">
        <tr>
          <th width="15%">会员名称：<span class="f_red"></span></th>
          <td width="85%">
            <!--{if !empty($vipuser.headimg)}-->
            <img src="<!--{$vipuser.headimg}-->" width="20px" height="20px" f="viewimg" />
            <!--{/if}-->
            uid:<!--{$vipuser.userid}-->/<!--{$vipuser.username}-->
          </td>
        </tr>
        <tr>
          <th>会员资料：<span class="f_red"></span></th>
          <td>
            <!--{hook mod="var" item="gender" type="text" value=$vipuser.gender}-->
            <!--{$vipuser.age}-->岁
            <!--{hook mod="var" item="marry" type="text" value=$vipuser.marry}--> 
            <!--{hook mod="var" item="education" type="text" value=$vipuser.education}-->
            <!--{$vipuser.height}-->CM
          </td>
        </tr>
        <tr>
          <th><font color="red">*</font> 会员等级：</th>
          <td>
            <div class="tbl_input input-200">
              <!--{hook mod="group" type="select" name="groupid" text="=请选择=" value=$vipuser.groupid}-->
            </div>
          </td>
        </tr>
        <tr>
          <th><font color="red">*</font> 到期时间：</th>
          <td>
            <div class="tbl_input input-200">
              <input type="text" name="vipetime" id="vipetime" class="layui-input" value="<!--{if $vipuser.vipetime > 0}--><!--{$vipuser.vipetime|date_format:"%Y-%m-%d %H:%M:%S"}--><!--{/if}-->" />
            </div>
            <script type="text/javascript">
            layui.use('laydate', function(){
                $laydate = layui.laydate;
                $laydate.render({
                    elem: '#vipetime',
                    type: 'datetime'
                });
            });
            </script>
          </td>
        </tr>
      </table>
    </div>
    </form>
  </div>
  <div class="oe_tbl_form_btn">
    <button class="layui-btn" id="but_submit_post" lay-submit lay-filter="editform">
      编辑保存
      <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
    </button>
  </div>
  
  <script type="text/javascript">
  $(function(){

      layui.use('form', function(){
          $form = layui.form;
          //保存...
          $form.on('submit(editform)', function(data){
              $obj_id = data.elem.getAttribute("id");
              if (!$("#"+$obj_id).hasClass("forbid_submit")) {
                  if ($("#groupid").val().length  == 0) {
                      layer.msg("请选择会员等级");
                      return false;
                  }
                  if ($("#vipetime").val().length  == 0) {
                      layer.msg("请设置到期时间");
                      return false;
                  }
                  
                  
                  $("#"+$obj_id).addClass("forbid_submit");
                  if ($("#"+$obj_id).find("span").length > 0) {
                      $("#"+$obj_id).find("span").show();
                  }
                  $("#myform").submit();
              }
          });   
      });
      
  });
  </script>
  <!--{/if}-->
  
</div>
<script type="text/javascript">
  jQuery(".drop").slide({ type:"menu", titCell:".down", targetCell:".sub",effect:"slideDown",delayTime:100,triggerTime:0,returnDefault:true});
</script>
</body>
</html>