parkexport.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <!-- 地磁 -->
  3. <view class="parking-lock">
  4. <!-- 地磁支付 -->
  5. <template v-if="infoData">
  6. <view class="parking-lock-pay">
  7. <view class="parking-lock-title">支付停车费</view>
  8. <view class="parking-lock-tips">请您确认停车费用,确认后请支付费用,结束停车。谢谢您的使用!</view>
  9. <view class="parking-lock-info">
  10. <view class="parking-lock-info-item">
  11. <view>车牌号</view>
  12. <view class="weight">{{ infoData.vehicleNo}}</view>
  13. </view>
  14. <view class="parking-lock-info-item">
  15. <view>停车场名称</view>
  16. <view class="weight">{{ infoData.parkingName}}</view>
  17. </view>
  18. <view class="parking-lock-info-item">
  19. <view>入场车道</view>
  20. <view class="weight">{{infoData.entranceName}}</view>
  21. </view>
  22. <view class="parking-lock-info-item">
  23. <view>入场时间</view>
  24. <view class="weight">{{infoData.inTime}}</view>
  25. </view>
  26. <view class="parking-lock-info-item">
  27. <view>出场车道</view>
  28. <view class="weight">{{infoData.outEntranceName }}</view>
  29. </view>
  30. <view class="parking-lock-info-item">
  31. <view>出场时间</view>
  32. <view class="weight">{{infoData.outTime}}</view>
  33. </view>
  34. <!-- <view class="parking-lock-info-item">
  35. <view>通道名称</view>
  36. <view class="weight">{{infoData.roadwayName}}</view>
  37. </view> -->
  38. <view class="parking-lock-info-item">
  39. <view>免费时长</view>
  40. <view class="weight">{{infoData.freeDuration}}</view>
  41. </view>
  42. <view class="parking-lock-info-item">
  43. <view class="weight">计费时长</view>
  44. <view class="weight">{{infoData.calcDuration}}</view>
  45. </view>
  46. <view class="parking-lock-info-item">
  47. <view>累计停车时长</view>
  48. <view class="weight">{{infoData.duration}}</view>
  49. </view>
  50. <view class="parking-lock-info-item">
  51. <view>应收金额</view>
  52. <view class="weight">{{infoData.totalAmount}}元</view>
  53. </view>
  54. <view class="parking-lock-info-item">
  55. <view>订单编号</view>
  56. <view class="weight">{{infoData.id}}</view>
  57. </view>
  58. </view>
  59. <view class="parking-lock-pay-btn">
  60. <button type="default" v-if="isPay" @click="onEntraceClick">支付出场</button>
  61. <button type="default" v-else @click="jumpHome('/pages/index/index')">支付成功,返回首页</button>
  62. </view>
  63. </view>
  64. </template>
  65. <template v-else>
  66. <view class="parking-lock-info">
  67. <view class="parking-lock-info-item">
  68. <view>出口无车辆</view>
  69. </view>
  70. </view>
  71. </template>
  72. <!-- 支付方式 -->
  73. <PaymentMethod
  74. :payWayPop="payWayPop"
  75. :curOrderList="orderList"
  76. :jumpUrl="jumpUrl"
  77. :exportFlag="true"
  78. :sanPay="saopay"
  79. @closePaymentMethod="closePaymentMethod"
  80. ></PaymentMethod>
  81. <u-toast ref="uToast" />
  82. </view>
  83. </template>
  84. <script>
  85. import PaymentMethod from '@/pages/paymentMethod/paymentMethod.vue'
  86. export default {
  87. components: {
  88. PaymentMethod
  89. },
  90. data() {
  91. return {
  92. intoInfo: {
  93. parkNo: '',
  94. roadwayNo: '',
  95. polyOrderId: '',
  96. isBack: 0
  97. },
  98. saopay: true,
  99. payWayPop: false, // 支付弹框
  100. infoData: undefined, // 订单信息
  101. orderList: [], // 支付订单列表
  102. jumpUrl: location.href + '&isBack=1', // 回调地址
  103. timer: null, // 轮询
  104. isPay: false, // 支付按钮显示
  105. }
  106. },
  107. onLoad(page) {
  108. this.intoInfo.parkNo = page?.parkNo;
  109. this.intoInfo.roadwayNo = page?.roadwayNo;
  110. this.intoInfo.polyOrderId = page?.polyOrderId
  111. this.intoInfo.isBack = page?.isBack
  112. },
  113. onShow() {
  114. this.getOrderDetails(this.intoInfo.parkNo, this.intoInfo.roadwayNo);
  115. if (this.intoInfo.polyOrderId && this.intoInfo.isBack == 1) {
  116. uni.showLoading({
  117. title: '订单状态查询中...'
  118. })
  119. this.timer = setInterval(() => {
  120. this.handlePayStatus(this.intoInfo.polyOrderId)
  121. }, 1000)
  122. }
  123. },
  124. onUnload() {
  125. clearInterval(this.timer)
  126. },
  127. methods: {
  128. /**
  129. * 立即支付
  130. */
  131. onEntraceClick() {
  132. this.payWayPop = true
  133. },
  134. /**
  135. * 反复查询支付状态
  136. * @param { String } orderId
  137. */
  138. handlePayStatus(orderId) {
  139. this.$u.api.getOrderStateExportApi({
  140. orderId
  141. }).then(res => {
  142. if (res.code === 200) {
  143. if (res.data.payStatus === 1 || res.data.payStatus === 3) {
  144. clearInterval(this.timer);
  145. uni.hideLoading()
  146. this.getOrderDetails(this.intoInfo.parkNo, this.intoInfo.roadwayNo);
  147. } else if (res.data.payStatus === 2) {
  148. this.isPay = true
  149. uni.hideLoading()
  150. }
  151. } else {
  152. clearInterval(this.timer);
  153. uni.hideLoading()
  154. this.$refs.uToast.show({
  155. title: res.msg || '支付失败!',
  156. type: 'error',
  157. });
  158. }
  159. }).catch(() => {
  160. uni.hideLoading()
  161. clearInterval(this.timer);
  162. })
  163. },
  164. /**
  165. * 查询订单信息
  166. * @param { String } parkNo 停车场编号
  167. * @param { String } roadwayNo 出口编号
  168. */
  169. getOrderDetails(parkNo, roadwayNo) {
  170. uni.showLoading({
  171. title: '订单查询中...'
  172. })
  173. this.$u.api.getDetailExportApi({
  174. parkNo,
  175. roadwayNo
  176. }).then(res => {
  177. if (res.code === 200) {
  178. this.infoData = res.data
  179. this.orderList = [res.data.id]
  180. if (res.data.orderStatus == 2 || res.data.orderStatus == 3) {
  181. this.isPay = true
  182. } else {
  183. this.isPay = false
  184. }
  185. } else {
  186. this.$refs.uToast.show({
  187. title: res.msg || '订单无数据',
  188. type: 'error',
  189. });
  190. }
  191. uni.hideLoading()
  192. }).catch(err => {
  193. uni.hideLoading()
  194. })
  195. },
  196. /**
  197. * 关闭支付弹框
  198. */
  199. closePaymentMethod() {
  200. this.payWayPop = false
  201. },
  202. jumpHome(url) {
  203. uni.switchTab({
  204. url: url
  205. })
  206. }
  207. }
  208. }
  209. </script>
  210. <style lang="scss" scoped>
  211. @import './parkexport.scss';
  212. </style>