card_index.php 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. {extend name="public/container"}
  2. {block name="content"}
  3. <div class="layui-fluid">
  4. <div class="layui-row layui-col-space15">
  5. <div class="layui-col-md12">
  6. <div class="layui-card">
  7. <div class="layui-card-body">
  8. <div class="layui-row layui-col-space15">
  9. <div class="layui-col-md12">
  10. <div class="layui-tab layui-tab-brief" lay-filter="tab">
  11. <ul class="layui-tab-title">
  12. <li lay-id="list" {eq name='activity_type' value='1'}class="layui-this" {/eq} >
  13. <a href="{eq name='activity_type' value='1'}javascript:;{else}{:Url('batch_index',['activity_type'=>1])}{/eq}">批次列表</a>
  14. </li>
  15. <li lay-id="list" {eq name='activity_type' value='2'}class="layui-this" {/eq}>
  16. <a href="{eq name='activity_type' value='2'}javascript:;{else}{:Url('card_index',['activity_type'=>2])}{/eq}">会员卡列表</a>
  17. </li>
  18. </ul>
  19. </div>
  20. </div>
  21. <div class="layui-col-md12">
  22. <form class="layui-form layui-form-pane" action="">
  23. <div class="layui-form-item">
  24. <div class="layui-inline">
  25. <label class="layui-form-label">批次</label>
  26. <div class="layui-input-inline">
  27. <select name="card_batch_id">
  28. <option value="">全部</option>
  29. {foreach $batch_list as $vo}
  30. <option value="{$vo.id}" {if condition="$card_batch_id eq $vo['id']"} selected {/if}>{$vo.title}</option>
  31. {/foreach}
  32. </select>
  33. </div>
  34. </div>
  35. <div class="layui-inline">
  36. <label class="layui-form-label">卡号</label>
  37. <div class="layui-input-inline">
  38. <input type="text" name="card_number" class="layui-input" placeholder="请输入卡号">
  39. <input type="hidden" name="activity_type" value="{$activity_type}">
  40. </div>
  41. </div>
  42. <div class="layui-inline">
  43. <label class="layui-form-label">电话</label>
  44. <div class="layui-input-inline">
  45. <input type="text" name="phone" class="layui-input" placeholder="请输入电话">
  46. </div>
  47. </div>
  48. <div class="layui-inline">
  49. <label class="layui-form-label">是否领取</label>
  50. <div class="layui-input-inline">
  51. <select name="is_use">
  52. <option value="">全部</option>
  53. <option value="1">领取</option>
  54. <option value="0">未领取</option>
  55. </select>
  56. </div>
  57. </div>
  58. <div class="layui-inline">
  59. <label class="layui-form-label">是否激活</label>
  60. <div class="layui-input-inline">
  61. <select name="is_status">
  62. <option value="">全部</option>
  63. <option value="1">激活</option>
  64. <option value="0">冻结</option>
  65. </select>
  66. </div>
  67. </div>
  68. <div class="layui-inline">
  69. <div class="layui-input-inline">
  70. <button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit="search" lay-filter="search">
  71. <i class="layui-icon">&#xe615;</i> 搜索</button>
  72. </div>
  73. </div>
  74. </div>
  75. </form>
  76. </div>
  77. <!--产品列表-->
  78. <div class="layui-col-md12">
  79. <div class="layui-btn-group">
  80. <button class="layui-btn layui-btn-normal layui-btn-sm" onclick="window.location.reload()"><i class="layui-icon">&#xe669;</i> 刷新</button>
  81. </div>
  82. <table class="layui-hide" id="List" lay-filter="List"></table>
  83. <script type="text/html" id="is_status">
  84. <input type='checkbox' name='id' lay-skin='switch' value="{{d.id}}" lay-filter='is_status' lay-text='激活|冻结' {{ d.status == 1 ? 'checked' : '' }}>
  85. </script>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. <script src="{__ADMIN_PATH}js/layuiList.js"></script>
  94. {/block}
  95. {block name="script"}
  96. <script>
  97. //实例化form
  98. layList.form.render();
  99. //加载列表
  100. layList.tableList({o:'List', done:function () {}},"{:Url('card_list',['card_batch_id'=>$card_batch_id])}",function (){
  101. return [
  102. {field: 'id', title: '编号', sort: true,event:'id',width:'8%',align: 'center'},
  103. {field: 'card_number', title: '卡号',align: 'center'},
  104. {field: 'card_password', title: '密码',align: 'center'},
  105. {field: 'username', title: '领取人',align: 'center'},
  106. {field: 'user_phone', title: '领取人电话',align: 'center'},
  107. {field: 'use_time', title: '领取时间',align: 'center'},
  108. {field: 'status', title: '是否激活', templet:'#is_status',align: 'center'},
  109. //{field: 'right', title: '操作',align:'center',toolbar:'#act',width:'10%'},
  110. ];
  111. });
  112. //下拉框
  113. $(document).click(function (e) {
  114. $('.layui-nav-child').hide();
  115. })
  116. function dropdown(that){
  117. var oEvent = arguments.callee.caller.arguments[0] || event;
  118. oEvent.stopPropagation();
  119. var offset = $(that).offset();
  120. var top=offset.top-$(window).scrollTop();
  121. var index = $(that).parents('tr').data('index');
  122. $('.layui-nav-child').each(function (key) {
  123. if (key != index) {
  124. $(this).hide();
  125. }
  126. })
  127. if($(document).height() < top+$(that).next('ul').height()){
  128. $(that).next('ul').css({
  129. 'padding': 10,
  130. 'top': - ($(that).parent('td').height() / 2 + $(that).height() + $(that).next('ul').height()/2),
  131. 'min-width': 'inherit',
  132. 'position': 'absolute'
  133. }).toggle();
  134. }else{
  135. $(that).next('ul').css({
  136. 'padding': 10,
  137. 'top':$(that).parent('td').height() / 2 + $(that).height(),
  138. 'min-width': 'inherit',
  139. 'position': 'absolute'
  140. }).toggle();
  141. }
  142. }
  143. //自定义方法
  144. var action= {
  145. set_value: function (field, id, value, model_type) {
  146. layList.baseGet(layList.Url({
  147. a: 'set_value',
  148. q: {field: field, id: id, value: value, model_type:model_type}
  149. }), function (res) {
  150. layList.msg(res.msg);
  151. }, function (err) {
  152. layList.msg(err.msg);
  153. });
  154. },
  155. //打开新添加页面
  156. open_add: function (url,title) {
  157. layer.open({
  158. type: 2 //Page层类型
  159. ,area: ['100%', '100%']
  160. ,title: title
  161. ,shade: 0.6 //遮罩透明度
  162. ,maxmin: true //允许全屏最小化
  163. ,anim: 1 //0-6的动画形式,-1不开启
  164. ,content: url
  165. ,end:function() {
  166. location.reload();
  167. }
  168. });
  169. }
  170. };
  171. //查询
  172. layList.search('search',function(where){
  173. layList.reload(where,true);
  174. });
  175. layList.switch('is_status',function (odj,value) {
  176. var is_status_value = 0
  177. if(odj.elem.checked==true){
  178. var is_status_value = 1
  179. }
  180. action.set_value('status',value,is_status_value,'member_card');
  181. });
  182. layList.sort(['id','sort'],true);
  183. </script>
  184. {/block}