applylist.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <div class="layui-fluid">
  2. <div class="layui-card">
  3. <div class="layui-form layui-form-pane layui-card-header layuiadmin-card-header-auto" lay-filter="LAY-broker-brokerlist-search">
  4. <div class="layui-form-item">
  5. <div class="layui-inline">
  6. <label class="layui-form-label">手机号</label>
  7. <div class="layui-input-block">
  8. <input type="text" name="mobile" placeholder="请输入" autocomplete="off" class="layui-input">
  9. </div>
  10. </div>
  11. <div class="layui-inline">
  12. <label class="layui-form-label">状态</label>
  13. <div class="layui-input-block">
  14. <select name="status">
  15. <option value="">全部状态</option>
  16. <option value="1">待审核</option>
  17. <option value="2">审核通过</option>
  18. <option value="3">审核拒绝</option>
  19. </select>
  20. </div>
  21. </div>
  22. <div class="layui-inline">
  23. <label class="layui-form-label">类型</label>
  24. <div class="layui-input-block">
  25. <select name="status">
  26. <option value="">全部</option>
  27. <option value="1">经纪人</option>
  28. <option value="2">红色合伙人</option>
  29. <option value="3">省外经纪人</option>
  30. </select>
  31. </div>
  32. </div>
  33. <div class="layui-inline">
  34. <button class="layui-btn" lay-submit lay-filter="LAY-broker-brokerlist-btn">
  35. <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
  36. </button>
  37. </div>
  38. </div>
  39. </div>
  40. <div class="layui-card-body">
  41. <div style="padding-bottom: 10px;">
  42. <button class="layui-btn layuiadmin-btn" data-type="batchdel">删除</button>
  43. </div>
  44. <table id="LAY-broker-brokerlist-table" lay-filter="LAY-broker-brokerlist-table"></table>
  45. <script type="text/html" id="address">
  46. {{d.town}} - {{d.village}}
  47. </script>
  48. <script type="text/html" id="workertitleTpl">
  49. {{d.worker.title}}
  50. </script>
  51. <script type="text/html" id="agenttitleTpl">
  52. {{d.agent.title}}
  53. </script>
  54. <script type="text/html" id="setTpl">
  55. {{# if(d.status == 1){ }}
  56. <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="apply"><i class="layui-icon layui-icon-edit"></i>审核通过</a>
  57. <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="reject"><i class="layui-icon layui-icon-edit"></i>审核拒绝</a>
  58. {{# } }}
  59. <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
  60. </script>
  61. </div>
  62. </div>
  63. </div>
  64. <script>
  65. layui.config({
  66. base: '/static/echoui/' //静态资源所在路径
  67. }).extend({
  68. index: 'lib/index' //主入口模块
  69. }).use(['index', 'form', 'set', 'table'], function() {
  70. var $ = layui.$,
  71. setter = layui.setter,
  72. admin = layui.admin,
  73. form = layui.form,
  74. table = layui.table;
  75. form.render();
  76. table.render({
  77. elem: '#LAY-broker-brokerlist-table',
  78. url: setter.baseAdminUrl + 'broker/listapply',
  79. cols: [
  80. [
  81. { type: 'checkbox', fixed: 'left' },
  82. { field: 'id', width: 80, title: '表ID', sort: true },
  83. { field: 'title', title: '姓名' },
  84. { field: 'mobile', title: '手机号' },
  85. { field: 'type_text', title: '类型', width: 100, align: 'center' },
  86. { field: 'address', title: '镇街', templet: '#address' },
  87. { field: 'region', title: '区域', width: 100, align: 'center'},
  88. { field: 'workertitle', title: '劳务公司', templet: '#workertitleTpl' },
  89. { field: 'agenttitle', title: '代理门店', templet: '#agenttitleTpl' },
  90. { field: 'status_text', title: '状态', width: 100, align: 'center' },
  91. { field: 'createtime', title: '申请时间', width: 170 },
  92. { title: '操作', width: 260, align: 'center', fixed: 'right', toolbar: '#setTpl' }
  93. ]
  94. ],
  95. page: true,
  96. limit: 50,
  97. cellMinWidth: 150,
  98. text: '对不起,加载出现异常!'
  99. });
  100. form.on('submit(LAY-broker-brokerlist-btn)', function(data) {
  101. table.reload('LAY-broker-brokerlist-table', {
  102. where: data.field,
  103. page: {
  104. curr: 1
  105. }
  106. });
  107. });
  108. var active = {
  109. batchdel: function() {
  110. var checkStatus = table.checkStatus('LAY-broker-brokerlist-table'),
  111. checkData = checkStatus.data; //得到选中的数据
  112. if (checkData.length === 0) {
  113. return layer.msg('请选择数据');
  114. }
  115. var idarr = [];
  116. for (var i = 0; i < checkData.length; i++) {
  117. idarr.push(checkData[i].id);
  118. }
  119. layer.confirm('确定删除此申请吗?', function(index) {
  120. admin.req({
  121. url: setter.baseAdminUrl + 'broker/delApply',
  122. data: {
  123. idarr: idarr
  124. },
  125. done: function(res) {
  126. table.reload('LAY-broker-brokerlist-table');
  127. layer.msg('已删除');
  128. }
  129. });
  130. layer.close(index);
  131. });
  132. },
  133. };
  134. table.on('tool(LAY-broker-brokerlist-table)', function(obj) {
  135. var data = obj.data;
  136. if (obj.event === 'del') {
  137. layer.confirm('确定删除此申请吗?', function(index) {
  138. admin.req({
  139. url: setter.baseAdminUrl + 'broker/delApply',
  140. data: {
  141. idarr: [data.id]
  142. },
  143. done: function(res) {
  144. obj.del();
  145. layer.msg('已删除');
  146. }
  147. });
  148. layer.close(index);
  149. });
  150. } else if (obj.event === 'apply') {
  151. layer.confirm('确定通过吗?', function(index) {
  152. admin.req({
  153. url: setter.baseAdminUrl + 'broker/statusApply',
  154. data: {
  155. id: data.id,
  156. status: 2,
  157. },
  158. done: function(res) {
  159. table.reload('LAY-broker-brokerlist-table');
  160. layer.msg('操作成功');
  161. }
  162. });
  163. layer.close(index);
  164. });
  165. } else if (obj.event === 'reject') {
  166. layer.confirm('确定拒绝吗?', function(index) {
  167. admin.req({
  168. url: setter.baseAdminUrl + 'broker/statusApply',
  169. data: {
  170. id: data.id,
  171. status: 3,
  172. },
  173. done: function(res) {
  174. table.reload('LAY-broker-brokerlist-table');
  175. layer.msg('操作成功');
  176. }
  177. });
  178. layer.close(index);
  179. });
  180. }
  181. });
  182. $('.layui-btn.layuiadmin-btn').on('click', function() {
  183. var type = $(this).data('type');
  184. active[type] ? active[type].call(this) : '';
  185. });
  186. });
  187. </script>