From 433f0cb71acfe2f21a5cbeb43e0a465c4054f3df Mon Sep 17 00:00:00 2001 From: fengchengzhi Date: Thu, 20 Sep 2018 15:57:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=B7=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/view/home.vue | 8 ++++++-- src/view/poster.vue | 12 ++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/view/home.vue b/src/view/home.vue index 1e4578d..ad0dae8 100644 --- a/src/view/home.vue +++ b/src/view/home.vue @@ -106,7 +106,8 @@ }, watch: { $route(to,from){ - this.getdefaultAddress() + //this.getdefaultAddress() + this.getCityName () }, // defaultCity (val,old){ // this.ShareWenXin() @@ -128,7 +129,10 @@ getCityName (){ let name = localStorage.getItem("cityName")||'' if(!name){ - return + this.defaultCity = '天河区' + this.merchantNo = 2 //商户编号 + this.districtId = '440106000' //区id + return; } //440000000&广东省,440100000&广州市,440106000&天河区&2 console.log(name) diff --git a/src/view/poster.vue b/src/view/poster.vue index e999a85..3997980 100644 --- a/src/view/poster.vue +++ b/src/view/poster.vue @@ -39,7 +39,7 @@ return { show: false, imgSrc: "", - merchantNo: "", //商户编号 + merchantNo: 2, //商户编号 isAuthorize: false, authorizeSrc : "", ImgFix: true, @@ -66,14 +66,15 @@ console.log(name) if(!name){ this.merchantNo = 2 + this.defaultCity = '天河区' return } let arr = name.split(',') this.addressValue = arr let cityNameArr = arr[2].split('&') let cityName = cityNameArr[1] - this.defaultCity = cityName - this.merchantNo = cityNameArr[2] + this.defaultCity = cityName || '天河区' + this.merchantNo = cityNameArr[2] || 2 }, getPoster (){ let merchantNo = this.merchantNo @@ -193,6 +194,7 @@ this.addressValue = name /// this.getName() }, + //加载地址 getAddress (){ homeApi.getAddress().then(res => { if ( res.code == 0 ){ @@ -206,6 +208,7 @@ goBack() { history.go(-1); }, + //获取连接上的信息 getParam(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var url = window.location.href; @@ -222,7 +225,7 @@ this.sourceType = this.getParam("sourceType") if ( this.sourceType == 2 ){ //指定优惠券 - this.defaultCity = '' + // this.defaultCity = '' this.getPoster2() } else { //通过商户默认推荐 this.getPoster() @@ -243,6 +246,7 @@ var coupon = this.getParam("no") var sourceType = this.getParam("sourceType") var merchantNo = this.getParam("merchantNo") + if ( sourceType == 2 ){ //指定优惠券 this.wxShare({"couponNo":coupon,"source":10,"url":encodeURIComponent(location.href)}) } else if( sourceType == 1) { //通过商户默认推荐