all.php 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <?php
  2. use backend\widgets\TabWidget;
  3. echo TabWidget::widget(['list' => $this->context->menuList, 'currentMenu' => $this->context->id]);
  4. ?>
  5. <div class="panel panel-default">
  6. <?php
  7. use backend\widgets\SubTabWidget;
  8. echo SubTabWidget::widget(['list' => $this->context->subMenuList, 'currentMenu' => $this->context->action->id]);
  9. ?>
  10. <div class="panel-body">
  11. <div class="dataTables_wrapper form-inline dt-bootstrap no-footer">
  12. <div class="row">
  13. <form action="" method="GET" id="topSearchForm">
  14. <div class="col-xs-6" style="width:90%;">
  15. <div class="dataTables_length">
  16. <label>类型: <select name="status" class="form-control">
  17. <option value="-1" <?php if (isset($_GET['status']) && $_GET['status'] == "-1") {
  18. echo 'selected="selected"';
  19. } ?> >全部
  20. </option>
  21. <option value="0" <?php if (isset($_GET['status']) && $_GET['status'] == "0") {
  22. echo 'selected="selected"';
  23. } ?> >未使用
  24. </option>
  25. <option value="1" <?php if (isset($_GET['status']) && $_GET['status'] == "1") {
  26. echo 'selected="selected"';
  27. } ?> >已使用
  28. </option>
  29. <option value="2" <?php if (isset($_GET['status']) && $_GET['status'] == "2") {
  30. echo 'selected="selected"';
  31. } ?> >已过期
  32. </option>
  33. </select> </label>
  34. <label>卷编号:<input type="text" value="<?= isset($_GET['id']) ? $_GET['id'] : '' ?>" class="form-control" name="id" placeholder=""></label>
  35. <label>手机号:<input type="text" value="<?= isset($_GET['mobile']) ? $_GET['mobile'] : '' ?>" class="form-control" name="mobile" placeholder=""></label>
  36. <input class="btn btn-secondary btn-single" type="submit" id="submitButton" value="搜索"/>
  37. </div>
  38. </div>
  39. </form>
  40. </div>
  41. <div class="table-responsive">
  42. <table class="table table-bordered table-striped table-hover">
  43. <thead>
  44. <tr class="active">
  45. <th class="no-sorting hidden-xs"><input type="checkbox"></th>
  46. <th class="hidden-xs">卷编号</th>
  47. <th class="hidden-xs">持有人</th>
  48. <th class="hidden-xs">手机号</th>
  49. <th>优惠金额</th>
  50. <th>最底消费</th>
  51. <th class="hidden-xs">过期时间</th>
  52. <th class="hidden-xs">状态</th>
  53. <th>操作</th>
  54. </tr>
  55. </thead>
  56. <tbody class="middle-align">
  57. <?php if (!empty($models)) {
  58. foreach ($models as $key => $val) { ?>
  59. <tr>
  60. <td class="hidden-xs"><input type="checkbox"></td>
  61. <td class="hidden-xs">
  62. <a href="/coupon/detail?id=<?= $val['id']; ?>"><?= $val['id']; ?></a></td>
  63. <td><?php echo isset($userInfoList[$val['userId']]['userName']) ? $userInfoList[$val['userId']]['userName'] : ''; ?></td>
  64. <td><?= $val['mobile'] ?></td>
  65. <td><?= $val['amount']; ?></td>
  66. <td><?= $val['meetAmount']; ?></td>
  67. <td><?php if ($val['deadline'] == 4294967295) {
  68. echo '无';
  69. } else {
  70. echo date("Y-m-d", $val['deadline']);
  71. } ?></td>
  72. <td>
  73. <?php if ($val['status'] == 0) {
  74. echo '未使用';
  75. } elseif ($val['status'] == 1) {
  76. echo '<a href="javascript:void(0)" style="color:#68b828;"><i class="fa fa-check"></i></a>';
  77. } elseif ($val['status'] == 2) {
  78. echo '已过期';
  79. } ?>
  80. </td>
  81. <td>
  82. <?php if ($val['status'] == 0) { ?>
  83. <button type="button" onclick="confirmUseCoupon(<?= $val['id'] ?>)" class="btn btn-secondary btn-sm btn-icon icon-left set-get-btn">确认使用</button>
  84. <?php } ?>
  85. </td>
  86. </tr>
  87. <?php }
  88. } ?>
  89. </tbody>
  90. </table>
  91. </div>
  92. <div class="row">
  93. <div>
  94. <!--
  95. <div style="display:inline-block;margin-left:15px;">
  96. <label><select name="example-1_length"
  97. aria-controls="example-1" class="form-control">
  98. <option value="0">批量操作</option>
  99. <option value="1">批量下架</option>
  100. <option value="2">批量删除</option>
  101. </select>
  102. </label>
  103. <input class="btn btn-secondary btn-single" type="submit" name="" value="确认" />
  104. </div>
  105. -->
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. <!-- footer -->
  112. <?php
  113. use backend\widgets\FooterWidget;
  114. ?>
  115. <?= FooterWidget::widget() ?>
  116. <!-- footer -->
  117. <div class="modal fade" id="confirmSendReward">
  118. <div class="modal-dialog" style="height:300px;">
  119. <div class="modal-content">
  120. <div class="modal-header">
  121. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  122. <h4 class="modal-title">提示</h4>
  123. </div>
  124. <div class="modal-body">
  125. 确认使用?
  126. </div>
  127. <div class="modal-footer">
  128. <button type="button" class="btn btn-info" onclick="confirmUseCouponOk()">确认</button>
  129. <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
  130. </div>
  131. </div>
  132. </div>
  133. </div>
  134. <script>
  135. //确认发放提示框 shish 2019.8.25
  136. var useCouponId;
  137. function confirmUseCoupon(id) {
  138. useCouponId = id;
  139. jQuery('#confirmSendReward').modal('show', {backdrop: 'fade'}).css({
  140. 'margin-top': function () {
  141. var modalHeight = jQuery("#confirmSendReward").find('.modal-dialog').height();
  142. return ($(window).height() / 2 - (modalHeight / 2));
  143. }
  144. });
  145. }
  146. //确认发放 shish 2019.8.25
  147. function confirmUseCouponOk() {
  148. $.ajax({
  149. type: "GET",
  150. url: '/coupon/use-coupon?id=' + useCouponId,
  151. async: false,
  152. dataType: 'json',
  153. success: function (data) {
  154. xhPopMsg(data.msg, 1200);
  155. if (data.code == 1) {
  156. $('#confirmSendReward').modal('hide');
  157. window.location.reload(true);
  158. }
  159. }
  160. });
  161. }
  162. $("#topSearchForm").keydown(function (e) {
  163. var e = e || event;
  164. var code = e.which || e.keyCode;
  165. if (code == 13) {
  166. $("#submitButton").trigger("click");
  167. }
  168. });
  169. </script>