【新增】用户地址添加地址,增加【从微信获取】功能,但因微信地址存储数据有限,同时省市县不统一,会有部分数据需要手动输入,无法全部一键识别入库。

This commit is contained in:
大灰灰
2022-10-31 23:21:58 +08:00
parent c2f2214eaa
commit 603bba1079
2 changed files with 23 additions and 8 deletions

View File

@@ -121,6 +121,9 @@
} }
}, },
"permission": { "permission": {
"scope.userFuzzyLocation": {
"desc": "你的位置信息将用于小程序定位"
},
"scope.userLocation": { "scope.userLocation": {
"desc": "你的位置信息将用于小程序定位" "desc": "你的位置信息将用于小程序定位"
} }

View File

@@ -84,7 +84,7 @@
<view class="coreshop-bottomBox"> <view class="coreshop-bottomBox">
<button class="coreshop-btn coreshop-btn-square coreshop-btn-w" @click="delShip" v-if="id && id != 0" :disabled='submitStatus' :loading='submitStatus'>删除</button> <button class="coreshop-btn coreshop-btn-square coreshop-btn-w" @click="delShip" v-if="id && id != 0" :disabled='submitStatus' :loading='submitStatus'>删除</button>
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
<button class="coreshop-btn coreshop-btn-square coreshop-btn-b" @click="wechatAddress" hover-class="btn-hover2">从微信获取</button> <button class="coreshop-btn coreshop-btn-square coreshop-btn-w" @click="wechatAddress" v-if="!id">从微信获取</button>
<!-- #endif --> <!-- #endif -->
<button class="coreshop-btn coreshop-btn-square coreshop-btn-b" @click="saveShip" :disabled='submitStatus' :loading='submitStatus'>保存</button> <button class="coreshop-btn coreshop-btn-square coreshop-btn-b" @click="saveShip" :disabled='submitStatus' :loading='submitStatus'>保存</button>
</view> </view>
@@ -275,7 +275,7 @@
//编辑获取收货地址信息 //编辑获取收货地址信息
getShipInfo() { getShipInfo() {
let data = { let data = {
'id': this.id id: this.id
} }
this.$u.api.shipDetail(data).then(res => { this.$u.api.shipDetail(data).then(res => {
if (res.status) { if (res.status) {
@@ -472,24 +472,36 @@
// #endif // #endif
}, },
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
wechatAddress: function () { wechatAddress() {
let _that = this; let _that = this;
wx.chooseAddress({ wx.chooseAddress({
success: res => { success: res => {
if (res.errMsg == "chooseAddress:ok") { if (res.errMsg == "chooseAddress:ok") {
//获取成功 //获取成功
//存储这个收获地区信息到数据库 _that.form.name = res.userName;
_that.form.mobile = res.telNumber;
_that.form.address = res.detailInfo;
_that.pickerValue = res.provinceName + " " + res.cityName + " " + res.countyName;
let data = { let data = {
provinceName: res.provinceName, provinceName: res.provinceName,
cityName: res.cityName, cityName: res.cityName,
countyName: res.countyName, countyName: res.countyName,
postalCode: res.postalCode
}; };
this.$u.api.getAreaId(data).then(res => {
if (res.status) {
this.areaId = res.data;
this.init();
} else {
uni.showModal({
title: '提示',
content: '地区选择出现问题,请重新选择地区',
showCancel: false
});
}
});
console.log(res); console.log(res);
} else { } else {
this.$refs.uToast.show({ title: '获取微信地址失败', type: 'error' }); this.$refs.uToast.show({ title: '获取微信地址失败', type: 'error' });
} }