|
|
|
@ -75,16 +75,16 @@ |
|
|
|
data() { |
|
|
|
return { |
|
|
|
show: false, |
|
|
|
defaultCity: '天河区', |
|
|
|
merchantNo: 2, //商户编号 |
|
|
|
districtId: '440106000', //区id |
|
|
|
defaultCity: '天河区', //区名 默认值 不需要去掉 |
|
|
|
merchantNo: 2, //商户编号 默认值 不需要去掉 |
|
|
|
districtId: '440106000', //区id 默认值 不需要去掉 |
|
|
|
addressData: [], |
|
|
|
addressValue: [], |
|
|
|
bannerImgList:[], //轮播图 |
|
|
|
promotionImgList: {}, //优惠券, |
|
|
|
goodsList:[], |
|
|
|
imghost: "http://medou.oss-cn-shenzhen.aliyuncs.com/", |
|
|
|
swiperOption: {//swiper3 |
|
|
|
swiperOption: { |
|
|
|
autoplay: { |
|
|
|
disableOnInteraction: false, |
|
|
|
}, |
|
|
|
@ -106,7 +106,6 @@ |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
$route(to,from){ |
|
|
|
//this.getdefaultAddress() |
|
|
|
this.getCityName () |
|
|
|
}, |
|
|
|
}, |
|
|
|
@ -119,14 +118,13 @@ |
|
|
|
this.getGoodsList() //加载商品列表 |
|
|
|
this.defaultCity = arr[1] |
|
|
|
this.show = false |
|
|
|
// console.log(this.addressValue) |
|
|
|
localStorage.setItem('cityName',this.addressValue) |
|
|
|
this.ShareWenXin() |
|
|
|
// console.log('本地存储',localStorage.getItem("cityName")) |
|
|
|
}, |
|
|
|
//获取本地存储上的地区信息 |
|
|
|
getCityName (){ |
|
|
|
let name = localStorage.getItem("cityName")||'' |
|
|
|
//本地存储不在 则赋予默认值 |
|
|
|
if(!name){ |
|
|
|
this.defaultCity = '天河区' |
|
|
|
this.merchantNo = 2 //商户编号 |
|
|
|
@ -134,7 +132,6 @@ |
|
|
|
return; |
|
|
|
} |
|
|
|
//440000000&广东省,440100000&广州市,440106000&天河区&2 |
|
|
|
// console.log(name) |
|
|
|
let arr = name.split(',') |
|
|
|
this.addressValue = arr |
|
|
|
let cityNameArr = arr[2].split('&') |
|
|
|
@ -144,9 +141,9 @@ |
|
|
|
}, |
|
|
|
//获取城市名称 |
|
|
|
change (name) { |
|
|
|
// console.log(name) |
|
|
|
this.addressValue = name |
|
|
|
}, |
|
|
|
//加载商品列表 |
|
|
|
getGoodsList (){ |
|
|
|
let that = this |
|
|
|
that.showLoading = true |
|
|
|
@ -186,9 +183,9 @@ |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
//加载地址数据 |
|
|
|
getAddress (){ |
|
|
|
homeApi.getAddress().then(res => { |
|
|
|
// console.log(res) |
|
|
|
if ( res.code == 0 ){ |
|
|
|
this.addressData = res.data |
|
|
|
} else { |
|
|
|
@ -208,7 +205,6 @@ |
|
|
|
|
|
|
|
homeApi.getdefaultAddress().then(res => { |
|
|
|
if ( res.code == 0 ){ |
|
|
|
// console.log(res) |
|
|
|
//如果获取的信息不存在 将从本地存储上拿 |
|
|
|
if ( !res.data ){ |
|
|
|
this.show = true |
|
|
|
@ -220,8 +216,7 @@ |
|
|
|
this.addressValue = [] |
|
|
|
this.addressValue.push(res.data.provinceId) |
|
|
|
this.addressValue.push(res.data.cityId) |
|
|
|
this.addressValue.push(res.data.districtId) |
|
|
|
// localStorage.setItem('cityName',this.addressValue) |
|
|
|
this.addressValue.push(res.data.districtId) |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.$vux.toast.text(res.msg,"middle"); |
|
|
|
@ -240,10 +235,6 @@ |
|
|
|
this.getdefaultAddress() |
|
|
|
this.getAddress() |
|
|
|
this.ShareWenXin() |
|
|
|
// console.log('本地存储',localStorage.getItem("cityName")) |
|
|
|
}, |
|
|
|
destroyed () { |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|