parkexport.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <!-- 道闸无牌车出场 -->
  2. <template>
  3. <view class="park-export">
  4. <template v-if="infoData">
  5. <template v-if="infoData.needCode">
  6. <view class="park-export-number">
  7. <view class="park-export-number-icon">
  8. <u-image width="100%" height="100%" src="/static/img/no-found-enter-info.png" />
  9. </view>
  10. <view class="park-export-number-text"> 查询不到入场信息 </view>
  11. <view class="park-export-number-error" v-if="isInputError">输入错误,请重新输入</view>
  12. <view class="park-export-number-input">
  13. <u-message-input :maxlength="6" :value="codeNum" inactive-color="#008CFF" @finish="codeInputFinish" />
  14. </view>
  15. <view class="park-export-number-tips">
  16. 提示:未查询到该微信/支付宝扫码入场的信息,<text>请输入车辆扫码入场时页面中的6位数进行结算出场。</text>
  17. </view>
  18. <view class="park-export-number-btn">
  19. <u-button type="primary" shape="circle" :disabled="codeNum.length === 0" @click="codeInputFinishConfirm">确 定</u-button>
  20. </view>
  21. </view>
  22. </template>
  23. <template v-else>
  24. <view class="park-export-order">
  25. <view class="park-export-order-title">支付停车费</view>
  26. <view class="park-export-order-tips">请您确认停车费用,确认后请支付费用,结束停车。谢谢您的使用!</view>
  27. <view class="park-export-order-info">
  28. <view class="park-export-order-info-item">
  29. <view>车牌号</view>
  30. <view class="vehicle-no">{{ infoData.vehicleNo }}</view>
  31. </view>
  32. <view class="park-export-order-info-item">
  33. <view>停车场名称</view>
  34. <view class="weight">{{ infoData.parkingName }}</view>
  35. </view>
  36. <view class="park-export-order-info-item">
  37. <view>入场车道</view>
  38. <view class="weight">{{ infoData.entranceName }}</view>
  39. </view>
  40. <view class="park-export-order-info-item">
  41. <view>入场时间</view>
  42. <view class="weight">{{ infoData.inTime }}</view>
  43. </view>
  44. <view class="park-export-order-info-item">
  45. <view>出场车道</view>
  46. <view class="weight">{{ infoData.outEntranceName }}</view>
  47. </view>
  48. <view class="park-export-order-info-item">
  49. <view>出场时间</view>
  50. <view class="weight">{{ infoData.outTime }}</view>
  51. </view>
  52. <view class="park-export-order-info-item">
  53. <view>免费时长</view>
  54. <view class="weight">{{ infoData.freeDuration || `0天0时${free_time}分0秒` }}</view>
  55. </view>
  56. <view class="park-export-order-info-item">
  57. <view class="weight">计费时长</view>
  58. <view class="weight">{{ infoData.calcDuration }}</view>
  59. </view>
  60. <view class="park-export-order-info-item">
  61. <view>累计停车时长</view>
  62. <view class="weight">{{ infoData.duration }}</view>
  63. </view>
  64. <view class="park-export-order-info-item">
  65. <view>应收金额</view>
  66. <view class="weight">{{ infoData.totalAmount || 0 }}元</view>
  67. </view>
  68. <view class="park-export-order-info-item">
  69. <view>订单编号</view>
  70. <view class="weight">{{ infoData.id }}</view>
  71. </view>
  72. </view>
  73. <view class="park-export-order-btn">
  74. <u-button type="primary" shape="circle" v-if="isPay" @click="onEntraceClick">支付出场</u-button>
  75. <u-button type="primary" shape="circle" v-else @click="jumpHome">支付成功,返回首页</u-button>
  76. </view>
  77. </view>
  78. </template>
  79. </template>
  80. <template v-else>
  81. <view class="park-export-order-info">
  82. <text>{{ tipTxt }}</text>
  83. </view>
  84. </template>
  85. <!-- 支付方式 -->
  86. <ChoosePayment
  87. v-if="choosePayment"
  88. ref="choosePayment"
  89. :payWayPop="payWayPop"
  90. :curOrderList="orderList"
  91. :jumpUrl="jumpUrl"
  92. :exportFlag="true"
  93. :sanPay="true"
  94. @closePaymentMethod="closePaymentMethod"
  95. />
  96. <!-- 广告轮播 -->
  97. <ad-banner />
  98. <u-toast ref="uToast" />
  99. </view>
  100. </template>
  101. <script>
  102. import ChoosePayment from '@/pages/choosePayment/choosePayment.vue';
  103. import AdBanner from '@/components/ad-banner/ad-banner.vue';
  104. export default {
  105. components: {
  106. ChoosePayment,
  107. AdBanner
  108. },
  109. data() {
  110. return {
  111. intoInfo: {
  112. parkNo: '',
  113. roadwayNo: '',
  114. polyOrderId: '',
  115. isBack: 0
  116. },
  117. payWayPop: false, // 支付弹框
  118. infoData: {
  119. needCode: true
  120. }, // 订单信息
  121. orderList: [], // 支付订单列表
  122. jumpUrl: location.href + '&isBack=1', // 回调地址
  123. timer: null, // 轮询
  124. isPay: false, // 支付按钮显示
  125. choosePayment: false,
  126. tipTxt: '出口无车辆',
  127. codeNum: '',
  128. isInputError: false
  129. };
  130. },
  131. onLoad(page) {
  132. this.intoInfo.parkNo = page?.parkNo;
  133. this.intoInfo.roadwayNo = page?.roadwayNo;
  134. this.intoInfo.polyOrderId = page?.polyOrderId;
  135. this.intoInfo.isBack = page?.isBack;
  136. },
  137. onShow() {
  138. this.getOrderDetails(this.intoInfo.parkNo, this.intoInfo.roadwayNo);
  139. if (this.intoInfo.polyOrderId && this.intoInfo.isBack == 1) {
  140. uni.showLoading({
  141. title: '订单状态查询中...'
  142. });
  143. this.timer = setInterval(() => {
  144. this.handlePayStatus(this.intoInfo.polyOrderId);
  145. }, 1000);
  146. }
  147. },
  148. onUnload() {
  149. clearInterval(this.timer);
  150. },
  151. methods: {
  152. /**
  153. * 立即支付
  154. */
  155. onEntraceClick() {
  156. this.choosePayment = true;
  157. this.$nextTick(() => {
  158. this.$refs['choosePayment'].openPopup({ ...this.infoData }, 'single', 'parking');
  159. });
  160. },
  161. /**
  162. * 反复查询支付状态
  163. * @param { String } orderId
  164. */
  165. handlePayStatus(orderId) {
  166. this.$u.api
  167. .getOrderStateExportApi({
  168. orderId
  169. })
  170. .then((res) => {
  171. if (res.code === 200) {
  172. if (res.data.payStatus === 1 || res.data.payStatus === 3) {
  173. clearInterval(this.timer);
  174. uni.hideLoading();
  175. this.getOrderDetails(this.intoInfo.parkNo, this.intoInfo.roadwayNo);
  176. } else if (res.data.payStatus === 2) {
  177. this.isPay = true;
  178. uni.hideLoading();
  179. }
  180. } else {
  181. clearInterval(this.timer);
  182. uni.hideLoading();
  183. this.$refs.uToast.show({
  184. title: res.msg || '支付失败!',
  185. type: 'error'
  186. });
  187. }
  188. })
  189. .catch(() => {
  190. uni.hideLoading();
  191. clearInterval(this.timer);
  192. });
  193. },
  194. /**
  195. * 查询订单信息
  196. * @param { String } parkNo 停车场编号
  197. * @param { String } roadwayNo 出口编号
  198. */
  199. getOrderDetails(parkNo, roadwayNo, codeNum) {
  200. uni.showLoading({
  201. title: '订单查询中...'
  202. });
  203. this.$u.api
  204. .getDetailExportApi({
  205. parkNo,
  206. roadwayNo,
  207. codeNum
  208. })
  209. .then((res) => {
  210. if (res.code === 200) {
  211. this.infoData = res.data;
  212. this.orderList = [res.data.id];
  213. if (res.data.orderStatus == 2 || res.data.orderStatus == 3) {
  214. this.isPay = true;
  215. } else {
  216. this.isPay = false;
  217. }
  218. }
  219. uni.hideLoading();
  220. })
  221. .catch((err) => {
  222. this.tipTxt = err?.msg ?? '出口无车辆';
  223. uni.hideLoading();
  224. });
  225. },
  226. /**
  227. * 关闭支付弹框
  228. */
  229. closePaymentMethod() {
  230. this.choosePayment = false;
  231. },
  232. /**
  233. * @description: 返回首页
  234. * @param {*} url
  235. * @return {*}
  236. */
  237. jumpHome() {
  238. uni.switchTab({
  239. url: '/pages/index/index'
  240. });
  241. },
  242. /**
  243. * @description: 验证码输入完成
  244. * @param {*} code
  245. * @return {*}
  246. */
  247. codeInputFinish(code) {
  248. this.codeNum = code;
  249. this.codeInputFinishConfirm();
  250. },
  251. codeInputFinishConfirm() {
  252. this.isInputError = this.codeNum.length !== 6;
  253. this.getOrderDetails(this.intoInfo.parkNo, this.intoInfo.roadwayNo, this.codeNum);
  254. }
  255. }
  256. };
  257. </script>
  258. <style lang="scss" scoped>
  259. @import './parkexport.scss';
  260. </style>