截流自动化的商城平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. {layout name="layout1" /}
  2. <style>
  3. .layui-table-cell {
  4. height:auto;
  5. }
  6. </style>
  7. <div class="wrapper">
  8. <div class="layui-card">
  9. <div class="layui-card-body">
  10. <!--操作提示-->
  11. <div class="layui-collapse" style="border:1px dashed #c4c4c4">
  12. <div class="layui-colla-item">
  13. <h2 class="layui-colla-title like-layui-colla-title">操作提示</h2>
  14. <div class="layui-colla-content layui-show">
  15. <p>*平台配置在各个场景下的通知发送方式和内容模板。</p>
  16. </div>
  17. </div>
  18. </div>
  19. </div>
  20. <div class="layui-card-body">
  21. <!--列表-->
  22. <div class="layui-tab layui-tab-card" lay-filter="like-tabs">
  23. <ul class="layui-tab-title">
  24. <li data-type='1' class="layui-this">通知会员</li>
  25. <li data-type='2' >通知商家</li>
  26. <li data-type='3' >通知平台</li>
  27. </ul>
  28. <div class="layui-tab-content">
  29. <!--通知会员-->
  30. <div class="layui-tab-item layui-show ">
  31. <table id="user-lists" lay-filter="user-lists"></table>
  32. </div>
  33. <!--通知商家-->
  34. <div class="layui-tab-item">
  35. <table id="shop-lists" lay-filter="shop-lists"></table>
  36. </div>
  37. <!--通知平台-->
  38. <div class="layui-tab-item">
  39. <table id="platform-lists" lay-filter="platform-lists"></table>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. <script type="text/html" id="systemTpl">
  47. {{# if((d.support).includes(1)){ }}
  48. <div>
  49. {{# if(d.system_notice.status == 1){ }}
  50. <a class="layui-btn layui-btn layui-btn-sm operation-btn">已开启</a>
  51. {{# } else { }}
  52. <a class="layui-btn layui-btn-primary layui-btn-sm operation-btn">已关闭</a>
  53. {{# } }}
  54. <a class="layui-btn layui-btn-normal layui-btn-sm operation-btn" lay-event="system_record">通知记录</a>
  55. <a class="layui-btn layui-btn-normal layui-btn-sm operation-btn" lay-event="system">设置</a>
  56. </div>
  57. {{# } else { }}
  58. -
  59. {{# } }}
  60. </script>
  61. <script type="text/html" id="smsTpl">
  62. {{# if((d.support).includes(2)){ }}
  63. <div>
  64. {{# if(d.sms_notice.status == 1){ }}
  65. <a class="layui-btn layui-btn layui-btn-sm operation-btn">已开启</a>
  66. {{# } else { }}
  67. <a class="layui-btn layui-btn-primary layui-btn-sm operation-btn">已关闭</a>
  68. {{# } }}
  69. <a class="layui-btn layui-btn-normal layui-btn-sm operation-btn" lay-event="sms_record">通知记录</a>
  70. <a class="layui-btn layui-btn-normal layui-btn-sm operation-btn" lay-event="sms">设置</a>
  71. </div>
  72. {{# } else { }}
  73. -
  74. {{# } }}
  75. </script>
  76. <script type="text/html" id="oaTpl">
  77. {{# if((d.support).includes(3)){ }}
  78. <div>
  79. {{# if(d.oa_notice.status == 1){ }}
  80. <a class="layui-btn layui-btn layui-btn-sm operation-btn">已开启</a>
  81. {{# } else { }}
  82. <a class="layui-btn layui-btn-primary layui-btn-sm operation-btn">已关闭</a>
  83. {{# } }}
  84. <a class="layui-btn layui-btn-normal layui-btn-sm operation-btn" lay-event="oa_record">通知记录</a>
  85. <a class="layui-btn layui-btn-normal layui-btn-sm operation-btn" lay-event="oa">设置</a>
  86. </div>
  87. {{# } else { }}
  88. -
  89. {{# } }}
  90. </script>
  91. <script type="text/html" id="mnpTpl">
  92. {{# if((d.support).includes(4)){ }}
  93. <div>
  94. {{# if(d.mnp_notice.status == 1){ }}
  95. <a class="layui-btn layui-btn layui-btn-sm operation-btn">已开启</a>
  96. {{# } else { }}
  97. <a class="layui-btn layui-btn-primary layui-btn-sm operation-btn">已关闭</a>
  98. {{# } }}
  99. <a class="layui-btn layui-btn-normal layui-btn-sm operation-btn" lay-event="mnp_record">通知记录</a>
  100. <a class="layui-btn layui-btn-normal layui-btn-sm operation-btn" lay-event="mnp">设置</a>
  101. </div>
  102. {{# } else { }}
  103. -
  104. {{# } }}
  105. </script>
  106. <script>
  107. layui.use(['element', 'table'], function () {
  108. var $ = layui.$
  109. , form = layui.form
  110. , table = layui.table
  111. , element = layui.element;
  112. getLists(1);
  113. //切换列表
  114. element.on('tab(like-tabs)', function (data) {
  115. form.render('select');
  116. var type = $(this).attr('data-type');
  117. getLists(type);
  118. });
  119. //列表
  120. function getLists(type) {
  121. var elem = '#user-lists';
  122. if (type == 2) {
  123. elem = '#shop-lists';
  124. } else if(type == 3) {
  125. elem = '#platform-lists';
  126. }
  127. like.tableLists(elem, '{:url("setting.noticeSetting/index")}?type='+type, [
  128. {field: 'scene', title: '通知类型',width:200}
  129. , {field: 'desc', title: '通知场景说明', width:200 }
  130. , {field: 'system_notice', title: '系统通知',width:240, align: 'center', templet:'#systemTpl'}
  131. , {field: 'sms_notice', title: '短信通知',width:240, align: 'center', templet:'#smsTpl'}
  132. , {field: 'oa_notice', title: '微信模板消息',width:240, align: 'center', templet:'#oaTpl'}
  133. , {field: 'mnp_notice', title: '微信小程序提醒',width:240, align: 'center', templet:'#mnpTpl'}
  134. ],[],false);
  135. }
  136. //操作
  137. var active = {
  138. //系统通知
  139. system: function (obj) {
  140. setPage('系统通知设置', obj.data.id, 'system');
  141. },
  142. //系统通知记录
  143. system_record: function (obj) {
  144. recordPage('系统通知记录', obj.data.id, 1);
  145. },
  146. //短信通知
  147. sms: function (obj) {
  148. setPage('短信通知设置', obj.data.id, 'sms');
  149. },
  150. //知信通知记录
  151. sms_record: function (obj) {
  152. recordPage('短信通知记录', obj.data.id, 2);
  153. },
  154. //公众号通知
  155. oa: function (obj) {
  156. setPage('公众号通知设置', obj.data.id, 'oa');
  157. },
  158. //微信模板通知记录
  159. oa_record: function (obj) {
  160. recordPage('微信模板通知记录', obj.data.id, 3);
  161. },
  162. //小程序
  163. mnp: function (obj) {
  164. setPage('小程序通知设置', obj.data.id, 'mnp');
  165. },
  166. //微信小程序通知记录
  167. mnp_record: function (obj) {
  168. recordPage('微信小程序通知记录', obj.data.id, 4);
  169. },
  170. };
  171. //设置页面
  172. function setPage(title, id, type) {
  173. layer.open({
  174. type: 2
  175. ,title: title
  176. ,content: '{:url("setting.noticeSetting/set")}?id='+id+'&type='+type
  177. ,area: ['90%','90%']
  178. ,btn: ['确定', '取消']
  179. ,yes: function(index, layero) {
  180. var iframeWindow = window['layui-layer-iframe'+ index]
  181. ,submitID = 'addSubmit'
  182. ,submit = layero.find('iframe').contents().find('#'+ submitID);
  183. //监听提交
  184. iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
  185. var field = data.field;
  186. like.ajax({
  187. url:'{:url("setting.noticeSetting/set")}',
  188. data:field,
  189. type:"post",
  190. success:function(res) {
  191. if(res.code === 1) {
  192. layui.layer.msg(res.msg, { offset:'15px', icon:1, time:1000 });
  193. layer.close(index);
  194. table.reload('user-lists');
  195. table.reload('platform-lists');
  196. }
  197. }
  198. });
  199. });
  200. submit.trigger('click');
  201. }
  202. });
  203. }
  204. // 通知记录界面
  205. function recordPage(title, id, send_type) {
  206. layer.open({
  207. type: 2
  208. ,title: title
  209. ,content: '{:url("setting.noticeSetting/record")}?id='+id+'&send_type='+send_type
  210. ,area: ['90%','90%']
  211. ,btn: ['确定', '取消']
  212. ,yes: function(index, layero) {
  213. layer.close(index);
  214. }
  215. });
  216. }
  217. // 监听表格右侧工具条
  218. table.on('tool(user-lists)', function(obj) {
  219. var type = obj.event;
  220. active[type] ? active[type].call(this, obj) : '';
  221. });
  222. table.on('tool(shop-lists)', function(obj) {
  223. var type = obj.event;
  224. active[type] ? active[type].call(this, obj) : '';
  225. });
  226. table.on('tool(platform-lists)', function(obj) {
  227. var type = obj.event;
  228. active[type] ? active[type].call(this, obj) : '';
  229. });
  230. });
  231. </script>