更新地图选择

This commit is contained in:
weipengfei 2023-11-24 18:46:37 +08:00
parent 102ee13e26
commit 167354a8da
6 changed files with 1059 additions and 971 deletions

View File

@ -14,7 +14,7 @@
</view> </view>
<view class="" v-if="!isFshow"> <view class="" v-if="!isFshow">
<view class="site-box1 flex_a_c_j_sb"> <view class="site-box1 flex_a_c_j_sb">
<view class="place_wrapper flex_a_c" @click="selectLocation"> <view class="place_wrapper flex_a_c" @click="changeMap">
<view class="iconfont icon-weizhi"></view> <view class="iconfont icon-weizhi"></view>
<view class="town_name">{{street||'定位中' }}</view> <view class="town_name">{{street||'定位中' }}</view>
<view class="town_name rotate-box" @click.stop="getPositionFn()"><uni-icons type="loop" <view class="town_name rotate-box" @click.stop="getPositionFn()"><uni-icons type="loop"
@ -618,6 +618,27 @@
} }
// console.log(that.userInfoData); // console.log(that.userInfoData);
}); });
},
//
changeMap(){
uni.navigateTo({
url: `/pages/select_address/select_address_n`,
success:()=> {
uni.$once('changeAddress', (e)=>{
// this.street_id = e.street.code;
// this.street = e.street.name;
if (e.longitude) {
this.longitude = e.longitude;
this.latitude = e.latitude;
this.$store.commit('setLocation', {
lat: e.longitude,
long: e.latitude,
});
}
this.$bus.$emit('value-updated', e.street.name + ',' + e.street.code);
})
}
})
} }
} }
}; };

View File

@ -30,7 +30,7 @@
</view> </view>
<view class="" v-if="!isFshow"> <view class="" v-if="!isFshow">
<view class="site-box1 flex_a_c_j_sb"> <view class="site-box1 flex_a_c_j_sb">
<view class="place_wrapper flex_a_c" @click="selectLocation"> <view class="place_wrapper flex_a_c" @click="changeMap">
<view class="iconfont icon-weizhi"></view> <view class="iconfont icon-weizhi"></view>
<view class="town_name">{{ street||'定位中' }}</view> <view class="town_name">{{ street||'定位中' }}</view>
<view class="town_name rotate-box" @click.stop="getPositionFn()"><uni-icons type="loop" color="#fff"></uni-icons></view> <view class="town_name rotate-box" @click.stop="getPositionFn()"><uni-icons type="loop" color="#fff"></uni-icons></view>
@ -846,6 +846,27 @@ export default {
} }
} }
// #endif // #endif
},
//
changeMap(){
uni.navigateTo({
url: `/pages/select_address/select_address_n`,
success:()=> {
uni.$once('changeAddress', (e)=>{
// this.street_id = e.street.code;
// this.street = e.street.name;
if (e.longitude) {
this.longitude = e.longitude;
this.latitude = e.latitude;
this.$store.commit('setLocation', {
lat: e.longitude,
long: e.latitude,
});
}
this.$bus.$emit('value-updated', e.street.name + ',' + e.street.code);
})
}
})
} }
} }
} }

View File

@ -808,8 +808,14 @@
uni.$once('changeAddress', (e)=>{ uni.$once('changeAddress', (e)=>{
this.street_id = e.street.code; this.street_id = e.street.code;
this.street = e.street.name; this.street = e.street.name;
if (e.longitude) {
this.longitude = e.longitude; this.longitude = e.longitude;
this.latitude = e.latitude; this.latitude = e.latitude;
this.$store.commit('setLocation', {
lat: e.longitude,
long: e.latitude,
});
}
this.getStoreList(true); this.getStoreList(true);
}) })
} }

View File

@ -810,8 +810,14 @@
uni.$once('changeAddress', (e)=>{ uni.$once('changeAddress', (e)=>{
this.street_id = e.street.code; this.street_id = e.street.code;
this.street = e.street.name; this.street = e.street.name;
if (e.longitude) {
this.longitude = e.longitude; this.longitude = e.longitude;
this.latitude = e.latitude; this.latitude = e.latitude;
this.$store.commit('setLocation', {
lat: e.longitude,
long: e.latitude,
});
}
this.getStoreList(true); this.getStoreList(true);
}) })
} }

View File

@ -879,8 +879,14 @@
uni.$once('changeAddress', (e)=>{ uni.$once('changeAddress', (e)=>{
this.street_id = e.street.code; this.street_id = e.street.code;
this.street = e.street.name; this.street = e.street.name;
if (e.longitude) {
this.longitude = e.longitude; this.longitude = e.longitude;
this.latitude = e.latitude; this.latitude = e.latitude;
this.$store.commit('setLocation', {
lat: e.longitude,
long: e.latitude,
});
}
this.storeMerchantList(); this.storeMerchantList();
}) })
} }

View File

@ -20,10 +20,11 @@
<view class="" v-if="!isFshow"> <view class="" v-if="!isFshow">
<view class="site-box1 flex_a_c_j_sb"> <view class="site-box1 flex_a_c_j_sb">
<view class="place_wrapper flex_a_c" @click="selectLocation"> <view class="place_wrapper flex_a_c" @click="changeMap">
<view class="iconfont icon-weizhi"></view> <view class="iconfont icon-weizhi"></view>
<view class="town_name">{{street||'定位中' }}</view> <view class="town_name">{{street||'定位中' }}</view>
<view class="town_name rotate-box" @click.stop="getPositionFn()"><uni-icons type="loop" color="#fff"></uni-icons></view> <view class="town_name rotate-box" @click.stop="getPositionFn()"><uni-icons type="loop"
color="#fff"></uni-icons></view>
</view> </view>
<navigator url="/pages/chat/customer_list/index?type=0" hover-class="none"> <navigator url="/pages/chat/customer_list/index?type=0" hover-class="none">
<view class="iconfont icon-xiaoxi" style="color:#fff;"> </view> <view class="iconfont icon-xiaoxi" style="color:#fff;"> </view>
@ -86,8 +87,7 @@
</view> </view>
<view class="list-con"> <view class="list-con">
<view class="list-con-left" <view class="list-con-left" @tap="navgo('/pages/nongKe/specialty/index?type_code=TypeFamousSpecialties')">
@tap="navgo('/pages/nongKe/specialty/index?type_code=TypeFamousSpecialties')">
<!-- <view class="list-con-title"> <!-- <view class="list-con-title">
<view class="con-titlea"> <view class="con-titlea">
名优特产 名优特产
@ -111,8 +111,7 @@
</view> --> </view> -->
<image src="@/static/images/f7.png" mode="aspectFit"></image> <image src="@/static/images/f7.png" mode="aspectFit"></image>
</view> </view>
<view class="con-right" <view class="con-right" @click="navgo('/pages/nongKe/tourism/index?type_code=TypeFeaturedCultural')">
@click="navgo('/pages/nongKe/tourism/index?type_code=TypeFeaturedCultural')">
<!-- <view class="list-con-title"> <!-- <view class="list-con-title">
<view class="con-titlea"> <view class="con-titlea">
特色文旅 特色文旅
@ -277,8 +276,7 @@
this.Area() this.Area()
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
}, },
onShow() { onShow() {},
},
onLoad() { onLoad() {
this.Area() this.Area()
// this.selfLocation() // this.selfLocation()
@ -303,8 +301,7 @@
this.list(false, this.street_id); this.list(false, this.street_id);
this.productList2 = []; this.productList2 = [];
}, 50) }, 50)
} } else if (this.productList2.length > 0) {
else if (this.productList2.length > 0) {
setTimeout(() => { setTimeout(() => {
this.list2(false, ''); this.list2(false, '');
}, 50) }, 50)
@ -359,7 +356,7 @@
}, },
getPositionFn() { getPositionFn() {
this.street = '定位中' this.street = '定位中'
this.$store.commit('setLocation', {lat: null, long: null}) this.$store.commit('setLocation', { lat: null, long: null })
uni.removeStorageSync('RejectTarget') uni.removeStorageSync('RejectTarget')
this.selfLocation() this.selfLocation()
@ -392,7 +389,7 @@
}).then(res => { }).then(res => {
// console.log(222) // console.log(222)
let list = res.data.list; let list = res.data.list;
if(list.length==0&&that.productList.length==0&&that.where.page==1){ if (list.length == 0 && that.productList.length == 0 && that.where.page == 1) {
that.list2(true, ''); that.list2(true, '');
} }
let productList = that.$util.SplitArray(list, that.productList); let productList = that.$util.SplitArray(list, that.productList);
@ -607,13 +604,13 @@
if (uni.getStorageSync('RejectTarget')) return; if (uni.getStorageSync('RejectTarget')) return;
if (uni.getStorageSync('loction') == true) { if (uni.getStorageSync('loction') == true) {
this.isshow = false this.isshow = false
this.list2(true,'') this.list2(true, '')
} else { } else {
this.isshow = true this.isshow = true
uni.setStorageSync('loction', true); uni.setStorageSync('loction', true);
} }
// console.log(this.$store.state.storage.location); // console.log(this.$store.state.storage.location);
if(this.$store?.state?.storage?.location?.lat){ if (this.$store?.state?.storage?.location?.lat) {
this.isshow = false this.isshow = false
this.latitude = this.$store.state.storage.location.lat; this.latitude = this.$store.state.storage.location.lat;
this.longitude = this.$store.state.storage.location.long; this.longitude = this.$store.state.storage.location.long;
@ -625,7 +622,7 @@
this.town = res.data.address_reference.town.title this.town = res.data.address_reference.town.title
this.street_id = res.data.address_reference.town.id this.street_id = res.data.address_reference.town.id
this.street = res.data.address_reference.town.title; this.street = res.data.address_reference.town.title;
this.list(true,this.street_id) this.list(true, this.street_id)
this.$nextTick(() => { this.$nextTick(() => {
this.$bus.$emit('value-updated', this.street + ',' + this this.$bus.$emit('value-updated', this.street + ',' + this
.street_id); .street_id);
@ -633,14 +630,13 @@
}).catch(err => { }).catch(err => {
this.isshow = false this.isshow = false
this.list2(true,'') this.list2(true, '')
uni.showToast({ uni.showToast({
title: err, title: err,
icon: 'none' icon: 'none'
}) })
}) })
} } else uni.getLocation({
else uni.getLocation({
type: 'wgs84', type: 'wgs84',
timeout: '10', timeout: '10',
success: (res) => { success: (res) => {
@ -670,7 +666,7 @@
}).catch(err => { }).catch(err => {
this.isshow = false this.isshow = false
this.list2(true,'') this.list2(true, '')
uni.showToast({ uni.showToast({
title: err, title: err,
icon: 'none' icon: 'none'
@ -693,7 +689,33 @@
} }
}); });
}, },
//
changeMap() {
uni.navigateTo({
url: `/pages/select_address/select_address_n`,
success: () => {
uni.$once('changeAddress', (e) => {
this.street_id = e.street.code;
this.street = e.street.name;
if (e.longitude) {
this.longitude = e.longitude;
this.latitude = e.latitude;
this.$store.commit('setLocation', {
lat: e.longitude,
long: e.latitude,
});
}
this.loadend = false;
this.loadend2 = false;
this.$set(this.where, 'page', 1)
this.$set(this.where2, 'page', 1)
this.$set(this, 'productList', []);
this.list(true, this.street_id)
this.$bus.$emit('value-updated', e.value[1].name + ',' + e.value[1].code);
})
}
})
}
} }
@ -769,7 +791,8 @@
font-size: 20rpx; font-size: 20rpx;
color: #5a5a5a; color: #5a5a5a;
} }
.locationx{
.locationx {
color: #000; color: #000;
position: absolute; position: absolute;
top: 10rpx; top: 10rpx;
@ -1154,18 +1177,22 @@
.goodslist { .goodslist {
margin: 0 auto; margin: 0 auto;
width: 725rpx; width: 725rpx;
.no-more{
.no-more {
text-align: center; text-align: center;
padding-top: 18rpx; padding-top: 18rpx;
} }
.pictrue_tips{
.pictrue_tips {
color: $uni-nothing-text; color: $uni-nothing-text;
} }
.common-hd { .common-hd {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 118rpx; height: 118rpx;
.title { .title {
padding: 0 80rpx; padding: 0 80rpx;
font-size: 34rpx; font-size: 34rpx;
@ -1178,6 +1205,7 @@
} }
} }
} }
.rotate-box { .rotate-box {
transform: rotate(0deg); transform: rotate(0deg);
transition: transform .5s ease-out; transition: transform .5s ease-out;