更新地图选择

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 class="" v-if="!isFshow">
<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="town_name">{{street||'定位中' }}</view>
<view class="town_name rotate-box" @click.stop="getPositionFn()"><uni-icons type="loop"
@ -618,6 +618,27 @@
}
// 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 class="" v-if="!isFshow">
<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="town_name">{{ street||'定位中' }}</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
},
//
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)=>{
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.getStoreList(true);
})
}

View File

@ -810,8 +810,14 @@
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.getStoreList(true);
})
}

View File

@ -879,8 +879,14 @@
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.storeMerchantList();
})
}

View File

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