rush.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. {extend name="../../base/view/common/base" /}
  2. <!-- 主体 -->
  3. {block name="body"}
  4. <div class="p-page">
  5. <div class="layui-row gg-form-bar border-x border-t">
  6. <div class="layui-input-inline"><button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="webform">换一批客户</button></div>
  7. <div class="layui-input-inline red">每点击一次随机获取20个公海客户的信息,每天最多可抢<strong class="mx-1">{$max_num|default="0"}</strong>个客户,你今天已抢了<strong class="mx-1" id="count">{$count}</strong>个客户</div>
  8. </div>
  9. <table class="layui-hide" id="test" lay-filter="test"></table>
  10. </div>
  11. {/block}
  12. <!-- /主体 -->
  13. <!-- 脚本 -->
  14. {block name="script"}
  15. <script>
  16. const moduleInit = ['tool'];
  17. function gouguInit() {
  18. var table = layui.table, tool = layui.tool ,form = layui.form;
  19. layui.pageTable = table.render({
  20. elem: '#test',
  21. title: '抢客宝列表',
  22. toolbar: false,
  23. defaultToolbar: false,
  24. url: "/customer/index/rush", //数据接口
  25. cellMinWidth: 80,
  26. page: false, //开启分页
  27. limit: 20,
  28. height: 'full-114',
  29. cols: [
  30. [ //表头
  31. {
  32. field: 'id',title: 'ID号',align: 'center',width: 80
  33. },{
  34. field: 'name',
  35. title: '客户名称',
  36. minWidth:240,
  37. templet: '<div><a data-href="/customer/customer/view/id/{{d.id}}.html" class="side-a">{{d.name}}</a></div>'
  38. },{
  39. field: 'contact_name',
  40. title: '联系人',
  41. align: 'center',
  42. width: 80
  43. },{
  44. field: 'contact_mobile',
  45. title: '手机号码',
  46. align: 'center',
  47. width: 110
  48. },{
  49. field: 'contact_email',
  50. title: '电子邮箱',
  51. width: 200
  52. },{
  53. field: 'grade',
  54. title: '客户等级',
  55. align: 'center',
  56. width: 100
  57. },{
  58. field: 'source',
  59. title: '来源渠道',
  60. align: 'center',
  61. width: 100
  62. },{
  63. field: 'industry',
  64. title: '所属行业',
  65. align: 'center',
  66. width: 120
  67. },{
  68. field: 'create_time',
  69. title: '创建时间',
  70. align: 'center',
  71. width: 150
  72. },{
  73. field: 'update_time',
  74. title: '最后编辑时间',
  75. align: 'center',
  76. width: 150
  77. },{
  78. field: 'right',
  79. fixed:'right',
  80. title: '操作',
  81. width: 80,
  82. align: 'center',
  83. templet: function (d) {
  84. if(login_admin==1){
  85. return '-';
  86. }
  87. else{
  88. return '<span class="layui-btn layui-btn-xs" lay-event="get">领取客户</span>';
  89. }
  90. }
  91. }
  92. ]
  93. ]
  94. });
  95. //监听行工具事件
  96. table.on('tool(test)', function(obj) {
  97. var data = obj.data;
  98. if (obj.event === 'get') {
  99. layer.confirm('确定要获取该客户?', {
  100. icon: 3,
  101. title: '提示'
  102. }, function(index) {
  103. let callback = function (e) {
  104. layer.msg(e.msg);
  105. if (e.code == 0) {
  106. layui.pageTable.reload();
  107. let count =$('#count').text();
  108. $('#count').html(++count);
  109. }
  110. }
  111. tool.post("/customer/index/to_get", {id: data.id}, callback);
  112. layer.close(index);
  113. });
  114. }
  115. });
  116. //监听搜索提交
  117. form.on('submit(webform)', function(data) {
  118. layui.pageTable.reload();
  119. return false;
  120. });
  121. }
  122. </script>
  123. {/block}
  124. <!-- /脚本 -->