invoices.blade.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. @extends('user.layouts')
  2. @section('css')
  3. <link href="/assets/global/vendor/bootstrap-table/bootstrap-table.min.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('user.menu.invoices')}}</h1>
  10. @if($prepaidPlan)
  11. <div class="panel-actions">
  12. <button onclick="closePlan()" class="btn btn-primary"> {{trans('common.active_item', ['attribute' => trans('user.status.prepaid')])}}</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('user.invoice.id')}} </th>
  22. <th> {{trans('user.shop.service')}} </th>
  23. <th> {{trans('user.payment_method')}} </th>
  24. <th> {{trans('user.invoice.amount')}} </th>
  25. <th> {{trans('user.bought_at')}} </th>
  26. <th> {{trans('common.expired_at')}} </th>
  27. <th> {{trans('common.status')}} </th>
  28. <th> {{trans('common.action')}} </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->sn}}" target="_blank">{{$order->sn}}</a></td>
  36. <td>{{$order->goods->name ?? trans('user.recharge_credit')}}</td>
  37. <td>{{$order->pay_way === 1 ? trans('user.shop.pay_credit') : trans('user.shop.pay_online')}}</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>{!! $order->status_label !!}</td>
  42. <td>
  43. <div class="btn-group">
  44. @if($order->status === 0 && $order->payment)
  45. @if($order->payment->qr_code)
  46. <a href="{{route('orderDetail', $order->payment->trade_no)}}" target="_blank" class="btn btn-primary">{{trans('user.pay')}}</a>
  47. @elseif($order->payment->url)
  48. <a href="{{$order->payment->url}}" target="_blank" class="btn btn-primary">{{trans('user.pay')}}</a>
  49. @endif
  50. <button onclick="closeOrder('{{route('closeOrder', $order)}}')" class="btn btn-danger">{{trans('common.cancel')}}</button>
  51. @elseif ($order->status === 1)
  52. <button onClick="window.location.reload();" class="btn btn-primary">
  53. <i class="icon wb-refresh" aria-hidden="true"></i></button>
  54. @endif
  55. </div>
  56. </td>
  57. </tr>
  58. @endforeach
  59. </tbody>
  60. </table>
  61. </div>
  62. <div class="panel-footer">
  63. <div class="row">
  64. <div class="col-12">
  65. <nav class="Page navigation float-right">
  66. {{$orderList->links()}}
  67. </nav>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. @endsection
  74. @section('javascript')
  75. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js"></script>
  76. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"></script>
  77. <script>
  78. function closePlan() {
  79. swal.fire({
  80. title: '{{trans('user.invoice.active_prepaid_question')}}',
  81. html: '{{trans('user.invoice.active_prepaid_tips')}}',
  82. icon: 'warning',
  83. showCancelButton: true,
  84. cancelButtonText: '{{trans('common.close')}}',
  85. confirmButtonText: '{{trans('common.confirm')}}',
  86. }).then((result) => {
  87. if (result.value) {
  88. $.ajax({
  89. method: 'POST',
  90. url: '{{route('cancelPlan')}}',
  91. dataType: 'json',
  92. data: {_token: '{{csrf_token()}}'},
  93. success: function(ret) {
  94. if (ret.status === 'success') {
  95. swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
  96. } else {
  97. swal.fire({title: ret.message, icon: 'error'});
  98. }
  99. },
  100. });
  101. }
  102. });
  103. }
  104. function closeOrder(url) {
  105. swal.fire({
  106. title: '{{trans('common.close_item', ['attribute' => trans('user.invoice.attribute')])}}?',
  107. icon: 'warning',
  108. showCancelButton: true,
  109. cancelButtonText: '{{trans('common.close')}}',
  110. confirmButtonText: '{{trans('common.confirm')}}',
  111. }).then((result) => {
  112. if (result.value) {
  113. $.ajax({
  114. method: 'PUT',
  115. url: url,
  116. dataType: 'json',
  117. data: {_token: '{{csrf_token()}}'},
  118. success: function(ret) {
  119. if (ret.status === 'success') {
  120. swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
  121. } else {
  122. swal.fire({title: ret.message, icon: 'error'});
  123. }
  124. },
  125. });
  126. }
  127. });
  128. }
  129. </script>
  130. @endsection