MrShi
2023-12-25 21544c5c6d1dc913ba44edec8c001a2272233ec6
bicycle/pages/index/index.vue
@@ -27,7 +27,8 @@
               </image>
            </view>
            <view class="index_box_function">
               <view class="cXYC" v-for="(item, index) in functionList" :key="index" @click="jump(item)">
               <view class="cXYC" v-for="(item, index) in functionList" :key="index" @click.stop="jump(item)">
                  <button open-type="getPhoneNumber" @getphonenumber="getPhone" v-if="!userInfo.mobile"></button>
                  <image class="img80" :src="item.icon" mode="widthFix"></image>
                  <text class="f26 c3 mt10">{{item.name}}</text>
               </view>
@@ -273,15 +274,80 @@
         if (JSON.stringify(this.userInfo) == '{}') {
            await this.$onLaunched;
         }
         console.log(decodeURIComponent(options.scene))
         this.getAddress()
         this.getHomeInfo()
         this.getSite()
         await this.getAddress()
         await this.getHomeInfo()
         await this.getSite()
         if (decodeURIComponent(options.scene) !== 'undefined') {
            console.log(decodeURIComponent(options.scene))
            this.carRentalCopy(decodeURIComponent(options.scene))
         }
      },
      onPageScroll(e) {
         this.top = e.scrollTop
      },
      methods: {
         // 微信打开小程序开锁方法
         async carRentalCopy(code) {
            await this.refresh()
            // 判断有没有交押金
            if (this.info.depositStatus === 0) {
               this.show1 = true
               return;
            } else if (this.info.depositStatus === 2) {
               uni.showToast({ title: '结算申请提交成功,请耐心等待退款!', icon: 'none', duration: 2000 });
               return;
            }
            var that = this;
            if (!that.disable) {
               that.disable = true
               // 打开开锁弹框
               that.show5 = true
               // 调用开锁接口
               let res = await that.$u.api.openLock({
                  code: code
               })
               if (res.code === 200) {
                  that.disable = false
                  that.show6 = false
                  that.show5 = true
                  // 循环次数
                  var num = 1
                  // 循环查看解锁结果
                  let timer = setInterval(async () => {
                     num += 1
                     let res1 = await that.$u.api.refreshLock({
                        id: res.data.id
                     })
                     // 开锁成功
                     if (res1.data.status === 1) {
                        that.refresh()
                        clearInterval(timer)
                        that.show5 = false
                        setTimeout(() => {
                           that.show2 = true
                        }, 500)
                     }
                     // 开锁失败
                     if (res1.data.status === 3) {
                        that.refresh()
                        clearInterval(timer)
                        that.show5 = false
                        uni.showToast({ title: '开锁失败', icon: 'error', duration: 2000 });
                     }
                     // 开锁超时
                     if (num === 180) {
                        that.refresh()
                        clearInterval(timer)
                        that.show5 = false
                        uni.showToast({ title: '开锁超时', icon: 'error', duration: 2000 });
                     }
                  }, 1000)
               } else {
                  that.show5 = false
                  that.disable = false
               }
            }
         },
         jumpX() {
            uni.navigateTo({
               url: '/pages/leaseNotice/leaseNotice'
@@ -327,7 +393,7 @@
                     this.show3 = false
                     this.show6 = false
                     this.show7 = false
                     uni.showToast({ title: '结算申请提交成功,请耐心等待退款!', icon: 'success', duration: 2000 });
                     uni.showToast({ title: '结算申请提交成功,请耐心等待退款!', icon: 'none', duration: 2000 });
                     // this.refresh()
                  }
               }).finally(() => {
@@ -369,6 +435,7 @@
                  url: '/pages/consumptionDetails/consumptionDetails'
               });
            } else if (item.id === 2) {
               if (!this.userInfo.mobile) return
               if (this.info.rideStatus === 1) {
                  uni.showToast({ title: '骑行中不能结算押金', icon: 'none', duration: 2000 })
                  return
@@ -381,6 +448,7 @@
                  uni.showToast({ title: '您暂无押金,无需结算!', icon: 'none', duration: 2000 });
               }
            } else if (item.id === 1) {
               if (!this.userInfo.mobile) return
               if (this.info.depositStatus === 1) {
                  uni.showToast({ title: '押金已充值', icon: 'none', duration: 2000 });
                  return
@@ -493,11 +561,13 @@
               // 扫码解锁骑行
               uni.scanCode({
                  success: async function(result) {
                     let text = decodeURIComponent(result.path)
                     text = text.substring(text.lastIndexOf('?') + 7, text.length)
                     // 打开开锁弹框
                     that.show5 = true
                     // 调用开锁接口
                     let res = await that.$u.api.openLock({
                        code: result.result
                        code: text
                     })
                     if (res.code === 200) {
                        that.disable = false
@@ -943,6 +1013,19 @@
               text {
                  font-weight: 400;
               }
               .cXYC {
                  position: relative;
                  button {
                     width: 100%;
                     height: 100%;
                     position: absolute;
                     top: 0;
                     left: 0;
                     background-color: rgba(0,0,0,0);
                     border: none;
                     opacity: 0;
                  }
               }
            }
            .index_box_poster {