equity.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. {extend name="public/container"}
  2. {block name="head_top"}
  3. {/block}
  4. {block name="content"}
  5. <style>
  6. .btn-outline{
  7. border:none;
  8. }
  9. .btn-outline:hover{
  10. background-color: #0e9aef;
  11. color: #fff;
  12. }
  13. .layui-form-item .layui-btn {
  14. margin-top: 5px;
  15. margin-right: 10px;
  16. }
  17. .layui-btn-primary{
  18. margin-right: 10px;
  19. margin-left: 0!important;
  20. }
  21. label{
  22. margin-bottom: 0!important;
  23. margin-top: 4px;
  24. }
  25. </style>
  26. <div class="layui-fluid">
  27. <div class="layui-row layui-col-space15" id="app">
  28. <!--搜索条件-->
  29. <!-- 中间详细信息-->
  30. <div :class="item.col!=undefined ? 'layui-col-sm'+item.col+' '+'layui-col-md'+item.col:'layui-col-sm6 layui-col-md3'"
  31. v-for="item in badge" v-cloak="" v-if="item.count > 0">
  32. </div>
  33. <!--enb-->
  34. </div>
  35. <!--列表-->
  36. <div class="layui-row layui-col-space15">
  37. <div class="layui-col-md12">
  38. <div class="layui-card">
  39. <div class="layui-card-header">优惠卡</div>
  40. <div class="layui-card-body">
  41. <table class="layui-hide" id="List" lay-filter="List"></table>
  42. <script type="text/html" id="nickname">
  43. {{d.nickname}}/{{d.uid}}
  44. </script>
  45. <script type="text/html" id="status">
  46. {{# if(d.status==0){ }}
  47. 未使用
  48. {{# } }}
  49. {{# if(d.status==1){ }}
  50. 已使用
  51. {{# } }}
  52. </script>
  53. <script type="text/html" id="use">
  54. {{# if(d.use==0){ }}
  55. 失效
  56. {{# } }}
  57. {{# if(d.use==1){ }}
  58. 正常
  59. {{# } }}
  60. {{# if(d.use==-1){ }}
  61. 过期
  62. {{# } }}
  63. </script>
  64. <script type="text/html" id="type">
  65. {{# if(d.type==1){ }}
  66. 限时
  67. {{# } }}
  68. {{# if(d.type==2){ }}
  69. 限次
  70. {{# } }}
  71. </script>
  72. <script type="text/html" id="act">
  73. <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" onclick="$eb.createModalFrame('编辑','{:Url('equity')}?id={{d.id}}',{h:1100,w:1100})">
  74. 详情
  75. </button>
  76. <button type="button" class="layui-btn layui-btn-xs layui-btn-danger" lay-event='delete' id="">
  77. 删除
  78. </button>
  79. </script>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. <!--end-->
  85. </div>
  86. <script src="{__ADMIN_PATH}js/layuiList.js"></script>
  87. {/block}
  88. {block name="script"}
  89. <script>
  90. layList.form.render();
  91. var id = {$id};
  92. layList.tableList('List', "{:Url('equity_list')}?id="+id, function () {
  93. return [
  94. {type: 'checkbox'},
  95. {field: 'id', title: 'ID', sort: true, event: 'id', width: '5%', templet: '#id', align: 'center'},
  96. {field: 'name', title: '优惠类型', align: 'center'},
  97. {field: 'type', title: '剩余次数',templet: '#type', align: 'center'},
  98. {field: 'number', title: '剩余次数', align: 'center'},
  99. {field: 'use', title: '状态', templet: '#use', align: 'center'},
  100. {field: 'create_time', title: '时间', align: 'center'},
  101. // {field: 'right', title: '操作', align: 'center', toolbar: '#act',width: '15%'},
  102. ];
  103. });
  104. //查询
  105. layList.search('search',function(where){
  106. layList.reload(where,true);
  107. });
  108. layList.switch('is_show',function (odj,value) {
  109. if(odj.elem.checked==true){
  110. layList.baseGet(layList.Url({a:'set_show',p:{is_show:1,id:value}}),function (res) {
  111. layList.msg(res.msg);
  112. });
  113. }else{
  114. layList.baseGet(layList.Url({a:'set_show',p:{is_show:0,id:value}}),function (res) {
  115. layList.msg(res.msg);
  116. });
  117. }
  118. });
  119. //点击事件绑定
  120. layList.tool(function (event,data,obj) {
  121. switch (event) {
  122. case 'delete':
  123. var url=layList.U({c:'water.water_cate',a:'delete',q:{id:data.id}});
  124. var code = {title:"操作提示",text:"确定将该商品移入回收站吗?",type:'info',confirm:'是的,移入回收站'};
  125. $eb.$swal('delete',function(){
  126. $eb.axios.get(url).then(function(res){
  127. if(res.status == 200 && res.data.code == 200) {
  128. $eb.$swal('success',res.data.msg);
  129. obj.del();
  130. location.reload();
  131. }else
  132. return Promise.reject(res.data.msg || '删除失败')
  133. }).catch(function(err){
  134. $eb.$swal('error',err);
  135. });
  136. },code)
  137. break;
  138. case 'open_image':
  139. $eb.openImage(data.image);
  140. break;
  141. case 'edit':
  142. location.href = layList.U({a:'edit',q:{id:data.id}});
  143. break;
  144. }
  145. })
  146. //改状态
  147. layList.switch('status',function (odj,value) {
  148. if(odj.elem.checked==true){
  149. layList.baseGet(layList.Url({c:'auction.auction',a:'set_status',p:{status:1,id:value}}),function (res) {
  150. layList.msg(res.msg, function () {
  151. layList.reload();
  152. });
  153. });
  154. }else{
  155. layList.baseGet(layList.Url({c:'auction.auction',a:'set_status',p:{status:0,id:value}}),function (res) {
  156. layList.msg(res.msg, function () {
  157. layList.reload();
  158. });
  159. });
  160. }
  161. });
  162. </script>
  163. {/block}