This commit is contained in:
weipengfei 2024-04-17 14:10:06 +08:00
parent f6ceed4060
commit f691bf6749
2 changed files with 141 additions and 78 deletions

View File

@ -291,6 +291,36 @@
}
}
}
.position-address {
position: absolute;
top: 70rpx;
right: -10rpx;
// background-color: rgba(#000, 0.7);
width: 250rpx;
padding: 20rpx;
padding-top: 30rpx;
font-size: 26rpx;
text-align: center;
border-radius: 10rpx;
background-image: url(https://lihai001.oss-cn-chengdu.aliyuncs.com/def/39cd0202404171145486922.png);
background-size: 100% 100%;
background-repeat: no-repeat;
.icon {
position: absolute;
right: 10rpx;
top: 25rpx;
}
.btn {
background-color: #40AE36;
width: 100%;
height: 40rpx;
margin-top: 20rpx;
border-radius: 40rpx;
}
}
</style>
<template>
<view class="wholeSale">
@ -299,13 +329,23 @@
<view class="wholeSale-header" style="position: fixed;top: 0;left: 0;width: 100%;z-index: 999;">
<!-- 适配不同机 -->
<view style="height: var(--status-bar-height);background-color: #40af37;"></view>
<view style="display: flex;padding: 20rpx 28rpx;background-color: #40af37;color: #fff;justify-content: space-between;">
<view style="display: flex;font-weight: bold;font-size: 32rpx;"><u-icon style="margin-right: 20rpx;" name="arrow-left" size="20"
color="#fff" @click="navBack"></u-icon>供销综合云市场</view>
<view style="display: flex;" @click="changeMap">
<view style="width: 250rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align: right;">{{street}}</view>
<u-icon name="arrow-down" size="14"
color="#fff"></u-icon>
<view
style="display: flex;padding: 20rpx 28rpx;background-color: #40af37;color: #fff;justify-content: space-between;">
<view style="display: flex;font-weight: bold;font-size: 32rpx;"><u-icon style="margin-right: 20rpx;"
name="arrow-left" size="20" color="#fff" @click="navBack"></u-icon>供销综合云市场</view>
<view style="display: flex;position: relative;" @click="changeMap">
<view style="width: 250rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align: right;">
{{street}}
</view>
<u-icon name="arrow-down" size="14" color="#fff"></u-icon>
<view class="position-address" v-if="isShowAddress" @click.stop="">
<u-icon class="icon" name="close" size="14" @click="closeShowAddress" color="#fff"></u-icon>
<view class="title">
<view>开启定位服务</view>
<view>查看附近商铺</view>
</view>
<view class="btn" @click.stop="getLocation">立即开启</view>
</view>
</view>
</view>
</view>
@ -315,12 +355,12 @@
<view class="wholeSale-nav">
<!-- <u-icon class="icon" name="arrow-left" size="20" @click="navBack"></u-icon> -->
<!-- 搜索 -->
<view @click="navTo(`/pages/columnGoods/goods_search/index?back=true&searchVal=${where.keyword}&shop=true`)" hover-class="none"
class="search_content flex_a_c_j_sb">
<view @click="navTo(`/pages/columnGoods/goods_search/index?back=true&searchVal=${where.keyword}&shop=true`)"
hover-class="none" class="search_content flex_a_c_j_sb">
<view class="flex_a_c search_content_wrap">
<view class="iconfont icon-sousuo" style="font-size: 39rpx;"></view>
<input type="text" placeholder="搜索店铺名称" :value="where.keyword" placeholder-style="font-size: 30rpx;color:#999;"
disabled style="pointer-events: none;">
<input type="text" placeholder="搜索店铺名称" :value="where.keyword"
placeholder-style="font-size: 30rpx;color:#999;" disabled style="pointer-events: none;">
</view>
<!-- <button class="search_btn">搜索</button> -->
</view>
@ -333,7 +373,8 @@
<block v-for="(item,index) in store_category" :key="index">
<view class="category-item" :class="{'category-item-active': index==cate_change}"
@click="changeCate(index)">
<u--image class="category-item-img" width="108rpx" :src="item.background" height="108rpx" shape="circle">
<u--image class="category-item-img" width="108rpx" :src="item.background" height="108rpx"
shape="circle">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
@ -379,8 +420,8 @@
<u--image :showLoading="true" src="/static/images/GXSC/DH.png" width="33.85rpx"
height="33.85rpx"></u--image>
<text> {{item.service_phone}}</text>
<u--image style="margin-left: 28rpx;" v-if="item.mer_take_time" :showLoading="true" src="/static/images/GXSC/SJ.png" width="33.85rpx"
height="33.85rpx"></u--image>
<u--image style="margin-left: 28rpx;" v-if="item.mer_take_time" :showLoading="true"
src="/static/images/GXSC/SJ.png" width="33.85rpx" height="33.85rpx"></u--image>
<text v-if="item.mer_take_time">{{item.mer_take_time[0]}}-{{item.mer_take_time[1]}}</text>
</view>
<view class="content-two">
@ -429,6 +470,7 @@ import { Toast } from '../../../libs/uniApi';
cate_change: 0,
goodsList: [],
isLoading: 0,
isShowAddress: false,
street: '定位中',
where: {
page: 1,
@ -451,10 +493,13 @@ import { Toast } from '../../../libs/uniApi';
}, mapGetters(['viewColor', 'keyColor'])),
},
onLoad(option) {
let getAddress = uni.getStorageSync('getAddress');
let closeShow = uni.getStorageSync('closeShow');
if (!getAddress && !closeShow) this.isShowAddress = true;
this.street = this.$store.state.storage.address.townName;
if (this.$store.state.storage.location.lat) {
this.where.location = `${this.$store.state.storage.location.lat},${this.$store.state.storage.location.long}`;
} else if(uni.getStorageSync('getAddress')){
} else if (getAddress) {
this.street = '';
this.getLocation();
} else Toast('点击右上角开启定位后才可获取附近商家')
@ -522,12 +567,18 @@ import { Toast } from '../../../libs/uniApi';
this.where.page++;
})
},
closeShowAddress() {
this.isShowAddress = false;
uni.setStorageSync('closeShow', true);
},
//
changeMap() {
uni.navigateTo({
url: `/pages/select_address_n/select_address_n`,
success: () => {
uni.$once('changeAddress', (e) => {
this.isShowAddress = false;
uni.setStorageSync('closeShow', true);
this.street = e.street.name;
this.$store.commit('setAddress', {
street_id: e.street.code,
@ -562,6 +613,9 @@ import { Toast } from '../../../libs/uniApi';
lat: res.latitude.toFixed(6),
long: res.longitude.toFixed(6),
});
this.isShowAddress = false;
uni.setStorageSync('closeShow', true);
uni.setStorageSync('getAddress', true);
getGeocoder({
lat: latitude,
long: longitude
@ -575,6 +629,12 @@ import { Toast } from '../../../libs/uniApi';
});
uni.$emit('getLocation_succees', {
street_id,
});
this.where.location = `${latitude},${longitude}`;
this.$nextTick(() => {
setTimeout(() => {
this.storeMerchantList(true);
}, 200)
})
}).catch(err => {
uni.showToast({

View File

@ -5,9 +5,9 @@
<view style="height: var(--status-bar-height);"></view>
<view class="location">
<view class="box flex_a_c_j_sb">
<view class="place_wrapper flex_a_c" @click="changeMap">
<view class="iconfont icon-weizhi" style="color:#fff;font-size:40rpx;"></view>
<view class="town_name">{{street||'定位中' }}</view>
<view class="place_wrapper flex_a_c">
<view v-if="street&&street!='未开启定位'" @click="changeMap" class="iconfont icon-weizhi" style="color:#fff;font-size:40rpx;"></view>
<view v-if="street&&street!='未开启定位'" @click="changeMap" class="town_name">{{street}}</view>
</view>
<view class="flex_a_c_j_sb">
<view style="margin-right: 30rpx;" @click="scanQRcode" hover-class="none">
@ -129,7 +129,7 @@
isCategory: false,
swiperTop: 0,
isFixed: true,
street: '未开启定位'
street: ''
};
},
watch: {
@ -138,6 +138,9 @@
}
},
created() {
uni.$on('changeAddress', (e)=>{
this.street = e.street.name;
})
var that = this
//
uni.getSystemInfo({