1
This commit is contained in:
parent
2ff122ebae
commit
d72f234cc7
@ -15,8 +15,8 @@ let openPlantGrass = '-openPlantGrass-'
|
|||||||
|
|
||||||
let httpSix, httpApi;
|
let httpSix, httpApi;
|
||||||
|
|
||||||
const env = 'dev'; // 开发
|
// const env = 'dev'; // 开发
|
||||||
// const env = 'prod'; // 生产
|
const env = 'prod'; // 生产
|
||||||
// const env = 'prew'; // 预上线
|
// const env = 'prew'; // 预上线
|
||||||
|
|
||||||
switch (env) {
|
switch (env) {
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
"name": "惠农生活",
|
"name": "惠农生活",
|
||||||
"appid": "__UNI__3A527D1",
|
"appid": "__UNI__3A527D1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"versionName": "2.0.23",
|
"versionName": "2.0.20",
|
||||||
"versionCode": 2023,
|
"versionCode": 2020,
|
||||||
"transformPx": false,
|
"transformPx": false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus": {
|
"app-plus": {
|
||||||
|
@ -1,425 +1,440 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="" style="background-color: #fff;">
|
<view class="" style="background-color: #fff;">
|
||||||
<u-sticky customNavHeight="0">
|
<u-sticky customNavHeight="0">
|
||||||
<view class="head_top">
|
<view class="head_top">
|
||||||
<!-- <u-search placeholder="搜索小区、办公楼等" @custom="searchMap"></u-search>
|
<u-search placeholder="搜索小区、办公楼等" @custom="searchMap"></u-search>
|
||||||
<view style="height: 20rpx;"></view> -->
|
<view style="height: 20rpx;"></view>
|
||||||
<u-tabs :list="tabsList" itemStyle="font-size: 32rpx;height: 74rpx;" :current="current" @change="changeCurrent"
|
<u-tabs :list="tabsList" itemStyle="font-size: 32rpx;height: 74rpx;" :current="current"
|
||||||
lineColor="#FF6D20" lineWidth="105rpx" height="7rpx"></u-tabs>
|
@change="changeCurrent" lineColor="#FF6D20" lineWidth="105rpx" height="7rpx"></u-tabs>
|
||||||
</u-tabs>
|
</u-tabs>
|
||||||
</view>
|
</view>
|
||||||
</u-sticky>
|
</u-sticky>
|
||||||
<view style="background-color: #f4f4f4;height: 30rpx;"></view>
|
<view style="background-color: #f4f4f4;height: 30rpx;"></view>
|
||||||
<view class="address-box" v-if="current==0" style="padding: 0;">
|
<view class="address-box" v-if="current==0" style="padding: 0;">
|
||||||
<map style="width: 750rpx;height: 750rpx;" :longitude="longitude" :latitude="latitude" :markers="[markers]"
|
<map style="width: 750rpx;height: 750rpx;" :longitude="longitude" :latitude="latitude" :markers="[markers]"
|
||||||
show-location @tap="handleMapTap"></map>
|
show-location @tap="handleMapTap"></map>
|
||||||
<view class="head_item" style="padding: 10rpx 20rpx;">
|
<view class="head_item" style="padding: 10rpx 20rpx;">
|
||||||
<view class="re-location">
|
<view class="re-location">
|
||||||
<view style="width: 120rpx;"><text class="text">当前位置: </text></view>
|
<view style="width: 120rpx;"><text class="text">当前位置: </text></view>
|
||||||
<view style="flex: 1;">
|
<view style="flex: 1;">
|
||||||
<text
|
<text
|
||||||
class="text">{{locationInfo.formatted_addresses?locationInfo.formatted_addresses.recommend:locationInfo.address}}</text>
|
class="text">{{locationInfo.formatted_addresses?locationInfo.formatted_addresses.recommend:locationInfo.address}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="re-btn" @click="reGetLocation">
|
<view class="re-btn" @click="reGetLocation">
|
||||||
<image class="re-address-img" src="@/static/images/re_address.png"></image><text class="text">重新定位</text>
|
<image class="re-address-img" src="@/static/images/re_address.png"></image><text
|
||||||
</view>
|
class="text">重新定位</text>
|
||||||
</view>
|
</view>
|
||||||
<u-button text="确认" @click="submitAddress"></u-button>
|
</view>
|
||||||
</view>
|
<u-button text="确认" @click="submitAddress"></u-button>
|
||||||
<view class="address-box" v-if="current==1">
|
</view>
|
||||||
<view class="head_item_tips">
|
<view class="address-box" v-if="current==1">
|
||||||
<view><text class="text">泸州区县</text></view>
|
<view class="head_item_tips">
|
||||||
</view>
|
<view><text class="text">泸州区县</text></view>
|
||||||
<view class="area">
|
</view>
|
||||||
<view class="area-item" :class="{'area-item-on': item.code==area_change}" v-for="(item, index) in areaList"
|
<view class="area">
|
||||||
:key="index" @click="changeArea(item)">
|
<view class="area-item" :class="{'area-item-on': item.code==area_change}"
|
||||||
<text class="text">{{item.name}}</text>
|
v-for="(item, index) in areaList" :key="index" @click="changeArea(item)">
|
||||||
</view>
|
<text class="text">{{item.name}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="head_item_tips">
|
</view>
|
||||||
<view><text class="text">选择街道/镇</text></view>
|
<view class="head_item_tips">
|
||||||
</view>
|
<view><text class="text">选择街道/镇</text></view>
|
||||||
<view class="street">
|
</view>
|
||||||
<view class="letter-item" v-for="key in mapKey" :key="key">
|
<view class="street">
|
||||||
<view class="letter"><text class="text">{{key}}</text></view>
|
<view class="letter-item" v-for="key in mapKey" :key="key">
|
||||||
<view class="item-box">
|
<view class="letter"><text class="text">{{key}}</text></view>
|
||||||
<view class="street-item" v-for="item in mapList[key]" :key="item.code" @click="changeStreet(item)">
|
<view class="item-box">
|
||||||
<text class="text">{{item.name}}</text>
|
<view class="street-item" v-for="item in mapList[key]" :key="item.code"
|
||||||
</view>
|
@click="changeStreet(item)">
|
||||||
</view>
|
<text class="text">{{item.name}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
getGeocoder,
|
getGeocoder,
|
||||||
merClassifly,
|
merClassifly,
|
||||||
getProductslist
|
getProductslist
|
||||||
} from '@/api/store.js';
|
} from '@/api/store.js';
|
||||||
import {
|
import {
|
||||||
getArea,
|
getArea,
|
||||||
getStreet
|
getStreet
|
||||||
} from "@/api/article.js";
|
} from "@/api/article.js";
|
||||||
import { Toast } from '@/libs/uniApi';
|
import {
|
||||||
import { wgsToGcj } from "@/utils/wgs.js";
|
Toast
|
||||||
export default {
|
} from '@/libs/uniApi';
|
||||||
data() {
|
import {
|
||||||
return {
|
wgsToGcj
|
||||||
tabsList: [{
|
} from "@/utils/wgs.js";
|
||||||
name: '地图定位',
|
export default {
|
||||||
}, {
|
data() {
|
||||||
name: '泸州区县',
|
return {
|
||||||
}],
|
tabsList: [{
|
||||||
current: 0,
|
name: '地图定位',
|
||||||
latitude: '28.87',
|
}, {
|
||||||
longitude: '105.44',
|
name: '泸州区县',
|
||||||
markers: {
|
}],
|
||||||
id: 1,
|
current: 0,
|
||||||
longitude: '28.87',
|
latitude: '28.87',
|
||||||
latitude: '105.44',
|
longitude: '105.44',
|
||||||
iconPath: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/cbbd5202311241523412538.png',
|
markers: {
|
||||||
width: 28,
|
id: 1,
|
||||||
height: 28
|
longitude: '28.87',
|
||||||
},
|
latitude: '105.44',
|
||||||
locationInfo: {},
|
iconPath: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/cbbd5202311241523412538.png',
|
||||||
town: '',
|
width: 28,
|
||||||
street_id: '',
|
height: 28
|
||||||
street: '',
|
},
|
||||||
areaList: [],
|
locationInfo: {},
|
||||||
streetList: [],
|
town: '',
|
||||||
mapList: {},
|
street_id: '',
|
||||||
area_change: '',
|
street: '',
|
||||||
street_change: '',
|
areaList: [],
|
||||||
}
|
streetList: [],
|
||||||
},
|
mapList: {},
|
||||||
onLoad(options) {
|
area_change: '',
|
||||||
// #ifdef APP-PLUS
|
street_change: '',
|
||||||
this.$store.dispatch("permission/requestPermissions",
|
selectedInfo: {
|
||||||
'ACCESS_FINE_LOCATION').then(result => {
|
address: '',
|
||||||
if (result == 1) {
|
location: ''
|
||||||
this.getLoaction();
|
}
|
||||||
this.loadArea();
|
}
|
||||||
}
|
},
|
||||||
})
|
onLoad(options) {
|
||||||
// #endif
|
// #ifdef APP-PLUS
|
||||||
// #ifndef APP-PLUS
|
this.$store.dispatch("permission/requestPermissions",
|
||||||
this.getLoaction();
|
'ACCESS_FINE_LOCATION').then(result => {
|
||||||
this.loadArea();
|
if (result == 1) {
|
||||||
// #endif
|
this.getLoaction();
|
||||||
},
|
this.loadArea();
|
||||||
onShow() {},
|
}
|
||||||
computed: {
|
})
|
||||||
mapKey() {
|
// #endif
|
||||||
return Object.keys(this.mapList).sort()
|
// #ifndef APP-PLUS
|
||||||
}
|
this.getLoaction();
|
||||||
},
|
this.loadArea();
|
||||||
methods: {
|
// #endif
|
||||||
changeCurrent(e) {
|
},
|
||||||
this.current = e.index;
|
onShow() {},
|
||||||
},
|
computed: {
|
||||||
getLoaction() {
|
mapKey() {
|
||||||
this.street = '定位中'
|
return Object.keys(this.mapList).sort()
|
||||||
this.locationInfo = {};
|
}
|
||||||
this.locationInfo.formatted_addresses = {};
|
},
|
||||||
this.locationInfo.formatted_addresses.recommend = '定位中'
|
methods: {
|
||||||
uni.setStorageSync('RejectTarget', false);
|
changeCurrent(e) {
|
||||||
uni.getLocation({
|
this.current = e.index;
|
||||||
type: 'gcj02',
|
},
|
||||||
success: (res) => {
|
getLoaction() {
|
||||||
// res = wgsToGcj(res);
|
this.street = '定位中'
|
||||||
let latitude, longitude;
|
this.locationInfo = {};
|
||||||
latitude = res.latitude.toString();
|
this.locationInfo.formatted_addresses = {};
|
||||||
longitude = res.longitude.toString();
|
this.locationInfo.formatted_addresses.recommend = '定位中'
|
||||||
this.latitude = res.latitude.toFixed(6);
|
uni.setStorageSync('RejectTarget', false);
|
||||||
this.longitude = res.longitude.toFixed(6);
|
uni.getLocation({
|
||||||
this.$store.commit('setLocation', {
|
type: 'gcj02',
|
||||||
lat: res.latitude.toFixed(6),
|
success: (res) => {
|
||||||
long: res.longitude.toFixed(6),
|
// res = wgsToGcj(res);
|
||||||
});
|
let latitude, longitude;
|
||||||
getGeocoder({
|
latitude = res.latitude.toString();
|
||||||
lat: latitude,
|
longitude = res.longitude.toString();
|
||||||
long: longitude
|
this.latitude = res.latitude.toFixed(6);
|
||||||
}).then(res => {
|
this.longitude = res.longitude.toFixed(6);
|
||||||
this.locationInfo = res.data;
|
this.$store.commit('setLocation', {
|
||||||
this.town = res.data.address_reference.town.title
|
lat: res.latitude.toFixed(6),
|
||||||
this.street_id = res.data.address_reference.town.id
|
long: res.longitude.toFixed(6),
|
||||||
this.street = res.data.address_reference.town.title;
|
});
|
||||||
}).catch(err => {
|
getGeocoder({
|
||||||
uni.showToast({
|
lat: latitude,
|
||||||
title: err,
|
long: longitude
|
||||||
icon: 'none'
|
}).then(res => {
|
||||||
})
|
this.locationInfo = res.data;
|
||||||
this.street = '定位失败'
|
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;
|
||||||
fail: (err) => {
|
|
||||||
console.log('定位失败');
|
|
||||||
this.isshow = false
|
|
||||||
Toast('定位失败,请检查定位权限是否开启')
|
|
||||||
this.street = '定位失败'
|
|
||||||
this.locationInfo.formatted_addresses.recommend = '定位失败'
|
|
||||||
|
|
||||||
// uni.showToast({
|
this.selectedInfo.address = res.data.address;
|
||||||
// title: "获取定位超时",
|
this.selectedInfo.location = `${latitude},${longitude}`;
|
||||||
// icon: 'none',
|
}).catch(err => {
|
||||||
// duration: 2000
|
uni.showToast({
|
||||||
// });
|
title: err,
|
||||||
}
|
icon: 'none'
|
||||||
});
|
})
|
||||||
},
|
this.street = '定位失败'
|
||||||
reGetLocation() {
|
})
|
||||||
this.getLoaction()
|
},
|
||||||
},
|
fail: (err) => {
|
||||||
loadArea() {
|
console.log('定位失败');
|
||||||
getArea({
|
this.isshow = false
|
||||||
city_code: 510500
|
Toast('定位失败,请检查定位权限是否开启')
|
||||||
}).then((res) => {
|
this.street = '定位失败'
|
||||||
this.areaList = res.data;
|
this.locationInfo.formatted_addresses.recommend = '定位失败'
|
||||||
this.changeArea(this.areaList[0]);
|
|
||||||
})
|
// uni.showToast({
|
||||||
},
|
// title: "获取定位超时",
|
||||||
loadStreet(area_code) {
|
// icon: 'none',
|
||||||
this.street_change = '';
|
// duration: 2000
|
||||||
getStreet({
|
// });
|
||||||
area_code
|
}
|
||||||
}).then((res) => {
|
});
|
||||||
this.streetList = res.data;
|
},
|
||||||
this.initPinyin();
|
reGetLocation() {
|
||||||
})
|
this.getLoaction()
|
||||||
},
|
},
|
||||||
initPinyin() {
|
loadArea() {
|
||||||
this.mapList = {};
|
getArea({
|
||||||
this.streetList.forEach((item) => {
|
city_code: 510500
|
||||||
let str = item.pinyin?.toUpperCase();
|
}).then((res) => {
|
||||||
str = str ? str : '#';
|
this.areaList = res.data;
|
||||||
if (this.mapList[str]) {
|
this.changeArea(this.areaList[0]);
|
||||||
this.mapList[str].push(item);
|
})
|
||||||
} else {
|
},
|
||||||
this.mapList[str] = [];
|
loadStreet(area_code) {
|
||||||
this.mapList[str].push(item)
|
this.street_change = '';
|
||||||
}
|
getStreet({
|
||||||
})
|
area_code
|
||||||
},
|
}).then((res) => {
|
||||||
changeArea(item) {
|
this.streetList = res.data;
|
||||||
this.area_change = item.code;
|
this.initPinyin();
|
||||||
this.loadStreet(this.area_change);
|
})
|
||||||
},
|
},
|
||||||
// 选择位置
|
initPinyin() {
|
||||||
changeStreet(item) {
|
this.mapList = {};
|
||||||
uni.navigateBack({
|
this.streetList.forEach((item) => {
|
||||||
success: () => {
|
let str = item.pinyin?.toUpperCase();
|
||||||
uni.$emit('changeAddress', {
|
str = str ? str : '#';
|
||||||
area: this.area_change,
|
if (this.mapList[str]) {
|
||||||
street: item
|
this.mapList[str].push(item);
|
||||||
})
|
} else {
|
||||||
}
|
this.mapList[str] = [];
|
||||||
})
|
this.mapList[str].push(item)
|
||||||
},
|
}
|
||||||
// 点击地图
|
})
|
||||||
handleMapTap(e) {
|
},
|
||||||
// console.log('点击地图', e);
|
changeArea(item) {
|
||||||
// #ifdef H5
|
this.area_change = item.code;
|
||||||
return Toast('H5暂不支持选择坐标');
|
this.loadStreet(this.area_change);
|
||||||
// #endif
|
},
|
||||||
let longitude = e.detail.longitude;
|
// 选择位置
|
||||||
let latitude = e.detail.latitude;
|
changeStreet(item) {
|
||||||
this.markers.longitude = longitude;
|
uni.navigateBack({
|
||||||
this.markers.latitude = latitude;
|
success: () => {
|
||||||
// console.log('修改成功', this.markers);
|
uni.$emit('changeAddress', {
|
||||||
getGeocoder({
|
area: this.area_change,
|
||||||
lat: latitude,
|
street: item
|
||||||
long: longitude
|
})
|
||||||
}).then(res => {
|
}
|
||||||
// console.log(res);
|
})
|
||||||
this.locationInfo = res.data;
|
},
|
||||||
}).catch(err => {
|
// 点击地图
|
||||||
uni.showToast({
|
handleMapTap(e) {
|
||||||
title: err,
|
// console.log('点击地图', e);
|
||||||
icon: 'none'
|
// #ifdef H5
|
||||||
})
|
return Toast('H5暂不支持选择坐标');
|
||||||
this.locationInfo = {};
|
// #endif
|
||||||
this.locationInfo.formatted_addresses = {};
|
let longitude = e.detail.longitude;
|
||||||
this.locationInfo.formatted_addresses.recommend = '定位失败'
|
let latitude = e.detail.latitude;
|
||||||
})
|
this.markers.longitude = longitude;
|
||||||
},
|
this.markers.latitude = latitude;
|
||||||
submitAddress() {
|
getGeocoder({
|
||||||
try {
|
lat: latitude,
|
||||||
uni.setStorageSync('getAddress', true);
|
long: longitude
|
||||||
this.town = this.locationInfo.address_reference.town.title;
|
}).then(res => {
|
||||||
this.street_id = this.locationInfo.address_reference.town.id;
|
// console.log(res);
|
||||||
this.street = this.locationInfo.address_reference.town.title;
|
this.locationInfo = res.data;
|
||||||
let obj = {
|
}).catch(err => {
|
||||||
area: this.locationInfo.ad_info.adcode,
|
uni.showToast({
|
||||||
street: {
|
title: err,
|
||||||
name: this.street,
|
icon: 'none'
|
||||||
code: this.street_id
|
})
|
||||||
},
|
this.locationInfo = {};
|
||||||
latitude: this.latitude,
|
this.locationInfo.formatted_addresses = {};
|
||||||
longitude: this.longitude
|
this.locationInfo.formatted_addresses.recommend = '定位失败'
|
||||||
}
|
})
|
||||||
console.log({ ...obj });
|
},
|
||||||
uni.navigateBack({
|
submitAddress() {
|
||||||
success: () => {
|
try {
|
||||||
uni.$emit('changeAddress', obj)
|
uni.setStorageSync('getAddress', true);
|
||||||
}
|
this.town = this.locationInfo.address_reference.town.title;
|
||||||
})
|
this.street_id = this.locationInfo.address_reference.town.id;
|
||||||
} catch (e) {
|
this.street = this.locationInfo.address_reference.town.title;
|
||||||
return Toast('地址有误,请重新选择')
|
let obj = {
|
||||||
}
|
area: this.locationInfo.ad_info.adcode,
|
||||||
},
|
street: {
|
||||||
searchMap() {
|
name: this.street,
|
||||||
uni.request({
|
code: this.street_id
|
||||||
url: 'https://restapi.amap.com/v3/place/text?keywords=北京大学&city=beijing&offset=20&page=1&key=0799f37420c0784f1e6cba230a68bdb1&extensions=all',
|
},
|
||||||
success: (res) => {
|
latitude: this.latitude,
|
||||||
console.log(res);
|
longitude: this.longitude,
|
||||||
},
|
addr: {
|
||||||
fail: (e) => {
|
...this.selectedInfo
|
||||||
console.log(e);
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
uni.navigateBack({
|
||||||
},
|
success: () => {
|
||||||
onPullDownRefresh() {
|
uni.$emit('changeAddress', obj)
|
||||||
uni.stopPullDownRefresh()
|
}
|
||||||
}
|
})
|
||||||
}
|
} 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>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
/* page {
|
/* page {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.head_top {
|
.head_top {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding: 28rpx;
|
padding: 28rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.address-box {
|
.address-box {
|
||||||
border-radius: 21rpx 21rpx 0rpx 0rpx;
|
border-radius: 21rpx 21rpx 0rpx 0rpx;
|
||||||
padding: 30rpx 28rpx;
|
padding: 30rpx 28rpx;
|
||||||
width: 750rpx;
|
width: 750rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.head_item {
|
.head_item {
|
||||||
width: 750rpx;
|
width: 750rpx;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding-bottom: 28rpx;
|
padding-bottom: 28rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
font-family: PingFang SC-Regular, PingFang SC;
|
font-family: PingFang SC-Regular, PingFang SC;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.re-location {
|
.re-location {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
flex-wrap: nowrap;
|
flex-wrap: nowrap;
|
||||||
width: 480rpx;
|
width: 480rpx;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.re-address-img {
|
.re-address-img {
|
||||||
width: 38.55rpx;
|
width: 38.55rpx;
|
||||||
height: 38.55rpx;
|
height: 38.55rpx;
|
||||||
margin-right: 10rpx;
|
margin-right: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.re-btn {
|
.re-btn {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
padding-left: 10rpx;
|
padding-left: 10rpx;
|
||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
height: 100rpx;
|
height: 100rpx;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.head_item_tips {
|
.head_item_tips {
|
||||||
height: 44rpx;
|
height: 44rpx;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
font-family: PingFang SC-Regular, PingFang SC;
|
font-family: PingFang SC-Regular, PingFang SC;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #737373;
|
color: #737373;
|
||||||
}
|
}
|
||||||
|
|
||||||
.address-list {
|
.address-list {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
font-family: PingFang SC-Regular, PingFang SC;
|
font-family: PingFang SC-Regular, PingFang SC;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
line-height: 75rpx;
|
line-height: 75rpx;
|
||||||
border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
|
border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.area {
|
.area {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
padding-top: 30rpx;
|
padding-top: 30rpx;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
.area-item {
|
.area-item {
|
||||||
height: 64rpx;
|
height: 64rpx;
|
||||||
/* width: 100px; */
|
/* width: 100px; */
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 11rpx 11rpx 11rpx 11rpx;
|
border-radius: 11rpx 11rpx 11rpx 11rpx;
|
||||||
border: 2rpx solid #B3B3B3;
|
border: 2rpx solid #B3B3B3;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 0 20rpx;
|
padding: 0 20rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
font-family: PingFang SC-Medium, PingFang SC;
|
font-family: PingFang SC-Medium, PingFang SC;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #737373;
|
color: #737373;
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
margin-right: 22rpx;
|
margin-right: 22rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.area-item-on {
|
.area-item-on {
|
||||||
color: #ff6d20;
|
color: #ff6d20;
|
||||||
border: 2rpx solid #ff6d20;
|
border: 2rpx solid #ff6d20;
|
||||||
}
|
}
|
||||||
|
|
||||||
.street {
|
.street {
|
||||||
padding-top: 28rpx;
|
padding-top: 28rpx;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.letter-item {
|
.letter-item {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
}
|
}
|
||||||
|
|
||||||
.letter {
|
.letter {
|
||||||
margin-right: 28rpx;
|
margin-right: 28rpx;
|
||||||
font-size: 25rpx;
|
font-size: 25rpx;
|
||||||
font-family: PingFang SC, PingFang SC;
|
font-family: PingFang SC, PingFang SC;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
width: 40rpx;
|
width: 40rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #737373;
|
color: #737373;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-box {
|
.item-box {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.street-item {
|
.street-item {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding-bottom: 28rpx;
|
padding-bottom: 28rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
font-family: PingFang SC, PingFang SC;
|
font-family: PingFang SC, PingFang SC;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -18,8 +18,8 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="con">
|
<view class="con">
|
||||||
<image class="record"
|
<image mode="aspectFit" class="record"
|
||||||
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_active_mer/new_active_mer_qrcode_record.webp">
|
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/eec81202404091550527405.webp">
|
||||||
</image>
|
</image>
|
||||||
|
|
||||||
<view class="table" v-if="list.length > 0">
|
<view class="table" v-if="list.length > 0">
|
||||||
@ -199,7 +199,7 @@
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
page {
|
page {
|
||||||
background-color: #FFF3EF;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.invite {
|
.invite {
|
||||||
@ -217,7 +217,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
width: 690rpx;
|
width: 690rpx;
|
||||||
height: 666rpx;
|
height: 666rpx;
|
||||||
background-image: url(https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_active_mer/new_active_mer_qrcode_bg.webp);
|
background-image: url(https://lihai001.oss-cn-chengdu.aliyuncs.com/def/5a3b2202404091555409835.webp);
|
||||||
background-size: 100%;
|
background-size: 100%;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
padding-top: 54rpx;
|
padding-top: 54rpx;
|
||||||
@ -261,18 +261,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.con {
|
.con {
|
||||||
background-color: #FFF3EF;
|
width: 100%;
|
||||||
|
background-color: #ECECEC;
|
||||||
padding: 192rpx 30rpx 0;
|
padding: 192rpx 30rpx 0;
|
||||||
|
border-radius: 40rpx 40rpx 0 0;
|
||||||
|
|
||||||
image {
|
image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 45rpx;
|
height: 42rpx;
|
||||||
margin-bottom: 40rpx;
|
margin-bottom: 40rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table {
|
.table {
|
||||||
#scrollView {
|
#scrollView {
|
||||||
height: calc(100vh - 544rpx - 350rpx);
|
width: 100%;
|
||||||
|
height: calc(100vh - 544rpx - 340rpx);
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
padding-bottom: 20rpx;
|
padding-bottom: 20rpx;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,44 @@
|
|||||||
|
<style lang="scss">
|
||||||
|
.sel_addr_wrap {
|
||||||
|
height: 120rpx;
|
||||||
|
padding: 30rpx 0;
|
||||||
|
|
||||||
|
.sel_addr {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin: 0 30rpx;
|
||||||
|
border: 2rpx solid #40ae36;
|
||||||
|
height: 60rpx;
|
||||||
|
line-height: 60rpx;
|
||||||
|
text-align: center;
|
||||||
|
color: #40ae36;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
background: rgba(64, 174, 54, .1);
|
||||||
|
}
|
||||||
|
|
||||||
|
text {
|
||||||
|
margin-right: 10rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<template>
|
<template>
|
||||||
<view :style="viewColor">
|
<view :style="viewColor">
|
||||||
<form @submit="formSubmit" report-submit='true'>
|
<form @submit="formSubmit" report-submit='true'>
|
||||||
<view class='addAddress'>
|
<view class='addAddress'>
|
||||||
<view class='list'>
|
<view class='list'>
|
||||||
|
|
||||||
|
<view class="sel_addr_wrap">
|
||||||
|
<view class="sel_addr" @click="handleToChoose">
|
||||||
|
<text>选择收货地址</text>
|
||||||
|
<u-icon name="arrow-right" size="16" color="#40ae36"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class='item acea-row row-between-wrapper'>
|
<view class='item acea-row row-between-wrapper'>
|
||||||
<view class='name'>姓名</view>
|
<view class='name'>姓名</view>
|
||||||
<input type='text' placeholder='请输入姓名' name='real_name' :value="userAddress.real_name"
|
<input type='text' placeholder='请输入姓名' name='real_name' :value="userAddress.real_name"
|
||||||
@ -16,35 +52,19 @@
|
|||||||
<view class='item acea-row row-between-wrapper'>
|
<view class='item acea-row row-between-wrapper'>
|
||||||
<view class='name'>所在地区</view>
|
<view class='name'>所在地区</view>
|
||||||
<view class="region">
|
<view class="region">
|
||||||
<view class="region_count" @click="changeRegion">
|
<view class="region_count" @click="handleToChoose">
|
||||||
<text v-if="!addressInfo.length" style="color:#cdcdcd;">请选择地区</text>
|
<text v-if="!detail.length" style="color:#cdcdcd;">请选择地区</text>
|
||||||
<text v-else>{{addressText}}</text>
|
<text v-else>{{detail}}</text>
|
||||||
<text class="iconfont icon-xiangyou"></text>
|
<text class="iconfont icon-xiangyou"></text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class='item acea-row row-between-wrapper'>
|
|
||||||
<view class='name'>所在村队</view>
|
|
||||||
<view class="region">
|
|
||||||
<view class="region_count" @click="changevillage">
|
|
||||||
<text v-if="!villageInfo.length" style="color:#cdcdcd;">请选择村队</text>
|
|
||||||
<text v-else>{{villageText}}</text>
|
|
||||||
<text class="iconfont icon-xiangyou"></text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
</view> -->
|
|
||||||
<view class='item acea-row row-between-wrapper'>
|
<view class='item acea-row row-between-wrapper'>
|
||||||
<view class='name'>详细地址</view>
|
<view class='name'>详细地址</view>
|
||||||
<input type='text' class="location-input" placeholder='请填写具体地址' name='detail'
|
<input type='text' class="location-input" placeholder='请填写具体地址' name='detail'
|
||||||
placeholder-class='placeholder' v-model="userAddress.detail"></input>
|
placeholder-class='placeholder' v-model="userAddress.detail"></input>
|
||||||
<!--<view class="location" @click="selfLocation">
|
|
||||||
<text class="iconfont icon-chakanditu"></text>
|
|
||||||
<br>
|
|
||||||
定位
|
|
||||||
</view> -->
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class='default acea-row row-middle'>
|
<view class='default acea-row row-middle'>
|
||||||
@ -86,7 +106,9 @@
|
|||||||
editAddress,
|
editAddress,
|
||||||
getAddressDetail
|
getAddressDetail
|
||||||
} from '@/api/user.js';
|
} from '@/api/user.js';
|
||||||
import { wgsToGcj } from "@/utils/wgs.js";
|
import {
|
||||||
|
wgsToGcj
|
||||||
|
} from "@/utils/wgs.js";
|
||||||
import {
|
import {
|
||||||
getCityV2,
|
getCityV2,
|
||||||
getCityList
|
getCityList
|
||||||
@ -126,10 +148,15 @@
|
|||||||
display: false,
|
display: false,
|
||||||
display_one: false,
|
display_one: false,
|
||||||
addressInfo: [],
|
addressInfo: [],
|
||||||
|
newAddrInfo: '',
|
||||||
|
newPCAS: '',
|
||||||
villageInfo: [],
|
villageInfo: [],
|
||||||
list: [],
|
list: [],
|
||||||
latitude: '',
|
latitude: '',
|
||||||
longitude: ''
|
longitude: '',
|
||||||
|
detail: '', //四川省泸州市龙马潭区龙门大道15号
|
||||||
|
location: '', // 经纬度
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -158,14 +185,28 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
// 选择地址
|
||||||
|
handleToChoose() {
|
||||||
|
let that = this;
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/select_address_n/select_address_n",
|
||||||
|
success: (res) => {
|
||||||
|
uni.$once('changeAddress', res => {
|
||||||
|
console.log(res)
|
||||||
|
// this.newAddrInfo = res.addr; "name": "中国,四川省,泸州市,龙马潭区",
|
||||||
|
that.detail = res.addr.address;
|
||||||
|
that.location = res.addr.location;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
OnChangeAddress(address) {
|
OnChangeAddress(address) {
|
||||||
this.addressInfo = address;
|
this.addressInfo = address;
|
||||||
this.list = address
|
this.list = address
|
||||||
},
|
},
|
||||||
OnChangevAddress(address) {
|
|
||||||
this.villageInfo = address;
|
|
||||||
console.log(this.villageInfo)
|
|
||||||
},
|
|
||||||
// 地址数据
|
// 地址数据
|
||||||
getCityList: function() {
|
getCityList: function() {
|
||||||
let that = this;
|
let that = this;
|
||||||
@ -208,14 +249,16 @@
|
|||||||
let region = [res.data.province, res.data.city, res.data.district, res.data.street, res
|
let region = [res.data.province, res.data.city, res.data.district, res.data.street, res
|
||||||
.data.village
|
.data.village
|
||||||
];
|
];
|
||||||
console.log({...res.data});
|
console.log({
|
||||||
|
...res.data
|
||||||
|
});
|
||||||
that.$set(that, 'userAddress', res.data);
|
that.$set(that, 'userAddress', res.data);
|
||||||
that.$set(that, 'region', region);
|
that.$set(that, 'region', region);
|
||||||
that.city_id = res.data.city_id
|
that.city_id = res.data.city_id
|
||||||
if(res.data.areas) that.addressInfo = res.data.areas;
|
if (res.data.areas) that.addressInfo = res.data.areas;
|
||||||
else {
|
else {
|
||||||
|
|
||||||
}
|
}
|
||||||
that.villageInfo = [res.data.brigade]
|
that.villageInfo = [res.data.brigade]
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -291,7 +334,7 @@
|
|||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
type: 'gcj02',
|
type: 'gcj02',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
res = wgsToGcj(res);
|
res = wgsToGcj(res);
|
||||||
let latitude, longitude;
|
let latitude, longitude;
|
||||||
latitude = res.latitude.toString();
|
latitude = res.latitude.toString();
|
||||||
longitude = res.longitude.toString();
|
longitude = res.longitude.toString();
|
||||||
@ -344,6 +387,7 @@
|
|||||||
formSubmit: function(e) {
|
formSubmit: function(e) {
|
||||||
let that = this,
|
let that = this,
|
||||||
value = e.detail.value;
|
value = e.detail.value;
|
||||||
|
|
||||||
if (!value.real_name) return that.$util.Tips({
|
if (!value.real_name) return that.$util.Tips({
|
||||||
title: '请填写收货人姓名'
|
title: '请填写收货人姓名'
|
||||||
});
|
});
|
||||||
@ -353,7 +397,7 @@
|
|||||||
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(value.phone)) return that.$util.Tips({
|
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(value.phone)) return that.$util.Tips({
|
||||||
title: '请输入正确的手机号码'
|
title: '请输入正确的手机号码'
|
||||||
});
|
});
|
||||||
if (!that.addressInfo.length) return that.$util.Tips({
|
if (!that.detail.length) return that.$util.Tips({
|
||||||
title: '请选择所在地区'
|
title: '请选择所在地区'
|
||||||
});
|
});
|
||||||
// if (!that.villageInfo.length) return that.$util.Tips({
|
// if (!that.villageInfo.length) return that.$util.Tips({
|
||||||
@ -364,8 +408,8 @@
|
|||||||
});
|
});
|
||||||
value.address_id = that.address_id;
|
value.address_id = that.address_id;
|
||||||
value.is_default = that.userAddress.is_default ? 1 : 0;
|
value.is_default = that.userAddress.is_default ? 1 : 0;
|
||||||
value.area = that.addressInfo;
|
value.area = that.detail;
|
||||||
value.brigade = that.villageInfo[0]
|
// value.brigade = that.villageInfo[0]
|
||||||
|
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '保存中',
|
title: '保存中',
|
||||||
@ -470,8 +514,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.region .region_count {
|
.region .region_count {
|
||||||
height: 42rpx;
|
// height: 42rpx;
|
||||||
line-height: 42rpx;
|
// line-height: 42rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
.icon-xiangyou {
|
.icon-xiangyou {
|
||||||
float: right;
|
float: right;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user