geomagnetismLock.vue 8.1 KB

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