启用导入微信地址

This commit is contained in:
hupeng
2023-12-07 09:57:50 +08:00
parent 659466931e
commit 549f945af9

View File

@ -46,7 +46,7 @@ import CitySelect from '@/components/CitySelect'
import { getAddress, postAddress, getCity } from '@/api/user'
import attrs, { required, chs_phone } from '@/utils/validate'
import { validatorDefaultCatch } from '@/utils/dialog'
// import { openAddress } from "@/libs/wechat";
import { openAddress } from "@/libs/wechat";
import { isWeixin } from '@/utils'
export default {
@ -114,7 +114,45 @@ export default {
that.address.district = res.data.district
})
},
getAddress() {},
getAddress() {
console.log('aaaaaaaaaa')
openAddress().then(userInfo => {
uni.showLoading({ title: "加载中" });
postAddress({
real_name: userInfo.userName,
phone: userInfo.telNumber,
address: {
province: userInfo.provinceName,
city: userInfo.cityName,
district: userInfo.countryName
},
detail: userInfo.detailInfo,
post_code: userInfo.postalCode,
wx_export: 1
})
.then(() => {
this.page = 1;
this.loading = false;
this.loadend = false;
this.addressList = [];
this.AddressList();
uni.hideLoading();
uni.showToast({
title: "添加成功",
icon: 'success',
duration: 2000
});
})
.catch(err => {
uni.hideLoading();
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none',
duration: 2000
});
});
});
},
async submit() {
let name = this.userAddress.realName,
phone = this.userAddress.phone,