geomagnetismLock.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <!-- 地磁 -->
  3. <view class="parking-lock">
  4. <view class="Jump">
  5. <view class="Jump-btn" @click="jumpArrears">
  6. 欠费补缴
  7. </view>
  8. </view>
  9. <!-- 地磁支付 -->
  10. <template v-if="parkingLockStatus === 1">
  11. <view class="parking-lock-pay">
  12. <view class="parking-lock-title">支付停车费</view>
  13. <view class="parking-lock-tips">请您确认停车费用,确认后请支付费用,结束停车。谢谢您的使用!</view>
  14. <view class="parking-lock-info">
  15. <view class="parking-lock-info-item">
  16. <view>车牌号</view>
  17. <view class="weight">{{ orderInfo.vehicleNo }}</view>
  18. </view>
  19. <view class="parking-lock-info-item">
  20. <view>停车场名称</view>
  21. <view>{{orderInfo.roadName }}</view>
  22. </view>
  23. <view class="parking-lock-info-item">
  24. <view>停车泊位</view>
  25. <view>{{orderInfo.spaceName}}</view>
  26. </view>
  27. <view class="parking-lock-info-item">
  28. <view>入场时间</view>
  29. <view>{{orderInfo.inTime}}</view>
  30. </view>
  31. <view class="parking-lock-info-item">
  32. <view>出场时间</view>
  33. <view>{{orderInfo.outTime}}</view>
  34. </view>
  35. <view class="parking-lock-info-item">
  36. <view>免费时长</view>
  37. <!-- <view>{{ orderInfo.freeDuration || '0天0时15分0秒' }}</view> -->
  38. <view>{{ '0天0时15分0秒' }}</view>
  39. </view>
  40. <view class="parking-lock-info-item">
  41. <view>计费时长</view>
  42. <view>{{orderInfo.calcDuration || 0}}</view>
  43. </view>
  44. <view class="parking-lock-info-item">
  45. <view>累计停车时长</view>
  46. <view>{{ orderInfo.duration || 0 }}</view>
  47. </view>
  48. <view class="parking-lock-info-item">
  49. <view>应缴金额</view>
  50. <view class="really-money">{{ orderInfo.payAmount || 0 }} 元</view>
  51. </view>
  52. <view class="parking-lock-info-item">
  53. <view>订单编号</view>
  54. <view>{{ orderInfo.orderId }}</view>
  55. </view>
  56. </view>
  57. <view class="parking-lock-pay-btn" v-if="is_pay && Number(orderInfo.payAmount) > 0">
  58. <button type="default" @click="payMoney">立即支付</button>
  59. </view>
  60. </view>
  61. </template>
  62. <template v-else-if="parkingLockStatus === 2">
  63. <view class="parking-lock-pay">
  64. <view class="parking-lock-tips">{{ tipsMsg }}</view>
  65. </view>
  66. </template>
  67. <!-- 支付方式 -->
  68. <PaymentMethod :payWayPop="payWayPop" :curOrderList="[orderId]" :jumpUrl="jumpUrl" :payeeId="payeeId"
  69. :payeeName="payeeName" @closePaymentMethod="closePaymentMethod"></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?.orderId
  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. }
  129. },
  130. onShow() {
  131. if (this.orderId) {
  132. this.getOrderDetails(this.spaceId, this.orderId, this.payeeId)
  133. if (this.polyOrderId && this.isBack == 1) {
  134. this.timer = setInterval(() => {
  135. this.show = true
  136. this.handlePayStatus(this.polyOrderId)
  137. }, 1000)
  138. }
  139. } else {
  140. this.show = false
  141. }
  142. },
  143. onUnload() {
  144. if (this.timer) {
  145. clearInterval(this.timer)
  146. }
  147. },
  148. methods: {
  149. jumpArrears() {
  150. uni.navigateTo({
  151. url: '../center/order/order?swiperIndex=2'
  152. })
  153. },
  154. /**
  155. * 反复查询支付状态
  156. * @param { String } orderId
  157. */
  158. handlePayStatus(orderId) {
  159. this.$u.api.getOrderInfo({
  160. orderId
  161. }).then(res => {
  162. if (res.code === 200) {
  163. if (res.data.payStatus === 1 || res.data.payStatus === 3) {
  164. this.show = false
  165. clearInterval(this.timer);
  166. this.is_pay = false
  167. uni.showModal({
  168. title: '提示',
  169. content: '支付成功,返回首页',
  170. showCancel: false,
  171. success: (res) => {
  172. if (res.confirm) {
  173. uni.switchTab({
  174. url: '/pages/index/index'
  175. })
  176. }
  177. }
  178. });
  179. } else if (res.data.payStatus === 2) {
  180. this.is_pay = true
  181. }
  182. } else {
  183. this.show = false
  184. clearInterval(this.timer);
  185. this.$refs.uToast.show({
  186. title: res.msg,
  187. type: 'error',
  188. });
  189. }
  190. }).catch(() => {
  191. this.show = false
  192. clearInterval(this.timer);
  193. })
  194. },
  195. /**
  196. * 立即支付
  197. */
  198. payMoney() {
  199. this.payWayPop = true
  200. },
  201. /**
  202. * 查询订单信息
  203. * @param { String } spaceId 车位ID
  204. * @param { String } orderId 订单id
  205. * @param { String } payeeId 收费员ID
  206. */
  207. getOrderDetails(spaceId, orderId, payeeId) {
  208. this.$u.api.geomaLockDetailsApi({
  209. spaceId,
  210. orderId,
  211. payeeId
  212. }).then(res => {
  213. if (res.code === 200 && res.data.id) {
  214. this.payeeName = res.data.payeeName
  215. this.parkingLockStatus = 1
  216. this.orderInfo = res.data
  217. this.show = false
  218. if (res.data.payStatus == 0 || res.data.payStatus == 2 || res.data.payStatus == 3) {
  219. this.is_pay = true
  220. } else if (res.data.payStatus == 1) {
  221. this.is_pay = false
  222. uni.showModal({
  223. title: '提示',
  224. content: '订单已支付,返回首页',
  225. showCancel: false,
  226. success: function(res) {
  227. if (res.confirm) {
  228. uni.switchTab({
  229. url: '/pages/index/index'
  230. })
  231. }
  232. }
  233. });
  234. }
  235. } else {
  236. this.$refs.uToast.show({
  237. title: res.msg || '订单无数据',
  238. type: 'error',
  239. });
  240. }
  241. })
  242. },
  243. /**
  244. * 关闭支付弹框
  245. */
  246. closePaymentMethod() {
  247. this.payWayPop = false
  248. }
  249. }
  250. }
  251. </script>
  252. <style lang="scss" scoped>
  253. @import './geomagnetismLock.scss';
  254. .Jump {
  255. position: fixed;
  256. top: 50px;
  257. right: 0;
  258. background-color: #F6F6FF;
  259. &-btn {
  260. color: rgb(0, 140, 255);
  261. padding: 20rpx 30rpx;
  262. }
  263. }
  264. </style>