index.php 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. {extend name="public/container"}
  2. {block name="content"}
  3. <style>
  4. .dropdown-menu li a i{
  5. width: 10px;
  6. }
  7. </style>
  8. <div class="row">
  9. <div class="col-sm-12">
  10. <div class="ibox">
  11. <div class="ibox-title">
  12. <button type="button" class="btn btn-w-m btn-primary" onclick="$eb.createModalFrame(this.innerText,'{:Url('create')}?type=0')">添加优惠券</button>
  13. <div class="ibox-tools">
  14. </div>
  15. </div>
  16. <div class="ibox-content">
  17. <div class="row">
  18. <div class="m-b m-l">
  19. <form action="" class="form-inline">
  20. <select name="status" aria-controls="editable" class="form-control input-sm">
  21. <option value="">是否有效</option>
  22. <option value="1" {eq name="where.status" value="1"}selected="selected"{/eq}>开启</option>
  23. <option value="0" {eq name="where.status" value="0"}selected="selected"{/eq}>关闭</option>
  24. </select>
  25. <select name="type" aria-controls="editable" class="form-control input-sm">
  26. <option value="">类型</option>
  27. <option value="0" {eq name="where.type" value="0"}selected="selected"{/eq}>通用券</option>
  28. <option value="1" {eq name="where.type" value="1"}selected="selected"{/eq}>品类券</option>
  29. <option value="2" {eq name="where.type" value="2"}selected="selected"{/eq}>商品券</option>
  30. </select>
  31. <div class="input-group">
  32. <input type="text" name="title" value="{$where.title}" placeholder="请输入优惠券名称" class="input-sm form-control">
  33. <span class="input-group-btn">
  34. <button type="submit" class="btn btn-sm btn-primary"> <i class="fa fa-search" ></i>搜索</button> </span>
  35. </div>
  36. </form>
  37. </div>
  38. </div>
  39. <div class="table-responsive" style="overflow:visible">
  40. <table class="table table-striped table-bordered">
  41. <thead>
  42. <tr>
  43. <th class="text-center">编号</th>
  44. <th class="text-center">优惠券名称</th>
  45. <th class="text-center">优惠券类型</th>
  46. <th class="text-center">优惠券面值</th>
  47. <th class="text-center">优惠券最低消费</th>
  48. <th class="text-center">优惠券有效期限</th>
  49. <th class="text-center">排序</th>
  50. <th class="text-center">是否有效</th>
  51. <th class="text-center">添加时间</th>
  52. <th class="text-center" width="10%">操作</th>
  53. </tr>
  54. </thead>
  55. <tbody class="">
  56. {volist name="list" id="vo"}
  57. <tr>
  58. <td class="text-center">
  59. {$vo.id}
  60. </td>
  61. <td class="text-center">
  62. {$vo.title}
  63. </td>
  64. <td class="text-center">
  65. {if $vo.type eq 0}
  66. 通用券
  67. {elseif $vo.type eq 1}
  68. 品类券
  69. {else/}
  70. 商品券
  71. {/if}
  72. </td>
  73. <td class="text-center">
  74. {$vo.coupon_price}
  75. </td>
  76. <td class="text-center">
  77. {$vo.use_min_price}
  78. </td>
  79. <td class="text-center">
  80. {$vo.coupon_time}天
  81. </td>
  82. <td class="text-center">
  83. {$vo.sort}
  84. </td>
  85. <td class="text-center">
  86. <i class="fa {eq name='vo.status' value='1'}fa-check text-navy{else/}fa-close text-danger{/eq}"></i>
  87. </td>
  88. <td class="text-center">
  89. {$vo.add_time|date='Y-m-d H:i:s'}
  90. </td>
  91. <td class="text-center">
  92. <div class="input-group-btn js-group-btn">
  93. <div class="btn-group">
  94. <button data-toggle="dropdown" class="btn btn-xs btn-primary"
  95. aria-expanded="false">操作
  96. <span class="caret"></span>
  97. </button>
  98. <ul class="dropdown-menu">
  99. {if condition="$vo['status']"}
  100. <li>
  101. <a href="javascript:void(0);" class="del" data-url="{:Url('status',array('id'=>$vo['id']))}">
  102. <i class="fa fa-yelp"></i> 立即失效
  103. </a>
  104. </li>
  105. <li>
  106. <a href="javascript:void(0);" onclick="$eb.createModalFrame(this.innerText+' [{$vo.title}] 优惠劵','{:Url('issue',['id'=>$vo['id']])}')">
  107. <i class="fa fa-male"></i> 发布
  108. </a>
  109. </li>
  110. {/if}
  111. <li>
  112. <a href="javascript:void(0);" class="delstor" data-url="{:Url('delete',array('id'=>$vo['id']))}">
  113. <i class="fa fa-times"></i> 删除
  114. </a>
  115. </li>
  116. </ul>
  117. </div>
  118. </div>
  119. </td>
  120. </tr>
  121. {/volist}
  122. </tbody>
  123. </table>
  124. </div>
  125. {include file="public/inner_page"}
  126. </div>
  127. </div>
  128. </div>
  129. </div>
  130. {/block}
  131. {block name="script"}
  132. <script>
  133. $('.js-group-btn').on('click',function(){
  134. $('.js-group-btn').css({zIndex:1});
  135. $(this).css({zIndex:100});
  136. });
  137. $('.del').on('click',function(){
  138. window.t = $(this);
  139. var _this = $(this),url =_this.data('url');
  140. $eb.$swal('delete',function(){
  141. $eb.axios.get(url).then(function(res){
  142. console.log(res);
  143. if(res.status == 200 && res.data.code == 200) {
  144. $eb.$swal('success',res.data.msg);
  145. // _this.parents('tr').remove();
  146. }else
  147. return Promise.reject(res.data.msg || '修改失败')
  148. }).catch(function(err){
  149. $eb.$swal('error',err);
  150. });
  151. },{'title':'您确定要修改优惠券的状态吗?','text':'修改后将无法恢复并且已发出的优惠券将失效,请谨慎操作!','confirm':'是的,我要修改'})
  152. });
  153. $('.delstor').on('click',function(){
  154. window.t = $(this);
  155. var _this = $(this),url =_this.data('url');
  156. $eb.$swal('delete',function(){
  157. $eb.axios.get(url).then(function(res){
  158. console.log(res);
  159. if(res.status == 200 && res.data.code == 200) {
  160. $eb.$swal('success',res.data.msg);
  161. _this.parents('tr').remove();
  162. }else
  163. return Promise.reject(res.data.msg || '删除失败')
  164. }).catch(function(err){
  165. $eb.$swal('error',err);
  166. });
  167. },{'title':'您确定要删除优惠券吗?','text':'删除后将无法恢复,请谨慎操作!','confirm':'是的,我要删除'})
  168. });
  169. $(".open_image").on('click',function (e) {
  170. var image = $(this).data('image');
  171. $eb.openImage(image);
  172. })
  173. </script>
  174. {/block}