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 |  126 +++++++++++++++++++++++++++++++++++++----
 1 files changed, 112 insertions(+), 14 deletions(-)

diff --git a/bicycle/pages/index/index.vue b/bicycle/pages/index/index.vue
index 06a0229..e7339a9 100644
--- a/bicycle/pages/index/index.vue
+++ b/bicycle/pages/index/index.vue
@@ -8,7 +8,7 @@
 				<view class="index_nav_a" :style="{ height: statusbarHeight + 'px' }"></view>
 				<view :style="{ height: navHeight + 'px' }"></view>
 				<view class="index_nav_b" :style="{ height: navHeight + 'px', lineHeight: navHeight + 'px', top: statusbarHeight + 'px' }">
-					<text>鍗拌薄婊ㄦ箹鑷杞�</text>
+					<text>鍗拌薄婊ㄦ箹瓒e懗鑷杞�</text>
 				</view>
 			</view>
 			<view class="index_box">
@@ -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>
@@ -36,7 +37,7 @@
 					<image class="imgfull" :src="info.leaseNoticeUrl" mode="widthFix"></image>
 				</view>
 				<view class="index_box_video" v-if="info.leaseVideoUrl">
-					<video class="img100b" :show-play-btn="false" :src="info.leaseVideoUrl" enable-danmu danmu-btn controls></video>
+					<video class="img100b" :src="info.leaseVideoUrl" enable-danmu danmu-btn controls></video>
 				</view>
 				<view style="width: 100%; height: calc(env(safe-area-inset-bottom) + 600rpx);" v-if="show5"></view>
 				<view style="width: 100%; height: calc(env(safe-area-inset-bottom) + 660rpx);" v-if="show6"></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,22 +393,27 @@
 							this.show3 = false
 							this.show6 = false
 							this.show7 = false
-							uni.showToast({ title: '缁撶畻鎴愬姛锛�', icon: 'success', duration: 2000 });
-							this.refresh()
+							uni.showToast({ title: '缁撶畻鐢宠鎻愪氦鎴愬姛锛岃鑰愬績绛夊緟閫�娆撅紒', icon: 'none', duration: 2000 });
+							// this.refresh()
 						}
 					}).finally(() => {
+						this.refresh()
+						this.show3 = false
 						this.isDisabled = true
 					})
 				}
 			},
 			minute() {
 				this.show3 = false
-				console.log(this.info.rideStatus)
 				if (this.info.rideStatus != -1) {
 					this.show6 = true
 				}
 			},
 			settlement() {
+				if (this.info.depositStatus === 2) {
+					uni.showToast({ title: '缁撶畻鐢宠鎻愪氦鎴愬姛锛岃鑰愬績绛夊緟閫�娆撅紒', icon: 'none', duration: 2000 });
+					return
+				}
 				this.show6 = false
 				this.show3 = true
 			},
@@ -353,7 +424,8 @@
 				});
 			},
 			// 璺宠浆
-			jump(item) {
+			async jump(item) {
+				await this.refresh()
 				if (item.id === 3) {
 					uni.navigateTo({
 						url: '/pages/pricingRules/pricingRules'
@@ -363,18 +435,25 @@
 						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
 					} 
 					if (this.info.depositStatus === 1) {
 						this.show3 = true
+					} else if (this.info.depositStatus === 2) {
+						uni.showToast({ title: '缁撶畻鐢宠鎻愪氦鎴愬姛锛岃鑰愬績绛夊緟閫�娆撅紒', icon: 'none', duration: 2000 });
 					} else {
 						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
+					} else if (this.info.depositStatus === 2) {
+						uni.showToast({ title: '缁撶畻鐢宠鎻愪氦鎴愬姛锛岃鑰愬績绛夊緟閫�娆撅紒', icon: 'none', duration: 2000 });
 						return
 					}
 					this.show1 = true
@@ -404,7 +483,7 @@
 									wx.requestPayment({
 										timeStamp: res.data.timeStamp,
 										nonceStr: res.data.nonceStr,
-										package: res.data.packageValue,
+										package: res.data.packageVal,
 										signType: 'MD5',
 										paySign: res.data.paySign,
 										success (res) {
@@ -466,10 +545,14 @@
 				}
 			},
 			// 鎵爜绉熻溅
-			carRental() {
+			async carRental() {
+				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;
@@ -478,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
@@ -928,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