geomagnetismLock.vue 6.8 KB

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