payment.blade.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. @extends('user.layouts')
  2. @section('content')
  3. <div class="page-content container">
  4. <div class="panel panel-bordered">
  5. <div class="panel-heading">
  6. <h1 class="panel-title cyan-600">
  7. <i class="icon wb-payment"></i>{{sysConfig('website_name')}}{{trans('home.online_pay')}}
  8. </h1>
  9. </div>
  10. <div class="panel-body border-primary ml-auto mr-auto w-p75">
  11. <div class="alert alert-info text-center">
  12. 请使用<strong class="red-600">{{$pay_type}}</strong>扫描二维码进行支付
  13. </div>
  14. <div class="row">
  15. <div class="col-md-6">
  16. <ul class="list-group list-group-dividered">
  17. <li class="list-group-item">服务名称:{{$name}}</li>
  18. <li class="list-group-item">支付金额:{{$payment->amount}}元</li>
  19. @if($days != 0)
  20. <li class="list-group-item">有效期:{{$days}} 天</li>
  21. @endif
  22. <li class="list-group-item"> 请在<code>15分钟</code>内完成支付,否者订单将会自动关闭</li>
  23. </ul>
  24. </div>
  25. <div class="col-auto ml-auto mr-auto">
  26. @if($payment->qr_code && $payment->url)
  27. <img src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->margin(2)->eyeColor(1, 0, 204, 153, 0, 153, 119)->size(250)->errorCorrection('H')->merge(url($pay_type_icon), .3, true)->generate($payment->url))!!}" alt="支付二维码">
  28. @else
  29. <img class="h-250 w-250" src="{{$payment->qr_code}}" alt="支付二维码">
  30. @endif
  31. </div>
  32. </div>
  33. <div class="alert alert-danger text-center">
  34. <strong>手机用户</strong>:长按二维码 -> 保存图片 ->打开支付软件 -> 扫一扫 -> 选择相册 进行付款
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. @endsection
  40. @section('script')
  41. <script type="text/javascript">
  42. // 检查支付单状态
  43. const r = window.setInterval(function () {
  44. $.ajax({
  45. type: 'GET',
  46. url: '/payment/getStatus',
  47. data: {trade_no: '{{$payment->trade_no}}'},
  48. dataType: 'json',
  49. success: function (ret) {
  50. window.clearInterval();
  51. if (ret.status === 'success') {
  52. swal.fire({title: ret.message, type: 'success', timer: 1500, showConfirmButton: false})
  53. .then(() => {
  54. window.location.href = '/invoices'
  55. });
  56. } else if (ret.status === 'error') {
  57. swal.fire({title: ret.message, type: "error", timer: 1500, showConfirmButton: false})
  58. .then(() => {
  59. window.location.href = '/invoices'
  60. })
  61. }
  62. }
  63. });
  64. }, 3000);
  65. </script>
  66. @endsection