openCabinet.vue 4.0 KB

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