grant_subscribe.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. {extend name="public/container"}
  2. {block name="head_top"}
  3. <script src="{__FRAME_PATH}js/content.min.js"></script>
  4. <script src="{__PLUG_PATH}sweetalert2/sweetalert2.all.min.js"></script>
  5. {/block}
  6. {block name="content"}
  7. <div class="row">
  8. <div class="col-sm-12">
  9. <div class="ibox">
  10. <div class="ibox-content">
  11. <div class="row">
  12. <div class="col-sm-8 m-b-xs">
  13. <form action="" class="form-inline">
  14. <i class="fa fa-search" style="margin-right: 10px;"></i>
  15. <div class="input-group" style="width: 80%">
  16. <input type="text" name="title" value="{$where.title}" placeholder="请输入优惠券名称" class="input-sm form-control"> <span class="input-group-btn">
  17. <button type="submit" class="btn btn-sm btn-primary"> 搜索</button> </span>
  18. </div>
  19. </form>
  20. </div>
  21. </div>
  22. <div class="table-responsive">
  23. <table class="table table-striped table-bordered">
  24. <thead>
  25. <tr>
  26. <th class="text-center">优惠券名称</th>
  27. <th class="text-center">优惠券面值</th>
  28. <th class="text-center">优惠券最低消费</th>
  29. <th class="text-center">优惠券有效期限</th>
  30. <th class="text-center">操作</th>
  31. </tr>
  32. </thead>
  33. <tbody class="">
  34. {volist name="list" id="vo"}
  35. <tr>
  36. <td class="text-center">
  37. {$vo.title}
  38. </td>
  39. <td class="text-center">
  40. {$vo.coupon_price}
  41. </td>
  42. <td class="text-center">
  43. {$vo.use_min_price}
  44. </td>
  45. <td class="text-center">
  46. {$vo.coupon_time}天
  47. </td>
  48. <td class="text-center">
  49. <button class="btn btn-primary btn-xs grant" data-url="{:Url('ump.storeCouponUser/grant_subscribe',array('id'=>$vo['id']))}" type="button"><i class="fa fa-arrow-circle-o-right"></i> 发放
  50. </button>
  51. </td>
  52. </tr>
  53. {/volist}
  54. </tbody>
  55. </table>
  56. </div>
  57. {include file="public/inner_page"}
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. {/block}
  63. {block name="script"}
  64. <script>
  65. $('.grant').on('click',function(){
  66. window.t = $(this);
  67. var _this = $(this),url =_this.data('url');
  68. swal({
  69. title: "您确定要发放优惠券吗?",
  70. text:"发放后将无法撤回,请谨慎操作!",
  71. type: "warning",
  72. showCancelButton: true,
  73. confirmButtonColor: "#DD6B55",
  74. confirmButtonText:"是的,我要发放!",
  75. cancelButtonText:"让我再考虑一下…",
  76. closeOnConfirm: false,
  77. closeOnCancel: false
  78. }).then(function(){
  79. $eb.axios.get(url).then(function(res){
  80. if(res.status == 200 && res.data.code == 200) {
  81. swal(res.data.msg);
  82. }else
  83. return Promise.reject(res.data.msg || '发放失败')
  84. }).catch(function(err){
  85. swal(err);
  86. });
  87. }).catch(console.log);
  88. });
  89. </script>
  90. {/block}