From 00a7a61df86db969f2ba61c508d02ba4709ce3d4 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期五, 05 六月 2026 10:09:06 +0800
Subject: [PATCH] 改bug

---
 small-program/pages/index/index.vue |  297 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 266 insertions(+), 31 deletions(-)

diff --git a/small-program/pages/index/index.vue b/small-program/pages/index/index.vue
index c045e6a..af69cb0 100644
--- a/small-program/pages/index/index.vue
+++ b/small-program/pages/index/index.vue
@@ -1,24 +1,24 @@
 <template>
 	<view class="index-page">
-		<view class="top-gradient-bg" :style="{ backgroundImage: 'url(' + backgroundImage + ')' }"></view>
+		<image class="top-gradient-bg" src="/static/image/bg_home@2x.png" mode="aspectFill"></image>
 		<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>
 
 			<view class="banner-card hero-banner">
 				<swiper class="banner-swiper" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="500" :circular="true" :indicator-color="'rgba(255, 255, 255, 0.5)'" :indicator-active-color="'#ffffff'">
-                <swiper-item v-for="(item, index) in bannerList" :key="index">
+                <swiper-item v-for="(item, index) in bannerList" :key="index" @click="jumpBannerDetail(item)">
                     <image class="banner-image" :src="item.imgurlFull" mode="aspectFill"></image>
                 </swiper-item>
             </swiper>
@@ -30,18 +30,18 @@
 				<view class="service-card deposit-card" @click="jumpxiadan">
 					<image class="service-image" src="/static/image/home_ic_jicun@2x.png" mode="aspectFit"></image>
 				</view>
-				<view class="service-card retrieve-card">
+				<view class="service-card retrieve-card"  @click="jumpOrderList(3)">
 					<image class="service-image" src="/static/image/home_ic_qujian@2x.png" mode="aspectFit"></image>
 				</view>
 			</view>
 
-			<view class="notice-card">
+			<view class="notice-card" v-if="ingOrder && ingOrder.orderId" @click="jumpOrderDetail(ingOrder.orderId)">
 				<view class="notice-icon-wrap">
 					<image src="/static/icon/home_ic_daizhifu@2x.png" mode="aspectFit"></image>
 				</view>
 				<view class="notice-copy">
-					<text class="notice-title">寰呮敮浠�</text>
-					<text class="notice-text">璇峰湪 10 鍒嗛挓鍐呭畬鎴愭敮浠橈紝瓒呮椂璁㈠崟灏嗚嚜鍔ㄥ彇娑�</text>
+					<text class="notice-title">{{ingOrder.statusDesc || ''}}</text>
+					<text class="notice-text">{{ingOrder.tip || ''}}</text>
 				</view>
 			</view>
 
@@ -49,23 +49,34 @@
 				<text class="section-title">鎺ㄨ崘瀵勫瓨鐐�</text>
 				<text class="section-more" @click="jumpJC">鏌ョ湅鏇村</text>
 			</view>
+			
+			<scroll-view class="label-list" scroll-x="true">
+				<view class="list-item" v-for="(item, index) in tagShopList" :key="index">
+					<text class="tag-name">{{ item.tagName }}</text>
+					<text>{{ item.shopCount }}</text>
+					<image src="/static/icon/ic_box@2x.png" mode="widthFix"></image>
+				</view>
+			</scroll-view>
 
 			<view class="recommend-list">
 				<template v-if="pointList.length > 0">
-					<view v-for="(item, index) in pointList" :key="index" class="point-card" @click="goStoragePage(item)">
+					<view v-for="(item, index) in pointList" :key="index" class="point-card" @click="goShopDetails(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>
+								<text class="point-name">{{ item.name ||'' }}</text>
+								<text class="point-distance">{{ item.distanceText  ||''}}</text>
+							</view>
+							<view class="point-tips" v-if="item.locationTagNames && item.locationTagNames.length > 0">
+								<view class="point-tips-item" v-for="(tag, idx) in item.locationTagNames" :key="idx">{{ tag }}</view>
 							</view>
 							<view class="point-address">
 								<image src="/static/icon/home_ic_location3@2x.png" mode="aspectFit"></image>
-								<text>{{ item.address }}</text>
+								<text>{{ item.address ||''}}</text>
 							</view>
-							<text class="point-time">{{ item.shopHours }}</text>
+							<text class="point-time">{{ item.shopHours ||'' }}</text>
 						</view>
 					</view>
 				</template>
@@ -84,6 +95,7 @@
 			</view>
 			<view class="toast-btn" @click="handleLocation">寮�鍚畾浣�</view>
 		</view>
+		<auth-login :show="showLogin" @close="showLogin = false"></auth-login>
 		<custom-tabbar></custom-tabbar>
 	</view>
 </template>
@@ -98,30 +110,118 @@
 			CustomTabbar
 		},
 		computed: {
-			...mapState(['navHeight', 'statusbarHeight', 'address', 'latitude', 'cityId', 'longitude']),
+			...mapState(['navHeight', 'statusbarHeight', 'address', 'latitude', 'cityId', 'longitude', 'token']),
 			currentAddress() {
 				return this.address && this.address !== '瀹氫綅涓�' ? this.address : '鑾峰彇瀹氫綅'
 			}
 		},
 		data() {
 			return {
-				backgroundImage: require('@/static/image/bg_home@2x.png'),
 				bannerList: [],
 				pointList: [],
-				page: 1,
-				isRequest: true
+				tagShopList: [],
+				ingOrder: null,
+				showLogin: false,
+				pendingNavigate: null,
+				lastLocationAuth: null
 			}
 		},
 		async onLoad() {
 			await this.$onLaunched
 			await this.getBannerList()
-			await this.getNearbyShopList()
+			if (this.cityId && this.latitude && this.longitude) {
+				await this.getNearbyShopList()
+			}
+			await this.getTagShopCount()
 		},
-		onReachBottom() {
-			this.getNearbyShopList()
+		onShow() {
+			this.ingOrder =null
+			this.getIngorder()
+			this.checkLocationAuth()
+		},
+		watch: {
+			token(newToken) {
+				if (newToken && this.pendingNavigate) {
+					const fn = this.pendingNavigate
+					this.pendingNavigate = null
+					this.showLogin = false
+					fn()
+				}
+			},
+			cityId() {
+				this.getTagShopCount()
+			}
 		},
 		methods: {
+			async getTagShopCount() {
+				if (!this.cityId) return
+				const res = await this.$u.api.locationTagShopCount({ cityId: this.cityId })
+				if (res.code === 200) {
+					this.tagShopList = res.data || []
+				}
+			},
+			async checkLocationAuth() {
+				const _this = this
+				uni.getSetting({
+					success(res) {
+						const authLocation = res.authSetting['scope.userLocation']
+						if (_this.lastLocationAuth !== null && _this.lastLocationAuth !== authLocation) {
+							if (authLocation) {
+								_this.positioning()
+							}
+						}
+						_this.lastLocationAuth = authLocation
+					}
+				})
+			},
+			async getIngorder() {
+				var that =this
+				let res = await that.$u.api.getActiveOrderTip()
+				if (res && res.code === 200) { 
+					this.ingOrder = res.data
+				} 
+			},
+			jumpBannerDetail(item) {
+				if(!item.content || item.content =='' || item.type==0){
+					return
+				}
+				if (item.type == 1) {
+					uni.navigateTo({
+						url: '/shop/pages/article-details/article-details?id=' + item.id
+					})
+				} else if(item.type == 2) {
+					uni.navigateTo({
+						url: '/shop/pages/webview/webview?url=' + item.content
+					})
+				}
+			},
+			jumpOrderDetail(id){
+				uni.navigateTo({
+					url:'/pages/delivery-order-detail/delivery-order-detail?userType=0&id='+id
+				})
+			},
+			jumpOrderList(status){
+				if (!this.token) {
+					this.pendingNavigate = () => this.jumpOrderList(status)
+					this.showLogin = true
+					return
+				}
+				uni.setStorageSync("orderStatus",status)
+				// uni.$emit('shuaxin', status)
+				uni.switchTab({
+					url: '/pages/itinerary/itinerary'
+				})
+			},
 			jumpxiadan() {
+				if (!this.token) {
+					this.pendingNavigate = () => this.jumpxiadan()
+					this.showLogin = true
+					return
+				}
+				if (!this.cityId) return uni.showToast({
+					title: '褰撳墠鍩庡競鏆傛湭寮�閫�',
+					icon: 'none'
+				})
 				uni.navigateTo({
 					url: '/pages/luggage-storage/luggage-storage'
 				})
@@ -133,10 +233,9 @@
 				}
 			},
 			async getNearbyShopList() {
-				if (!this.isRequest) return;
 				const res = await this.$u.api.getNearbyShopList({
-					capacity: 10,
-					page: this.page,
+					capacity: 5,
+					page: 1,
 					model: {
 						latitude: this.latitude,
 						longitude: this.longitude,
@@ -145,14 +244,20 @@
 					}
 				})
 				if (res.code === 200) {
-					this.pointList = res.data.records || []
-					this.page++
-					if (res.data.total <= this.pointList.length) {
-						this.isRequest = false
-					}
+					const list = res.data.records || []
+					list.forEach(item => {
+						if (item.locationTagNames) {
+							item.locationTagNames = item.locationTagNames.split(',')
+						}
+					})
+					this.pointList = list
 				}
 			},
 			jumpJC() {
+				if (!this.cityId) return uni.showToast({
+					title: '褰撳墠鍩庡競鏆傛湭寮�閫�',
+					icon: 'none'
+				})
 				uni.navigateTo({
 					url: '/pages/storage-point/storage-point'
 				})
@@ -167,6 +272,53 @@
 					}
 				});
 			},
+			chooseLocation() {
+				uni.navigateTo({
+					url: '/shop/pages/storage-point/storage-point'
+				})
+				// var that = this;
+				// uni.chooseLocation({
+				// 	type: 'gcj02',
+				// 	success: async function(addr) {
+				// 		console.log(addr, '==================uniapp閫夋嫨浣嶇疆鎴愬姛');
+				// 		if (addr.errMsg === 'chooseLocation:ok' && addr.latitude) {
+				// 			const locParam = { latitude: addr.latitude, longitude: addr.longitude };
+				// 			var myAmapFun = new amapFile.AMapWX({ key: that.$gaodeMapKey });
+				// 			myAmapFun.getRegeo({
+				// 				location: addr.longitude + ',' + addr.latitude,
+				// 				success: async function(data) {
+				// 					console.log(data, '==================閫夋嫨鍦板潃閫嗚В鏋�');
+				// 					let info = data[0];
+				// 					locParam.province = info.province;
+				// 					locParam.adcode = info.regeocodeData.addressComponent.adcode
+				// 					var ta = addr.name || '鍦板潃鑾峰彇澶辫触';
+				// 					locParam.address = ta
+				// 					const resCity = await that.$u.api.getCityByName({ code: locParam.adcode })
+				// 					if (resCity.code === 200 && resCity.data) {
+				// 						locParam.cityId = resCity.data.id
+				// 						that.$store.commit('setPosition', locParam)
+				// 						that.pointList = []
+				// 						that.getNearbyShopList()
+				// 					} else {
+				// 						that.$store.commit('setPosition', locParam)
+				// 						that.$store.commit('clearCityId')
+				// 						that.pointList = []
+				// 					}
+				// 				},
+				// 				fail: function(err) {
+				// 					console.error('鑾峰彇浣嶇疆澶辫触===========', err);
+				// 					that.$store.commit('setPosition', locParam)
+				// 					that.pointList = []
+				// 					that.getNearbyShopList()
+				// 				}
+				// 			});
+				// 		}
+				// 	},
+				// 	fail: function(err) {
+				// 		console.error('閫夋嫨浣嶇疆澶辫触===========', err);
+				// 	}
+				// });
+			},
 			// 瀹氫綅
 			positioning() {
 				var that = this;
@@ -176,23 +328,25 @@
 					isHighAccuracy: true,
 					success: function (addr) {
 						const locParam = { latitude: addr.latitude, longitude: addr.longitude };
-						var myAmapFun = new amapFile.AMapWX({ key: 'f2e6c0bfcac14c27b4f0d6d0d5b9d7d' });
+						var myAmapFun = new amapFile.AMapWX({ key: that.$gaodeMapKey });
 						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.adcode = info.regeocodeData.addressComponent.adcode;
 								locParam.area = info.district;
 								locParam.street = info.street;
+								locParam.cityName = info.regeocodeData.addressComponent.city;
 								var ta = info.name || '鍦板潃鑾峰彇澶辫触';
 								locParam.address = ta
-								const resCity = await that.$u.api.getCityByName({ cityName: locParam.city })
+								const resCity = await that.$u.api.getCityByName({ code: locParam.adcode })
 								if (resCity.code === 200) {
 									locParam.cityId = resCity.data.id
 								}
 								that.$store.commit('setPosition', locParam)
+								that.getNearbyShopList()
 								that.$isResolve()
 							},
 							fail: (err) => {
@@ -202,7 +356,16 @@
 					}
 				});
 			},
+			goShopDetails(item){
+				uni.navigateTo({
+					url: '/pages/storage-point-detail/storage-point-detail?id='+item.id
+				})
+			},
 			goStoragePage() {
+				if (!this.cityId) return uni.showToast({
+					title: '褰撳墠鍩庡競鏆傛湭寮�閫�',
+					icon: 'none'
+				})
 				uni.navigateTo({
 					url: '/pages/storage-point/storage-point'
 				})
@@ -398,6 +561,56 @@
 		justify-content: space-between;
 		margin-top: 40rpx;
 	}
+	
+	.label-list {
+		width: 100%;
+		margin-top: 30rpx;
+		white-space: nowrap;
+		.list-item {
+			width: 210rpx;
+			height: 120rpx;
+			padding: 16rpx 20rpx;
+			box-sizing: border-box;
+			background: #E6F7FF;
+			border-radius: 16rpx;
+			position: relative;
+			display: inline-flex;
+			flex-direction: column;
+			justify-content: space-between;
+			margin-right: 20rpx;
+			vertical-align: middle;
+			text {
+				&:nth-child(1) {
+					font-weight: 400;
+					font-size: 26rpx;
+					color: #10B2FA;
+				}
+				&:nth-child(2) {
+					font-weight: 600;
+					font-size: 34rpx;
+					color: #222222;
+				}
+			}
+			image {
+				width: 76rpx;
+				height: 62rpx;
+				position: absolute;
+				bottom: 0;
+				right: 0;
+			}
+		}
+	}
+	
+	.label-list::-webkit-scrollbar {
+		display: none;
+	}
+	
+	.tag-name {
+		overflow: hidden;
+		text-overflow: ellipsis;
+		white-space: nowrap;
+		max-width: 170rpx;
+	}
 
 	.section-title {
 		font-size: 36rpx;
@@ -465,6 +678,28 @@
 		gap: 10rpx;
 	}
 
+	.point-tips {
+		width: 100%;
+		display: flex;
+		align-items: center;
+		margin-top: 12rpx;
+		.point-tips-item {
+			width: 130rpx;
+			height: 36rpx;
+			line-height: 36rpx;
+			text-align: center;
+			border-radius: 8rpx;
+			font-weight: 400;
+			font-size: 20rpx;
+			color: #10B2FA;
+			margin-right: 12rpx;
+			border: 1rpx solid #10B2FA;
+			white-space: nowrap;
+			overflow: hidden;
+			text-overflow: ellipsis;
+		}
+	}
+
 	.point-name {
 		flex: 1;
 		font-size: 32rpx;

--
Gitblit v1.9.3