截流自动化的商城平台
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.

lists.html 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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. <!--操作提示-->
  10. <div class="layui-card-body">
  11. <div class="layui-collapse like-layui-collapse" lay-accordion="" style="border:1px dashed #c4c4c4">
  12. <div class="layui-colla-item">
  13. <h2 class="layui-colla-title like-layui-colla-title" style="background-color: #fff">操作提示</h2>
  14. <div class="layui-colla-content layui-show">
  15. *短信渠道配置,
  16. <a href="https://cn.aliyun.com" target="_blank" style="color: rgb(64,115,250)">阿里云</a>、
  17. <a href="https://cloud.tencent.com" target="_blank" style="color: rgb(64,115,250)">腾讯云</a>请前往申请短信服务。
  18. </div>
  19. </div>
  20. </div>
  21. </div>
  22. <div class="layui-tab layui-tab-card" lay-filter="tab-all">
  23. <ul class="layui-tab-title">
  24. <li data-type="1" class="layui-this">短信配置</li>
  25. <li data-type="2">发送记录</li>
  26. </ul>
  27. <!--搜索内容-->
  28. <div class="layui-card-body layui-form">
  29. <div class="layui-form-item search">
  30. <div class="layui-inline">
  31. <label class="layui-form-label">短信标题:</label>
  32. <div class="layui-input-block">
  33. <input type="text" name="name" id="name" placeholder="请输入短信标题" autocomplete="off"
  34. class="layui-input">
  35. </div>
  36. </div>
  37. <div class="layui-inline">
  38. <label class="layui-form-label">发送手机号:</label>
  39. <div class="layui-input-block">
  40. <input type="text" name="mobile" id="mobile" placeholder="请输入手机号码" autocomplete="off"
  41. class="layui-input">
  42. </div>
  43. </div>
  44. <div class="layui-inline">
  45. <label class="layui-form-label">发送状态:</label>
  46. <div class="layui-input-block">
  47. <select name="send_status" id="send_status">
  48. <option value="">全部</option>
  49. {foreach $status_list as $item => $val}
  50. <option value="{$item}">{$val}</option>
  51. {/foreach}
  52. </select>
  53. </div>
  54. </div>
  55. <div class="layui-row">
  56. <div class="layui-inline">
  57. <label class="layui-form-label">创建时间:</label>
  58. <div class="layui-input-inline">
  59. <div class="layui-input-inline">
  60. <input type="text" name="start_time" class="layui-input" id="start_time"
  61. placeholder="" autocomplete="off">
  62. </div>
  63. </div>
  64. <div class="layui-input-inline" style="margin-right: 5px;width: 20px;">
  65. <label class="layui-form-mid">至</label>
  66. </div>
  67. <div class="layui-input-inline">
  68. <input type="text" name="end_time" class="layui-input" id="end_time"
  69. placeholder="" autocomplete="off">
  70. </div>
  71. </div>
  72. <div class="layui-inline">
  73. <button class="layui-btn layui-btn-sm layuiadmin-btn-ad {$view_theme_color}" lay-submit
  74. lay-filter="sms-search">查询
  75. </button>
  76. <button class="layui-btn layui-btn-sm layuiadmin-btn-ad layui-btn-primary " lay-submit
  77. lay-filter="sms-clear-search">清空查询
  78. </button>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. <!--列表-->
  84. <div class="layui-tab-item layui-show">
  85. <div class="layui-card">
  86. <div class="layui-card-body">
  87. <table id="like-table-lists" lay-filter="like-table-lists"></table>
  88. <script type="text/html" id="table-status">
  89. {{# if(d.status){ }}
  90. 开启
  91. {{# } else { }}
  92. 关闭
  93. {{# } }}
  94. </script>
  95. <script type="text/html" id="table-operation-config">
  96. <a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="config">配置</a>
  97. </script>
  98. <script type="text/html" id="table-operation">
  99. <a class="layui-btn layui-btn-primary layui-btn-sm" lay-event="detail">详情</a>
  100. </script>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. <script>
  108. layui.use(['table', 'laydate', 'element', 'table'], function () {
  109. var $ = layui.$
  110. , form = layui.form
  111. , table = layui.table
  112. , element = layui.element
  113. , laydate = layui.laydate
  114. , type = 1;
  115. //监听搜索
  116. form.on('submit(sms-search)', function (data) {
  117. var field = data.field;
  118. table.reload('like-table-lists', {
  119. where: field, page: {curr: 1}
  120. });
  121. });
  122. //清空查询
  123. form.on('submit(sms-clear-search)', function () {
  124. $('#name').val('');
  125. $('#mobile').val('');
  126. $('#send_status').val('');
  127. $('#start_time').val('');
  128. $('#end_time').val('');
  129. form.render('select');
  130. //刷新列表
  131. table.reload('like-table-lists', {
  132. where: [], page: {curr: 1}
  133. });
  134. });
  135. getList();
  136. $('.search').hide();
  137. element.on('tab(tab-all)', function (data) {
  138. type = $(this).attr('data-type');
  139. $('.search').hide();
  140. if (type == 2) {
  141. $('.search').show();
  142. }
  143. getList();
  144. });
  145. //日期时间范围
  146. laydate.render({
  147. elem: '#start_time'
  148. , type: 'datetime'
  149. });
  150. laydate.render({
  151. elem: '#end_time'
  152. , type: 'datetime'
  153. });
  154. function getList() {
  155. var page = false;
  156. var url = '{:url("setting.Sms/lists")}';
  157. var cols = [
  158. {type: 'numbers', title: '序号', width: 60}
  159. , {field: 'name', title: '短信通道', align: 'center'}
  160. , {field: 'status', title: '状态', align: 'center', templet: '#table-status'}
  161. , {title: '操作', width: 250, align: 'center', fixed: 'right', toolbar: '#table-operation-config'}
  162. ];
  163. if (type == 2) {
  164. url = '{:url("setting.Sms/logLists")}';
  165. cols = [
  166. {type: 'numbers', title: '序号', width: 60}
  167. , {field: 'scene_name', title: '短信标题', align: 'center'}
  168. , {field: 'content', title: '短信内容', align: 'center'}
  169. , {field: 'mobile', title: '发送手机号', align: 'center'}
  170. , {field: 'send_status', title: '发送状态', align: 'center'}
  171. , {field: 'send_time', title: '发送时间', align: 'center'}
  172. , {field: 'create_time', title: '创建时间', align: 'center'}
  173. , {title: '操作', width: 250, align: 'center', fixed: 'right', toolbar: '#table-operation'}
  174. ];
  175. page = true;
  176. }
  177. like.tableLists('#like-table-lists', url, cols, {}, page);
  178. }
  179. var active = {
  180. config: function(obj) {
  181. layer.open({
  182. type: 2
  183. , title: '消息设置'
  184. , content: '{:url("setting.Sms/config")}?engine=' + obj.data.engine
  185. , area: ['90%', '90%']
  186. , btn: ['保存', '取消']
  187. , yes: function (index, layero) {
  188. var iframeWindow = window["layui-layer-iframe" + index];
  189. var submit = layero.find("iframe").contents().find("#addSubmit");
  190. iframeWindow.layui.form.on("submit(addSubmit)", function(data){
  191. var field = data.field;
  192. like.ajax({
  193. url: '{:url("setting.Sms/config")}',
  194. data: field,
  195. type: "post",
  196. success: function (res) {
  197. if(res.code === 1) {
  198. layui.layer.msg(res.msg,{
  199. offset: '15px'
  200. , icon: 1
  201. , time: 1000
  202. });
  203. layer.close(index);
  204. table.reload("like-table-lists", {
  205. where: {},
  206. page: { cur: 1 }
  207. });
  208. }
  209. }
  210. });
  211. });
  212. submit.trigger('click');
  213. }
  214. })
  215. },
  216. detail: function(obj) {
  217. layer.open({
  218. type: 2
  219. , title: '短信详情'
  220. , content: '{:url("setting.Sms/detail")}?id=' + obj.data.id
  221. , area: ['90%', '90%']
  222. })
  223. }
  224. };
  225. like.eventClick(active);
  226. });
  227. </script>