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: { computed: {
// swiper() {
// return this.$refs.mySwiper.swiper
// }
}, },
methods: { methods: {
getName (){ getName (){
@ -124,6 +122,20 @@
localStorage.setItem('cityName',this.addressValue) 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) { change (name) {
this.addressValue = name this.addressValue = name
}, },
@ -185,7 +197,7 @@
// //
getdefaultAddress (){ getdefaultAddress (){
homeApi.getdefaultAddress().then(res => { homeApi.getdefaultAddress().then(res => {
// console.log('',res)
console.log('默认地址信息',res)
if ( res.code == 0 ){ if ( res.code == 0 ){
if ( !res.data ){ if ( !res.data ){
this.show = true this.show = true
@ -202,8 +214,8 @@
} else { } else {
this.$vux.toast.text(res.msg,"middle"); this.$vux.toast.text(res.msg,"middle");
} }
console.log(this.merchantNo)
this.getGoodsList() this.getGoodsList()
this.getCityName ()
}); });
} }
}, },
@ -211,21 +223,6 @@
// //
this.getdefaultAddress() this.getdefaultAddress()
this.getAddress() 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 () { destroyed () {

Loading…
Cancel
Save