From 8843e6724ff7d13b8be575e544cfaf59e04d74fd Mon Sep 17 00:00:00 2001 From: wangkesi Date: Mon, 29 Oct 2018 20:56:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86storage=E7=9A=84?= =?UTF-8?q?=E8=BF=87=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/view/home.vue | 64 ++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 34 deletions(-) diff --git a/src/view/home.vue b/src/view/home.vue index 0ae03cd..4adea5e 100644 --- a/src/view/home.vue +++ b/src/view/home.vue @@ -330,46 +330,42 @@ export default { this.addressData = res.data.allAddress; this.flag = true; let data = res.data; - // this.provinceId = data.userAddress.provinceId; - this.cityId = data.userAddress.cityId - ? data.userAddress.cityId - : this.cityId; - this.districtId = data.userAddress.districtId - ? data.userAddress.districtId - : this.districtId; - this.defaultCity = data.userAddress.districtName - ? data.userAddress.districtName - : this.defaultCity; - this.merchantNo = data.userAddress.merchantNo; - if ( - data.userAddress.type != 1 && - data.userAddress.type != -1 - ) { - // this.addressValue = [ - // this.provinceId + - // "&" + - // data.userAddress.provinceName, - // this.cityId + - // "&" + - // data.userAddress.cityName, - // this.districtId + - // "&" + - // data.userAddress.districtName + - // "&" + - // data.userAddress.merchantNo - // ]; - // localStorage.setItem( - // "cityName", - // this.addressValue.slice() - // ); - } - // console.log(data.userAddress) if (data.userAddress.type == 1) { this.address = data.userAddress.cityName + data.userAddress.districtName; this.alertShow = true; } else if (data.userAddress.type == 2) { + this.provinceId = data.userAddress.provinceId + ? data.userAddress.provinceId + : this.provinceId; + this.cityId = data.userAddress.cityId + ? data.userAddress.cityId + : this.cityId; + this.districtId = data.userAddress.districtId + ? data.userAddress.districtId + : this.districtId; + this.defaultCity = data.userAddress.districtName + ? data.userAddress.districtName + : this.defaultCity; + this.merchantNo = data.userAddress.merchantNo; + this.addressValue = [ + this.provinceId + + "&" + + data.userAddress.provinceName, + this.cityId + + "&" + + data.userAddress.cityName, + this.districtId + + "&" + + data.userAddress.districtName + + "&" + + data.userAddress.merchantNo + ]; + localStorage.setItem( + "cityName", + this.addressValue.slice() + ); this.$vux.confirm.show({ title: "自动定位地址:", content: