From 549f945af988857e541ed39aa137e5a4f6f49981 Mon Sep 17 00:00:00 2001 From: hupeng Date: Thu, 7 Dec 2023 09:57:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=AF=E7=94=A8=E5=AF=BC=E5=85=A5=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/user/address/AddAddress/index.vue | 42 +++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) 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,