blacklist.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. {extend name="base"/}
  2. {block name="resources"}
  3. {/block}
  4. {block name="main"}
  5. <div class="screen layui-collapse" lay-filter="selection_panel">
  6. <div class="layui-colla-item">
  7. <form class="layui-colla-content layui-form layui-show">
  8. <div class="layui-form-item">
  9. <div class="layui-inline">
  10. <label class="layui-form-label">账号</label>
  11. <div class="layui-input-inline">
  12. <select name="search_text_type">
  13. <option value="username">用户名</option>
  14. <option value="nickname">昵称</option>
  15. <option value="mobile">手机号</option>
  16. </select>
  17. </div>
  18. <div class="layui-input-inline">
  19. <input type="text" name="search_text" placeholder="用户名/昵称/手机号" autocomplete="off" class="layui-input ">
  20. </div>
  21. </div>
  22. </div>
  23. <div class="form-row">
  24. <button class="layui-btn" lay-submit lay-filter="search">筛选</button>
  25. </div>
  26. </form>
  27. </div>
  28. </div>
  29. <!-- 列表 -->
  30. <table id="member_list" lay-filter="member_list"></table>
  31. <!-- 用户信息 -->
  32. <script type="text/html" id="userdetail">
  33. <div class='table-title'>
  34. <div class='title-pic'>
  35. <img layer-src src="{{ns.img(d.headimg)}}" onerror="this.src = '{:img('public/static/img/default_img/head.png')}' ">
  36. </div>
  37. <div class='title-content'>
  38. <p class="layui-elip">{{d.nickname}}</p>
  39. </div>
  40. </div>
  41. </script>
  42. <!-- 工具栏操作 -->
  43. <script type="text/html" id="operation">
  44. <div class="table-btn">
  45. <a class="layui-btn" lay-event="remove">移除</a>
  46. </div>
  47. </script>
  48. <script type="text/html" id="toolbarOperation">
  49. <button class="layui-btn layui-btn-primary" lay-event="remove">批量移除</button>
  50. </script>
  51. <script type="text/html" id="batchOperation">
  52. <button class="layui-btn layui-btn-primary" lay-event="remove">批量移除</button>
  53. </script>
  54. {/block}
  55. {block name="script"}
  56. <script type="text/javascript">
  57. var table, form;
  58. layui.use(['form', 'laytpl'], function() {
  59. form = layui.form;
  60. table = new Table({
  61. elem: '#member_list',
  62. url: ns.url("shop/member/blacklist"),
  63. cols: [
  64. [
  65. {
  66. width: "3%",
  67. type: 'checkbox',
  68. unresize: 'false'
  69. }, {
  70. field: 'userdetail',
  71. title: '账户',
  72. width: '16%',
  73. unresize: 'false',
  74. templet: '#userdetail'
  75. }, {
  76. field: 'member_level_name',
  77. title: '会员等级',
  78. width: '12%',
  79. unresize: 'false'
  80. }, {
  81. field: 'point',
  82. title: '积分',
  83. width: '15%',
  84. unresize: 'false',
  85. align: 'left',
  86. templet: function (data) {
  87. return parseInt(data.point);
  88. }
  89. }, {
  90. field: 'balance',
  91. title: '余额',
  92. width: '15%',
  93. unresize: 'false',
  94. align: 'left',
  95. templet: function(data) {
  96. var balance = parseFloat(data.balance) + parseFloat(data.balance_money);
  97. return '<span style="color: red;" title="'+ balance.toFixed(2) +'">¥' + balance.toFixed(2) + '</span>';
  98. }
  99. }, {
  100. field: 'growth',
  101. title: '成长值',
  102. width: '15%',
  103. unresize: 'false',
  104. align: 'left'
  105. }, {
  106. field: 'reg-login',
  107. title: '最后登录时间',
  108. width: '20%',
  109. unresize: 'false',
  110. templet: function (data) {
  111. return ns.time_to_date(data.last_login_time);
  112. }
  113. }, {
  114. title: '操作',
  115. unresize: 'false',
  116. toolbar: '#operation',
  117. align : 'right'
  118. }
  119. ]
  120. ],
  121. toolbar: '#toolbarOperation',
  122. bottomToolbar: "#batchOperation"
  123. });
  124. /**
  125. * 批量操作
  126. */
  127. table.bottomToolbar(function(obj) {
  128. if (obj.data.length < 1) {
  129. layer.msg('请选择要操作的数据');
  130. return;
  131. }
  132. switch (obj.event) {
  133. case "remove":
  134. var id_array = new Array();
  135. for (i in obj.data) id_array.push(obj.data[i].member_id);
  136. removeBlacklist(id_array.toString());
  137. break;
  138. }
  139. });
  140. /**
  141. * 批量操作
  142. */
  143. table.toolbar(function(obj) {
  144. if (obj.data.length < 1) {
  145. layer.msg('请选择要操作的数据');
  146. return;
  147. }
  148. switch (obj.event) {
  149. case "remove":
  150. var id_array = new Array();
  151. for (i in obj.data) id_array.push(obj.data[i].member_id);
  152. removeBlacklist(id_array.toString());
  153. break;
  154. }
  155. });
  156. /**
  157. * 监听工具栏操作
  158. */
  159. table.tool(function(obj) {
  160. var data = obj.data;
  161. switch (obj.event) {
  162. case 'remove': // 移除黑名单
  163. removeBlacklist(data.member_id);
  164. break;
  165. }
  166. });
  167. function removeBlacklist(member_ids) {
  168. layer.confirm('确定要移除黑名单?', function() {
  169. $.ajax({
  170. url: ns.url("shop/member/modifyStatus"),
  171. data: {
  172. member_ids: member_ids,
  173. status: 1
  174. },
  175. dataType: 'JSON',
  176. type: 'POST',
  177. success: function(res) {
  178. layer.msg(res.message);
  179. if (res.code == 0) {
  180. table.reload();
  181. }
  182. }
  183. });
  184. }, function () {
  185. layer.close();
  186. });
  187. }
  188. /**
  189. * 搜索功能
  190. */
  191. form.on('submit(search)', function(data) {
  192. table.reload({
  193. page: {
  194. curr: 1
  195. },
  196. where: data.field
  197. });
  198. return false;
  199. });
  200. })
  201. </script>
  202. {/block}