zhifutanchuan.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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"> ¥{{ 133 }} </view>
  13. </view>
  14. <view class="zhuangtaitubiao" v-if="[3].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"> ¥{{ 133 }} </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">{{ detail.payType | payTypeFilter }}</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].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: 3
  72. }
  73. },
  74. filters: {
  75. payTypeFilter(val) {
  76. const MAP = {
  77. WECHAT: '微信支付',
  78. LINE: '线下支付'
  79. }
  80. return MAP[val]
  81. }
  82. },
  83. data() {
  84. return {
  85. type: this.state,
  86. miao: 30
  87. }
  88. },
  89. watch: {
  90. state() {
  91. if (this.state == 2) {
  92. if (this.timeId) {
  93. clearTimeout(this.timeId)
  94. }
  95. }
  96. this.type = this.state
  97. },
  98. miao: {
  99. handler(newVal, oldVal) {
  100. if (newVal > 0) {
  101. if (this.timeId) {
  102. clearTimeout(this.timeId)
  103. }
  104. this.timeId = setTimeout(() => {
  105. this.miao--
  106. }, 1000)
  107. } else {
  108. this.type = 3
  109. }
  110. },
  111. immediate: true
  112. }
  113. },
  114. methods: {
  115. scan() {
  116. if (this.timeId) {
  117. clearTimeout(this.timeId)
  118. }
  119. this.$emit('scan')
  120. },
  121. KeepWaiting() {
  122. this.type = 1
  123. this.miao = 30
  124. },
  125. back() {
  126. if (this.timeId) {
  127. clearTimeout(this.timeId)
  128. }
  129. this.$emit('back')
  130. }
  131. }
  132. }
  133. </script>
  134. <style scoped lang="scss">
  135. .z-popup {
  136. position: fixed;
  137. background: #efefef;
  138. width: 100%;
  139. height: 100vh;
  140. z-index: 1000000000;
  141. left: 0;
  142. right: 0;
  143. transition: top 0.5s;
  144. box-sizing: border-box;
  145. padding: 40rpx;
  146. .zhuangtaitubiao {
  147. width: 100%;
  148. height: auto;
  149. box-sizing: border-box;
  150. padding: 40rpx;
  151. background: #fff;
  152. border-radius: 20rpx;
  153. margin-bottom: 50rpx;
  154. display: flex;
  155. justify-content: center;
  156. align-items: center;
  157. flex-direction: column;
  158. .textclass {
  159. font-size: 42rpx;
  160. font-weight: 500;
  161. }
  162. }
  163. .anniukuang {
  164. width: 100%;
  165. margin-bottom: 20rpx;
  166. }
  167. .title {
  168. font-size: 32rpx;
  169. font-weight: 500;
  170. align-items: left;
  171. }
  172. .row {
  173. display: flex;
  174. align-items: left;
  175. margin-top: 30rpx;
  176. width: 100%;
  177. .label {
  178. color: $sec-font;
  179. }
  180. .price {
  181. color: $minor-color;
  182. font-weight: 500;
  183. }
  184. }
  185. }
  186. </style>