123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- {layout name="layout1" /}
-
- <style>
- .layui-table-cell {
- height:auto;
- }
- </style>
-
- <div class="wrapper">
- <div class="layui-card">
- <div class="layui-card-body">
- <!--操作提示-->
- <div class="layui-collapse" style="border:1px dashed #c4c4c4">
- <div class="layui-colla-item">
- <h2 class="layui-colla-title like-layui-colla-title">操作提示</h2>
- <div class="layui-colla-content layui-show">
- <p>*平台配置在各个场景下的通知发送方式和内容模板。</p>
- </div>
- </div>
- </div>
- </div>
- <div class="layui-card-body">
- <!--列表-->
- <div class="layui-tab layui-tab-card" lay-filter="like-tabs">
- <ul class="layui-tab-title">
- <li data-type='1' class="layui-this">通知会员</li>
- <li data-type='2' >通知商家</li>
- <li data-type='3' >通知平台</li>
- </ul>
- <div class="layui-tab-content">
- <!--通知会员-->
- <div class="layui-tab-item layui-show ">
- <table id="user-lists" lay-filter="user-lists"></table>
- </div>
- <!--通知商家-->
- <div class="layui-tab-item">
- <table id="shop-lists" lay-filter="shop-lists"></table>
- </div>
- <!--通知平台-->
- <div class="layui-tab-item">
- <table id="platform-lists" lay-filter="platform-lists"></table>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-
-
- <script type="text/html" id="systemTpl">
- {{# if((d.support).includes(1)){ }}
- <div>
- {{# if(d.system_notice.status == 1){ }}
- <a class="layui-btn layui-btn layui-btn-sm operation-btn">已开启</a>
- {{# } else { }}
- <a class="layui-btn layui-btn-primary layui-btn-sm operation-btn">已关闭</a>
- {{# } }}
- <a class="layui-btn layui-btn-normal layui-btn-sm operation-btn" lay-event="system_record">通知记录</a>
- <a class="layui-btn layui-btn-normal layui-btn-sm operation-btn" lay-event="system">设置</a>
- </div>
- {{# } else { }}
- -
- {{# } }}
- </script>
-
- <script type="text/html" id="smsTpl">
- {{# if((d.support).includes(2)){ }}
- <div>
- {{# if(d.sms_notice.status == 1){ }}
- <a class="layui-btn layui-btn layui-btn-sm operation-btn">已开启</a>
- {{# } else { }}
- <a class="layui-btn layui-btn-primary layui-btn-sm operation-btn">已关闭</a>
- {{# } }}
- <a class="layui-btn layui-btn-normal layui-btn-sm operation-btn" lay-event="sms_record">通知记录</a>
- <a class="layui-btn layui-btn-normal layui-btn-sm operation-btn" lay-event="sms">设置</a>
- </div>
- {{# } else { }}
- -
- {{# } }}
- </script>
-
- <script type="text/html" id="oaTpl">
- {{# if((d.support).includes(3)){ }}
- <div>
- {{# if(d.oa_notice.status == 1){ }}
- <a class="layui-btn layui-btn layui-btn-sm operation-btn">已开启</a>
- {{# } else { }}
- <a class="layui-btn layui-btn-primary layui-btn-sm operation-btn">已关闭</a>
- {{# } }}
- <a class="layui-btn layui-btn-normal layui-btn-sm operation-btn" lay-event="oa_record">通知记录</a>
- <a class="layui-btn layui-btn-normal layui-btn-sm operation-btn" lay-event="oa">设置</a>
- </div>
- {{# } else { }}
- -
- {{# } }}
- </script>
-
- <script type="text/html" id="mnpTpl">
- {{# if((d.support).includes(4)){ }}
- <div>
- {{# if(d.mnp_notice.status == 1){ }}
- <a class="layui-btn layui-btn layui-btn-sm operation-btn">已开启</a>
- {{# } else { }}
- <a class="layui-btn layui-btn-primary layui-btn-sm operation-btn">已关闭</a>
- {{# } }}
- <a class="layui-btn layui-btn-normal layui-btn-sm operation-btn" lay-event="mnp_record">通知记录</a>
- <a class="layui-btn layui-btn-normal layui-btn-sm operation-btn" lay-event="mnp">设置</a>
- </div>
- {{# } else { }}
- -
- {{# } }}
- </script>
-
- <script>
- layui.use(['element', 'table'], function () {
- var $ = layui.$
- , form = layui.form
- , table = layui.table
- , element = layui.element;
-
- getLists(1);
-
- //切换列表
- element.on('tab(like-tabs)', function (data) {
- form.render('select');
- var type = $(this).attr('data-type');
- getLists(type);
- });
-
-
- //列表
- function getLists(type) {
- var elem = '#user-lists';
- if (type == 2) {
- elem = '#shop-lists';
- } else if(type == 3) {
- elem = '#platform-lists';
- }
- like.tableLists(elem, '{:url("setting.noticeSetting/index")}?type='+type, [
- {field: 'scene', title: '通知类型',width:200}
- , {field: 'desc', title: '通知场景说明', width:200 }
- , {field: 'system_notice', title: '系统通知',width:240, align: 'center', templet:'#systemTpl'}
- , {field: 'sms_notice', title: '短信通知',width:240, align: 'center', templet:'#smsTpl'}
- , {field: 'oa_notice', title: '微信模板消息',width:240, align: 'center', templet:'#oaTpl'}
- , {field: 'mnp_notice', title: '微信小程序提醒',width:240, align: 'center', templet:'#mnpTpl'}
- ],[],false);
- }
-
-
- //操作
- var active = {
- //系统通知
- system: function (obj) {
- setPage('系统通知设置', obj.data.id, 'system');
- },
- //系统通知记录
- system_record: function (obj) {
- recordPage('系统通知记录', obj.data.id, 1);
- },
-
- //短信通知
- sms: function (obj) {
- setPage('短信通知设置', obj.data.id, 'sms');
- },
- //知信通知记录
- sms_record: function (obj) {
- recordPage('短信通知记录', obj.data.id, 2);
- },
-
- //公众号通知
- oa: function (obj) {
- setPage('公众号通知设置', obj.data.id, 'oa');
- },
- //微信模板通知记录
- oa_record: function (obj) {
- recordPage('微信模板通知记录', obj.data.id, 3);
- },
-
- //小程序
- mnp: function (obj) {
- setPage('小程序通知设置', obj.data.id, 'mnp');
- },
- //微信小程序通知记录
- mnp_record: function (obj) {
- recordPage('微信小程序通知记录', obj.data.id, 4);
- },
- };
-
-
- //设置页面
- function setPage(title, id, type) {
- layer.open({
- type: 2
- ,title: title
- ,content: '{:url("setting.noticeSetting/set")}?id='+id+'&type='+type
- ,area: ['90%','90%']
- ,btn: ['确定', '取消']
- ,yes: function(index, layero) {
- var iframeWindow = window['layui-layer-iframe'+ index]
- ,submitID = 'addSubmit'
- ,submit = layero.find('iframe').contents().find('#'+ submitID);
- //监听提交
- iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
- var field = data.field;
- like.ajax({
- url:'{:url("setting.noticeSetting/set")}',
- data:field,
- type:"post",
- success:function(res) {
- if(res.code === 1) {
- layui.layer.msg(res.msg, { offset:'15px', icon:1, time:1000 });
- layer.close(index);
- table.reload('user-lists');
- table.reload('platform-lists');
- }
- }
- });
- });
- submit.trigger('click');
- }
- });
- }
- // 通知记录界面
- function recordPage(title, id, send_type) {
- layer.open({
- type: 2
- ,title: title
- ,content: '{:url("setting.noticeSetting/record")}?id='+id+'&send_type='+send_type
- ,area: ['90%','90%']
- ,btn: ['确定', '取消']
- ,yes: function(index, layero) {
- layer.close(index);
- }
- });
- }
-
-
- // 监听表格右侧工具条
- table.on('tool(user-lists)', function(obj) {
- var type = obj.event;
- active[type] ? active[type].call(this, obj) : '';
- });
-
- table.on('tool(shop-lists)', function(obj) {
- var type = obj.event;
- active[type] ? active[type].call(this, obj) : '';
- });
-
- table.on('tool(platform-lists)', function(obj) {
- var type = obj.event;
- active[type] ? active[type].call(this, obj) : '';
- });
-
- });
-
- </script>
|