From 825418425a91c4cf95e56c3fbaf06ea9fb5a37d8 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期六, 28 二月 2026 09:41:21 +0800
Subject: [PATCH] 合并

---
 mini-program/pages/index/index.vue |   75 +++++++++++++++++++++++++++----------
 1 files changed, 55 insertions(+), 20 deletions(-)

diff --git a/mini-program/pages/index/index.vue b/mini-program/pages/index/index.vue
index caa8ba7..3b24c1f 100644
--- a/mini-program/pages/index/index.vue
+++ b/mini-program/pages/index/index.vue
@@ -6,7 +6,7 @@
 				<view :style="{ width: '100%', height: statusbarHeight + 'px' }"></view>
 				<view class="head-bar-nav" :style="{ height: navHeight + 'px' }" @click="openLoacing">
 					<image src="/static/icon/home_ic_location@2x.png" mode="widthFix"></image>
-					<text>鑾茶姳绉戞妧鍒涙柊浜т笟鍥璅搴�</text>
+					<text>{{position.formatted_addresses.recommend}}</text>
 					<u-icon name="arrow-right" color="#222222" size="13"></u-icon>
 				</view>
 			</view>
@@ -20,7 +20,7 @@
 			<u-scroll-list indicatorActiveColor="#004096">
 				<view class="scroll-list">
 					<view class="scroll-list__line" v-for="(item, index) in labels" :key="index">
-						<view class="cate-item" v-for="(child, index) in item" :key="index">
+						<view class="cate-item" v-for="(child, a) in item" :key="a" @click="jumpSearch1(child, 1)">
 							<view class="cate-item-image">
 								<image :src="child.imgUrl" mode="widthFix"></image>
 							</view>
@@ -35,7 +35,7 @@
 			<u-scroll-list indicatorActiveColor="#004096">
 				<view class="scroll-list" style="padding: 0;">
 					<view class="scroll-list__line" v-for="(item, index) in brand" :key="index">
-						<view class="cate-item1" v-for="(child, index) in item" :key="index">
+						<view class="cate-item1" v-for="(child, a) in item" :key="a" @click="jumpSearch1(child, 2)">
 							<image :src="child.imgUrl" mode="widthFix"></image>
 							<text>{{child.name}}</text>
 						</view>
@@ -44,22 +44,22 @@
 			</u-scroll-list>
 			<view class="title">
 				<view class="title-left">鍝佽川涓撳尯</view>
-				<view class="title-right">
+				<view class="title-right" @click="toZhuanqu">
 					<text>鏇村</text>
 					<u-icon name="arrow-right" color="#AAAAAA" size="10"></u-icon>
 				</view>
 			</view>
 			<view class="quality">
 				<view class="quality-item" @click="jumpShopZ(specialZone[0])">
-					<image class="quality-item-image" :src="specialZone[0].imgUrl" mode="widthFix"></image>
+					<image class="quality-item-image" :src="specialZone[0].imgUrl || '/static/icon/default2.png'" mode="widthFix"></image>
 				</view>
 				<view style="width: 22rpx; height: 100%;"></view>
 				<view class="quality-item">
 					<view class="quality-item-row" @click="jumpShopZ(specialZone[1])">
-						<image class="quality-item-row-image" :src="specialZone[1].imgUrl" mode="widthFix"></image>
+						<image class="quality-item-row-image" :src="specialZone[1].imgUrl || '/static/icon/default2.png'" mode="widthFix"></image>
 					</view>
 					<view class="quality-item-row" @click="jumpShopZ(specialZone[2])">
-						<image class="quality-item-row-image" :src="specialZone[2].imgUrl" mode="widthFix"></image>
+						<image class="quality-item-row-image" :src="specialZone[2].imgUrl || '/static/icon/default2.png'" mode="widthFix"></image>
 					</view>
 				</view>
 			</view>
@@ -69,7 +69,7 @@
 			<view class="commodity">
 				<view class="commodity-item" v-for="(item, i) in goodsList" :key="i" @click="jumpDetails(item.id)">
 					<view class="commodity-item-image">
-						<image :src="item.imgurl" mode="widthFix"></image>
+						<image :src="item.imgurl || '/static/icon/default2.png'" mode="widthFix"></image>
 					</view>
 					<view class="commodity-item-box">
 						<view class="commodity-item-box-title">
@@ -86,7 +86,7 @@
 						</view>
 						<view class="commodity-item-shou">
 							<text>宸插敭{{item.saleNum + item.realSaleNum}}</text>
-							<view class="commodity-item-shou-add">+</view>
+							<view class="commodity-item-shou-add" @click.stop="addCard(item)">+</view>
 						</view>
 					</view>
 				</view>
@@ -143,6 +143,22 @@
 			this.getGoodsList()
 		},
 		methods: {
+			toZhuanqu() {
+				uni.navigateTo({
+					url: '/pages/zhuanqu/zhuanqu'
+				})
+			},
+			addCard(e) {
+				this.$u.api.addCart({
+					goodsId: e.id,
+					goodsSkuId: e.goodsSkuResponseList[0].id,
+					num: 1
+				}).then(res => {
+					if (res.code === 200) {
+						uni.showToast({ title: '娣诲姞鎴愬姛', icon: 'success' })
+					}
+				})
+			},
 			jumpDetails(id) {
 				uni.navigateTo({
 					url: '/pages/details/details?id=' + id
@@ -179,7 +195,7 @@
 				this.$u.api.getGoodsLabelsByType({ type: 12 })
 					.then(res => {
 						if (res.code === 200) {
-							this.specialZone = res.data
+							this.specialZone = res.data.length > 0 ? res.data.slice(0, 3) : []
 						}
 					})
 			},
@@ -249,10 +265,19 @@
 					highAccuracyExpireTime: 3000,
 					isHighAccuracy: true,
 					success: function(addr) {
+						
+					}
+				});
+			},
+			openLoacing() {
+				var that = this;
+				uni.chooseLocation({
+					success(res1) {
 						const locParam = {
-							latitude: addr.latitude,
-							longitude: addr.longitude
+							latitude: res1.latitude,
+							longitude: res1.longitude
 						};
+						console.log(locParam)
 						const qqmapsdk = new QQMapWX({
 							key: 'HEIBZ-QJLLM-SZ36X-6ZBHI-S6Y2J-S6FND'
 						});
@@ -260,19 +285,13 @@
 						qqmapsdk.reverseGeocoder({
 							locParam,
 							success: function(res) {
-								console.log(res, '==================鑾峰彇鍦板潃');
+								console.log(res,  '==================index鑾峰彇鍦板潃')
+								that.$store.commit('setPosition', res.result)
 							},
 							fail: (err) => {
 								console.error('鑾峰彇浣嶇疆澶辫触===========', err);
 							}
 						});
-					}
-				});
-			},
-			openLoacing() {
-				uni.chooseLocation({
-					success(res) {
-						console.log(res)
 					}
 				})
 			},
@@ -280,6 +299,18 @@
 				uni.navigateTo({
 					url: '/pages/search/search'
 				})
+			},
+			jumpSearch1(row, type) {
+				console.log(row)
+				if (type === 1) {
+					uni.navigateTo({
+						url: '/pages/search/search?categoryId=' + row.id
+					})
+				} else {
+					uni.navigateTo({
+						url: '/pages/search/search?applicableBrandId=' + row.id
+					})
+				}
 			}
 		}
 	}
@@ -369,10 +400,14 @@
 					}
 
 					text {
+						max-width: 400rpx;
 						font-weight: 500;
 						font-size: 32rpx;
 						color: #111111;
 						margin-right: 8rpx;
+						white-space: nowrap;
+						overflow: hidden;
+						text-overflow: ellipsis;
 					}
 				}
 			}

--
Gitblit v1.9.3