index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view class="flex-direction plr-100-30 box-sizing-border">
  3. <view class="align-items-center flex-justify-center pt-50 mb-20">
  4. <view class="sys-color-547BFA sys-size-32">
  5. ¥
  6. </view>
  7. <view class="sys-color-547BFA sys-size-64 sys-weight-bold">
  8. {{orderInfo.pay_money || '0.00'}}
  9. </view>
  10. </view>
  11. <view class="align-items-center flex-justify-center cg-box">
  12. <uni-icons v-if="orderInfo.status === 2 || orderInfo.status === 6" class="mr-10" type="checkbox-filled"
  13. size="25" color="#547BFA"></uni-icons>
  14. <uni-icons v-else class="mr-10" type="clear" size="25" color="#FF0000"></uni-icons>
  15. <view class="" v-if="orderInfo.status === 2 || orderInfo.status === 6">
  16. 支付成功
  17. </view>
  18. <view class="" v-else>
  19. 支付失败
  20. </view>
  21. </view>
  22. <view class="align-items-center flex-justify-space mb-20">
  23. <view class="sys-color-AD flex-shrink0 mr-20">
  24. 商户名称
  25. </view>
  26. <view class="sys-size-28">
  27. {{orderInfo.shop_name || '无'}}
  28. </view>
  29. </view>
  30. <view class="align-items-center flex-justify-space mb-20">
  31. <view class="sys-color-AD flex-shrink0 mr-20">
  32. 订单号
  33. </view>
  34. <view class="sys-size-28">
  35. {{orderInfo.rs_sn || '无'}}
  36. </view>
  37. </view>
  38. <!-- <view class="align-items-center flex-justify-space mb-64">
  39. <view class="sys-color-AD flex-shrink0 mr-20">
  40. 交易流水号
  41. </view>
  42. <view class="sys-size-28">
  43. {{orderInfo.pay_sn}}
  44. </view>
  45. </view> -->
  46. <view class="flex-justify-center pb-24">
  47. <view @click="jumpOut" class="but-box border-449470 sys-radius-200 text-align-center sys-color-195E3F">
  48. 返回首页
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import {
  55. shopOrderInfo,
  56. shopAutomaticCancel
  57. } from '@/api/shop_order';
  58. export default {
  59. components: {},
  60. data() {
  61. return {
  62. orderInfo: {}
  63. }
  64. },
  65. onLoad(data) {
  66. var mchData = {
  67. action: 'onIframeReady',
  68. displayStyle: 'SHOW_CUSTOM_PAGE'
  69. };
  70. var postData = JSON.stringify(mchData);
  71. parent.postMessage(postData, "https://payapp.weixin.qq.com");
  72. if (data.order_sn) {
  73. this.shopOrderInfo(data.order_sn)
  74. }
  75. },
  76. mounted() {},
  77. methods: {
  78. shopOrderInfo(order) {
  79. shopOrderInfo({
  80. order_sn: order
  81. }).then((res) => {
  82. if (res.code === 1) {
  83. this.orderInfo = res.data
  84. if (res.data.status === 1) {
  85. this.shopAutomaticCancel(res.data.rs_sn)
  86. }
  87. }
  88. })
  89. },
  90. jumpOut() {
  91. if (this.orderInfo.status === 2 || this.orderInfo.status === 6) {
  92. var mchData = {
  93. action: 'jumpOut',
  94. jumpOutUrl: "https://wap.jhcs888.com/#/pages/index-my/index"
  95. }
  96. var postData = JSON.stringify(mchData)
  97. parent.postMessage(postData, 'https://payapp.weixin.qq.com')
  98. } else {
  99. window.location.href = "https://wap.jhcs888.com/#/pages/index-my/index"
  100. }
  101. },
  102. shopAutomaticCancel(order_sn) {
  103. shopAutomaticCancel({
  104. order_sn: order_sn
  105. }).then((res) => {
  106. if (res.code === 1) {
  107. console.log(res, 'ok');
  108. }
  109. })
  110. }
  111. }
  112. }
  113. </script>
  114. <style lang="scss" scoped>
  115. .plr-100-30 {
  116. padding: 0 8%;
  117. }
  118. .pt-50 {
  119. padding-top: 50rpx;
  120. }
  121. .cg-box {
  122. padding-bottom: 50rpx;
  123. border-bottom: 1rpx solid #F5F5F5;
  124. margin-bottom: 50rpx;
  125. }
  126. .but-box {
  127. width: 40%;
  128. padding: 15rpx 0;
  129. }
  130. </style>