<!--{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-auto">
          <input type="checkbox" lay-skin="primary" name="smale" id="smale" value="1" />
        </div>
      </div>
      <div class="layui-inline">
        <div class="layui-form-label">女士</div>
        <div class="layui-input-inline input-auto">
          <input type="checkbox" lay-skin="primary"  name="sfemale" id="sfemale" value="1" />
        </div>
      </div>
      <div class="layui-inline">
        <div class="layui-form-label">内容：</div>
        <div class="layui-input-inline input-200">
          <input type="text" name="scont" id="scont" class="layui-input" value="<!--{$scont}-->" />
        </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" 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}-->&a=del" method="post">
    <input type="hidden" name="a" id="a" value="del" />
    <table class="layui-table">
      <thead>
        <tr>
          <th width="2%">选</th>
          <th width="7%">ID</th>
          <th width="10%">女士</th>
          <th width="7%">男士</th>
          <th width="7%">状态</th>
          <th width="8%">使用</th>
          <th width="15%">添加时间</th>
          <th>内容</th>
          <th width="10%">操作</th>
        </tr>
      </thead>
      <!--{if empty($greet)}-->
      <tr>
        <td class="text_center" colspan="9">没有符合条件的信息</td>
      </tr>
      <!--{else}-->
      <!--{foreach $greet as $volist}-->
      <tr>
        <td class="text_center check">
          <input type="checkbox" lay-skin="primary" name="id[]" class="selall" value="<!--{$volist.greetid}-->" />
         </td>
        <td class="text_center">
          <!--{$volist.greetid}-->
        </td>
        <td class="text_center">
          <input type="checkbox" name="male" lay-skin="primary" value="1" lay-filter="updatestatus" data-id="<!--{$volist.greetid}-->" data-type="male"<!--{if $volist.male == '1'}--> checked<!--{/if}--> />
        </td>
        <td class="text_center">
          <input type="checkbox" name="female" lay-skin="primary" value="1" lay-filter="updatestatus" data-id="<!--{$volist.greetid}-->" data-type="female"<!--{if $volist.female == '1'}--> checked<!--{/if}--> />
        </td>
        <td class="text_center">
          <input type="checkbox" name="flag" lay-skin="primary" value="1" lay-filter="updatestatus" data-id="<!--{$volist.greetid}-->" data-type="flag"<!--{if $volist.flag == '1'}--> checked<!--{/if}--> />
        </td>
        <td class="text_center"><!--{$volist.usecount}--></td>
        <td class="text_center"><!--{$volist.timeline|date_format:"%Y-%m-%d %H:%M:%S"}--></td>
        <td><!--{$volist.greeting}--></td>
        <td class="text_center">
          <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=edit&id=<!--{$volist.greetid}-->&<!--{$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.greetid}-->&<!--{$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 == '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>
  
  <div class="layui-card oe_table_edit">
    <form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post" />
    <input type="hidden" name="a" id="a" value="saveadd" />
    <div class="layui-card-header">添加自定义信件</div>
      <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%">
              <input type="checkbox" lay-skin="primary" name="male" id="male" value="1" title="男士"/>
              <input type="checkbox" lay-skin="primary" name="female" id="female" value="1" title="女士"/>
            </td>
          </tr>
          <tr>
            <th>状&#12288;&#12288;态：</th>
            <td>
              <div class="tbl_input">
                <select name="flag" id="flag">
                  <option value="">=请选择=</option>
                  <option value="1" selected>正常</option>
                  <option value="0">锁定</option>
                </select>
              </div>
            </td>
          </tr>
          <tr>
            <th><font color="red">*</font>信件内容：</th>
            <td>
              <textarea class="layui-textarea" name="greeting" id="greeting" style="width:50%;height:80px;"></textarea>
            </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>
  
</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 ($("#greeting").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>
  
  <div class="layui-card oe_table_edit">
  
    <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-header">编辑信件</div>
    <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%">
            <input lay-skin="primary" type="checkbox" name="male" id="male" value="1"<!--{if $greet.male == '1'}--> checked<!--{/if}--> title="男士"/>
            <input lay-skin="primary" type="checkbox" name="female" id="female" value="1"<!--{if $greet.female == '1'}--> checked<!--{/if}--> title="女士" />
          </td>
        </tr>
        <tr>
          <th>状&#12288;&#12288;态：</th>
          <td>
            <div class="tbl_input">
              <select name="flag" id="flag">
                <option value="">=请选择=</option>
                <option value="1"<!--{if $greet.flag == '1'}--> selected<!--{/if}-->>正常</option>
                <option value="0"<!--{if $greet.flag == '0'}--> selected<!--{/if}-->>锁定</option>
              </select>
            </div>
          </td>
        </tr>
        <tr>
          <th><font color="red">*</font>信件内容：</th>
          <td>
            <textarea class="layui-textarea" name="greeting" id="greeting" style="width:50%;height:80px;"><!--{$greet.greeting}--></textarea>
          </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>
  
</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 ($("#greeting").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>