|
|
|
@ -171,7 +171,8 @@ export default { |
|
|
|
show: false, |
|
|
|
location: {}, |
|
|
|
uniqueId: "", |
|
|
|
defaultCity: "天河区", //区名 默认值 不需要去掉 |
|
|
|
defaultDistrict: "天河区", |
|
|
|
defaultCity: "广州市", //区名 默认值 不需要去掉 |
|
|
|
defaultCommunity: "请选择小区", |
|
|
|
merchantNo: 2, //商户编号 默认值 不需要去掉 |
|
|
|
districtId: "440106000", //区id 默认值 不需要去掉 |
|
|
|
@ -319,11 +320,12 @@ export default { |
|
|
|
lng: this.lng |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
console.log("----------getAddressInfo"); |
|
|
|
if (res.response.allAddress && res.response.userAddress) { |
|
|
|
this.addressData = res.response.allAddress; |
|
|
|
this.flag = true; |
|
|
|
let data = res.response; |
|
|
|
//type:1-定位失败,0-不弹窗,1-弹窗无服务商,2-弹窗有服务商 |
|
|
|
//type:-1定位失败,0-不弹窗,1-弹窗无服务商,2-弹窗有服务商,3-小区无效 |
|
|
|
if (data.userAddress.type == 1) { |
|
|
|
this.address = |
|
|
|
data.userAddress.cityName + |
|
|
|
@ -332,54 +334,23 @@ export default { |
|
|
|
: ""); |
|
|
|
this.alertShow = true; |
|
|
|
} else if (data.userAddress.type == 2) { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
chooseCommunityApi |
|
|
|
.getEstateList({ |
|
|
|
draw: 0, |
|
|
|
lat: this.lat, |
|
|
|
lng: this.lng, |
|
|
|
num: 1 |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
//获取定位地址 |
|
|
|
if (res.dataList.length > 0) { |
|
|
|
var addreRes = res.dataList[0]; |
|
|
|
this.$vux.confirm.show({ |
|
|
|
title: "自动定位小区:", |
|
|
|
content: addreRes.housingEstateName, |
|
|
|
cancelText: "切换地址", |
|
|
|
onCancel: () => { |
|
|
|
this.chooseCommunity(); |
|
|
|
}, |
|
|
|
onConfirm: () => { |
|
|
|
this.defaultLocalEstate(addreRes); |
|
|
|
this.getGoodsList(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.$vux.confirm.show({ |
|
|
|
title: "自动定位地址:", |
|
|
|
content: |
|
|
|
data.userAddress.cityName + |
|
|
|
(data.userAddress.districtName |
|
|
|
? data.userAddress.districtName |
|
|
|
: ""), |
|
|
|
confirmText: "选择小区", |
|
|
|
cancelText: "切换地址", |
|
|
|
onCancel: () => { |
|
|
|
this.chooseCommunity(); |
|
|
|
}, |
|
|
|
onConfirm: () => { |
|
|
|
this.defaultLocalEstate(data.estateInfo); |
|
|
|
this.chooseCommunity(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
this.showLoading = false; |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
this.showLoading = false; |
|
|
|
}); |
|
|
|
this.showLoading = false; |
|
|
|
this.$vux.confirm.show({ |
|
|
|
title: "自动定位小区", |
|
|
|
content: |
|
|
|
data.estateInfo.cityName + |
|
|
|
data.estateInfo.districtName + |
|
|
|
"【" + |
|
|
|
data.estateInfo.housingEstateName + |
|
|
|
"】", |
|
|
|
cancelText: "切换", |
|
|
|
onCancel: () => { |
|
|
|
this.chooseCommunity(); |
|
|
|
}, |
|
|
|
onConfirm: () => { |
|
|
|
this.defaultLocalEstate(data.estateInfo); |
|
|
|
this.getGoodsList(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else if (data.userAddress.type == 0) { |
|
|
|
this.getGoodsList(); |
|
|
|
@ -393,6 +364,20 @@ export default { |
|
|
|
this.chooseCommunity(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else if (data.userAddress.type == 3) { |
|
|
|
localStorage.removeItem("estate"); |
|
|
|
this.$vux.alert.show({ |
|
|
|
title: |
|
|
|
this.defaultCity + |
|
|
|
this.defaultDistrict + |
|
|
|
"【" + |
|
|
|
this.defaultCommunity + |
|
|
|
"】" + |
|
|
|
"暂无开通服务", |
|
|
|
onHide: () => { |
|
|
|
this.chooseCommunity(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
resolve(); |
|
|
|
} |
|
|
|
@ -413,9 +398,10 @@ export default { |
|
|
|
this.addressValue = arr; |
|
|
|
this.provinceId = arr[0].split("&")[0]; |
|
|
|
this.cityId = arr[1].split("&")[0]; |
|
|
|
let cityNameArr = arr[2].split("&"); |
|
|
|
this.districtId = cityNameArr[0]; |
|
|
|
this.defaultCity = cityNameArr[1]; |
|
|
|
this.defaultCity = arr[1].split("&")[1]; |
|
|
|
let districtArr = arr[2].split("&"); |
|
|
|
this.districtId = districtArr[0]; |
|
|
|
this.defaultDistrict = districtArr[1]; |
|
|
|
// this.merchantNo = cityNameArr[2]; |
|
|
|
this.merchantNo = 2; |
|
|
|
} |
|
|
|
@ -428,6 +414,7 @@ export default { |
|
|
|
}, |
|
|
|
getData() { |
|
|
|
let get = async () => { |
|
|
|
this.getId(); |
|
|
|
await this.getAddressInfo(); |
|
|
|
// await this.getGoodsList(); |
|
|
|
}; |
|
|
|
@ -438,19 +425,33 @@ export default { |
|
|
|
this.chooseCommunity(); |
|
|
|
}, |
|
|
|
getLocation() { |
|
|
|
// let get = async () => { |
|
|
|
//判断是否在微信环境下操作 |
|
|
|
var ua = window.navigator.userAgent.toLowerCase(); |
|
|
|
//通过正则表达式匹配ua中是否含有MicroMessenger字符串 |
|
|
|
let _this = this; |
|
|
|
if (ua.match(/MicroMessenger/i) == "micromessenger") { |
|
|
|
//微信环境 |
|
|
|
this.wxLocation({}); |
|
|
|
this.wxLocation().then(result => { |
|
|
|
console.log("wxLocationresult:" + result); |
|
|
|
this.getId(); |
|
|
|
this.getAddressInfo(); |
|
|
|
}); |
|
|
|
// this.getData().then(result => { |
|
|
|
// this.wxLocation({}) |
|
|
|
// }); |
|
|
|
} else { |
|
|
|
// TODO 非微信环境用百度api |
|
|
|
this.getCity(); |
|
|
|
} |
|
|
|
// }; |
|
|
|
// return get(); |
|
|
|
}, |
|
|
|
getWXLocation() { |
|
|
|
let get = async () => { |
|
|
|
await this.wxLocation({}); |
|
|
|
}; |
|
|
|
return get(); |
|
|
|
}, |
|
|
|
|
|
|
|
getCity() { |
|
|
|
let _this = this; |
|
|
|
var geolocation = new BMap.Geolocation(); |
|
|
|
@ -467,8 +468,8 @@ export default { |
|
|
|
if (data.addressComponents) { |
|
|
|
const result = data.addressComponents; |
|
|
|
const location = { |
|
|
|
creditLongitude: r.point.lat, // 经度 |
|
|
|
creditLatitude: r.point.lng, // 纬度 |
|
|
|
creditLongitude: r.point.lng, // 经度 |
|
|
|
creditLatitude: r.point.lat, // 纬度 |
|
|
|
creditProvince: result.province || "", // 省 |
|
|
|
creditCity: result.city || "", // 市 |
|
|
|
creditArea: result.district || "", // 区 |
|
|
|
@ -480,20 +481,22 @@ export default { |
|
|
|
localStorage.setItem("longitude", location.creditLongitude); |
|
|
|
_this.lat = location.creditLatitude; |
|
|
|
_this.lng = location.creditLongitude; |
|
|
|
// alert( |
|
|
|
// "省-" + |
|
|
|
// location.creditProvince + |
|
|
|
// ";市-" + |
|
|
|
// location.creditCity + |
|
|
|
// ";区-" + |
|
|
|
// location.creditArea + |
|
|
|
// ";街道-" + |
|
|
|
// location.creditStreet + |
|
|
|
// ";lat-" + |
|
|
|
// location.creditLatitude + |
|
|
|
// ";lng-" + |
|
|
|
// location.creditLongitude |
|
|
|
// ); |
|
|
|
alert( |
|
|
|
"省-" + |
|
|
|
location.creditProvince + |
|
|
|
";市-" + |
|
|
|
location.creditCity + |
|
|
|
";区-" + |
|
|
|
location.creditArea + |
|
|
|
";街道-" + |
|
|
|
location.creditStreet + |
|
|
|
";lat-" + |
|
|
|
location.creditLatitude + |
|
|
|
";lng-" + |
|
|
|
location.creditLongitude |
|
|
|
); |
|
|
|
_this.getId(); |
|
|
|
_this.getAddressInfo(); |
|
|
|
} |
|
|
|
}); |
|
|
|
// } |
|
|
|
@ -505,12 +508,15 @@ export default { |
|
|
|
? estateRes.provinceId |
|
|
|
: this.provinceId; |
|
|
|
this.cityId = estateRes.cityId ? estateRes.cityId : this.cityId; |
|
|
|
this.cityName = estateRes.cityName |
|
|
|
? estateRes.cityName |
|
|
|
: this.defaultCity; |
|
|
|
this.districtId = estateRes.districtId |
|
|
|
? estateRes.districtId |
|
|
|
: this.districtId; |
|
|
|
this.defaultCity = estateRes.districtName |
|
|
|
this.defaultDistrict = estateRes.districtName |
|
|
|
? estateRes.districtName |
|
|
|
: this.defaultCity; |
|
|
|
: this.defaultDistrict; |
|
|
|
this.merchantNo = estateRes.merchantNo; |
|
|
|
this.addressValue = [ |
|
|
|
this.provinceId + "&" + estateRes.provinceName, |
|
|
|
@ -542,6 +548,12 @@ export default { |
|
|
|
// this.getdefaultAddress(); |
|
|
|
// this.getAddress(); |
|
|
|
// this.getLocation(); |
|
|
|
// this.$vux.confirm.show({ |
|
|
|
// content: "当前小区为:天河区丽江新村,是否切换为:天河区骏景花园", |
|
|
|
// confirmText: "确定", |
|
|
|
|
|
|
|
// onConfirm: () => {} |
|
|
|
// }); |
|
|
|
this.getId(); |
|
|
|
let eId = this.$route.query.estateId; |
|
|
|
console.log("eId----" + eId + "estateId---" + this.estateId); |
|
|
|
@ -568,20 +580,36 @@ export default { |
|
|
|
this.showLoading = false; |
|
|
|
if (isEmpty(res.response)) { |
|
|
|
//链接小区无效 |
|
|
|
this.chooseCommunity(); |
|
|
|
this.$vux.alert.show({ |
|
|
|
title: |
|
|
|
this.defaultCity + |
|
|
|
this.defaultDistrict + |
|
|
|
"【" + |
|
|
|
this.defaultCommunity + |
|
|
|
"】" + |
|
|
|
"暂无开通服务", |
|
|
|
onHide: () => { |
|
|
|
this.chooseCommunity(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
//链接小区有效 |
|
|
|
var linkEstate = res.response; |
|
|
|
this.$vux.confirm.show({ |
|
|
|
title: "当前小区", |
|
|
|
content: linkEstate.housingEstateName, |
|
|
|
confirmText: "确定", |
|
|
|
cancelText: "切换", |
|
|
|
content: |
|
|
|
linkEstate.cityName + |
|
|
|
linkEstate.districtName + |
|
|
|
"【" + |
|
|
|
linkEstate.housingEstateName + |
|
|
|
"】", |
|
|
|
confirmText: "切换", |
|
|
|
cancelText: "确定", |
|
|
|
onCancel: () => { |
|
|
|
this.chooseCommunity(); |
|
|
|
this.defaultLocalEstate(linkEstate); |
|
|
|
}, |
|
|
|
onConfirm: () => { |
|
|
|
this.defaultLocalEstate(linkEstate); |
|
|
|
this.chooseCommunity(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
@ -590,8 +618,19 @@ export default { |
|
|
|
this.showLoading = false; |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.showLoading = false; |
|
|
|
this.chooseCommunity(); |
|
|
|
this.$vux.alert.show({ |
|
|
|
title: |
|
|
|
this.defaultCity + |
|
|
|
this.defaultDistrict + |
|
|
|
"【" + |
|
|
|
this.defaultCommunity + |
|
|
|
"】" + |
|
|
|
"暂无开通服务", |
|
|
|
onHide: () => { |
|
|
|
this.showLoading = false; |
|
|
|
this.chooseCommunity(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
var loclEstate = res.response; |
|
|
|
@ -617,10 +656,20 @@ export default { |
|
|
|
//链接小区有效 |
|
|
|
var linkEstate = res.response; |
|
|
|
this.$vux.confirm.show({ |
|
|
|
title: "切换小区", |
|
|
|
content: linkEstate.housingEstateName, |
|
|
|
content: |
|
|
|
"当前小区为:" + |
|
|
|
this.defaultCity + |
|
|
|
this.defaultDistrict + |
|
|
|
"【" + |
|
|
|
this.defaultCommunity + |
|
|
|
"】,是否切换为:" + |
|
|
|
linkEstate.cityName + |
|
|
|
linkEstate.districtName + |
|
|
|
"【" + |
|
|
|
linkEstate.housingEstateName + |
|
|
|
"】,是否切换为:", |
|
|
|
confirmText: "不切换", |
|
|
|
cancelText: "切换", |
|
|
|
cancelText: "确定", |
|
|
|
onCancel: () => { |
|
|
|
this.defaultLocalEstate(linkEstate); |
|
|
|
this.getGoodsList(); |
|
|
|
@ -661,16 +710,21 @@ export default { |
|
|
|
var linkEstate = res.response; |
|
|
|
this.$vux.confirm.show({ |
|
|
|
title: "当前小区", |
|
|
|
content: linkEstate.housingEstateName, |
|
|
|
confirmText: "确定", |
|
|
|
cancelText: "切换", |
|
|
|
content: |
|
|
|
linkEstate.cityName + |
|
|
|
linkEstate.districtName + |
|
|
|
"【" + |
|
|
|
linkEstate.housingEstateName + |
|
|
|
"】", |
|
|
|
confirmText: "切换", |
|
|
|
cancelText: "确定", |
|
|
|
onCancel: () => { |
|
|
|
this.chooseCommunity(); |
|
|
|
}, |
|
|
|
onConfirm: () => { |
|
|
|
this.defaultLocalEstate(linkEstate); |
|
|
|
this.getGoodsList(); |
|
|
|
countPartner() |
|
|
|
countPartner(); |
|
|
|
}, |
|
|
|
onConfirm: () => { |
|
|
|
this.chooseCommunity(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
@ -680,8 +734,8 @@ export default { |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
//this.getData(); |
|
|
|
this.getLocation(); |
|
|
|
this.getData(); |
|
|
|
} |
|
|
|
|
|
|
|
var uuniqueId = this.$route.query.uniqueId; |
|
|
|
|