invoices.blade.php 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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 class="btn btn-primary" onclick="closePlan()">
  13. {{ trans('common.active_item', ['attribute' => trans('common.order.status.prepaid')]) }}</button>
  14. </div>
  15. @endif
  16. </div>
  17. <div class="panel-body">
  18. <table class="text-md-center" data-toggle="table" data-mobile-responsive="true">
  19. <thead class="thead-default">
  20. <tr>
  21. <th> #</th>
  22. <th> {{ trans('model.order.id') }} </th>
  23. <th> {{ trans('user.shop.service') }} </th>
  24. <th> {{ trans('user.payment_method') }} </th>
  25. <th> {{ trans('user.invoice.amount') }} </th>
  26. <th> {{ trans('user.bought_at') }} </th>
  27. <th> {{ trans('common.expired_at') }} </th>
  28. <th> {{ trans('common.status.attribute') }} </th>
  29. <th> {{ trans('common.action') }} </th>
  30. </tr>
  31. </thead>
  32. <tbody>
  33. @foreach ($orderList as $order)
  34. <tr>
  35. <td>{{ $loop->iteration }}</td>
  36. <td><a href="/invoice/{{ $order->sn }}" target="_blank">{{ $order->sn }}</a></td>
  37. <td>{{ $order->goods->name ?? trans('user.recharge_credit') }}</td>
  38. <td>{{ $order->pay_way === 1 ? trans('user.shop.pay_credit') : trans('user.shop.pay_online') }}</td>
  39. <td>{{ $order->amount_tag }}</td>
  40. <td>{{ $order->created_at }}</td>
  41. <td>{{ empty($order->goods) || $order->goods_id === null || $order->status === 3 ? '' : $order->expired_at }}</td>
  42. <td>{!! $order->status_label !!}</td>
  43. <td>
  44. <div class="btn-group">
  45. @if ($order->status === 0 && $order->pay_way !== 1)
  46. @if ($order->payment)
  47. @if ($order->payment->qr_code)
  48. <a class="btn btn-primary" href="{{ route('orderDetail', $order->payment->trade_no) }}"
  49. target="_blank">{{ trans('user.pay') }}</a>
  50. @elseif($order->payment->url)
  51. <a class="btn btn-primary" href="{{ $order->payment->url }}" target="_blank">{{ trans('user.pay') }}</a>
  52. @endif
  53. @endif
  54. <button class="btn btn-danger"
  55. onclick="closeOrder('{{ route('closeOrder', $order) }}')">{{ trans('common.cancel') }}</button>
  56. @elseif ($order->status === 1)
  57. <button class="btn btn-primary" onClick="window.location.reload();">
  58. <i class="icon wb-refresh" aria-hidden="true"></i></button>
  59. @endif
  60. </div>
  61. </td>
  62. </tr>
  63. @endforeach
  64. </tbody>
  65. </table>
  66. </div>
  67. <div class="panel-footer">
  68. <div class="row">
  69. <div class="col-12">
  70. <nav class="Page navigation float-right">
  71. {{ $orderList->links() }}
  72. </nav>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. @endsection
  79. @section('javascript')
  80. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js"></script>
  81. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"></script>
  82. <script>
  83. function closePlan() {
  84. swal.fire({
  85. title: '{{ trans('user.invoice.active_prepaid_question') }}',
  86. html: @json(trans('user.invoice.active_prepaid_tips')),
  87. icon: 'warning',
  88. showCancelButton: true,
  89. cancelButtonText: '{{ trans('common.close') }}',
  90. confirmButtonText: '{{ trans('common.confirm') }}',
  91. }).then((result) => {
  92. if (result.value) {
  93. $.ajax({
  94. method: 'POST',
  95. url: '{{ route('cancelPlan') }}',
  96. dataType: 'json',
  97. data: {
  98. _token: '{{ csrf_token() }}'
  99. },
  100. success: function(ret) {
  101. if (ret.status === 'success') {
  102. swal.fire({
  103. title: ret.message,
  104. icon: 'success',
  105. timer: 1000,
  106. showConfirmButton: false,
  107. }).then(() => window.location.reload());
  108. } else {
  109. swal.fire({
  110. title: ret.message,
  111. icon: 'error'
  112. });
  113. }
  114. },
  115. });
  116. }
  117. });
  118. }
  119. function closeOrder(url) {
  120. swal.fire({
  121. title: '{{ trans('common.close_item', ['attribute' => trans('user.invoice.attribute')]) }}?',
  122. icon: 'warning',
  123. showCancelButton: true,
  124. cancelButtonText: '{{ trans('common.close') }}',
  125. confirmButtonText: '{{ trans('common.confirm') }}',
  126. }).then((result) => {
  127. if (result.value) {
  128. $.ajax({
  129. method: 'PUT',
  130. url: url,
  131. dataType: 'json',
  132. data: {
  133. _token: '{{ csrf_token() }}'
  134. },
  135. success: function(ret) {
  136. if (ret.status === 'success') {
  137. swal.fire({
  138. title: ret.message,
  139. icon: 'success',
  140. timer: 1000,
  141. showConfirmButton: false,
  142. }).then(() => window.location.reload());
  143. } else {
  144. swal.fire({
  145. title: ret.message,
  146. icon: 'error'
  147. });
  148. }
  149. },
  150. });
  151. }
  152. });
  153. }
  154. </script>
  155. @endsection