voucher.html 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <!-- include 'headAndLeftWrapper' -->
  2. <div class="mainWrapper container-fluid">
  3. <div class="page-header pageTop">
  4. <h3>代金券</h3>
  5. </div>
  6. <div class="tableContent">
  7. <div class="tab-content">
  8. <div class="tabMain">
  9. <div class="shopContent clearfix">
  10. <div class="sort" style="margin-right:20px;">
  11. <button class="btn btn-primary" data-toggle="modal" data-target="#addVoucher">添加代金券</button>
  12. </div>
  13. <div class="sort" style="margin-right:20px;">
  14. <select class="form-control" id="searchList">
  15. <option value="-1">全部状态</option>
  16. <option value="1" <!-- if isset({{status}}) && {{status}} == 1 -->selected<!-- endif -->>进行中</option>
  17. <option value="2" <!-- if isset({{status}}) && {{status}} == 2 -->selected<!-- endif -->>已结束</option>
  18. <option value="0" <!-- if isset({{status}}) && {{status}} == 0 -->selected<!-- endif -->>未开始</option>
  19. </select>
  20. </div>
  21. </div>
  22. <div class="tableContent">
  23. <table class="table table-hover">
  24. <thead>
  25. <th width="300">活动名</th>
  26. <th width="100">领取码</th>
  27. <th width="100">金额</th>
  28. <th width="100">数量/领取</th>
  29. <th width="150">开始时间</th>
  30. <th width="150">结束时间</th>
  31. <th width="100">状态</th>
  32. <th width="100">操作</th>
  33. </thead>
  34. <tbody>
  35. <!-- if isset({{voucherlist}}) -->
  36. <!-- loop voucherlist -->
  37. <tr>
  38. <td>{{voucherlist' value.vname}}</td>
  39. <td>{{voucherlist' value.vcode}}</td>
  40. <td>¥{{voucherlist' value.vcost}}</td>
  41. <td <!-- if {{voucherlist' value.vcount}} != 0 && {{voucherlist' value.hadnum}} >= {{voucherlist' value.vcount}} -->class="text-danger"<!-- endif -->><!-- if {{voucherlist' value.vcount}} == 0 -->不限/{{voucherlist' value.hadnum}}<!-- else -->{{voucherlist' value.vcount}}/{{voucherlist' value.hadnum}}<!-- endif --></td>
  42. <td>{{formatDate(voucherlist' value.vstarttime)}}</td>
  43. <td <!-- if {{thistime}} >= {{voucherlist' value.vendtime}} -->class="text-danger"<!-- endif -->>{{formatDate(voucherlist' value.vendtime)}}</td>
  44. <td><!-- if {{voucherlist' value.status}} == 0 --><span class="text-warning">未开始</span><!-- elseif {{voucherlist' value.status}} == 1 --><span class="text-success">进行中</span><!-- elseif {{voucherlist' value.status}} == 2 --><span class="text-muted">已结束</span><!-- endif --></td>
  45. <td><!-- if {{voucherlist' value.status}} == 0 --><a href="/m/delvoucher/{{voucherlist' value.id}}" class="text-danger"><i class="glyphicon glyphicon-remove"></i> 删除</a><!-- endif --></td>
  46. </tr>
  47. <!-- endloop -->
  48. <!-- endif -->
  49. </tbody>
  50. </table>
  51. <nav style="margin: 30px 0">
  52. {{pager}}
  53. </nav>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. <!-- mainWrapper end -->
  60. </div>
  61. <!-- 添加限期代金券开始 -->
  62. <div class="modal fade" id="addVoucher" tabindex="-1" role="dialog" aria-hidden="true">
  63. <div class="modal-dialog">
  64. <div class="modal-content">
  65. <div class="modal-header">
  66. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  67. <h4 class="modal-title" id="myModalLabel">添加代金券</h4>
  68. </div>
  69. <form role="form" action="/m/setvoucher" onsubmit="return checksubmit();" method="post">
  70. <div class="modal-body">
  71. <div class="form-group">
  72. <label>活动名称</label>
  73. <input type="text" name="vname" id="vname" class="form-control" placeholder="输入活动名称">
  74. </div>
  75. <div class="form-group">
  76. <label>单张代金券金额(限额20)</label>
  77. <input type="number" name="vcost" id="vcost" max="20" step="0.01" class="form-control" placeholder="输入单张代金券金额">
  78. </div>
  79. <div class="form-group">
  80. <label>发放数量(限额100)</label>
  81. <input type="number" name="vcount" max="100" class="form-control" placeholder="输入代金券数量">
  82. <p class="help-block text-danger">数量为空,则为不限量,代金券领取完毕,活动也将结束</p>
  83. </div>
  84. <div class="form-group">
  85. <div>
  86. <label>活动时间</label>
  87. <input type="date" name="starttime" id="starttime" class="form-control" value="{{formatDateTime(starttime)}}">00:00:00
  88. <p class="text-center">至</p>
  89. <input type="date" name="endtime" id="endtime" class="form-control">23:59:59
  90. <p class="help-block text-danger">开始时间不能为活动添加当天</p>
  91. </div>
  92. </div>
  93. </div>
  94. <div class="modal-footer">
  95. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  96. <button type="submit" class="btn btn-primary">确定添加</button>
  97. </div>
  98. </form>
  99. </div>
  100. </div>
  101. </div>
  102. <script>
  103. $(function(){
  104. $('#searchList').change(function(){
  105. var html = '';
  106. if($(this).val() != -1){
  107. html += '/status/'+$(this).val();
  108. }
  109. window.location.href = '/m/voucher'+html;
  110. })
  111. });
  112. function checksubmit(){
  113. if($('#vname').val() == ''){
  114. alert('活动名不能为空');
  115. return false;
  116. }
  117. if($('#vcost').val() == ''){
  118. alert('金额不能为空');
  119. return false;
  120. }
  121. if($('#starttime').val() == ''){
  122. alert('请选择开始日期');
  123. return false;
  124. }
  125. if($('#endtime').val() == ''){
  126. alert('请选择结束日期');
  127. return false;
  128. }
  129. var time = new Date($('#starttime').val()+' 00:00:00');
  130. if(time.getTime()/1000 < {{starttime}}){
  131. alert('开始时间不能小于或等于活动添加当天');
  132. return false;
  133. }
  134. if(new Date($('#endtime').val()+' 23:59:59').getTime()/1000 < time/1000){
  135. alert('结束时间不能小于开始时间');
  136. return false;
  137. }
  138. }
  139. </script>
  140. </body>
  141. </html>