success.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view class="uni-main">
  3. <view class="uni-icon">
  4. <img src="../../static/index/icon/pay.png" alt="">
  5. </view>
  6. <view class="uni-info">
  7. <view class="uni-text uni-msg">
  8. 支付成功!
  9. </view>
  10. <view class="uni-text">
  11. 支付金额:{{orderInfo.pay_money}}
  12. </view>
  13. <view class="uni-text">
  14. 订单编号:{{orderInfo.out_trade_no}}
  15. </view>
  16. <view class="uni-btn" @click="payBack()">
  17. 完成
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. orderInfo: {
  27. out_trade_no: 'G20210715122544',
  28. pay_money: 0.02,
  29. status: 1,
  30. type: 1,
  31. source_id: 0,
  32. }
  33. }
  34. },
  35. onLoad(option) {
  36. let _uni = this
  37. console.log(option)
  38. },
  39. methods: {
  40. payBack() {
  41. switch (this.orderInfo.type) {
  42. case 1:
  43. location.href = '/pages/index/gongdeng/fodengInfo?id=' + this.orderInfo.source_id
  44. break;
  45. case 2:
  46. location.href = '/pages/pay/recharge'
  47. break;
  48. default:
  49. location.href = '/pages/index/index'
  50. break;
  51. }
  52. },
  53. getInfo(order_sn) {
  54. let _uni = this
  55. uni.showLoading()
  56. this.$request.api('/api/order/info', {
  57. order_sn: order_sn
  58. }).then(res => {
  59. uni.hideLoading()
  60. if (res.success == true) {
  61. _uni.orderInfo = res.data
  62. }else{
  63. uni.showToast({
  64. title: '获取订单信息错误,将返回主页',
  65. icon: 'none'
  66. })
  67. setTimeout(function(){
  68. location.href = '/pages/index/index'
  69. }, 1200)
  70. }
  71. }).catch(err => {
  72. uni.showToast({
  73. title: typeof(err.msg) != 'undefined' ? err.msg : '服务器错误',
  74. icon: 'none'
  75. })
  76. })
  77. },
  78. },
  79. }
  80. </script>
  81. <style>
  82. .uni-main {
  83. text-align: center;
  84. }
  85. .uni-info {
  86. margin: 0 auto;
  87. }
  88. .uni-icon {
  89. margin-top: 100rpx;
  90. }
  91. .uni-text {
  92. margin-bottom: 10rpx;
  93. }
  94. .uni-btn {
  95. width: 30%;
  96. margin: 30rpx auto;
  97. background-color: #18B566;
  98. color: #fff;
  99. padding: 8rpx 10rpx;
  100. border-radius: 8rpx;
  101. }
  102. </style>