visit_list.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. {extend name="public/layout" /} {block name="title"}二维码扫码统计{/block} {block name="body"}
  2. <style type="text/css">
  3. html,
  4. body {
  5. display: block;
  6. width: 100%;
  7. background-color: #fff;
  8. min-width: 700px;
  9. }
  10. .layui-form {
  11. padding: 20px 30px;
  12. }
  13. .layui-table thead tr,
  14. .layui-table-header {
  15. background-color: #D8E6F1 !important;
  16. }
  17. .nowbtn {
  18. border: 1px solid #249EFB;
  19. background-color: #fff;
  20. color: #249EFB;
  21. }
  22. .nowbtn:hover {
  23. border: 1px solid #249EFB;
  24. background-color: #fff;
  25. color: #249EFB;
  26. }
  27. .layui-form {
  28. padding: 0px;
  29. }
  30. .layui-card {
  31. padding: 0px 20px 0px;
  32. }
  33. .mt20 {
  34. margin-top: 20px;
  35. }
  36. </style>
  37. <body>
  38. <div class="layui-form" id="admin" enctype="multipart/form-data">
  39. <!--<div class="layui-form-item mt20">
  40. <label class="layui-form-label">选择时间</label>
  41. <div class="layui-input-inline">
  42. <input type="text" name="start_date" id="start_date" placeholder="选择开始日期" autocomplete="off"
  43. class="layui-input">
  44. </div>
  45. <div class="layui-form-mid">-</div>
  46. <div class="layui-input-inline">
  47. <input type="text" name="end_date" id="end_date" placeholder="选择结束日期" autocomplete="off"
  48. class="layui-input">
  49. </div>
  50. </div>-->
  51. <div class="layui-card">
  52. <table class="layui-table" id="livecodestatistics" lay-filter="livecodestatistics">
  53. </table>
  54. <script type="text/html" id="qrLinkOperate">
  55. <a class="layui-btn layui-btn-normal layui-btn-xs nowbtn lookphone" lay-event="look">查看</a>
  56. </script>
  57. </div>
  58. </div>
  59. </body>
  60. <script id="codelookphone" type="text/html">
  61. <div class="layui-card-body layui-form" style="padding: 15px;">
  62. <table class="layui-table" id="livecodephone" lay-filter="livecodephone">
  63. <thead>
  64. <tr>
  65. <th>微信昵称</th>
  66. <th>头像</th>
  67. <!--<th>电话</th>-->
  68. </tr>
  69. </thead>
  70. <tbody id="livecodetbody">
  71. </tbody>
  72. </table>
  73. </div>
  74. </script>
  75. {/block} {block name="js"}
  76. <script>
  77. layui.config({
  78. base: '__LAYUI__/',
  79. urlbase: '/sys'
  80. }).extend({
  81. index: 'lib/index' //主入口模块
  82. }).use(['index', 'form', 'table', 'laydate'], function () {
  83. var $ = layui.$,
  84. form = layui.form,
  85. table = layui.table,
  86. laydate = layui.laydate;
  87. //日期范围
  88. laydate.render({
  89. elem: '#start_date'
  90. });
  91. laydate.render({
  92. elem: '#end_date'
  93. });
  94. table.render({
  95. elem: '#livecodestatistics',
  96. url: "{:url('Huoma/visit_list')}?id={$id}",
  97. height: 'full-160',
  98. cols: [
  99. [
  100. { align: 'center', field: 'file_name', title: '活码名称' },
  101. { align: 'center', field: 'visit_num', title: '报名数' },
  102. { align: 'center', field: 'code_url', title: '报名详情', templet: '#qrLinkOperate' },
  103. ]
  104. ],
  105. page: true,
  106. text: '对不起,加载出现异常!'
  107. });
  108. function setHtml(arr) {
  109. let htmls = arr.map(v => {
  110. return `<tr>
  111. <td>${v.user.nickname}</td>
  112. <td><img src="${v.user.headimgurl}" alt="" width="20px" height="20px"></td>
  113. <!--<td>${v.user.phone}</td>-->
  114. </tr>`;
  115. }).join('')
  116. $('#livecodetbody').html(htmls)
  117. }
  118. function getUserList(id) {
  119. let formData = new FormData();
  120. formData.append('id', id)
  121. $.ajax({
  122. url: '{:url("huoma/user_list")}',
  123. type: 'post',
  124. data: formData,
  125. dataType: 'json',
  126. processData: false,
  127. contentType: false,
  128. success: (ress) => {
  129. if (ress.code == 0) {
  130. setHtml(ress.data);
  131. }
  132. },
  133. });
  134. }
  135. table.on('tool(livecodestatistics)', function (obj) {
  136. var data = obj.data;
  137. switch (obj.event) {
  138. case 'look':
  139. layer.open({
  140. type: 1,
  141. title: ['查看', 'color:#333333;background-color:#D8E6F1;'],
  142. content: $('#codelookphone').html(), //这里content是一个DOM,注意:最好该元素要存放在body最外层,否则可能被其它的相对元素所影响
  143. maxmin: true,
  144. area: ['80%', '80%']
  145. });
  146. setTimeout(() => {
  147. getUserList(data.id)
  148. }, 500)
  149. break;
  150. }
  151. })
  152. })
  153. </script>
  154. {/block}