新增定位页面

This commit is contained in:
weipengfei 2023-11-16 19:09:57 +08:00
parent 8beb5a3d8b
commit 62ca7da81b
4 changed files with 227 additions and 2 deletions

View File

@ -178,6 +178,14 @@
"enablePullDownRefresh": false
}
},
{
"path" : "pages/select_address/select_address",
"style" :
{
"navigationBarTitleText" : "选择位置",
"enablePullDownRefresh" : false
}
}
],
"subPackages": [{

View File

@ -0,0 +1,217 @@
<template>
<view class="">
<u-sticky customNavHeight="0">
<view class="head_top">
<u-search placeholder="搜索小区、办公楼等" :showAction="false"></u-search>
<view style="height: 20rpx;"></view>
<u-tabs
:list="tabsList" itemStyle="font-size: 32rpx;height: 74rpx;"
:current="current"
@change="changeCurrent"
lineColor="#FF6D20"
lineWidth="105rpx"
height="7rpx"
></u-tabs>
</u-tabs>
</view>
</u-sticky>
<view style="background-color: #f4f4f4;height: 30rpx;"></view>
<view class="address-box" v-if="current==0">
<view class="head_item">
<view class="re-location">
<view class="re-title">当前位置: </view>
<view>{{street}}</view>
</view>
<view class="re-btn"><image class="re-address-img" src="@/static/images/re_address.png"></image>重新定位</view>
</view>
<view class="head_item_tips">
<view>附近地址</view>
</view>
<view class="address-list">商业宾馆春雨路二段</view>
<view class="address-list">商业宾馆春雨路二段</view>
<view class="address-list">商业宾馆春雨路二段</view>
</view>
<view class="address-box" v-if="current==1">
<view class="head_item_tips">
<view>泸州区县</view>
</view>
<view class="area">
<view class="area-item" :class="{'area-item-on': item==2}" v-for="item in 7" >江阳区</view>
</view>
<view class="head_item_tips">
<view>选择街道/</view>
</view>
</view>
</view>
</template>
<script>
import {
getGeocoder,
merClassifly,
getProductslist
} from '@/api/store.js';
export default {
data() {
return {
tabsList: [{
name: '附近地址',
}, {
name: '泸州区县',
}, ],
current: 1,
latitude: '',
longitude: '',
town: '',
street_id: '',
street: ''
}
},
onLoad() {
this.getLoaction();
},
onShow() {},
methods: {
changeCurrent(e){
this.current = e.index;
},
getLoaction(){
this.street = '定位中'
uni.getLocation({
type: 'wgs84',
timeout: '10',
success: (res) => {
let latitude, longitude;
latitude = res.latitude.toString();
longitude = res.longitude.toString();
this.latitude = res.latitude.toFixed(6);
this.longitude = res.longitude.toFixed(6);
this.$store.commit('setLocation', {
lat: res.latitude.toFixed(6),
long: res.longitude.toFixed(6),
});
getGeocoder({
lat: latitude,
long: longitude
}).then(res => {
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;
}).catch(err => {
uni.showToast({
title: err,
icon: 'none'
})
this.street = '定位失败'
})
},
fail: (err) => {
console.log('定位失败');
this.isshow = false
uni.setStorageSync("RejectTarget", true)
Toast('定位失败,请检查定位权限是否开启')
this.street = '定位失败'
// uni.showToast({
// title: "",
// icon: 'none',
// duration: 2000
// });
}
});
}
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
}
}
</script>
<style lang="scss">
page{
background-color: #fff;
}
.head_top {
background-color: #fff;
padding: 28rpx;
}
.address-box{
// background-color: red;
border-radius: 21rpx 21rpx 0rpx 0rpx;
padding: 30rpx 28rpx;
.head_item{
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 28rpx;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
.re-location{
display: flex;
.re-title{
flex-shrink: 0;
padding-right: 14rpx;
}
}
.re-address-img{
width: 38.55rpx;
height: 38.55rpx;
margin-right: 14rpx;
}
.re-btn{
display: flex;
align-items: center;
flex-shrink: 0;
padding-left: 14rpx;
}
}
.head_item_tips{
height: 44rpx;
font-size: 32rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #737373;
}
.address-list{
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
height: 80rpx;
line-height: 75rpx;
border-bottom: 1rpx solid rgba(0,0,0,0.1);
}
.area{
display: flex;
flex-wrap: wrap;
padding-top: 30rpx;
.area-item{
// width: 158rpx;
height: 64rpx;
// background: #F4F4F4;
background-color: #fff;
border-radius: 11rpx 11rpx 11rpx 11rpx;
border: 2rpx solid #B3B3B3;
display: flex;
align-items: center;
justify-content: center;
padding: 0 20rpx;
font-size: 28rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #737373;
margin-bottom: 22rpx;
margin-right: 22rpx;
}
.area-item-on{
background-color: #F4F4F4;
color: #333;
font-weight: bold;
}
}
}
</style>

View File

@ -648,7 +648,7 @@
`${this.business[0][this.index2[0]].name} ${this.business[1][this.index2[1]].name} ${this.business[2][this.index2[2]].name}`
this.area_id = this.business[0][this.index2[0]].code
this.street_id = this.business[1][this.index2[1]].code
if(this.merchantData.mer_type==12) return ; //
merstreet({
street_code: this.street_id
}).then((res) => {
@ -1046,7 +1046,7 @@
});
if (!this.mer_storeType) return that.$util.Tips({
title: '请选择商户类型'
title: '请选择店铺类型'
})
if (!this.business_name) return that.$util.Tips({
title: '请选择店铺所在地'

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB