zhifutanchuan.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <view :style="{ top: 0 }" class="z-popup">
  3. <view class="zhuangtaitubiao" v-if="[1].includes(type)">
  4. <image src="@/static/common/jiazai.gif" mode="aspectFill" style="width: 240rpx; height: 240rpx"></image>
  5. <view class="textclass"> 支付中请耐心等待 </view>
  6. </view>
  7. <view class="zhuangtaitubiao" v-if="[2].includes(type)">
  8. <view class="icon">
  9. <text class="iconfont icon-chenggong true" style="font-size: 100rpx; color: greenyellow"></text>
  10. </view>
  11. <view class="textclass"> 支付成功 </view>
  12. <view class="textclass" style="margin-top: 20rpx"> ¥{{ detail.totalAmount }} </view>
  13. </view>
  14. <view class="zhuangtaitubiao" v-if="[3, 4].includes(type)">
  15. <view class="icon">
  16. <text class="iconfont icon-shibai false" style="font-size: 100rpx; color: red"></text>
  17. </view>
  18. <view class="textclass"> 支付失败 </view>
  19. <view class="textclass" style="margin-top: 20rpx"> ¥{{ detail.totalAmount }} </view>
  20. </view>
  21. <view class="zhuangtaitubiao" style="justify-content: flex-start !important" v-if="[2].includes(type)">
  22. <view class="title">支付信息</view>
  23. <view class="row">
  24. <view class="label">支付单号:</view>
  25. <view class="value">{{ orderId }}</view>
  26. </view>
  27. <view class="row">
  28. <view class="label">支付金额:</view>
  29. <view class="price">¥{{ detail.totalAmount || '' }}</view>
  30. </view>
  31. <view class="row">
  32. <view class="label">支付时间:</view>
  33. <view class="value">{{ detail.payTime || '' }}</view>
  34. </view>
  35. <view class="row">
  36. <view class="label">支付结果:</view>
  37. <view class="value">成功</view>
  38. </view>
  39. <view class="row">
  40. <view class="label">支付方式:</view>
  41. <!-- <view class="value">微信支付</view> -->
  42. <!-- <view class="value">线下支付</view> -->
  43. <view class="value">{{ detail.payType == 'WECHAT' ? '微信支付' : '线下支付' }}</view>
  44. </view>
  45. </view>
  46. <view class="anniukuang" v-if="[1].includes(type)">
  47. <u-button text="取消" @click="back"></u-button>
  48. </view>
  49. <view class="anniukuang" v-if="[1, 3, 4].includes(type)">
  50. <u-button type="primary" text="重新扫描" @click="scan"></u-button>
  51. </view>
  52. <view class="anniukuang" v-if="[2].includes(type)">
  53. <u-button type="primary" text="返回订单" @click="back"></u-button>
  54. </view>
  55. <view class="anniukuang" v-if="[3].includes(type)">
  56. <u-button type="primary" text="查询支付结果" @click="KeepWaiting"></u-button>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. export default {
  62. props: {
  63. detail: {
  64. type: Object,
  65. default: () => ({})
  66. },
  67. orderId: {
  68. type: [String, Number],
  69. default: ''
  70. },
  71. state: {
  72. type: [String, Number],
  73. default: 0
  74. }
  75. },
  76. data() {
  77. return {
  78. type: this.state,
  79. miao: 30
  80. }
  81. },
  82. watch: {
  83. state() {
  84. if (this.state == 2) {
  85. if (this.timeId) {
  86. clearTimeout(this.timeId)
  87. }
  88. this.$emit('offTiming')
  89. }
  90. this.type = this.state
  91. },
  92. miao: {
  93. handler(newVal, oldVal) {
  94. if (newVal > 0) {
  95. if (this.timeId) {
  96. clearTimeout(this.timeId)
  97. }
  98. this.timeId = setTimeout(() => {
  99. this.miao--
  100. }, 1000)
  101. } else if (this.state != 2) {
  102. this.type = 3
  103. }
  104. },
  105. immediate: true
  106. }
  107. },
  108. methods: {
  109. scan() {
  110. if (this.timeId) {
  111. clearTimeout(this.timeId)
  112. }
  113. this.$emit('scan')
  114. },
  115. KeepWaiting() {
  116. this.type = 1
  117. this.miao = 30
  118. },
  119. back() {
  120. if (this.timeId) {
  121. clearTimeout(this.timeId)
  122. }
  123. this.$emit('back')
  124. }
  125. }
  126. }
  127. </script>
  128. <style scoped lang="scss">
  129. .z-popup {
  130. position: fixed;
  131. background: #efefef;
  132. width: 100%;
  133. height: 100vh;
  134. z-index: 1000000000;
  135. left: 0;
  136. right: 0;
  137. transition: top 0.5s;
  138. box-sizing: border-box;
  139. padding: 40rpx;
  140. .zhuangtaitubiao {
  141. width: 100%;
  142. height: auto;
  143. box-sizing: border-box;
  144. padding: 40rpx;
  145. background: #fff;
  146. border-radius: 20rpx;
  147. margin-bottom: 50rpx;
  148. display: flex;
  149. justify-content: center;
  150. align-items: center;
  151. flex-direction: column;
  152. .textclass {
  153. font-size: 42rpx;
  154. font-weight: 500;
  155. }
  156. }
  157. .anniukuang {
  158. width: 100%;
  159. margin-bottom: 20rpx;
  160. }
  161. .title {
  162. font-size: 32rpx;
  163. font-weight: 500;
  164. align-items: left;
  165. }
  166. .row {
  167. display: flex;
  168. align-items: left;
  169. margin-top: 30rpx;
  170. width: 100%;
  171. .label {
  172. color: $sec-font;
  173. }
  174. .price {
  175. color: $minor-color;
  176. font-weight: 500;
  177. }
  178. }
  179. }
  180. </style>