Browse Source

地区

feature/feature-compatible
fengchengzhi 7 years ago
parent
commit
66499e14bd
1 changed files with 17 additions and 20 deletions
  1. 37
      src/view/home.vue

37
src/view/home.vue

@ -109,9 +109,7 @@
},
computed: {
// swiper() {
// return this.$refs.mySwiper.swiper
// }
},
methods: {
getName (){
@ -124,6 +122,20 @@
localStorage.setItem('cityName',this.addressValue)
},
getCityName (){
let name = localStorage.getItem("cityName")||''
console.log(name)
if(!name){
this.merchantNo = 2
return
}
let arr = name.split(',')
this.addressValue = arr
let cityNameArr = arr[2].split('&')
let cityName = cityNameArr[1]
this.defaultCity = cityName
this.merchantNo = cityNameArr[2]
},
change (name) {
this.addressValue = name
},
@ -185,7 +197,7 @@
//
getdefaultAddress (){
homeApi.getdefaultAddress().then(res => {
// console.log('',res)
console.log('默认地址信息',res)
if ( res.code == 0 ){
if ( !res.data ){
this.show = true
@ -202,8 +214,8 @@
} else {
this.$vux.toast.text(res.msg,"middle");
}
console.log(this.merchantNo)
this.getGoodsList()
this.getCityName ()
});
}
},
@ -211,21 +223,6 @@
//
this.getdefaultAddress()
this.getAddress()
// window.onscroll = function() {
//
// var top = $(window).scrollTop()
// console.log(top);
// if(top > 20){
// $('#top-nav').css({
// 'position': 'fixed'
// })
// }else {
// $('#top-nav').css({
// 'position': 'relative'
// })
// }
// };
},
destroyed () {

Loading…
Cancel
Save