roadGateSystem.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  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时15分0秒' }}</view> -->
  37. <view>{{ `0天0时${free_time}分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. <ChoosePayment
  67. ref="choosePayment"
  68. :curOrderList="[orderId]"
  69. :jumpUrl="jumpUrl"
  70. :payeeId="payeeId"
  71. :payeeName="payeeName"
  72. :pursueType="pursueType"
  73. :vehicleNo="orderInfo.vehicleNo"
  74. />
  75. <u-popup v-model="show" mode="center" border-radius="14" width="200rpx" height="200rpx">
  76. <view class="loadingSelect">订单查询中...</view>
  77. <view class="spinner">
  78. <view class="rect1"></view>
  79. <view class="rect2"></view>
  80. <view class="rect3"></view>
  81. <view class="rect4"></view>
  82. <view class="rect5"></view>
  83. </view>
  84. </u-popup>
  85. <!-- 广告轮播 -->
  86. <ad-banner />
  87. <u-toast ref="uToast" />
  88. </view>
  89. </template>
  90. <script>
  91. import ChoosePayment from '@/pages/choosePayment/choosePayment.vue';
  92. import AdBanner from '@/components/ad-banner/ad-banner.vue';
  93. export default {
  94. components: {
  95. ChoosePayment,
  96. AdBanner
  97. },
  98. data() {
  99. return {
  100. // 车位锁状态 1:需支付 2:查询失败返回提醒
  101. parkingLockStatus: 0,
  102. // 支付方式选择弹框
  103. payWayPop: false,
  104. // 订单编号
  105. orderList: [],
  106. // 提示信息
  107. tipsMsg: null,
  108. // 轮询
  109. timer: null,
  110. // 订单信息
  111. orderInfo: {},
  112. // 订单id
  113. orderId: null,
  114. // 重定向地址
  115. jumpUrl: location.href + '&isBack=1',
  116. show: false,
  117. isBack: '',
  118. polyOrderId: '',
  119. // 地磁
  120. spaceId: '',
  121. payeeId: '',
  122. payeeName: '',
  123. pursueType: '',
  124. is_pay: false
  125. };
  126. },
  127. onLoad(page) {
  128. if (page.orderId) {
  129. this.orderId = page?.orderId;
  130. this.spaceId = page?.spaceId;
  131. this.payeeId = page?.payeeId;
  132. this.polyOrderId = page?.polyOrderId;
  133. this.pursueType = page?.pursueType;
  134. this.isBack = page?.isBack;
  135. } else {
  136. this.tipsMsg = page.msg || '参数丢失!';
  137. // this.parkingLockStatus = 2
  138. uni.showModal({
  139. title: '提示',
  140. content: (page.msg || '参数丢失') + ',返回首页',
  141. showCancel: false,
  142. success: (res) => {
  143. if (res.confirm) {
  144. uni.switchTab({
  145. url: '/pages/index/index'
  146. });
  147. }
  148. }
  149. });
  150. }
  151. },
  152. onShow() {
  153. if (this.orderId) {
  154. this.getOrderDetails(this.spaceId, this.orderId, this.payeeId);
  155. if (this.polyOrderId && this.isBack == 1) {
  156. this.timer = setInterval(() => {
  157. this.show = true;
  158. this.handlePayStatus(this.polyOrderId);
  159. }, 1000);
  160. }
  161. } else {
  162. this.show = false;
  163. }
  164. },
  165. onUnload() {
  166. if (this.timer) {
  167. clearInterval(this.timer);
  168. }
  169. },
  170. methods: {
  171. /**
  172. * 反复查询支付状态
  173. * @param { String } orderId
  174. */
  175. handlePayStatus(orderId) {
  176. this.$u.api
  177. .getOrderInfo({
  178. orderId
  179. })
  180. .then((res) => {
  181. if (res.code === 200) {
  182. if (res.data.payStatus === 1 || res.data.payStatus === 3) {
  183. this.show = false;
  184. clearInterval(this.timer);
  185. this.is_pay = false;
  186. uni.showModal({
  187. title: '提示',
  188. content: '支付成功,返回首页',
  189. showCancel: false,
  190. success: (res) => {
  191. if (res.confirm) {
  192. uni.switchTab({
  193. url: '/pages/index/index'
  194. });
  195. }
  196. }
  197. });
  198. } else if (res.data.payStatus === 2) {
  199. this.is_pay = true;
  200. }
  201. } else {
  202. this.show = false;
  203. clearInterval(this.timer);
  204. this.$refs.uToast.show({
  205. title: res.msg,
  206. type: 'error'
  207. });
  208. }
  209. })
  210. .catch(() => {
  211. this.show = false;
  212. clearInterval(this.timer);
  213. });
  214. },
  215. /**
  216. * 立即支付
  217. */
  218. payMoney() {
  219. this.$nextTick(() => {
  220. this.$refs['choosePayment'].openPopup({ ...this.orderInfo }, 'single', 'road');
  221. });
  222. },
  223. /**
  224. * 查询订单信息
  225. * @param { String } spaceId 车位ID
  226. * @param { String } orderId 订单id
  227. * @param { String } payeeId 收费员ID
  228. */
  229. getOrderDetails(spaceId, orderId, payeeId) {
  230. this.$u.api
  231. .geomaLockDetailsApi({
  232. spaceId,
  233. orderId,
  234. payeeId
  235. })
  236. .then((res) => {
  237. if (res.code === 200 && res.data.id) {
  238. this.payeeName = res.data.payeeName;
  239. this.parkingLockStatus = 1;
  240. this.orderInfo = res.data;
  241. this.show = false;
  242. if (res.data.payStatus == 0 || res.data.payStatus == 2) {
  243. this.is_pay = true;
  244. } else if (res.data.payStatus == 1) {
  245. this.is_pay = false;
  246. uni.showModal({
  247. title: '提示',
  248. content: '订单已支付,返回首页',
  249. showCancel: false,
  250. success: function (res) {
  251. if (res.confirm) {
  252. uni.switchTab({
  253. url: '/pages/index/index'
  254. });
  255. }
  256. }
  257. });
  258. }
  259. } else {
  260. this.$refs.uToast.show({
  261. title: res.msg || '订单无数据',
  262. type: 'error'
  263. });
  264. }
  265. })
  266. .catch((err) => {
  267. this.show = false;
  268. });
  269. },
  270. /**
  271. * 关闭支付弹框
  272. */
  273. closePaymentMethod() {
  274. this.payWayPop = false;
  275. }
  276. }
  277. };
  278. </script>
  279. <style lang="scss" scoped>
  280. @import './roadGateSystem.scss';
  281. </style>