parkexport.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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.outParkingName}}</view>
  17. </view>
  18. <view class="parking-lock-info-item">
  19. <view>入场车道</view>
  20. <view class="weight">{{infoData.inTime}}</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.outRoadwayName}}</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. @closePaymentMethod="closePaymentMethod"
  79. ></PaymentMethod>
  80. <u-toast ref="uToast" />
  81. </view>
  82. </template>
  83. <script>
  84. import PaymentMethod from '@/pages/paymentMethod/paymentMethod.vue'
  85. export default {
  86. components: {
  87. PaymentMethod
  88. },
  89. data() {
  90. return {
  91. intoInfo: {
  92. parkNo: '',
  93. roadwayNo: '',
  94. polyOrderId: '',
  95. isBack: 0
  96. },
  97. payWayPop: false, // 支付弹框
  98. infoData: undefined, // 订单信息
  99. orderList: [], // 支付订单列表
  100. jumpUrl: location.href + '&isBack=1', // 回调地址
  101. timer: null, // 轮询
  102. isPay: false, // 支付按钮显示
  103. }
  104. },
  105. onLoad(page) {
  106. this.intoInfo.parkNo = page?.parkNo;
  107. this.intoInfo.roadwayNo = page?.roadwayNo;
  108. this.intoInfo.polyOrderId = page?.polyOrderId
  109. this.intoInfo.isBack = page?.isBack
  110. },
  111. onShow() {
  112. this.getOrderDetails(this.intoInfo.parkNo, this.intoInfo.roadwayNo);
  113. if (this.intoInfo.polyOrderId && this.intoInfo.isBack == 1) {
  114. uni.showLoading({
  115. title: '订单状态查询中...'
  116. })
  117. this.timer = setInterval(() => {
  118. this.handlePayStatus(this.intoInfo.polyOrderId)
  119. }, 1000)
  120. }
  121. },
  122. onUnload() {
  123. clearInterval(this.timer)
  124. },
  125. methods: {
  126. /**
  127. * 立即支付
  128. */
  129. onEntraceClick() {
  130. this.payWayPop = true
  131. },
  132. /**
  133. * 反复查询支付状态
  134. * @param { String } orderId
  135. */
  136. handlePayStatus(orderId) {
  137. this.$u.api.getOrderStateExportApi({
  138. orderId
  139. }).then(res => {
  140. if (res.code === 200) {
  141. if (res.data.payStatus === 1 || res.data.payStatus === 3) {
  142. clearInterval(this.timer);
  143. uni.hideLoading()
  144. this.getOrderDetails(this.intoInfo.parkNo, this.intoInfo.roadwayNo);
  145. } else if (res.data.payStatus === 2) {
  146. this.isPay = true
  147. uni.hideLoading()
  148. }
  149. } else {
  150. clearInterval(this.timer);
  151. uni.hideLoading()
  152. this.$refs.uToast.show({
  153. title: res.msg || '支付失败!',
  154. type: 'error',
  155. });
  156. }
  157. }).catch(() => {
  158. uni.hideLoading()
  159. clearInterval(this.timer);
  160. })
  161. },
  162. /**
  163. * 查询订单信息
  164. * @param { String } parkNo 停车场编号
  165. * @param { String } roadwayNo 出口编号
  166. */
  167. getOrderDetails(parkNo, roadwayNo) {
  168. uni.showLoading({
  169. title: '订单查询中...'
  170. })
  171. this.$u.api.getDetailExportApi({
  172. parkNo,
  173. roadwayNo
  174. }).then(res => {
  175. if (res.code === 200) {
  176. this.infoData = res.data
  177. this.orderList = [res.data.id]
  178. if (res.data.orderStatus == 2 || res.data.orderStatus == 3) {
  179. this.isPay = true
  180. } else {
  181. this.isPay = false
  182. }
  183. } else {
  184. this.$refs.uToast.show({
  185. title: res.msg || '订单无数据',
  186. type: 'error',
  187. });
  188. }
  189. uni.hideLoading()
  190. }).catch(err => {
  191. uni.hideLoading()
  192. })
  193. },
  194. /**
  195. * 关闭支付弹框
  196. */
  197. closePaymentMethod() {
  198. this.payWayPop = false
  199. },
  200. jumpHome(url) {
  201. uni.switchTab({
  202. url: url
  203. })
  204. }
  205. }
  206. }
  207. </script>
  208. <style lang="scss" scoped>
  209. @import './parkexport.scss';
  210. </style>