roadGateSystem.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <!-- 道闸 -->
  3. <view class="parking-lock">
  4. <!-- 道闸支付 -->
  5. <template v-if="parkingLockStatus === 1">
  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">{{ orderInfo.vehicleNo }}</view>
  13. </view>
  14. <view class="parking-lock-info-item">
  15. <view>停车场名称</view>
  16. <view>{{orderInfo.roadName }}</view>
  17. </view>
  18. <view class="parking-lock-info-item">
  19. <view>入场车道</view>
  20. <view>{{'入口1'}}</view>
  21. </view>
  22. <view class="parking-lock-info-item">
  23. <view>入场时间</view>
  24. <view>{{orderInfo.inTime}}</view>
  25. </view>
  26. <view class="parking-lock-info-item">
  27. <view>出场车道</view>
  28. <view>{{'出口1'}}</view>
  29. </view>
  30. <view class="parking-lock-info-item">
  31. <view>出场时间</view>
  32. <view>{{orderInfo.outTime}}</view>
  33. </view>
  34. <view class="parking-lock-info-item">
  35. <view>免费时长</view>
  36. <!-- <view>{{ orderInfo.freeDuration || '0天0时30分0秒' }}</view> -->
  37. <view>{{ '0天0时30分0秒' }}</view>
  38. </view>
  39. <view class="parking-lock-info-item">
  40. <view>计费时长</view>
  41. <view>{{orderInfo.calcDuration || 0}}</view>
  42. </view>
  43. <view class="parking-lock-info-item">
  44. <view>累计停车时长</view>
  45. <view>{{ orderInfo.duration || 0 }}</view>
  46. </view>
  47. <view class="parking-lock-info-item">
  48. <view>应缴金额</view>
  49. <view class="really-money">{{ orderInfo.payAmount || 0 }} 元</view>
  50. </view>
  51. <view class="parking-lock-info-item">
  52. <view>订单编号</view>
  53. <view>{{ orderInfo.orderId }}</view>
  54. </view>
  55. </view>
  56. <view class="parking-lock-pay-btn" v-if="is_pay">
  57. <button type="default" @click="payMoney">立即支付</button>
  58. </view>
  59. </view>
  60. </template>
  61. <template v-else-if="parkingLockStatus === 2">
  62. <view class="parking-lock-pay">
  63. <view class="parking-lock-tips">{{ tipsMsg }}</view>
  64. </view>
  65. </template>
  66. <!-- 支付方式 -->
  67. <PaymentMethod :payWayPop="payWayPop" :curOrderList="[orderId]" :jumpUrl="jumpUrl" :payeeId="payeeId"
  68. :payeeName="payeeName" :vehicleNo="orderInfo.vehicleNo" @closePaymentMethod="closePaymentMethod">
  69. </PaymentMethod>
  70. <u-popup v-model="show" mode="center" border-radius="14" width="200rpx" height="200rpx">
  71. <view class="loadingSelect">订单查询中...</view>
  72. <view class="spinner">
  73. <view class="rect1"></view>
  74. <view class="rect2"></view>
  75. <view class="rect3"></view>
  76. <view class="rect4"></view>
  77. <view class="rect5"></view>
  78. </view>
  79. </u-popup>
  80. <u-toast ref="uToast" />
  81. </view>
  82. </template>
  83. <script>
  84. import getUrlParams from "../../utils/getUrlParams.js";
  85. import PaymentMethod from '@/pages/paymentMethod/paymentMethod.vue'
  86. export default {
  87. components: {
  88. PaymentMethod
  89. },
  90. data() {
  91. return {
  92. // 车位锁状态 1:需支付 2:查询失败返回提醒
  93. parkingLockStatus: 0,
  94. // 支付方式选择弹框
  95. payWayPop: false,
  96. // 订单编号
  97. orderList: [],
  98. // 提示信息
  99. tipsMsg: null,
  100. // 轮询
  101. timer: null,
  102. // 订单信息
  103. orderInfo: {},
  104. // 订单id
  105. orderId: null,
  106. // 重定向地址
  107. jumpUrl: location.href + '&isBack=1',
  108. show: true,
  109. isBack: '',
  110. polyOrderId: '',
  111. // 地磁
  112. spaceId: '',
  113. payeeId: '',
  114. payeeName: '',
  115. is_pay: false
  116. }
  117. },
  118. onLoad(page) {
  119. if (page.orderId) {
  120. this.orderId = page?.orderId
  121. this.spaceId = page?.spaceId
  122. this.payeeId = page?.payeeId
  123. this.polyOrderId = page?.polyOrderId
  124. this.isBack = page?.isBack
  125. } else {
  126. this.tipsMsg = page.msg || '参数丢失!';
  127. // this.parkingLockStatus = 2
  128. uni.showModal({
  129. title: '提示',
  130. content: (page.msg || '参数丢失') + ',返回首页',
  131. showCancel: false,
  132. success: (res) => {
  133. if (res.confirm) {
  134. uni.switchTab({
  135. url: '/pages/index/index'
  136. })
  137. }
  138. }
  139. });
  140. }
  141. },
  142. onShow() {
  143. if (this.orderId) {
  144. this.getOrderDetails(this.spaceId, this.orderId, this.payeeId)
  145. if (this.polyOrderId && this.isBack == 1) {
  146. this.timer = setInterval(() => {
  147. this.show = true
  148. this.handlePayStatus(this.polyOrderId)
  149. }, 1000)
  150. }
  151. } else {
  152. this.show = false
  153. }
  154. },
  155. onUnload() {
  156. if (this.timer) {
  157. clearInterval(this.timer)
  158. }
  159. },
  160. methods: {
  161. /**
  162. * 反复查询支付状态
  163. * @param { String } orderId
  164. */
  165. handlePayStatus(orderId) {
  166. this.$u.api.getOrderInfo({
  167. orderId
  168. }).then(res => {
  169. if (res.code === 200) {
  170. if (res.data.payStatus === 1 || res.data.payStatus === 3) {
  171. this.show = false
  172. clearInterval(this.timer);
  173. this.is_pay = false
  174. uni.showModal({
  175. title: '提示',
  176. content: '支付成功,返回首页',
  177. showCancel: false,
  178. success: (res) => {
  179. if (res.confirm) {
  180. uni.switchTab({
  181. url: '/pages/index/index'
  182. })
  183. }
  184. }
  185. });
  186. } else if (res.data.payStatus === 2) {
  187. this.is_pay = true
  188. }
  189. } else {
  190. this.show = false
  191. clearInterval(this.timer);
  192. this.$refs.uToast.show({
  193. title: res.msg,
  194. type: 'error',
  195. });
  196. }
  197. }).catch(() => {
  198. this.show = false
  199. clearInterval(this.timer);
  200. })
  201. },
  202. /**
  203. * 立即支付
  204. */
  205. payMoney() {
  206. this.payWayPop = true
  207. },
  208. /**
  209. * 查询订单信息
  210. * @param { String } spaceId 车位ID
  211. * @param { String } orderId 订单id
  212. * @param { String } payeeId 收费员ID
  213. */
  214. getOrderDetails(spaceId, orderId, payeeId) {
  215. this.$u.api.geomaLockDetailsApi({
  216. spaceId,
  217. orderId,
  218. payeeId
  219. }).then(res => {
  220. if (res.code === 200 && res.data.id) {
  221. this.payeeName = res.data.payeeName
  222. this.parkingLockStatus = 1
  223. this.orderInfo = res.data
  224. this.show = false
  225. if (res.data.payStatus == 0 || res.data.payStatus == 2) {
  226. this.is_pay = true
  227. } else if (res.data.payStatus == 1) {
  228. this.is_pay = false
  229. uni.showModal({
  230. title: '提示',
  231. content: '订单已支付,返回首页',
  232. showCancel: false,
  233. success: function(res) {
  234. if (res.confirm) {
  235. uni.switchTab({
  236. url: '/pages/index/index'
  237. })
  238. }
  239. }
  240. });
  241. }
  242. } else {
  243. this.$refs.uToast.show({
  244. title: res.msg || '订单无数据',
  245. type: 'error',
  246. });
  247. }
  248. }).catch(err => {
  249. this.show = false
  250. })
  251. },
  252. /**
  253. * 关闭支付弹框
  254. */
  255. closePaymentMethod() {
  256. this.payWayPop = false
  257. }
  258. }
  259. }
  260. </script>
  261. <style lang="scss" scoped>
  262. @import './roadGateSystem.scss';
  263. </style>