index.vue 3.2 KB

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