invoices.blade.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. @extends('user.layouts')
  2. @section('css')
  3. <link href="/assets/global/vendor/bootstrap-table/bootstrap-table.min.css" type="text/css" rel="stylesheet">
  4. @endsection
  5. @section('content')
  6. <div class="page-content container">
  7. <div class="panel">
  8. <div class="panel-heading p-20">
  9. <h1 class="panel-title cyan-600"><i class="icon wb-bookmark"></i>{{trans('home.invoices')}}</h1>
  10. @if($prepaidPlan)
  11. <div class="panel-actions">
  12. <button onclick="closePlan()" class="btn btn-primary"> 激活预付单</button>
  13. </div>
  14. @endif
  15. </div>
  16. <div class="panel-body">
  17. <table class="text-md-center" data-toggle="table" data-mobile-responsive="true">
  18. <thead class="thead-default">
  19. <tr>
  20. <th> #</th>
  21. <th> {{trans('home.invoice_table_id')}} </th>
  22. <th> {{trans('home.invoice_table_name')}} </th>
  23. <th> {{trans('home.invoice_table_pay_way')}} </th>
  24. <th> {{trans('home.invoice_table_price')}} </th>
  25. <th> {{trans('home.invoice_table_create_date')}} </th>
  26. <th> {{trans('home.invoice_table_expired_at')}} </th>
  27. <th> {{trans('home.invoice_table_status')}} </th>
  28. <th> {{trans('home.invoice_table_actions')}} </th>
  29. </tr>
  30. </thead>
  31. <tbody>
  32. @foreach($orderList as $order)
  33. <tr>
  34. <td>{{$loop->iteration}}</td>
  35. <td><a href="/invoice/{{$order->order_sn}}" target="_blank">{{$order->order_sn}}</a></td>
  36. <td>{{$order->goods->name ?? ($order->goods_id === 0 ? '余额充值': trans('home.invoice_table_goods_deleted'))}}</td>
  37. <td>{{$order->pay_way === 1 ? trans('home.service_pay_button') : trans('home.online_pay')}}</td>
  38. <td>¥{{$order->amount}}</td>
  39. <td>{{$order->created_at}}</td>
  40. <td>{{empty($order->goods) || $order->goods_id === 0 || $order->status === 3 ? '' : $order->expired_at}}</td>
  41. <td>
  42. @switch($order->status)
  43. @case(-1)
  44. <span class="badge badge-default">{{trans('home.invoice_status_closed')}}</span>
  45. @break
  46. @case(0)
  47. <span class="badge badge-danger">{{trans('home.invoice_status_wait_payment')}}</span>
  48. @break
  49. @case(1)
  50. <span class="badge badge-info">{{trans('home.invoice_status_wait_confirm')}}</span>
  51. @break
  52. @case(2)
  53. @if ($order->goods_id === 0)
  54. <span class="badge badge-default">{{trans('home.invoice_status_payment_confirm')}}</span>
  55. @else
  56. @if($order->is_expire)
  57. <span class="badge badge-default">{{trans('home.invoice_table_expired')}}</span>
  58. @else
  59. <span class="badge badge-success">{{trans('home.invoice_table_active')}}</span>
  60. @endif
  61. @endif
  62. @break
  63. @case(3)
  64. <span class="badge badge-info">{{trans('home.invoice_table_prepay')}}</span>
  65. @break
  66. @endswitch
  67. <td>
  68. <div class="btn-group">
  69. @if($order->status === 0 && $order->payment)
  70. @if($order->payment->qr_code)
  71. <a href="{{route('orderDetail', $order->payment->trade_no)}}" target="_blank" class="btn btn-primary">{{trans('home.pay')}}</a>
  72. @elseif($order->payment->url)
  73. <a href="{{$order->payment->url}}" target="_blank" class="btn btn-primary">{{trans('home.pay')}}</a>
  74. @endif
  75. <button onclick="closeOrder('{{$order->id}}')" class="btn btn-danger">{{trans('home.cancel')}}</button>
  76. @elseif ($order->status === 1)
  77. <button onClick="window.location.reload();" class="btn btn-primary">
  78. <i class="icon wb-refresh" aria-hidden="true"></i></button>
  79. @endif
  80. </div>
  81. </td>
  82. </tr>
  83. @endforeach
  84. </tbody>
  85. </table>
  86. </div>
  87. <div class="panel-footer">
  88. <div class="row">
  89. <div class="col-12">
  90. <nav class="Page navigation float-right">
  91. {{$orderList->links()}}
  92. </nav>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. @endsection
  99. @section('script')
  100. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js" type="text/javascript"></script>
  101. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js" type="text/javascript"></script>
  102. <script type="text/javascript">
  103. function closePlan() {
  104. swal.fire({
  105. title: '是否提前激活预支付套餐?',
  106. html: '套餐激活后:<br>先前套餐将直接失效!<br>过期日期将由本日重新开始计算!',
  107. icon: 'warning',
  108. showCancelButton: true,
  109. cancelButtonText: '{{trans('home.ticket_close')}}',
  110. confirmButtonText: '{{trans('home.ticket_confirm')}}',
  111. }).then((result) => {
  112. if (result.value) {
  113. $.ajax({
  114. method: 'POST',
  115. url: '{{route('cancelPlan')}}',
  116. async: false,
  117. data: {_token: '{{csrf_token()}}'},
  118. dataType: 'json',
  119. success: function(ret) {
  120. if (ret.status === 'success') {
  121. swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).
  122. then(() => window.location.reload());
  123. }
  124. else {
  125. swal.fire({title: ret.message, icon: 'error'});
  126. }
  127. },
  128. });
  129. }
  130. });
  131. }
  132. function closeOrder(id) {
  133. swal.fire({
  134. title: '关闭订单?',
  135. icon: 'warning',
  136. showCancelButton: true,
  137. cancelButtonText: '{{trans('home.ticket_close')}}',
  138. confirmButtonText: '{{trans('home.ticket_confirm')}}',
  139. }).then((result) => {
  140. if (result.value) {
  141. $.ajax({
  142. method: 'POST',
  143. url: '{{route('closeOrder')}}',
  144. async: false,
  145. data: {_token: '{{csrf_token()}}', id: id},
  146. dataType: 'json',
  147. success: function(ret) {
  148. if (ret.status === 'success') {
  149. swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).
  150. then(() => window.location.reload());
  151. }
  152. else {
  153. swal.fire({title: ret.message, icon: 'error'});
  154. }
  155. },
  156. });
  157. }
  158. });
  159. }
  160. </script>
  161. @endsection