winning_customer.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  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. }
  9. .layui-table thead tr,
  10. .layui-table-header {
  11. background-color: #D8E6F1 !important;
  12. }
  13. .layui-fluid {
  14. display: block;
  15. border-radius: 5px;
  16. background-color: #ffffff;
  17. padding: 15px 30px;
  18. }
  19. .layui-tab {
  20. padding: 0px;
  21. height: 100%;
  22. }
  23. .layui-form-item {
  24. width: 100%;
  25. }
  26. .layui-form-item .layui-inline {
  27. display: block;
  28. float: left;
  29. height: 38px;
  30. line-height: 38px;
  31. background: #FFFFFF;
  32. margin-right: 5px;
  33. }
  34. .layui-form-item .layui-input-inline {
  35. width: 145px;
  36. height: 38px;
  37. line-height: 38px;
  38. margin-bottom: 0;
  39. }
  40. .layui-form-item .layui-input-inline .layui-input {
  41. border: 1px solid #9DB6CF;
  42. border-radius: 5px;
  43. }
  44. .layui-form-select dl dd.layui-this {
  45. background-color: #249EFB;
  46. }
  47. .layui-form-item div.searchBox {
  48. width: 320px;
  49. background: #FFFFFF;
  50. height: 38px;
  51. overflow: hidden;
  52. padding-left: 18px;
  53. position: relative;
  54. margin-bottom: 0px;
  55. float: right;
  56. }
  57. .searchBox .inputBox {
  58. width: 240px;
  59. float: left;
  60. height: 36px;
  61. line-height: 36px;
  62. }
  63. .searchBtn {
  64. position: absolute;
  65. top: 0;
  66. right: 0;
  67. width: 51px;
  68. height: 38px;
  69. background-color: #fff;
  70. }
  71. .searchBtn img {
  72. position: absolute;
  73. width: 26px;
  74. top: 6px;
  75. left: 0;
  76. }
  77. .layui-btn.layui-btn-success {
  78. background-color: #009688;
  79. }
  80. .layui-card-body {
  81. padding: 0px;
  82. box-shadow: none;
  83. }
  84. .layui-card-header {
  85. padding: 0px 0px 15px !important;
  86. }
  87. .layui-tab-title .layui-this {
  88. background-color: #249EFB !important;
  89. color: #fff;
  90. }
  91. .layui-tab-title .layui-this:after {
  92. border-bottom: none;
  93. border: none;
  94. }
  95. .layui-tab-title li {
  96. background-color: #F2F2F2;
  97. margin: 0px 5px;
  98. }
  99. </style>
  100. <div class="layui-fluid">
  101. <div class="layui-tab">
  102. <ul class="layui-tab-title">
  103. <li class="layui-this switchTab" style="margin-left: 0px;" data-index="1">
  104. 中奖客户
  105. </li>
  106. <li class="switchTab" data-index="2">
  107. 未中奖客户
  108. </li>
  109. </ul>
  110. </div>
  111. <div class="layui-card">
  112. <div class="layui-form layui-card-header layuiadmin-card-header-auto">
  113. <div class="layui-form-item clearfix">
  114. <div class="layui-inline" style="margin-left: 10px;">
  115. <select name="org" id="depart" lay-filter="org_select">
  116. <option value="">请选择部门</option>
  117. </select>
  118. </div>
  119. <div class="layui-inline" style="margin-left: 10px;">
  120. <select name="employee" id="employee" lay-filter="org_select1">
  121. <option value="">请选择员工</option>
  122. </select>
  123. </div>
  124. <div class="layui-inline" style="margin-left: 10px;">
  125. <input type="text" name="keyword" id="keyword" placeholder="请输入手机号" autocomplete="off" class="layui-input">
  126. </div>
  127. <div class="layui-inline" style="margin-left: 10px;">
  128. <button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="LAY-app-contlist-search">
  129. <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
  130. </button>
  131. </div>
  132. </div>
  133. </div>
  134. <div class="layui-card-body">
  135. <table lay-filter="commentdatalist" id="commentdatalist"></table>
  136. </div>
  137. </div>
  138. </div>
  139. {/block} {block name="js"}
  140. <script type="text/html" id="table-operate">
  141. {{# if(d.status){ }}
  142. {{# if(d.status==1){ }}
  143. <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="cashPrize">
  144. 确认兑奖
  145. </a>
  146. {{# }else if(d.status==2){ }}
  147. <button class="layui-btn layui-btn-disabled layui-btn-xs">已兑奖</button>
  148. {{# } }}
  149. {{# }else{ }}
  150. <span style="color: #cccccc;">无</span>
  151. {{# } }}
  152. </script>
  153. <script type="text/html" id="usernick">
  154. {{# if(d.user.nickname){ }}
  155. {{d.user.nickname}}
  156. {{# }else{ }}
  157. <span style="color: #cccccc;">无</span>
  158. {{# } }}
  159. </script>
  160. <script type="text/html" id="userphone">
  161. {{# if(d.user.phone){ }}
  162. {{d.user.phone}}
  163. {{# }else{ }}
  164. <span style="color: #cccccc;">无</span>
  165. {{# } }}
  166. </script>
  167. <script type="text/html" id="userheadimg">
  168. {{# if(d.user.headimgurl){ }}
  169. <img style="display: inline-block; width: 25%; height: 100%;" src="{{d.user.headimgurl}}?x-oss-process=image/resize,w_50">
  170. {{# }else{ }}
  171. <span style="color: #cccccc;">无</span>
  172. {{# } }}
  173. </script>
  174. <script type="text/html" id="share_img">
  175. {{# if(d.lotteryuser && d.lotteryuser.share_img && d.is_share_yes){ }}
  176. <img style="display: inline-block; width: 25%; height: 100%;" src="{{d.lotteryuser.share_img}}?x-oss-process=image/resize,w_50">
  177. {{# }else if(d.share_img){ }}
  178. <img style="display: inline-block; width: 25%; height: 100%;" src="{{d.share_img}}?x-oss-process=image/resize,w_50">
  179. {{# }else{ }}
  180. <span style="color: #cccccc;">无</span>
  181. {{# } }}
  182. </script>
  183. <script type="text/html" id="lucky_time">
  184. {{# if(d.lucky_time){ }}
  185. <span>{{d.lucky_time}}</span>
  186. {{# }else{ }}
  187. <span>{{d.addtime}}</span>
  188. {{# } }}
  189. </script>
  190. <script type="text/html" id="goods">
  191. {{# if(d.good){ }}
  192. <span>{{d.good.good_name}}</span>
  193. {{# }else{ }}
  194. <span style="color: #cccccc;">无</span>
  195. {{# } }}
  196. </script>
  197. <script type="text/html" id="wiped_sn">
  198. {{# if(d.status==2){ }}
  199. <span>已核销</span>
  200. {{# }else{ }}
  201. <span style="color: #cccccc;">未核销</span>
  202. {{# } }}
  203. </script>
  204. <script type="text/html" id="share_name">
  205. {{# if(d.emp.name){ }}
  206. <span>{{d.emp.name}}</span>
  207. {{# }else{ }}
  208. <span style="color: #cccccc;">无</span>
  209. {{# } }}
  210. </script>
  211. <script>
  212. var orgids_str = '{:$orgids}';
  213. var orgids = JSON.parse(orgids_str);
  214. var org = eval('{$org|raw}');
  215. layui.use(['form', 'table', 'laydate'], function () {
  216. var form = layui.form,
  217. table = layui.table,
  218. $ = layui.$,
  219. laydate = layui.laydate,
  220. depart = [];
  221. //执行一个laydate实例
  222. laydate.render({
  223. elem: '#dateTime1' //指定元素
  224. });
  225. //执行一个laydate实例
  226. laydate.render({
  227. elem: '#dateTime2' //指定元素
  228. });
  229. $('#depart').append(setOrgOption(org, ''));
  230. form.render('select')
  231. form.on('select(org_select)', function (data) {
  232. var val = data.value;
  233. $.ajax({
  234. url: '{:url("org/employee")}'
  235. , data: { org:val,limit:10000}
  236. , type: 'get'
  237. , success: function (res) {
  238. if (res.code == 0) {
  239. $('#employee').html('<option value="">请选择</option>');
  240. res.data.forEach(element => {
  241. $('#employee').append('<option value="' + element.id + '">' + element.name + '</option>');
  242. });
  243. form.render('select')
  244. }
  245. }
  246. });
  247. });
  248. function setOrgOption(opt, sj) {
  249. var html = '';
  250. opt.forEach(element => {
  251. if (orgids.length > 0) {
  252. if (in_array(element.id, orgids)) {
  253. html += '<option value="' + element.id + '">' + sj + element.title + '</option>';
  254. }
  255. }
  256. if (element && element.children.length > 0) html += setOrgOption(element.children, sj + '-');
  257. });
  258. return html;
  259. }
  260. function in_array(search, array) {
  261. for (var i in array) {
  262. if (array[i] == search) {
  263. return true;
  264. }
  265. }
  266. return false;
  267. }
  268. var field = {};
  269. form.on('submit(LAY-app-contlist-search)', function (data) {
  270. var keyword = $('#keyword').val();
  271. var org = $('#depart').val();
  272. var employee = $('#employee').val();
  273. field['keyword'] = keyword;
  274. field['org'] = org;
  275. field['employee'] = employee;
  276. //执行重载
  277. table.reload('commentdatalist', {
  278. where: field,
  279. page: {
  280. curr: 1
  281. }
  282. });
  283. });
  284. $('.switchTab').click((e) => {
  285. let type = e.target.dataset.index;
  286. e.target.className="layui-this switchTab";
  287. if (type == 1) {
  288. $('.switchTab')[1].className="switchTab";
  289. } else {
  290. $('.switchTab')[0].className="switchTab";
  291. }
  292. field['type'] = type;
  293. //执行重载
  294. table.reload('commentdatalist', {
  295. where: field,
  296. page: {
  297. curr: 1
  298. }
  299. });
  300. })
  301. table.render({
  302. elem: '#commentdatalist',
  303. url: "{:url('turntable/winning_customer')}?id={$id}",
  304. page: true,
  305. height: 'full-120',
  306. cols: [
  307. [{
  308. type: 'numbers',
  309. field: 'id',
  310. title: '序号'
  311. },
  312. {
  313. field: 'user.headimgurl',
  314. title: '头像',
  315. templet:'#userheadimg'
  316. },
  317. {
  318. field: 'user.nickname',
  319. title: '昵称',
  320. templet:'#usernick'
  321. },
  322. {
  323. field: 'user.phone',
  324. title: '手机号',
  325. templet:'#userphone'
  326. },
  327. {
  328. field: 'lucky_time',
  329. title: '抽奖时间',
  330. templet:'#lucky_time'
  331. },
  332. {
  333. field: 'good.good_name',
  334. title: '抽中奖品',
  335. templet:'#goods'
  336. },
  337. {
  338. field: 'user.nickname',
  339. title: '转发人员',
  340. templet:'#share_name'
  341. },
  342. {
  343. field: 'time',
  344. title: '截图上传',
  345. templet:'#share_img'
  346. },
  347. {
  348. field: 'wiped_sn',
  349. title: '核销码',
  350. templet:'#wiped_sn'
  351. },
  352. {
  353. toolbar: '#table-operate',
  354. title: '操作',
  355. fixed: 'right',
  356. }
  357. ]
  358. ]
  359. });
  360. //监听
  361. table.on('tool(commentdatalist)', function(obj) {
  362. var data = obj.data;
  363. if (obj.event === 'cashPrize') {
  364. layer.prompt({
  365. formType: 3,
  366. value: '',
  367. title: ['请输入核销码', 'color:#333333;background-color:#D8E6F1;'],
  368. }, function(value, index, elem){
  369. //console.log(data);
  370. var formData = new FormData();
  371. formData.append('id',data.id);
  372. formData.append('wiped_sn',value);
  373. $.ajax({
  374. url: '{:url("Turntable/wiped_lottery")}',
  375. type: 'post',
  376. data: formData,
  377. dataType: 'json',
  378. processData: false,
  379. contentType: false,
  380. success: function (res) {
  381. if (res.code === 0) {
  382. table.reload('commentdatalist');
  383. layer.msg(res.msg, {
  384. anim: 0
  385. , time: 2000
  386. }, function () {
  387. layer.close(index); //再执行关闭
  388. });
  389. } else {
  390. layer.msg(res.msg, {
  391. anim: 6
  392. , time: 2000
  393. });
  394. }
  395. }
  396. });
  397. //layer.close(index);
  398. });
  399. }
  400. });
  401. });
  402. </script>
  403. {/block}