|
|
|
@ -149,7 +149,7 @@ import chooseCommunityApi from "../models/choose-community"; |
|
|
|
import homeApi from "../models/home-model.js"; |
|
|
|
import configs from "../configs"; |
|
|
|
import { Alert, Toast, Loading } from "vux"; |
|
|
|
import {isEmpty} from "@/common/util"; |
|
|
|
import { isEmpty } from "@/common/util"; |
|
|
|
import routerFooter from "../components/nav-bottom"; |
|
|
|
import popupPicker from "../components/popup-picker.vue"; |
|
|
|
import { countPartner } from "@/common/util"; |
|
|
|
@ -341,12 +341,12 @@ export default { |
|
|
|
num: 1 |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
//获取定位地址 |
|
|
|
//获取定位地址 |
|
|
|
if (res.dataList.length > 0) { |
|
|
|
var addreRes = res.dataList[0]; |
|
|
|
this.$vux.confirm.show({ |
|
|
|
title: "自动定位小区:", |
|
|
|
content:addreRes.housingEstateName, |
|
|
|
content: addreRes.housingEstateName, |
|
|
|
cancelText: "切换地址", |
|
|
|
onCancel: () => { |
|
|
|
this.chooseCommunity(); |
|
|
|
@ -356,8 +356,8 @@ export default { |
|
|
|
this.getGoodsList(); |
|
|
|
} |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
this.$vux.confirm.show({ |
|
|
|
} else { |
|
|
|
this.$vux.confirm.show({ |
|
|
|
title: "自动定位地址:", |
|
|
|
content: |
|
|
|
data.userAddress.cityName + |
|
|
|
@ -450,7 +450,7 @@ export default { |
|
|
|
this.getCity(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getCity() { |
|
|
|
let _this = this; |
|
|
|
var geolocation = new BMap.Geolocation(); |
|
|
|
@ -528,22 +528,26 @@ export default { |
|
|
|
this.defaultCommunity = estateRes.housingEstateName |
|
|
|
? estateRes.housingEstateName |
|
|
|
: this.defaultCommunity; |
|
|
|
if(!isEmpty(this.estateId)){ |
|
|
|
localStorage.setItem("estate",this.estateId + "&" + this.defaultCommunity); |
|
|
|
countPartner(); |
|
|
|
} |
|
|
|
|
|
|
|
if (!isEmpty(this.estateId)) { |
|
|
|
localStorage.setItem( |
|
|
|
"estate", |
|
|
|
this.estateId + "&" + this.defaultCommunity |
|
|
|
); |
|
|
|
countPartner(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted() { |
|
|
|
//异步加载 |
|
|
|
// this.getdefaultAddress(); |
|
|
|
// this.getAddress(); |
|
|
|
// this.getLocation(); |
|
|
|
this.getId(); |
|
|
|
let eId = this.$route.query.estateId; |
|
|
|
if (!isEmpty(eId) ) { |
|
|
|
console.log("eId----" + eId + "estateId---" + this.estateId); |
|
|
|
if (!isEmpty(eId)) { |
|
|
|
if (!isEmpty(this.estateId)) { |
|
|
|
//本地有小区 |
|
|
|
this.showLoading = true; |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
chooseCommunityApi |
|
|
|
@ -553,11 +557,50 @@ mounted() { |
|
|
|
.then(res => { |
|
|
|
if (isEmpty(res.response)) { |
|
|
|
//本地小区无效 |
|
|
|
localStorage.removeItem("estate") |
|
|
|
this.estateId = eId; |
|
|
|
this.getData(); |
|
|
|
localStorage.removeItem("estate"); |
|
|
|
if (eId !== this.estateId) { |
|
|
|
//本地小区不等于链接小区 |
|
|
|
chooseCommunityApi |
|
|
|
.getEstateInfo({ |
|
|
|
estateId: eId ? eId : "" |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
this.showLoading = false; |
|
|
|
if (isEmpty(res.response)) { |
|
|
|
//链接小区无效 |
|
|
|
this.chooseCommunity(); |
|
|
|
} else { |
|
|
|
//链接小区有效 |
|
|
|
var linkEstate = res.response; |
|
|
|
this.$vux.confirm.show({ |
|
|
|
title: "当前小区", |
|
|
|
content: linkEstate.housingEstateName, |
|
|
|
confirmText: "确定", |
|
|
|
cancelText: "切换", |
|
|
|
onCancel: () => { |
|
|
|
this.chooseCommunity(); |
|
|
|
}, |
|
|
|
onConfirm: () => { |
|
|
|
this.defaultLocalEstate(linkEstate); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
this.showLoading = false; |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.showLoading = false; |
|
|
|
this.chooseCommunity(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
var loclEstate = res.response; |
|
|
|
if (eId === this.estateId) { |
|
|
|
this.showLoading = false; |
|
|
|
this.getGoodsList(); |
|
|
|
countPartner(); |
|
|
|
return; |
|
|
|
} |
|
|
|
//本地小区有效,判断链接小区是否有效 |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
chooseCommunityApi |
|
|
|
@ -568,7 +611,8 @@ mounted() { |
|
|
|
this.showLoading = false; |
|
|
|
if (isEmpty(res.response)) { |
|
|
|
//链接小区无效 |
|
|
|
this.defaultLocalEstate(loclEstate); |
|
|
|
this.getGoodsList(); |
|
|
|
countPartner(); |
|
|
|
} else { |
|
|
|
//链接小区有效 |
|
|
|
var linkEstate = res.response; |
|
|
|
@ -578,10 +622,12 @@ mounted() { |
|
|
|
confirmText: "不切换", |
|
|
|
cancelText: "切换", |
|
|
|
onCancel: () => { |
|
|
|
this.chooseCommunity(); |
|
|
|
this.defaultLocalEstate(linkEstate); |
|
|
|
this.getGoodsList(); |
|
|
|
countPartner(); |
|
|
|
}, |
|
|
|
onConfirm: () => { |
|
|
|
this.defaultLocalEstate(linkEstate); |
|
|
|
this.getGoodsList(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
@ -598,8 +644,40 @@ mounted() { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.estateId = eId; |
|
|
|
this.getData(); |
|
|
|
// this.estateId = eId; |
|
|
|
// this.getData(); |
|
|
|
//本地无小区 |
|
|
|
chooseCommunityApi |
|
|
|
.getEstateInfo({ |
|
|
|
estateId: eId ? eId : "" |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
this.showLoading = false; |
|
|
|
if (isEmpty(res.response)) { |
|
|
|
//链接小区无效 |
|
|
|
this.chooseCommunity(); |
|
|
|
} else { |
|
|
|
//链接小区有效 |
|
|
|
var linkEstate = res.response; |
|
|
|
this.$vux.confirm.show({ |
|
|
|
title: "当前小区", |
|
|
|
content: linkEstate.housingEstateName, |
|
|
|
confirmText: "确定", |
|
|
|
cancelText: "切换", |
|
|
|
onCancel: () => { |
|
|
|
this.chooseCommunity(); |
|
|
|
}, |
|
|
|
onConfirm: () => { |
|
|
|
this.defaultLocalEstate(linkEstate); |
|
|
|
this.getGoodsList(); |
|
|
|
countPartner() |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
this.showLoading = false; |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.getLocation(); |
|
|
|
|