<!--{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">套餐名称：</div>
        <div class="layui-input-inline">
          <input type="text" name="stcname" id="stcname" class="layui-input" value="<!--{$stcname}-->" />
        </div>
      </div>
      
      <div class="layui-inline">
        <div class="layui-form-label">状态：</div>
        <div class="layui-input-inline">
          <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" 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="<!--{$oefile}-->&c=<!--{$c}-->&a=add" class="btn add fl">
          <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>
    
    <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>套餐名称</th>
          <th width="8%">特权</th>
          <th width="6%">排序</th>
          <th width="5%">状态</th>
          <th width="5%">推荐</th>
          <th width="8%">服务天数</th>
          <th width="12%">服务价格</th>
          <th width="14%">添加时间</th>
          <th width="10%">操作</th>
        </tr> 
      </thead>
      
      <!--{if empty($taocan)}-->
      <tr>
        <td colspan="11" class="text_center">没有符合条件的信息</td>
      </tr>
      <!--{else}-->
      <!--{foreach $taocan as $volist}-->
      <tr>
        <td class="check text_center">
          <input type="checkbox" name="id[]" lay-skin="primary" value="<!--{$volist.tcid}-->" />
        </td>
        <td class="text_center">
          <!--{$volist.tcid}-->
        </td>
        <td class="text_center"><!--{$volist.tcname}--></td>
        <td class="text_center">
          VIP<!--{$volist.level-1}-->
        </td>
        <td class="text_center"><!--{$volist.orders}--></td>
        <td class="text_center">
          <input type="checkbox" name="flag" lay-skin="primary" value="1" lay-filter="updatestatus" data-id="<!--{$volist.tcid}-->" data-type="flag"<!--{if $volist.flag == '1'}--> checked<!--{/if}--> />
        </td>
        <td class="text_center">
          <input type="checkbox" name="elite" lay-skin="primary" value="1" lay-filter="updatestatus" data-id="<!--{$volist.tcid}-->" data-type="elite"<!--{if $volist.elite == '1'}--> checked<!--{/if}--> />
        </td>
        
        <td class="text_center">
          <!--{$volist.days}-->天
        </td>
        <td class="text_center">
          男会员：<!--{doubleval($volist.price)}-->元 <br />
          女会员：<!--{doubleval($volist.price2)}-->元
        </td>
        <td class="text_center"><!--{$volist.addtime|date_format:"%Y-%m-%d %H:%M:%S"}--></td>
        <td class="text_center">
          <div class="btn_box">
            <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=edit&id=<!--{$volist.tcid}-->&<!--{$comeurl}-->" class="layui-btn layui-btn-xs layui-btn-normal">编辑</a>
            <a href="javascript:;" f="handle-one" data-url="<!--{$oefile}-->&c=<!--{$c}-->&a=del&id[]=<!--{$volist.tcid}-->&<!--{$comeurl}-->" class="layui-btn layui-btn-xs layui-btn-danger">删除</a>
          </div>
        </td>
      </tr>
      <!--{/foreach}-->
      <!--{/if}-->
    </table>
    </form>
    <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}-->&<!--{$comeurl}-->">返回列表</a></span>
    </div> 
  </div>
  
  <form class="layui-form" id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->" method="post">
  <input type="hidden" name="a" id="a" value="saveadd" />
  <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> 套餐名称：</th>
          <td width="35%">
            <input type="text" name="tcname" id="tcname" class="layui-input input-300" />
          </td>
          <th width="15%"><font color="red">*</font> 尊享特权：</th>
          <td width="35%">
            <!--{assign var="grouplist" value=vo_list("mod={group} where={v.groupid > 1 AND v.flag='1'} orderby={v.orders ASC}")}-->
            <div class="layui-input-inline input-150">
            <select name="level" id="level">
              <option value="">请选择</option>
              <!--{foreach $grouplist as $val}-->
              <option value="<!--{$val.groupid}-->"><!--{$val.groupname}--></option>
              <!--{/foreach}-->
            </select>
            </div>
          </td>
        </tr>
        
        <tr>
          <th><font color="red">*</font> 服务周期：</th>
          <td colspan="3">
            <input type="text" name="days" id="days" class="layui-input input-120" />&nbsp;天
            &nbsp;&nbsp;&nbsp;
            <a class="time_duan current" href="javascript:;" f="but_sel_tcdays" data-days="30" title="点击设置">一个月</a>
            <a class="time_duan" href="javascript:;" f="but_sel_tcdays" data-days="60" title="点击设置">2个月</a>
            <a class="time_duan" href="javascript:;" f="but_sel_tcdays" data-days="90" title="点击设置">3个月</a>
            <a class="time_duan" href="javascript:;" f="but_sel_tcdays" data-days="180" title="点击设置">半年</a>
            <a class="time_duan" href="javascript:;" f="but_sel_tcdays" data-days="365" title="点击设置">一年</a>
          </td>
        </tr>
        
        <tr>
          <th>原价：</th>
          <td><input type="text" name="oldprice" id="oldprice" class="layui-input input-120" /> 元</td>
          <th>现价：</th>
          <td style="line-height:40px;">
            男会员：<input type="text" name="price" id="price" class="layui-input input-120" /> 元 <br />
            女会员：<input type="text" name="price2" id="price2" class="layui-input input-120" /> 元
          </td>
        </tr>
        
        <tr>
          <th>排序：</th>
          <td><input type="text" name="orders" id="orders" class="layui-input input-120" value="<!--{$orders}-->" /></td>
          <th>已售笔数：</th>
          <td><input type="text" name="salenums" id="salenums" class="layui-input input-120" /></td>
        </tr>
        <tr>
          <th>启用：</th>
          <td>
            <input type="radio" name="flag" title="是" value="1" checked />
            <input type="radio" name="flag" title="否" value="0" />
          </td>
          <th>推荐：</th>
          <td>
            <input type="radio" name="elite" title="是" value="1" />
            <input type="radio" name="elite" title="否" value="0" checked />
          </td>
        </tr>
        <tr>
          <th>套餐描述：</th>
          <td colspan="3">
            <textarea name="intro" id="intro" class="layui-textarea" style="width:65%;height:140px;"></textarea>
          </td>
        </tr>
      </table>
    </div>
  </div>
  </form>
  
  <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")) {
            
                if ($("#tcname").val().length  == 0) {
                    layer.msg("请填写套餐名称");
                    return false;
                }
                if ($("#level").val().length  == 0) {
                    layer.msg("请选择尊享特权");
                    return false;
                }
                if ($("#days").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-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="editform">
        编辑保存
        <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}-->&<!--{$comeurl}-->">返回列表</a></span>
    </div> 
  </div>
  
  <form class="layui-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">
    <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> 套餐名称：</th>
          <td width="35%">
            <input type="text" name="tcname" id="tcname" class="layui-input input-300" value="<!--{$taocan.tcname}-->" />
          </td>
          <th width="15%"><font color="red">*</font> 尊享特权：</th>
          <td width="35%">
            <!--{assign var="grouplist" value=vo_list("mod={group} where={v.groupid > 1 AND v.flag='1'} orderby={v.orders ASC}")}-->
            <div class="layui-input-inline input-150">
            <select name="level" id="level">
              <option value="">请选择</option>
              <!--{foreach $grouplist as $val}-->
              <option value="<!--{$val.groupid}-->"<!--{if $taocan.level == $val.groupid}--> selected<!--{/if}-->><!--{$val.groupname}--></option>
              <!--{/foreach}-->
            </select>
            </div>
          </td>
        </tr>
        
        <tr>
          <th><font color="red">*</font> 服务周期：</th>
          <td colspan="3">
            <input type="text" name="days" id="days" class="layui-input input-120" value="<!--{$taocan.days}-->" />&nbsp;天
            &nbsp;&nbsp;&nbsp;
            <a class="time_duan current" href="javascript:;" f="but_sel_tcdays" data-days="30" title="点击设置">一个月</a>
            <a class="time_duan" href="javascript:;" f="but_sel_tcdays" data-days="60" title="点击设置">2个月</a>
            <a class="time_duan" href="javascript:;" f="but_sel_tcdays" data-days="90" title="点击设置">3个月</a>
            <a class="time_duan" href="javascript:;" f="but_sel_tcdays" data-days="180" title="点击设置">半年</a>
            <a class="time_duan" href="javascript:;" f="but_sel_tcdays" data-days="365" title="点击设置">一年</a>
          </td>
        </tr>
        
        <tr>
          <th>原价：</th>
          <td><input type="text" name="oldprice" id="oldprice" class="layui-input input-120" value="<!--{doubleval($taocan.oldprice)}-->" /> 元</td>
          <th>现价：</th>
          <td style="line-height:40px;">
            男会员：<input type="text" name="price" id="price" class="layui-input input-120" value="<!--{doubleval($taocan.price)}-->" /> 元 <br />
            女会员：<input type="text" name="price2" id="price2" class="layui-input input-120" value="<!--{doubleval($taocan.price2)}-->" /> 元
          </td>
        </tr>
        
        <tr>
          <th>排序：</th>
          <td><input type="text" name="orders" id="orders" class="layui-input input-120" value="<!--{$taocan.orders}-->" /></td>
          <th>已售笔数：</th>
          <td><input type="text" name="salenums" id="salenums" class="layui-input input-120" value="<!--{$taocan.salenums}-->" /></td>
        </tr>
        <tr>
          <th>启用：</th>
          <td>
            <input type="radio" name="flag" title="是" value="1"<!--{if $taocan.flag == '1'}--> checked<!--{/if}--> />
            <input type="radio" name="flag" title="否" value="0"<!--{if $taocan.flag == '0'}--> checked<!--{/if}--> />
          </td>
          <th>推荐：</th>
          <td>
            <input type="radio" name="elite" title="是" value="1"<!--{if $taocan.elite == '1'}--> checked<!--{/if}--> />
            <input type="radio" name="elite" title="否" value="0"<!--{if $taocan.elite == '0'}--> checked<!--{/if}--> />
          </td>
        </tr>
        <tr>
          <th>套餐描述：</th>
          <td colspan="3">
            <textarea name="intro" id="intro" class="layui-textarea" style="width:65%;height:140px;"><!--{$taocan.intro}--></textarea>
          </td>
        </tr>
      </table>
    </div>
  </div>
  </form>
  
  <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>
  
</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 ($("#tcname").val().length  == 0) {
                    layer.msg("请填写套餐名称");
                    return false;
                }
                if ($("#level").val().length  == 0) {
                    layer.msg("请选择尊享特权");
                    return false;
                }
                if ($("#days").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}-->
</body>
</html>