zhifutanchuan.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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>
  43. </view>
  44. <view class="anniukuang" v-if="[1].includes(type)">
  45. <u-button text="取消" @click="back"></u-button>
  46. </view>
  47. <view class="anniukuang" v-if="[1, 3, 4].includes(type)">
  48. <u-button type="primary" text="重新扫描" @click="scan"></u-button>
  49. </view>
  50. <view class="anniukuang" v-if="[2].includes(type)">
  51. <u-button type="primary" text="返回订单" @click="back"></u-button>
  52. </view>
  53. <view class="anniukuang" v-if="[3].includes(type)">
  54. <u-button type="primary" text="查询支付结果" @click="KeepWaiting"></u-button>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. export default {
  60. props: {
  61. detail: {
  62. type: Object,
  63. default: () => ({})
  64. },
  65. orderId: {
  66. type: [String, Number],
  67. default: ''
  68. },
  69. state: {
  70. type: [String, Number],
  71. default: 0
  72. }
  73. },
  74. data() {
  75. return {
  76. type: this.state,
  77. miao: 30
  78. }
  79. },
  80. watch: {
  81. state() {
  82. if (this.state == 2) {
  83. if (this.timeId) {
  84. clearTimeout(this.timeId)
  85. }
  86. this.$emit('offTiming')
  87. }
  88. this.type = this.state
  89. },
  90. miao: {
  91. handler(newVal, oldVal) {
  92. if (newVal > 0) {
  93. if (this.timeId) {
  94. clearTimeout(this.timeId)
  95. }
  96. this.timeId = setTimeout(() => {
  97. this.miao--
  98. }, 1000)
  99. } else if (this.state != 2) {
  100. this.type = 3
  101. }
  102. },
  103. immediate: true
  104. }
  105. },
  106. methods: {
  107. scan() {
  108. if (this.timeId) {
  109. clearTimeout(this.timeId)
  110. }
  111. this.$emit('scan')
  112. },
  113. KeepWaiting() {
  114. this.type = 1
  115. this.miao = 30
  116. },
  117. back() {
  118. if (this.timeId) {
  119. clearTimeout(this.timeId)
  120. }
  121. this.$emit('back')
  122. }
  123. }
  124. }
  125. </script>
  126. <style scoped lang="scss">
  127. .z-popup {
  128. position: fixed;
  129. background: #efefef;
  130. width: 100%;
  131. height: 100vh;
  132. z-index: 1000000000;
  133. left: 0;
  134. right: 0;
  135. transition: top 0.5s;
  136. box-sizing: border-box;
  137. padding: 40rpx;
  138. .zhuangtaitubiao {
  139. width: 100%;
  140. height: auto;
  141. box-sizing: border-box;
  142. padding: 40rpx;
  143. background: #fff;
  144. border-radius: 20rpx;
  145. margin-bottom: 50rpx;
  146. display: flex;
  147. justify-content: center;
  148. align-items: center;
  149. flex-direction: column;
  150. .textclass {
  151. font-size: 42rpx;
  152. font-weight: 500;
  153. }
  154. }
  155. .anniukuang {
  156. width: 100%;
  157. margin-bottom: 20rpx;
  158. }
  159. .title {
  160. font-size: 32rpx;
  161. font-weight: 500;
  162. align-items: left;
  163. }
  164. .row {
  165. display: flex;
  166. align-items: left;
  167. margin-top: 30rpx;
  168. width: 100%;
  169. .label {
  170. color: $sec-font;
  171. }
  172. .price {
  173. color: $minor-color;
  174. font-weight: 500;
  175. }
  176. }
  177. }
  178. </style>