From 397d00d95a766ab838986edf6df4ea754474f0be Mon Sep 17 00:00:00 2001
From: web <candymxq888@outlook.com>
Date: 星期五, 11 七月 2025 15:49:16 +0800
Subject: [PATCH] fix:修改设备取水状态

---
 pages/device/index.vue |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/pages/device/index.vue b/pages/device/index.vue
index 10df413..85b2e9d 100644
--- a/pages/device/index.vue
+++ b/pages/device/index.vue
@@ -12,7 +12,8 @@
 						<view class="item-info">
 							<view class="info-name">
 								<view class="name">{{item.facilityName}}</view>
-								<view class="btn" @click="handleQushui(item.id)">取水</view>
+								<view class="btn" v-if="item.state === 2" @click="handleQushui(item.id)">取水</view>
+								<view v-else>设备使用中...</view>
 							</view>
 							<view class="info-addr" @click="openMap(item.lat,item.lon)">
 								<text class="addr-text">地址:{{item.address}}</text>
@@ -52,6 +53,8 @@
 	const facilityId = ref()
 	const qushuiNum = ref()
 	
+	let timer = null
+	
 	const getFacitilyList = () => {
 		const data = {
 			longitude: userLocation.value?.lon,
@@ -64,6 +67,12 @@
 				facitilyList.value = res.data.list
 			}
 		})
+		
+		// 重新挂在定时器
+		clearInterval(timer)
+		timer = setInterval(() => {
+			getFacitilyList()
+		}, 10000)
 	}
 	
 	// 取水
@@ -100,6 +109,7 @@
 					icon:'success'
 				})
 				dialogClose()
+				getFacitilyList()
 			}else{
 				uni.showToast({
 					title:res.msg,

--
Gitblit v1.9.3