diff --git a/pages/cart.vue b/pages/cart.vue index ba1b6ef..4fff1b5 100644 --- a/pages/cart.vue +++ b/pages/cart.vue @@ -361,7 +361,10 @@ export default { }, addNewAddress() { this.$yrouter.push({ - path: "/pages/user/address/AddAddress/index" + path: "/pages/user/address/AddAddress/index", + query: { + choosMode: 1 + } }); }, getAddress() { diff --git a/pages/user/address/AddAddress/index.vue b/pages/user/address/AddAddress/index.vue index 6db7837..f16b738 100644 --- a/pages/user/address/AddAddress/index.vue +++ b/pages/user/address/AddAddress/index.vue @@ -368,7 +368,7 @@ export default { is_default: isDefault ? true : false, post_code: "" }; - postAddress(data).then(function () { + postAddress(data).then(function (res) { if (that.id) { uni.showToast({ title: "修改成功", @@ -382,6 +382,20 @@ export default { duration: 2000 }); } + if(that.$yroute.query.choosMode == 1) { + const item = { + id: res.data.id, + realName: name, + phone: phone, + district: that.address.district, + province: that.address.province, + city: that.address.city, + detail: detail, + is_default: isDefault ? true : false, + post_code: "" + } + uni.$emit('chooseAddress', item) + } that.$yrouter.back(); }); } catch (err) {