<!--{include file="<!--{$oetplpath}-->block_head.tpl"}-->

<!--{if $a == "run"}-->
<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>
  <!--//Top End -->
  <blockquote class="layui-elem-quote" style="margin-top:20px;line-height:30px;">
    <b>温馨提示：</b><br />
    使用该会话消息，需要先开启模板消息，<a href="<!--{$oefile}-->&c=setting&a=wxnotify">去设置&gt;&gt;</a>。<br />
    当微信粉丝与公众号交互，在有效时间内(48小时)，将以会话模板方式推送微信消息。<br />
    管理员可以自由修改会话内容，每个内容已包含可用的标签，请按说明修改。
  </blockquote>

  <div class="oe_table_wrap layui-form">
    
    <table class="layui-table">
      <thead>
        <tr>
          <th width="8%">ID</th>
          <th width="8%">编号</th>
          <th width="8%">类型</th>
          <th width="15%">描述</th>
          <th>会话内容</th>
          <th width="8%">操作</th>
        </tr> 
      </thead>
      <!--{if empty($weixintpl)}-->
      <tr>
        <td colspan="5" class="text_center">没有符合条件的信息</td>
      </tr>
      <!--{else}-->
      <!--{foreach $weixintpl as $volist}-->
      <tr>
        <td class="text_center"><!--{$volist.tplid}--></td>
        <td class="text_center"><!--{$volist.idmark}--></td>
        <td class="text_center"><!--{$volist.type}--></td>
        
        <td class="text_center"><!--{$volist.title}--></td>
        <td>
          <!--{$volist.content|nl2br}-->
        </td>
        <td class="text_center">
          <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=edit&id=<!--{$volist.tplid}-->&<!--{$comeurl}-->" class="layui-btn layui-btn-xs layui-btn-normal">编辑</a>
        </td>
      </tr>
      <!--{/foreach}-->
      <!--{/if}-->
    </table>
    
    <div class="oe_page_box"><!--{$showpage}--></div>
    
    
  </div>
</div>
<!--{/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%">模板类型：</th>
          <td width="85%">
            <!--{$weixintpl.type}-->
          </td>
        </tr>
        <tr>
          <th>描述：</th>
          <td><!--{$weixintpl.title}--></td>
        </tr>
        <tr>
          <th><font color="red">*</font>模板内容：</th>
          <td>
            <textarea name="content" id="content" class="layui-textarea" style="width:70%;height:150px;"><!--{$weixintpl.content}--></textarea>
          </td>
        </tr>
        <tr>
          <th>可用标签：</th>
          <td><!--{$weixintpl.label}--></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 ($("#content").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>