index.php 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. {extend name="public/container"}
  2. {block name="content"}
  3. <div class="row">
  4. <div class="col-sm-12">
  5. <div class="ibox">
  6. <div class="ibox-content">
  7. <div class="row">
  8. <div class="m-b m-l">
  9. <form action="" class="form-inline">
  10. <select name="status" aria-controls="editable" class="form-control input-sm">
  11. <option value="">状态</option>
  12. <option value="1" {eq name="where.status" value="1"}selected="selected"{/eq}>正常</option>
  13. <option value="0" {eq name="where.status" value="0"}selected="selected"{/eq}>未开启</option>
  14. <option value="-1" {eq name="where.status" value="2"}selected="selected"{/eq}>已失效</option>
  15. </select>
  16. <select name="type" aria-controls="editable" class="form-control input-sm">
  17. <option value="">类型</option>
  18. <option value="0" {eq name="where.type" value="0"}selected="selected"{/eq}>通用券</option>
  19. <option value="1" {eq name="where.type" value="1"}selected="selected"{/eq}>品类券</option>
  20. <option value="2" {eq name="where.type" value="2"}selected="selected"{/eq}>商品券</option>
  21. </select>
  22. <div class="input-group">
  23. <input type="text" name="coupon_title" value="{$where.coupon_title}" placeholder="请输入优惠券名称" class="input-sm form-control"> <span class="input-group-btn">
  24. <button type="submit" class="btn btn-sm btn-primary"> <i class="fa fa-search" ></i>搜索</button> </span>
  25. </div>
  26. </form>
  27. </div>
  28. </div>
  29. <div class="table-responsive">
  30. <table class="table table-striped table-bordered">
  31. <thead>
  32. <tr>
  33. <th class="text-center">编号</th>
  34. <th class="text-center">优惠券名称</th>
  35. <th class="text-center">优惠券类型</th>
  36. <th class="text-center">领取日期</th>
  37. <th class="text-center">首次关注赠送</th>
  38. <th class="text-center">消费满赠</th>
  39. <th class="text-center">发布数量</th>
  40. <th class="text-center">状态</th>
  41. <th class="text-center">操作</th>
  42. </tr>
  43. </thead>
  44. <tbody class="">
  45. {volist name="list" id="vo"}
  46. <tr>
  47. <td class="text-center">
  48. {$vo.id}
  49. </td>
  50. <td class="text-center">
  51. {$vo.title}
  52. </td>
  53. <td class="text-center">
  54. {if $vo.type eq 0}
  55. 通用券
  56. {elseif $vo.type eq 1}
  57. 品类券
  58. {else/}
  59. 商品券
  60. {/if}
  61. </td>
  62. <td class="text-center">
  63. {empty name="$vo.start_time"}
  64. 不限时
  65. {else/}
  66. {$vo.start_time|date="Y/m/d H:i"} - {$vo.end_time|date="Y/m/d H:i"}
  67. {/empty}
  68. </td>
  69. <td class="text-center">
  70. {if $vo.is_give_subscribe eq 1}
  71. {else/}
  72. {/if}
  73. </td>
  74. <td class="text-center">
  75. {if $vo.is_full_give eq 1}
  76. {else/}
  77. {/if}
  78. </td>
  79. <td class="text-center">
  80. {if condition="$vo['is_permanent']"}
  81. 不限量
  82. {else/}
  83. <b style="color: #0a6aa1">发布:{$vo.total_count}</b>
  84. <br/>
  85. <b style="color:#ff0000;">剩余:{$vo.remain_count}</b>
  86. {/if}
  87. </td>
  88. <td class="text-center">
  89. <?php if(!$vo['status']){ ?>
  90. <span class="label label-warning">未开启</span>
  91. <?php }elseif(-1 == $vo['status']){ ?>
  92. <span class="label label-danger">已失效</span>
  93. <?php }elseif(1 == $vo['status']){ ?>
  94. <span class="label label-primary">正常</span>
  95. <?php } ?>
  96. </td>
  97. <td class="text-center">
  98. <button class="btn btn-info btn-xs" type="button" onclick="$eb.createModalFrame('修改状态','{:Url('issue_log',array('id'=>$vo['id']))}')"><i class="fa fa-commenting-o"></i> 领取记录</button>
  99. {neq name="vo.status" value="-1"}
  100. <button class="btn btn-primary btn-xs" type="button" onclick="$eb.createModalFrame('修改状态','{:Url('edit',array('id'=>$vo['id']))}',{w:400,h:170})"><i class="fa fa-edit"></i> 修改状态</button>
  101. {/neq}
  102. <button class="btn btn-danger btn-xs" data-url="{:Url('delete',array('id'=>$vo['id']))}" type="button"><i class="fa fa-times"></i> 删除
  103. </button>
  104. </td>
  105. </tr>
  106. {/volist}
  107. </tbody>
  108. </table>
  109. </div>
  110. {include file="public/inner_page"}
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. <script>
  116. $('.btn-danger').on('click',function(){
  117. var _this = $(this),url =_this.data('url');
  118. $eb.$swal('delete',function(){
  119. $eb.axios.get(url).then(function(res){
  120. if(res.status == 200 && res.data.code == 200) {
  121. $eb.$swal('success',res.data.msg);
  122. _this.parents('tr').remove();
  123. }else
  124. return Promise.reject(res.data.msg || '删除失败')
  125. }).catch(function(err){
  126. $eb.$swal('error',err);
  127. });
  128. },{'title':'您确定要删除发布的优惠券吗?','text':'删除后将无法恢复,请谨慎操作!','confirm':'是的,我要删除'})
  129. });
  130. </script>
  131. {/block}