receive.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. {extend name="public/layout" /} {block name="title"}活动领取{/block} {block name="body"}
  2. <link rel="stylesheet" href="__LAYUI__/common.css" media="all">
  3. <style type="text/css">
  4. .layui-form-item div.searchBox {
  5. width: 320px;
  6. background: #FFFFFF;
  7. border: 1px solid #B6CADE;
  8. border-radius: 24px;
  9. height: 38px;
  10. overflow: hidden;
  11. padding-left: 18px;
  12. position: relative;
  13. margin-bottom: 0px;
  14. float: right;
  15. }
  16. .searchBox .inputBox {
  17. width: 240px;
  18. float: left;
  19. height: 36px;
  20. line-height: 36px;
  21. border-width: 0;
  22. }
  23. .searchBtn {
  24. position: absolute;
  25. top: 0;
  26. right: 0;
  27. width: 51px;
  28. height: 38px;
  29. background-color: #fff;
  30. }
  31. .searchBtn img {
  32. position: absolute;
  33. width: 26px;
  34. top: 6px;
  35. left: 0;
  36. }
  37. </style>
  38. <body>
  39. <div class="layui-fluid">
  40. <div class="layui-card">
  41. <div class="layui-form layui-card-header layuiadmin-card-header-auto">
  42. <div class="layui-form-item clearfix relative">
  43. <div class="layui-inline pull-left clearfix searchBox">
  44. <input type="text" name="keyword" placeholder="请输入搜索联系方式" autocomplete="off" class="layui-input inputBox">
  45. <button class="layui-btn layuiadmin-btn-course searchBtn" lay-submit lay-filter="LAY-user-front-search">
  46. <img src="__LAYUI__/image/sous.png" alt="">
  47. </button>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="layui-card-body">
  52. <table id="spellgroup" lay-filter="spellgroup"></table>
  53. <script type="text/html" id="img">
  54. <img style="display: inline-block; width: 15%; height: 100%;border-radius: 50%;" src={{d.headimgurl}}>
  55. </script>
  56. <script type="text/html" id="status">
  57. {{# if(d.status == 0){ }}
  58. <a lay-event="get" style="color: #0091FF;">确认领取</a>
  59. {{# }else{ }}
  60. 已领取
  61. {{# } }}
  62. </script>
  63. </div>
  64. </div>
  65. </div>
  66. </body>
  67. {/block} {block name="js"}
  68. <script>
  69. layui.config({
  70. base: '__LAYUI__/',
  71. urlbase: '/sys'
  72. }).extend({
  73. index: 'lib/index' //主入口模块
  74. }).use(['index', 'form', 'table'], function() {
  75. var $ = layui.$,
  76. form = layui.form,
  77. table = layui.table;
  78. //监听搜索
  79. form.on('submit(LAY-user-front-search)', function(data) {
  80. var field = data.field;
  81. //执行重载
  82. table.reload('spellgroup', {
  83. where: field
  84. });
  85. });
  86. //事件
  87. var active = {};
  88. var id = {$id};
  89. var tid = {$tid}
  90. //领取列表
  91. table.render({
  92. elem: '#spellgroup',
  93. autoSort: false,
  94. url: "{:url('spellgroup/receive')}?id="+id+"&tid="+tid,
  95. cols: [
  96. [{
  97. type: 'numbers',
  98. field: 'id',
  99. title: '序号',
  100. align: 'center',
  101. }, {
  102. field: 'cover',
  103. title: '头像',
  104. align: 'center',
  105. templet:'#img'
  106. }, {
  107. field: 'phone',
  108. align: 'center',
  109. title: '手机号',
  110. }, {
  111. title: '操作',
  112. align: 'center',
  113. toolbar: '#status'
  114. }]
  115. ],
  116. page: true,
  117. limit: 30,
  118. height: 'full-220',
  119. text: '对不起,加载出现异常!'
  120. });
  121. //监听审核
  122. table.on('tool(spellgroup)', function(obj) {
  123. var data = obj.data;
  124. console.log(data)
  125. if(obj.event === 'get') {
  126. $.ajax({
  127. type: 'post',
  128. url: "{:url('spellgroup/receive_success')}",
  129. data: {
  130. id: data.id
  131. },
  132. success: function(res) {
  133. if(res.code == 0) {
  134. layer.msg(res.msg, {
  135. anim: 0
  136. },function(){
  137. layui.table.reload('spellgroup'); //重载表格
  138. });
  139. } else {
  140. layer.msg(res.msg, {
  141. anim: 6
  142. });
  143. }
  144. }
  145. });
  146. }
  147. });
  148. $('.layui-btn.layuiadmin-btn-course').on('click', function() {
  149. var type = $(this).data('type');
  150. active[type] ? active[type].call(this) : '';
  151. });
  152. });
  153. </script>
  154. {/block}