From 2e3ab7fbbb336cf11ed37b8b0a7871976d597564 Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期三, 22 四月 2026 20:06:51 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 small-program/pages/index/index.vue |   77 ++++++++++++++++++++++++++++++++++++--
 1 files changed, 73 insertions(+), 4 deletions(-)

diff --git a/small-program/pages/index/index.vue b/small-program/pages/index/index.vue
index c045e6a..97d7090 100644
--- a/small-program/pages/index/index.vue
+++ b/small-program/pages/index/index.vue
@@ -4,14 +4,14 @@
 		<view class="top-hero">
 			<view :style="{ height: statusbarHeight + 'px' }"></view>
 			<view class="hero-bar" :style="{ height: navHeight + 'px' }">
-				<view class="location-chip" @tap="handleLocation">
+				<view class="location-chip" @click="chooseLocation">
 					<image src="/static/icon/home1_ic_location@2x.png" mode="aspectFit"></image>
 					<text>{{ currentAddress }}</text>
 					<u-icon name="arrow-right" size="14" color="#ffffff"></u-icon>
 				</view>
 			</view>
 
-			<view class="search-box" @tap="goStoragePage">
+			<view class="search-box" @click="goStoragePage">
 				<image src="/static/icon/home_ic_search@2x.png" mode="aspectFit"></image>
 				<text class="search-text">鎼滅储瀵勫瓨鐐瑰悕绉版垨鍦板潃</text>
 			</view>
@@ -115,13 +115,21 @@
 		async onLoad() {
 			await this.$onLaunched
 			await this.getBannerList()
-			await this.getNearbyShopList()
+			if (this.cityId && this.latitude && this.longitude) {
+				await this.getNearbyShopList()
+			}
 		},
 		onReachBottom() {
-			this.getNearbyShopList()
+			if (this.cityId && this.latitude && this.longitude) {
+				this.getNearbyShopList()
+			}
 		},
 		methods: {
 			jumpxiadan() {
+				if (!this.cityId) return uni.showToast({
+					title: '褰撳墠鍩庡競鏆傛湭寮�閫�',
+					icon: 'none'
+				})
 				uni.navigateTo({
 					url: '/pages/luggage-storage/luggage-storage'
 				})
@@ -153,6 +161,10 @@
 				}
 			},
 			jumpJC() {
+				if (!this.cityId) return uni.showToast({
+					title: '褰撳墠鍩庡競鏆傛湭寮�閫�',
+					icon: 'none'
+				})
 				uni.navigateTo({
 					url: '/pages/storage-point/storage-point'
 				})
@@ -164,6 +176,59 @@
 						if (res.authSetting['scope.userLocation']) {
 							that.positioning()
 						}
+					}
+				});
+			},
+			chooseLocation() {
+				var that = this;
+				uni.chooseLocation({
+					type: 'gcj02',
+					success: async function(addr) {
+						if (addr.errMsg === 'chooseLocation:ok' && addr.latitude) {
+							const locParam = { latitude: addr.latitude, longitude: addr.longitude };
+							// uni.setStorageSync('address', locParam);
+							
+							var myAmapFun = new amapFile.AMapWX({ key: 'e4d46c87adf151dca20060317592b1b6' });
+							myAmapFun.getRegeo({
+								location: addr.longitude + ',' + addr.latitude,
+								success: async function(data) {
+									console.log(data, '==================閫夋嫨鍦板潃閫嗚В鏋�');
+									let info = data[0];
+									locParam.province = info.province;
+									locParam.city = (info.regeocodeData.addressComponent.city && typeof info.regeocodeData.addressComponent.city === 'string') 
+										? info.regeocodeData.addressComponent.city 
+										: info.regeocodeData.addressComponent.province;
+									var ta = info.name || '鍦板潃鑾峰彇澶辫触';
+									locParam.address = ta
+									const resCity = await that.$u.api.getCityByName({ cityName: locParam.city })
+									if (resCity.code === 200 && resCity.data) {
+										locParam.cityId = resCity.data.id
+										that.$store.commit('setPosition', locParam)
+										that.page = 1
+										that.pointList = []
+										that.isRequest = true
+										that.getNearbyShopList()
+									} else {
+										that.$store.commit('setPosition', locParam)
+										that.$store.commit('clearCityId')
+										that.page = 1
+										that.pointList = []
+										that.isRequest = true
+									}
+								},
+								fail: function(err) {
+									console.error('鑾峰彇浣嶇疆澶辫触===========', err);
+									that.$store.commit('setPosition', locParam)
+									that.page = 1
+									that.pointList = []
+									that.isRequest = true
+									// that.getNearbyShopList()
+								}
+							});
+						}
+					},
+					fail: function(err) {
+						console.error('閫夋嫨浣嶇疆澶辫触===========', err);
 					}
 				});
 			},
@@ -203,6 +268,10 @@
 				});
 			},
 			goStoragePage() {
+				if (!this.cityId) return uni.showToast({
+					title: '褰撳墠鍩庡競鏆傛湭寮�閫�',
+					icon: 'none'
+				})
 				uni.navigateTo({
 					url: '/pages/storage-point/storage-point'
 				})

--
Gitblit v1.9.3