diff --git a/pages/home/child/promotion.vue b/pages/home/child/promotion.vue index f619b55..4e75d60 100644 --- a/pages/home/child/promotion.vue +++ b/pages/home/child/promotion.vue @@ -318,7 +318,7 @@ export default { new Promise((resolve) => { let status = true; - if (uni.getStorageSync("agencyInfo")) { + if (uni.getStorageSync("agencyInfo") && uni.getStorageSync("apply-token")) { this.G.Get( this.api.get_supplier_info, { diff --git a/pages/home/index.vue b/pages/home/index.vue index 7ff198b..05d0938 100644 --- a/pages/home/index.vue +++ b/pages/home/index.vue @@ -659,28 +659,47 @@ export default { }, initSelectedCityByAgencyInfo() { let that = this; - let agencyInfo = uni.getStorageSync("agencyInfo"); return new Promise((resolve) => { + let agencyInfo = uni.getStorageSync("agencyInfo"); if (agencyInfo && agencyInfo.fdbHomeCity !== undefined) { - if (agencyInfo.fdbHomeCity == 1) { + that.processAgencyInfo(agencyInfo, resolve); + } else { + that.G.Get("/yishoudan/agency/getInfo", {}, (res) => { + if (res && res.agency) { + uni.setStorageSync("agencyInfo", res.agency); + that.processAgencyInfo(res.agency, resolve); + } else { + that.cityLoading = false; + resolve(); + } + }, () => { that.cityLoading = false; resolve(); - } else if (agencyInfo.fdbHomeCity == 0) { - that.getLocation().then(() => { - that.getCityNameByLatLng().then(() => { - if (that.currentCity) { - that.selectedCity = that.currentCity; - } - that.cityLoading = false; - resolve(); - }); - }); - } - } else { + }); + } + }); + }, + processAgencyInfo(agencyInfo, resolve) { + let that = this; + if (agencyInfo && agencyInfo.fdbHomeCity !== undefined) { + if (agencyInfo.fdbHomeCity == 1) { that.cityLoading = false; resolve(); + } else if (agencyInfo.fdbHomeCity == 0) { + that.getLocation().then(() => { + that.getCityNameByLatLng().then(() => { + if (that.currentCity) { + that.selectedCity = that.currentCity; + } + that.cityLoading = false; + resolve(); + }); + }); } - }); + } else { + that.cityLoading = false; + resolve(); + } }, checkScroll() { let that = this;