From 069a551ee29c0340fe9d16492a2213ee53bd15da Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期四, 23 四月 2026 20:06:08 +0800
Subject: [PATCH] 支付宝支付ddd

---
 small-program/pages/index/index.vue |  161 +++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 125 insertions(+), 36 deletions(-)

diff --git a/small-program/pages/index/index.vue b/small-program/pages/index/index.vue
index a5dc843..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>
@@ -51,22 +51,29 @@
 			</view>
 
 			<view class="recommend-list">
-				<view v-for="(item, index) in pointList" :key="index" class="point-card" @click="goStoragePage(item)">
-					<view class="point-thumb">
-						<image class="point-thumb-image" :src="item.coverImg" mode="widthFix"></image>
-					</view>
-					<view class="point-main">
-						<view class="point-head">
-							<text class="point-name">{{ item.name }}</text>
-							<text class="point-distance">{{ item.distanceText }}</text>
+				<template v-if="pointList.length > 0">
+					<view v-for="(item, index) in pointList" :key="index" class="point-card" @click="goStoragePage(item)">
+						<view class="point-thumb">
+							<image class="point-thumb-image" :src="item.coverImg" mode="widthFix"></image>
 						</view>
-						<view class="point-address">
-							<image src="/static/icon/home_ic_location3@2x.png" mode="aspectFit"></image>
-							<text>{{ item.address }}</text>
+						<view class="point-main">
+							<view class="point-head">
+								<text class="point-name">{{ item.name }}</text>
+								<text class="point-distance">{{ item.distanceText }}</text>
+							</view>
+							<view class="point-address">
+								<image src="/static/icon/home_ic_location3@2x.png" mode="aspectFit"></image>
+								<text>{{ item.address }}</text>
+							</view>
+							<text class="point-time">{{ item.shopHours }}</text>
 						</view>
-						<text class="point-time">{{ item.shopHours }}</text>
 					</view>
-				</view>
+				</template>
+				<template v-else>
+					<view class="no-data">
+						<image src="/static/image/default_nodata_white@2x.png" mode="widthFix"></image>
+					</view>
+				</template>
 			</view>
 		</view>
 
@@ -77,13 +84,19 @@
 			</view>
 			<view class="toast-btn" @click="handleLocation">寮�鍚畾浣�</view>
 		</view>
+		<custom-tabbar></custom-tabbar>
 	</view>
 </template>
 
 <script>
 	import { mapState } from 'vuex'
+	import amapFile from '@/utils/amap-wx.130.js'
+	import CustomTabbar from '@/components/custom-tabbar/custom-tabbar.vue'
 
 	export default {
+		components: {
+			CustomTabbar
+		},
 		computed: {
 			...mapState(['navHeight', 'statusbarHeight', 'address', 'latitude', 'cityId', 'longitude']),
 			currentAddress() {
@@ -102,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'
 				})
@@ -140,6 +161,10 @@
 				}
 			},
 			jumpJC() {
+				if (!this.cityId) return uni.showToast({
+					title: '褰撳墠鍩庡競鏆傛湭寮�閫�',
+					icon: 'none'
+				})
 				uni.navigateTo({
 					url: '/pages/storage-point/storage-point'
 				})
@@ -154,6 +179,59 @@
 					}
 				});
 			},
+			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);
+					}
+				});
+			},
 			// 瀹氫綅
 			positioning() {
 				var that = this;
@@ -163,28 +241,23 @@
 					isHighAccuracy: true,
 					success: function (addr) {
 						const locParam = { latitude: addr.latitude, longitude: addr.longitude };
-						const qqmapsdk = new QQMapWX({
-							key: 'WE3BZ-HN6WS-ONDOH-62QCV-MNL6F-5NFNE'
-						});
-						qqmapsdk.reverseGeocoder({
-							locParam,
-							success: async function(res) {
-								console.log(res, '==================鑾峰彇鍦板潃');
-								let info = res.result;
-								locParam.province = info.address_component.province;
-								locParam.city = info.address_component.city;
-								locParam.area = info.address_component.district;
-								locParam.street = info.address_component.street;
-								var ta = info.address  || '鍦板潃鑾峰彇澶辫触' ;
-								if(info.formatted_addresses  && info.formatted_addresses.recommend){
-									ta =info.formatted_addresses.recommend
-								}
-								locParam.address = ta	
+						var myAmapFun = new amapFile.AMapWX({ key: 'f2e6c0bfcac14c27b4f0d6d0d5b9d7d' });
+						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.city;
+								locParam.area = info.district;
+								locParam.street = info.street;
+								var ta = info.name || '鍦板潃鑾峰彇澶辫触';
+								locParam.address = ta
 								const resCity = await that.$u.api.getCityByName({ cityName: locParam.city })
 								if (resCity.code === 200) {
 									locParam.cityId = resCity.data.id
-								}										
-								that.$store.commit('setPosition',locParam)
+								}
+								that.$store.commit('setPosition', locParam)
 								that.$isResolve()
 							},
 							fail: (err) => {
@@ -195,6 +268,10 @@
 				});
 			},
 			goStoragePage() {
+				if (!this.cityId) return uni.showToast({
+					title: '褰撳墠鍩庡競鏆傛湭寮�閫�',
+					icon: 'none'
+				})
 				uni.navigateTo({
 					url: '/pages/storage-point/storage-point'
 				})
@@ -410,6 +487,18 @@
 		margin-top: 32rpx;
 	}
 
+	.no-data {
+		width: 100%;
+		margin-top: 80rpx;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		image {
+			width: 320rpx;
+			height: 320rpx;
+		}
+	}
+
 	.point-card {
 		display: flex;
 		gap: 18rpx;

--
Gitblit v1.9.3