From 21544c5c6d1dc913ba44edec8c001a2272233ec6 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期一, 25 十二月 2023 15:14:49 +0800
Subject: [PATCH] Mr.Shi

---
 bicycle/pages/index/index.vue |   97 +++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 90 insertions(+), 7 deletions(-)

diff --git a/bicycle/pages/index/index.vue b/bicycle/pages/index/index.vue
index f511ca6..e7339a9 100644
--- a/bicycle/pages/index/index.vue
+++ b/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
+						// 寰幆鏌ョ湅瑙i攣缁撴灉
+						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 @@
 					// 鎵爜瑙i攣楠戣
 					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 {

--
Gitblit v1.9.3