index.php 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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" width="10%">操作</th>
  52. </tr>
  53. </thead>
  54. <tbody class="">
  55. {volist name="list" id="vo"}
  56. <tr>
  57. <td class="text-center">
  58. {$vo.id}
  59. </td>
  60. <td class="text-center">
  61. {$vo.title}
  62. </td>
  63. <td class="text-center">
  64. {$vo.coupon_price}
  65. </td>
  66. <td class="text-center">
  67. {$vo.name}
  68. </td>
  69. <td class="text-center">
  70. {if($vo.start_time)}
  71. {$vo.start_time} - {$vo.end_time}
  72. {else}
  73. 没有期限
  74. {/if}
  75. </td>
  76. <td class="text-center">
  77. {$vo.sort}
  78. </td>
  79. <td class="text-center">
  80. <i class="fa {eq name='vo.status' value='1'}fa-check text-navy{else/}fa-close text-danger{/eq}"></i>
  81. </td>
  82. <td class="text-center">
  83. {$vo.add_time|date='Y-m-d H:i:s'}
  84. </td>
  85. <td class="text-center">
  86. <div class="input-group-btn js-group-btn">
  87. <div class="btn-group">
  88. <button data-toggle="dropdown" class="btn btn-xs btn-primary"
  89. aria-expanded="false">操作
  90. <span class="caret"></span>
  91. </button>
  92. <ul class="dropdown-menu">
  93. {if condition="$vo['status']"}
  94. <li>
  95. <a href="javascript:void(0);" onclick="$eb.createModalFrame(this.innerText,'{:Url('edit')}?type=0&id={$vo['id']}')">
  96. <i class="fa fa-yelp"></i> 编辑
  97. </a>
  98. </li>
  99. <li>
  100. <a href="javascript:void(0);" class="del" data-url="{:Url('status',array('id'=>$vo['id']))}">
  101. <i class="fa fa-yelp"></i> 立即失效
  102. </a>
  103. </li>
  104. <!-- <li>-->
  105. <!-- <a href="javascript:void(0);" onclick="$eb.createModalFrame(this.innerText+' [{$vo.title}] 优惠劵','{:Url('issue',['id'=>$vo['id']])}')">-->
  106. <!-- <i class="fa fa-male"></i> 发布-->
  107. <!-- </a>-->
  108. <!-- </li>-->
  109. {/if}
  110. <li>
  111. <a href="javascript:void(0);" class="delstor" data-url="{:Url('delete',array('id'=>$vo['id']))}">
  112. <i class="fa fa-times"></i> 删除
  113. </a>
  114. </li>
  115. </ul>
  116. </div>
  117. </div>
  118. </td>
  119. </tr>
  120. {/volist}
  121. </tbody>
  122. </table>
  123. </div>
  124. {include file="public/inner_page"}
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. {/block}
  130. {block name="script"}
  131. <script>
  132. $('.js-group-btn').on('click',function(){
  133. $('.js-group-btn').css({zIndex:1});
  134. $(this).css({zIndex:100});
  135. });
  136. $('.del').on('click',function(){
  137. window.t = $(this);
  138. var _this = $(this),url =_this.data('url');
  139. $eb.$swal('delete',function(){
  140. $eb.axios.get(url).then(function(res){
  141. console.log(res);
  142. if(res.status == 200 && res.data.code == 200) {
  143. $eb.$swal('success',res.data.msg);
  144. // _this.parents('tr').remove();
  145. }else
  146. return Promise.reject(res.data.msg || '修改失败')
  147. }).catch(function(err){
  148. $eb.$swal('error',err);
  149. });
  150. },{'title':'您确定要修改优惠券的状态吗?','text':'修改后将无法恢复并且已发出的优惠券将失效,请谨慎操作!','confirm':'是的,我要修改'})
  151. });
  152. $('.delstor').on('click',function(){
  153. window.t = $(this);
  154. var _this = $(this),url =_this.data('url');
  155. $eb.$swal('delete',function(){
  156. $eb.axios.get(url).then(function(res){
  157. console.log(res);
  158. if(res.status == 200 && res.data.code == 200) {
  159. $eb.$swal('success',res.data.msg);
  160. _this.parents('tr').remove();
  161. }else
  162. return Promise.reject(res.data.msg || '删除失败')
  163. }).catch(function(err){
  164. $eb.$swal('error',err);
  165. });
  166. },{'title':'您确定要删除优惠券吗?','text':'删除后将无法恢复,请谨慎操作!','confirm':'是的,我要删除'})
  167. });
  168. $(".open_image").on('click',function (e) {
  169. var image = $(this).data('image');
  170. $eb.openImage(image);
  171. })
  172. </script>
  173. {/block}