index.blade.php 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <style type="text/css">
  2. .pagination{
  3. margin:0 !important;
  4. }
  5. </style>
  6. @if(Session::has('message'))
  7. <div class="alert alert-success alert-dismissable">
  8. <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
  9. <h4><i class="icon fa fa-check"></i> 提示!</h4>
  10. {{ Session::get('message') }}
  11. </div>
  12. @endif
  13. <div class="ibox float-e-margins">
  14. <div class="ibox-content" style="display: block;">
  15. <a href="{{ route('admin.course.vipcard.create') }}" class="btn btn-primary margin-bottom" no-pjax>添加会员卡</a>
  16. <div>
  17. <div class="box-body table-responsive">
  18. <table class="table table-hover table-bordered">
  19. <thead>
  20. <tr>
  21. <td>卡名称</td>
  22. <td>等级</td>
  23. <td>原价</td>
  24. <td>现价</td>
  25. <td>期限</td>
  26. <td>升级</td>
  27. <td>保级</td>
  28. <td>会员权益</td>
  29. <td>兑换码类型</td>
  30. <td>兑换码数量</td>
  31. <td>是否启用</td>
  32. <td>操作</td>
  33. </tr>
  34. </thead>
  35. @if(count($vipcard)>0)
  36. <tbody>
  37. @foreach ($vipcard as $item)
  38. <tr>
  39. <td>{{$item->name}}</td>
  40. <td>{{$item->gread}}级</td>
  41. <td>{{$item->original_price}}</td>
  42. <td>{{$item->price}}</td>
  43. <td>
  44. @if(!empty($item->use_day))
  45. {{ $item->use_day }}
  46. @if($item->date=='1')天
  47. @elseif($item->date=='2')月
  48. @elseif($item->date=='3')年
  49. @endif
  50. @else
  51. 永久
  52. @endif
  53. </td>
  54. <td>{{$item->promote_num}}</td>
  55. <td>{{$item->keep_grade_num}}</td>
  56. <td>{{$item->couponsInfo}}</td>
  57. <td>
  58. @if($item->exchange_type)
  59. @foreach($vipExchange as $key=>$val)
  60. @if($item->exchange_type==$val->id)
  61. {{$val->name}}
  62. @endif
  63. @endforeach
  64. @else
  65. @endif
  66. </td>
  67. <td>{{$item->exchange_num}}</td>
  68. <td><a class="status" cid="{{$item->id}}" status="{{$item->status}}">
  69. <i class="fa @if($item->status==1) fa-toggle-on @else fa-toggle-off @endif"></i></a></td>
  70. <td>
  71. <a class="btn btn-xs btn-primary"
  72. href="{{route('admin.course.vipcard.edit',['id'=>$item->id])}}" no-pjax>
  73. <i data-toggle="tooltip" data-placement="top" class="fa fa-pencil-square-o" title="编辑"></i></a>
  74. <a class="btn btn-xs btn-danger vipcard-delete"
  75. data-url="{{route('admin.course.vipcard.destroy',['id'=>$item->id])}}" no-pjax>
  76. <i data-toggle="tooltip" data-placement="top" class="fa fa-trash" title="删除"></i></a>
  77. </td>
  78. </tr>
  79. @endforeach
  80. </tbody>
  81. <tfoot>
  82. <tr>
  83. <td colspan="12">
  84. <div class="pull-left">
  85. &nbsp;&nbsp;共&nbsp;{!! $vipcard->total() !!} 条记录
  86. </div>
  87. <div class="pull-right">
  88. {!! $vipcard->appends(request()->except('page'))->render() !!}
  89. </div>
  90. </td>
  91. </tr>
  92. </tfoot>
  93. @else
  94. <tfoot>
  95. <tr>
  96. <td colspan="10">
  97. 当前无数据
  98. </td>
  99. </tr>
  100. </tfoot>
  101. @endif
  102. </table>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. <script>
  108. $('.vipcard-delete').on('click', function () {
  109. var thisPoint = $(this);
  110. var url = thisPoint.data('url');
  111. swal({
  112. title: "确认删除此项?",
  113. imageUrl: "/assets/backend/activity/backgroundImage/delete-xxl.png",
  114. showCancelButton: true,
  115. confirmButtonColor: "#DD6B55",
  116. confirmButtonText: "确认",
  117. cancelButtonText: "取消",
  118. closeOnConfirm: false,
  119. closeOnCancel: true
  120. },
  121. function (isConfirm) {
  122. if (isConfirm) {
  123. $.ajax({
  124. type: "GET",
  125. url: url,
  126. success: function (data) {
  127. if (data.status) {
  128. swal({
  129. title: "删除成功",
  130. text: "",
  131. type: "success"
  132. },
  133. function () {
  134. location.reload();
  135. });
  136. }
  137. }
  138. });
  139. } else {
  140. }
  141. });
  142. });
  143. $('.status').on('click', function () {
  144. var value = $(this).attr('status');
  145. var modelId = $(this).attr('cid');
  146. value = parseInt(value);
  147. modelId = parseInt(modelId);
  148. if (value == 1) {
  149. value = 0;
  150. } else {
  151. value = 1;
  152. }
  153. var that = $(this);
  154. $.post("{{route('admin.course.vipcard.status')}}",
  155. {
  156. status: value,
  157. modelId: modelId
  158. },
  159. function (data, status) {
  160. if (status) {
  161. if (1 == value) {
  162. that.children().removeClass('fa-toggle-off');
  163. that.children().addClass('fa-toggle-on');
  164. that.attr('status',1);
  165. } else {
  166. that.children().removeClass('fa-toggle-on');
  167. that.children().addClass('fa-toggle-off');
  168. that.attr('status',0);
  169. }
  170. that.attr('value', value);
  171. }
  172. });
  173. });
  174. </script>