diff --git a/pages/user/address/AddAddress/index.vue b/pages/user/address/AddAddress/index.vue index 45977eb..3e6fdb6 100644 --- a/pages/user/address/AddAddress/index.vue +++ b/pages/user/address/AddAddress/index.vue @@ -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,