From b099e758396f61b39d24cf5fa6be7bb0d10c2b4d Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期一, 18 五月 2026 19:16:26 +0800
Subject: [PATCH] 提交
---
small-program/pages/index/index.vue | 145 +++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 129 insertions(+), 16 deletions(-)
diff --git a/small-program/pages/index/index.vue b/small-program/pages/index/index.vue
index df092fb..c5a7244 100644
--- a/small-program/pages/index/index.vue
+++ b/small-program/pages/index/index.vue
@@ -49,6 +49,14 @@
<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">
@@ -60,6 +68,9 @@
<view class="point-head">
<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>
@@ -108,9 +119,11 @@
return {
bannerList: [],
pointList: [],
+ tagShopList: [],
ingOrder: null,
showLogin: false,
- pendingNavigate: null
+ pendingNavigate: null,
+ lastLocationAuth: null
}
},
async onLoad() {
@@ -119,10 +132,12 @@
if (this.cityId && this.latitude && this.longitude) {
await this.getNearbyShopList()
}
+ await this.getTagShopCount()
},
onShow() {
this.ingOrder =null
this.getIngorder()
+ this.checkLocationAuth()
},
watch: {
token(newToken) {
@@ -132,9 +147,40 @@
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
@@ -153,13 +199,6 @@
uni.navigateTo({
url:'/pages/delivery-order-detail/delivery-order-detail?userType=0&id='+id
})
- },
- async getIngorder(){
- var that =this
- let res = await that.$u.api.getActiveOrderTip()
- if (res && res.code === 200) {
- this.ingOrder = res.data
- }
},
jumpOrderList(status){
if (!this.token) {
@@ -204,7 +243,13 @@
}
})
if (res.code === 200) {
- this.pointList = res.data.records || []
+ const list = res.data.records || []
+ list.forEach(item => {
+ if (item.locationTagNames) {
+ item.locationTagNames = item.locationTagNames.split(',')
+ }
+ })
+ this.pointList = list
}
},
jumpJC() {
@@ -241,12 +286,10 @@
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;
+ locParam.adcode = info.regeocodeData.addressComponent.adcode
var ta = addr.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 && resCity.data) {
locParam.cityId = resCity.data.id
that.$store.commit('setPosition', locParam)
@@ -281,23 +324,24 @@
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;
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) => {
@@ -512,6 +556,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;
@@ -579,6 +673,25 @@
gap: 10rpx;
}
+ .point-tips {
+ width: 100%;
+ display: flex;
+ align-items: center;
+ margin-top: 12rpx;
+ .point-tips-item {
+ width: 116rpx;
+ 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;
+ }
+ }
+
.point-name {
flex: 1;
font-size: 32rpx;
--
Gitblit v1.9.3