diff --git a/src/view/choose-community.vue b/src/view/choose-community.vue index cf54765..beddff8 100644 --- a/src/view/choose-community.vue +++ b/src/view/choose-community.vue @@ -173,11 +173,13 @@ export default { }, //确定时保存记录 confirm(list) { - console.log("list:" + list); + console.log("list:" + list); + // let addressArr = list.split(","); let arr = list[2].split("&") || ""; this.districtId = arr[0]; this.defaultCity = arr[1]; this.addressValue = list.slice(); + console.log("arr:" + this.defaultCity); // localStorage.setItem("cityName", list); this.show = false; this.pageNum = 1; @@ -188,26 +190,6 @@ export default { this.fetchCommunityList(); }, cancel() { - let str = localStorage.getItem("cityName") || ""; - //首次取消也需要请求 - if (!str) { - this.defaultCity = "天河区"; - //商户编号 - this.merchantNo = 2; - //区id - this.districtId = "440106000"; - this.addressValue = [ - "440000000&广东省", - "440100000&广州市", - "440106000&天河区&2" - ]; - this.pageNum = 0; - this.busy = false; - this.loadMoreHide = false; - this.loadMoreTips = false; - this.communityList = []; - this.fetchCommunityList(); - } this.show = false; }, clear() { @@ -242,7 +224,7 @@ export default { this.isRequesting = true; //this.busy = true; var _this = this; - console.log("communityName:" + this.communityName); + console.log("communityName:" + this.defaultCity); return new Promise((resolve, reject) => { var params = { pageNo: this.pageNum, @@ -279,13 +261,13 @@ export default { }); }, chooseCommunity(item) { - var addressValue = [ + this.addressValue = [ item.provinceId + "&" + item.provinceName, item.cityId + "&" + item.cityName, item.districtId + "&" + item.districtName + "&" + item.merchantNo ]; if (isEmpty(this.templateNo)) { - localStorage.setItem("cityName", addressValue.slice()); + localStorage.setItem("cityName", this.addressValue.slice()); localStorage.setItem( "estate", item.housingEstateId + "&" + item.housingEstateName @@ -312,7 +294,7 @@ export default { .then(res => { this.showLoading = false; if (res.code === 0) { - localStorage.setItem("cityName", addressValue.slice()); + localStorage.setItem("cityName", this.addressValue.slice()); localStorage.setItem( "estate", item.housingEstateId + "&" + item.housingEstateName @@ -327,7 +309,7 @@ export default { content: item.housingEstateName + "暂无提供此商品服务", confirmText: "确定", onConfirm: () => { - localStorage.setItem("cityName", addressValue.slice()); + localStorage.setItem("cityName", this.addressValue.slice()); localStorage.setItem( "estate", item.housingEstateId + "&" + item.housingEstateName