openCabinet.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <view class="container-view">
  3. <view class="open-bg-view">
  4. <img class="open-bg" src="https://qiniu.bms16.com/FqNzU4Wh2kry5H0EqC5zeM2thRFg" alt="">
  5. </view>
  6. <view class="explain-view">
  7. <view class="explain-num-view flex-row">
  8. <!-- <text><text class="explain-num">{{empty_door_id}} </text>号仓门已打开</text> -->
  9. <text>仓门已打开</text>
  10. <!-- <text v-if="list.status == 2">换电中</text>
  11. <text v-if="list.status == 3">换电成功</text>
  12. <text v-if="list.status == 4">换电失败</text> -->
  13. </view>
  14. <view class="explain-text">请存入更换电池,取走满电电池,并关好仓门</view>
  15. <!-- <view class="explain-text">请 归还 / 取出 电池并关上仓门</view> -->
  16. <!-- <view class="explain-text">请取出电池并关上仓门</view> -->
  17. <!-- <view class="explain-text-grap">归还完成后电柜会自动打开可租仓门</view> -->
  18. <!-- <view class="explain-text-grap">自动为您匹配最高电量电池</view> -->
  19. </view>
  20. <!-- 完成弹窗 -->
  21. <view v-if="isOverModal" class="modal-group">
  22. <view class="payment-info-main">
  23. <view class="payment-info-top flex-row">
  24. <!-- <img class="check-icon" :src="showtxt.img" alt=""> -->
  25. <img v-if="list.status==3" class="check-icon" src="https://qiniu.bms16.com/Fg5C4OVF17Q8p5-mHu7CoFne0Zqp" alt="">
  26. <img v-if="list.status==4" class="check-icon" src="https://qiniu.bms16.com/FmGcOOZZm09nx9lH3lez7D3DYHKn" alt="">
  27. </view>
  28. <view v-if="list.status==3" class="open-result-view">
  29. <view class="open-result flex-row">换电成功</view>
  30. <view class="open-result-tip flex-row">即将跳转至首页,祝您骑行愉快</view>
  31. </view>
  32. <view v-if="list.status==4" class="open-result-view">
  33. <view class="open-result flex-row">换电失败</view>
  34. <view class="open-result-tip flex-row">{{list.fail_reason}}</view>
  35. </view>
  36. <view class="over-btn-view">
  37. <view v-if="list.status==3" @tap="tapToIndex" class="over-btn flex-row">回到首页</view>
  38. <view v-if="list.status==4" @tap="connectStore" class="over-btn flex-row">联系门店</view>
  39. <view v-if="list.status==4" @click="srcFn(`/pages/carList/carList`)" class="over-btn flex-row">确认</view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. const http = require('../../common/request.js');
  47. const config = require('../../common/config_gyq.js');
  48. const common = require('../../common/common.js');
  49. var bluetooth = require('../../common/bluetooth.js');
  50. const DF_CAB_INFO_DONE = 10000; //机柜信息传输完成
  51. const app = getApp();
  52. export default {
  53. data() {
  54. return {
  55. isOverModal:false,
  56. order_sn: '',
  57. time: null,
  58. list: {}
  59. };
  60. },
  61. /**
  62. * 生命周期函数--监听页面加载
  63. */
  64. onLoad: function(options) {
  65. this.order_sn = options.order_sn
  66. this.exchangeStatusFn()
  67. this.time = setInterval(() => {
  68. this.exchangeStatusFn()
  69. }, 1200)
  70. },
  71. /**
  72. * 生命周期函数--监听页面显示
  73. */
  74. onShow: function() {
  75. },
  76. onUnload() {
  77. this.clearIntervalTimer()
  78. },
  79. methods: {
  80. srcFn(url){
  81. uni.redirectTo({
  82. url
  83. })
  84. },
  85. tapToIndex() {
  86. this.isOverModal = false
  87. uni.reLaunch({
  88. url: '/pages/index/index',
  89. })
  90. },
  91. connectStore() {
  92. uni.makePhoneCall({
  93. phoneNumber: this.list.link_phone //仅为示例
  94. });
  95. },
  96. clearIntervalTimer() {
  97. if (this.time == null) return
  98. clearInterval(this.time)
  99. this.time = null
  100. },
  101. async exchangeStatusFn() {
  102. let {
  103. data
  104. } = await http.postApi(config.API_FLK_CABINET_EXCHANGE_STATUS, {
  105. order_sn: this.order_sn
  106. })
  107. if (data.code == 200) {
  108. this.list = data.data.statusInfo
  109. if (data.data.statusInfo.status == 3 || data.data.statusInfo.status == 4) {
  110. this.clearIntervalTimer()
  111. this.isOverModal = true
  112. }
  113. } else {
  114. common.simpleToast(data.msg)
  115. }
  116. }
  117. }
  118. };
  119. </script>
  120. <style>
  121. @import './openCabinet.css';
  122. </style>