reward.php 7.0 KB

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