pay_status.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <view :style="colorStyle" class="main">
  3. <view class='payment-status'>
  4. <view class='iconfont icons icon-duihao2 bg-color'></view>
  5. <view class='status'>{{$t(`代付成功`)}}</view>
  6. <view class='wrapper'>
  7. <view class='itemCom'> <text class="rmb">{{$t(`¥`)}}</text> {{resData.pay_price || 0.00}}</view>
  8. </view>
  9. <view class="head-other">
  10. <view class="user-img">
  11. <image class="" :src="resData.avatar" mode=""></image>
  12. </view>
  13. <view class="order-status">
  14. {{$t(`谢谢你为我付款,还可以再去看看其他商品哟~`)}}
  15. </view>
  16. </view>
  17. </view>
  18. <button @click="goIndex" class='returnBnt' formType="submit" hover-class='none'>{{$t(`返回首页`)}}</button>
  19. </view>
  20. </template>
  21. <script>
  22. import {
  23. getOrderDetail
  24. } from '@/api/order.js';
  25. import {
  26. toLogin
  27. } from '@/libs/login.js';
  28. import {
  29. mapGetters
  30. } from "vuex";
  31. import colors from "@/mixins/color";
  32. import {
  33. friendDetail
  34. } from '@/api/user.js'
  35. export default {
  36. mixins: [colors],
  37. data() {
  38. return {
  39. loading: false,
  40. isAuto: false, //没有授权的不会自动授权
  41. isShowAuth: false, //是否隐藏授权
  42. resData: {}
  43. };
  44. },
  45. computed: mapGetters(['isLogin']),
  46. watch: {
  47. isLogin: {
  48. handler: (newV, oldV) => {
  49. if (newV) {
  50. this.getDetail();
  51. }
  52. },
  53. deep: true
  54. }
  55. },
  56. onLoad(options) {
  57. this.options = options
  58. if (!options.order_id) return this.$util.Tips({
  59. title: this.$t(`缺少参数无法查看订单支付状态`)
  60. }, {
  61. tab: 3,
  62. url: 1
  63. });
  64. this.orderId = options.order_id;
  65. },
  66. onShow() {
  67. if (this.isLogin) {
  68. this.getDetail();
  69. } else {
  70. toLogin();
  71. }
  72. },
  73. methods: {
  74. getDetail() {
  75. friendDetail(this.orderId).then(res => {
  76. console.log(res)
  77. if (this.resData.paid == 0) {
  78. return this.$util.Tips({
  79. title: this.$t(`该订单暂未支付`)
  80. }, {
  81. tab: 3,
  82. url: 1
  83. });
  84. }
  85. this.resData = res.data.info
  86. })
  87. },
  88. openTap() {
  89. this.$set(this, 'couponsHidden', !this.couponsHidden);
  90. },
  91. onLoadFun() {
  92. this.getDetail();
  93. },
  94. /**
  95. * 支付完成查询支付状态
  96. */
  97. getOrderPayInfo() {
  98. let that = this;
  99. uni.showLoading({
  100. title: that.$t(`正在加载中`)
  101. });
  102. getOrderDetail(that.orderId).then(res => {
  103. uni.hideLoading();
  104. that.$set(that, 'order_pay_info', res.data);
  105. uni.setNavigationBarTitle({
  106. title: res.data.paid ? that.$t(`支付成功`) : that.$t(`未支付`)
  107. });
  108. this.loading = true
  109. }).catch(err => {
  110. this.loading = true
  111. uni.hideLoading();
  112. });
  113. },
  114. /**
  115. * 去首页关闭当前所有页面
  116. */
  117. goIndex(e) {
  118. uni.switchTab({
  119. url: '/pages/index/index'
  120. });
  121. },
  122. }
  123. }
  124. </script>
  125. <style lang="scss" scoped>
  126. .main {
  127. width: 100%;
  128. height: 100vh;
  129. background-color: #fff;
  130. .payment-status {
  131. background-color: #fff;
  132. margin: 0rpx 30rpx 0 30rpx;
  133. border-radius: 10rpx;
  134. padding: 94rpx 0 60rpx 0;
  135. color: #333;
  136. .icons {
  137. font-size: 70rpx;
  138. width: 140rpx;
  139. height: 140rpx;
  140. border-radius: 50%;
  141. color: #fff;
  142. text-align: center;
  143. line-height: 140rpx;
  144. border: 6rpx solid #f5f5f5;
  145. margin: 0rpx auto 0 auto;
  146. background-color: #999;
  147. }
  148. .rmb {
  149. font-size: 33rpx;
  150. }
  151. .status {
  152. font-size: 32rpx;
  153. font-weight: bold;
  154. text-align: center;
  155. margin: 25rpx 0 7rpx 0;
  156. }
  157. .wrapper {
  158. text-align: center;
  159. color: #333;
  160. font-size: 66rpx;
  161. font-weight: bold;
  162. }
  163. .head-other {
  164. display: flex;
  165. align-items: center;
  166. justify-content: center;
  167. padding-top: 20rpx;
  168. .user-img {
  169. display: flex;
  170. align-items: center;
  171. image {
  172. width: 50rpx;
  173. height: 50rpx;
  174. border-radius: 50%;
  175. }
  176. }
  177. .order-status {
  178. margin-left: 20rpx;
  179. color: #666666;
  180. padding: 6rpx 13rpx;
  181. font-size: 24rpx;
  182. }
  183. }
  184. }
  185. .returnBnt {
  186. width: 80%;
  187. height: 86rpx;
  188. border-radius: 50rpx;
  189. color: #fff;
  190. font-size: 30rpx;
  191. text-align: center;
  192. line-height: 86rpx;
  193. margin: 0 auto;
  194. background-color: var(--view-theme);
  195. }
  196. }
  197. </style>