This commit is contained in:
weipengfei 2023-12-23 18:31:17 +08:00
parent 2a69565134
commit 9630c164d9
6 changed files with 454 additions and 24 deletions

View File

@ -269,6 +269,14 @@
"navigationBarTitleText" : "选择地址",
"enablePullDownRefresh" : false
}
},
{
"path" : "pages/select_address/select_address_n",
"style" :
{
"navigationBarTitleText" : "选择地址",
"enablePullDownRefresh" : false
}
}
],
"subPackages": [{

View File

@ -305,7 +305,7 @@
<view class="item">
<view class="acea-row row-middle">
<text class="item-name">公司名称:</text>
<input type="text" placeholder="请输入公司名称" v-model="merchantData.company_name" @input="validateBtn"
<input type="text" placeholder="请输入公司名称" disabled v-model="merchantData.company_name" @input="validateBtn"
placeholder-class='placeholder' />
</view>
</view>
@ -1061,7 +1061,8 @@ import { Toast } from '../../libs/uniApi';
this.userid = res.data.uid
this.userInfoData = res.data
this.$store.commit('SET_USERINFO', res.data);
this.merchantData.phone = res.data.phone
this.merchantData.phone = res.data.phone;
this.merchantData.company_name = res.data.mer_info.company_name;
if (res.data.service == null) {
// console.log('123');
this.isgShow = false

View File

@ -714,13 +714,14 @@
this.storeParam.page = 1;
this.goodsList = [];
}
// console.log({...this.userInfoData});
// console.log({...this.userInfoData.mer_info.category_id});
let query = {
product_type: this.product_type,
// cate_pid: this.storeParam.category_id,
page: this.storeParam.page,
order: this.storeParam.order,
keyword: this.storeParam.keyword
keyword: this.storeParam.keyword,
category_id: this.userInfoData.mer_info.category_id,
};
if(this.storeParam.category_id==-1) null;
else if(!this.merchantTow.pid) query.cate_pid = this.storeParam.category_id; // pid

View File

@ -33,14 +33,14 @@
<view class="text">店铺资质</view>
<block v-if="images[3].img">
<u--image :showLoading="true" :src="images[3].img" width="382.46rpx" height="210.53rpx"
radius="4px" @click="delImg(3)"></u--image>
radius="4px"></u--image>
</block>
<view v-else class="zizhi_img" @click="seleckImage(3)">
<!-- <view v-else class="zizhi_img" @click="seleckImage(3)">
<view class="iconfont icon-tupian1"></view>
</view>
</view> -->
</view>
</view>
<view class="store_avatar flex_a_c_j_sb" style="padding: 20rpx 0;">
<view class="store_avatar flex_a_c_j_sb" style="padding: 20rpx 0;" v-if="imagesArr.length>0">
<view class="avatar_box">
<view class="text flex_a_c"></i>店铺其他资质</view>
<view class="other-img">
@ -103,18 +103,23 @@
</view>
<block>
<view class="item_cell flex_a_c">
<view class="item_cell flex_a_c" style="display: flex;justify-content: space-between;align-items: flex-start;">
<view class="sub_title flex_a_c"><i class="iconfont icon-xinghao"></i>详细地址</view>
<input class="com_input" type="text" v-model="mer_address" placeholder="输入商户地址">
<!-- <input class="com_input" type="text" v-model="mer_address" placeholder="输入商户地址"> -->
<view class="input" style="flex: 1;margin-right: 15rpx;">{{mer_address}}</view>
<view class="get_site flex_a_c" @click="navTo('/pages/select_address/select_address_n')">
<i class="iconfont icon-dizhi"></i>
获取地址
</view>
</view>
<view class="long_lat">
<!-- <view class="long_lat">
<input class="com_input site_input" type="text" v-model="longLati" placeholder="输入经纬度坐标">
<view class="get_site flex_a_c" @click="selfLocation">
<i class="iconfont icon-dizhi"></i>
获取地址
</view>
</view>
</view> -->
<view class="sub_title flex_a_c"><i class="iconfont icon-xinghao"></i>提货点营业日期:</view>
<view class="week_box">
<view class="week_item" v-for="(item,index) in dateWeek" :key="index" @click="sel(item,index)">
@ -142,16 +147,16 @@
<view class="text flex_a_c">商户信息配置</view>
</view>
<view class="item_cell flex_a_c">
<view class="sub_title flex_a_c"><i class="iconfont icon-xinghao"></i>商户名称</view>
<input class="com_input" type="text" v-model="mer_name" disabled placeholder="输入商户名称">
<view class="sub_title flex_a_c">商户名称</view>
<input class="com_input" type="text" disabled v-model="mer_name">
</view>
<view class="item_cell flex_a_c">
<view class="sub_title flex_a_c"><i class="iconfont icon-xinghao"></i>商户简介</view>
<input class="com_input" type="text" v-model="intro" placeholder="输入商户简介">
<view class="sub_title flex_a_c">商户分类</view>
<input class="com_input" type="text" disabled v-model="category_name">
</view>
<view class="item_cell flex_a_c">
<view class="sub_title flex_a_c"><i class="iconfont icon-xinghao"></i>客服电话</view>
<input class="com_input" type="number" v-model="servicePhone" placeholder="输入客服电话">
<view class="sub_title flex_a_c">客服电话</view>
<input class="com_input" type="number" disabled v-model="servicePhone">
</view>
<!-- <view class="item_cell flex_a_c" v-if="type_code!='TypeFamousSpecialties'||type_code!='TypeLocalCuisine'||type_code!='TypeFeaturedCultural'" >
@ -293,6 +298,7 @@
interest_rate: '', //
settle_cycle: '', //
mer_name: '',
category_name: '', //
type_code: ''
}
},
@ -310,11 +316,17 @@
id
}).then(res => {
this.mer_name = res.data.mer_name
this.category_name = res.data.merchantCategory.category_name
this.images[0].img = res.data.mer_banner
this.images[1].img = res.data.mer_avatar
this.images[2].img = res.data.mini_banner
this.images[3].img = res.data.mer_certificate
this.delivery_way = res.data.delivery_way.split(',')
if(typeof res.data.mer_certificate != 'string'){
this.images[3].img = res.data.mer_certificate[0];
res.data.mer_certificate.shift();
this.imagesArr = res.data.mer_certificate;
}else this.images[3].img = res.data.mer_certificate;
if(typeof res.data.delivery_way == 'string') this.delivery_way = res.data.delivery_way.split(',');
else this.delivery_way = res.data.delivery_way;
this.delivery_way.forEach(item => {
if (item === '1') this.isZiti = true
if (item === '2') this.isKuaidi = true
@ -326,12 +338,13 @@
res.data.mer_take_day.forEach((item, i) => {
this.dateWeek[Number(item) - 1].isCheck = true
})
this.selarr = res.data.mer_take_day;
this.type_code = res.data.type_code
this.mer_take_time = res.data.mer_take_time
this.intro = res.data.mer_info
this.cruxText = res.data.mer_keyword
this.servicePhone = res.data.service_phone
// this.servicePhone = res.data.service_phone
this.servicePhone = res.data.mer_take_phone
this.mer_address = res.data.mer_address
this.merState = res.data.mer_state === 1 ? true : false
this.credit_buy = res.data.credit_buy === 1 ? true : false
@ -359,14 +372,16 @@
this.credit_buy = e
console.log(e);
},
//
//
sel(item, i) {
if (item.isCheck == false) {
item.isCheck = true;
this.selarr.push(String(item.id));
} else {
item.isCheck = false;
this.selarr.splice(this.selarr.indexOf(i + 1), 1);
this.selarr = this.selarr.filter(id=>{
return id!=item.id
})
}
},
postMerchantUpdata() {
@ -513,6 +528,20 @@
}
}
})
},
navTo(url){
if(url=='/pages/select_address/select_address_n'){
uni.$once('changeAddress', (res)=>{
// console.log('', res);
this.mer_address = res.formatted_addresses.recommend;
this.latitude = res.latitude;
this.longitude = res.longitude;
this.longLati = `${res.latitude},${res.longitude}`
})
}
uni.navigateTo({
url:url
})
}
},
onPullDownRefresh() {
@ -700,6 +729,10 @@
.ziti {
margin-right: 21.05rpx;
}
.get_site{
color: #20A162;
}
}
.remark {

View File

@ -0,0 +1,387 @@
<template>
<view class="" style="background-color: #fff;">
<u-sticky customNavHeight="0">
<view class="head_top">
<!-- <u-search placeholder="搜索小区、办公楼等" @custom="searchMap"></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" style="padding: 0;">
<map style="width: 750rpx;height: 750rpx;" :longitude="longitude" :latitude="latitude" :markers="[markers]"
show-location @tap="handleMapTap"></map>
<view class="head_item" style="padding: 10rpx 20rpx;">
<view class="re-location">
<view style="width: 120rpx;"><text class="text">当前位置: </text></view>
<view style="flex: 1;">
<text
class="text">{{locationInfo.formatted_addresses?locationInfo.formatted_addresses.recommend:locationInfo.address}}</text>
</view>
</view>
<view class="re-btn" @click="reGetLocation">
<image class="re-address-img" src="@/static/images/re_address.png"></image><text class="text">重新定位</text>
</view>
</view>
<u-button text="确认" @click="submitAddress"></u-button>
</view>
</view>
</template>
<script>
import {
getGeocoder,
merClassifly,
getProductslist
} from '@/api/store.js';
import {
getArea,
getStreet
} from "@/api/article.js";
import { Toast } from '@/libs/uniApi';
export default {
data() {
return {
tabsList: [{
name: '地图定位',
}],
current: 0,
latitude: '28.87',
longitude: '105.44',
markers: {
id: 1,
longitude: '28.87',
latitude: '105.44',
iconPath: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/cbbd5202311241523412538.png',
width: 28,
height: 28
},
locationInfo: {},
town: '',
street_id: '',
street: '',
areaList: [],
streetList: [],
mapList: {},
area_change: '',
street_change: '',
}
},
onLoad(options) {
this.getLoaction();
this.loadArea();
},
onShow() {},
computed: {
mapKey() {
return Object.keys(this.mapList).sort()
}
},
methods: {
changeCurrent(e) {
this.current = e.index;
},
getLoaction() {
this.street = '定位中'
this.locationInfo = {};
this.locationInfo.formatted_addresses = {};
this.locationInfo.formatted_addresses.recommend = '定位中'
uni.getLocation({
type: 'gcj02',
timeout: '4',
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.locationInfo = res.data;
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
Toast('定位失败,请检查定位权限是否开启')
this.street = '定位失败'
this.locationInfo.formatted_addresses.recommend = '定位失败'
// uni.showToast({
// title: "获取定位超时",
// icon: 'none',
// duration: 2000
// });
}
});
},
reGetLocation() {
this.getLoaction()
},
loadArea() {
getArea({
city_code: 510500
}).then((res) => {
this.areaList = res.data;
this.changeArea(this.areaList[0]);
})
},
loadStreet(area_code) {
this.street_change = '';
getStreet({
area_code
}).then((res) => {
this.streetList = res.data;
this.initPinyin();
})
},
initPinyin() {
this.mapList = {};
this.streetList.forEach((item) => {
let str = item.pinyin?.toUpperCase();
str = str ? str : '#';
if (this.mapList[str]) {
this.mapList[str].push(item);
} else {
this.mapList[str] = [];
this.mapList[str].push(item)
}
})
},
changeArea(item) {
this.area_change = item.code;
this.loadStreet(this.area_change);
},
// 选择位置
changeStreet(item) {
uni.navigateBack({
success: () => {
uni.$emit('changeAddress', {
area: this.area_change,
street: item,
})
}
})
},
// 点击地图
handleMapTap(e) {
// console.log('点击地图', e);
// #ifdef H5
return Toast('H5暂不支持选择坐标');
// #endif
let longitude = e.detail.longitude;
let latitude = e.detail.latitude;
this.markers.longitude = longitude;
this.markers.latitude = latitude;
// console.log('修改成功', this.markers);
getGeocoder({
lat: latitude,
long: longitude
}).then(res => {
// console.log(res);
this.locationInfo = res.data;
}).catch(err => {
uni.showToast({
title: err,
icon: 'none'
})
this.locationInfo = {};
this.locationInfo.formatted_addresses = {};
this.locationInfo.formatted_addresses.recommend = '定位失败'
})
},
submitAddress() {
console.log({...this.locationInfo});
try {
this.town = this.locationInfo.address_reference.town.title;
this.street_id = this.locationInfo.address_reference.town.id;
this.street = this.locationInfo.address_reference.town.title;
let obj = {
area: this.locationInfo.ad_info.adcode,
street: {
name: this.street,
code: this.street_id
},
latitude: this.latitude,
longitude: this.longitude,
formatted_addresses: this.locationInfo.formatted_addresses
}
console.log({...obj});
uni.navigateBack({
success: () => {
uni.$emit('changeAddress', obj)
}
})
} catch (e) {
return Toast('地址有误,请重新选择')
}
},
searchMap(){
uni.request({
url: 'https://restapi.amap.com/v3/place/text?keywords=北京大学&city=beijing&offset=20&page=1&key=0799f37420c0784f1e6cba230a68bdb1&extensions=all',
success: (res) => {
console.log(res);
},
fail: (e) => {
console.log(e);
}
})
}
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
}
}
</script>
<style>
/* page {
background-color: #fff;
} */
.text {
font-size: 28rpx;
white-space: normal;
}
.head_top {
background-color: #fff;
padding: 28rpx;
}
.address-box {
border-radius: 21rpx 21rpx 0rpx 0rpx;
padding: 30rpx 28rpx;
width: 750rpx;
}
.head_item {
width: 750rpx;
flex-direction: row;
justify-content: space-between;
padding-bottom: 28rpx;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
}
.re-location {
flex-direction: row;
flex-wrap: nowrap;
width: 480rpx;
align-items: center;
}
.re-address-img {
width: 38.55rpx;
height: 38.55rpx;
margin-right: 10rpx;
}
.re-btn {
flex-direction: row;
padding-left: 10rpx;
width: 200rpx;
height: 100rpx;
align-items: center;
}
.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 {
flex-direction: row;
flex-wrap: wrap;
padding-top: 30rpx;
justify-content: flex-start;
}
.area-item {
height: 64rpx;
/* width: 100px; */
background-color: #fff;
border-radius: 11rpx 11rpx 11rpx 11rpx;
border: 2rpx solid #B3B3B3;
flex-direction: row;
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 {
color: #ff6d20;
border: 2rpx solid #ff6d20;
}
.street {
padding-top: 28rpx;
}
.letter-item {
flex-direction: row;
}
.letter {
margin-right: 28rpx;
font-size: 25rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
width: 40rpx;
text-align: center;
color: #737373;
}
.item-box {
flex: 1;
}
.street-item {
width: 100%;
padding-bottom: 28rpx;
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #333333;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB