|
|
|
@ -9,8 +9,8 @@ |
|
|
|
<i class="text" @click="show = true">{{defaultCity}}</i> |
|
|
|
</div> |
|
|
|
<div class="page-content"> |
|
|
|
<img class="poster-img" v-if="imgSrc != ''" :src="imghost + imgSrc"> |
|
|
|
<button class="create-poster" @click="createPoster(1)">重新生成海报</button> |
|
|
|
<img class="poster-img" v-if="imgSrc != ''" :src="imgSrc"> |
|
|
|
<button class="create-poster" @click="create">重新生成海报</button> |
|
|
|
</div> |
|
|
|
|
|
|
|
<popup v-model="show"> |
|
|
|
@ -37,12 +37,13 @@ |
|
|
|
imgSrc: "", |
|
|
|
merchantNo: "", //商户编号 |
|
|
|
isAuthorize: false, |
|
|
|
authorizeSrc : '', |
|
|
|
authorizeSrc : "", |
|
|
|
ImgFix: true, |
|
|
|
defaultCity: '天河区', |
|
|
|
addressData: [], |
|
|
|
addressValue: [], |
|
|
|
imghost: "http://medou.oss-cn-shenzhen.aliyuncs.com/", |
|
|
|
no: "", |
|
|
|
sourceType : "" |
|
|
|
}; |
|
|
|
}, |
|
|
|
components: { |
|
|
|
@ -69,10 +70,8 @@ |
|
|
|
|
|
|
|
}, |
|
|
|
getPoster (){ |
|
|
|
var merchantNo = this.merchantNo |
|
|
|
//console.log(merchantNo) |
|
|
|
let merchantNo = this.merchantNo |
|
|
|
posterApi.getPoster(merchantNo).then(res => { |
|
|
|
console.log("res",res) |
|
|
|
if ( res.code == 0 ){ |
|
|
|
this.authorizeSrc = res.data.oauthUrl || '' |
|
|
|
if ( res.data.hasOAuth == 1 ){ |
|
|
|
@ -86,7 +85,7 @@ |
|
|
|
location.href = res.data.oauthUrl |
|
|
|
return |
|
|
|
} else { |
|
|
|
createPoster() |
|
|
|
this.createPoster() |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
@ -95,13 +94,13 @@ |
|
|
|
if ( res.code == 667 ){ |
|
|
|
setTimeout(function(){ |
|
|
|
location.href = '/mall/web/user/login' |
|
|
|
}) |
|
|
|
},3000) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
createPoster (status){ |
|
|
|
console.log(111,this.authorizeSrc) |
|
|
|
createPoster (){ |
|
|
|
//console.log(111,this.authorizeSrc) |
|
|
|
if ( !this.isAuthorize ){ |
|
|
|
location.href = this.authorizeSrc |
|
|
|
return; |
|
|
|
@ -109,9 +108,55 @@ |
|
|
|
var merchantNo = this.merchantNo |
|
|
|
posterApi.createPoster(merchantNo).then(res => { |
|
|
|
if ( res.code == 0 ){ |
|
|
|
if ( status ){ |
|
|
|
this.$vux.toast.text(res.msg,"middle"); |
|
|
|
this.imgSrc = res.response |
|
|
|
} else { |
|
|
|
this.$vux.toast.text(res.msg,"middle"); |
|
|
|
if ( res.code == 666 ){ |
|
|
|
setTimeout(function(){ |
|
|
|
location.href = '/mall/web/user/login' |
|
|
|
},3000) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
getPoster2 (){ |
|
|
|
|
|
|
|
posterApi.getPoster2(this.no).then(res => { |
|
|
|
if ( res.code == 0 ){ |
|
|
|
this.authorizeSrc = res.data.oauthUrl || '' |
|
|
|
if ( res.data.hasOAuth == 1 ){ |
|
|
|
this.isAuthorize = true |
|
|
|
} |
|
|
|
|
|
|
|
if ( res.data.imageUrl ){ |
|
|
|
this.imgSrc = res.data.imageUrl |
|
|
|
} else { |
|
|
|
if ( res.data.hasOAuth == 0 ){ |
|
|
|
location.href = res.data.oauthUrl |
|
|
|
return |
|
|
|
} else { |
|
|
|
this.createPoster2() |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
this.$vux.toast.text(res.msg,"middle"); |
|
|
|
if ( res.code == 667 ){ |
|
|
|
setTimeout(function(){ |
|
|
|
location.href = '/mall/web/user/login' |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
createPoster2 (){ |
|
|
|
if ( !this.isAuthorize ){ |
|
|
|
location.href = this.authorizeSrc |
|
|
|
return; |
|
|
|
} |
|
|
|
var no = this.no |
|
|
|
posterApi.createPoster2({"couponNo":no}).then(res => { |
|
|
|
if ( res.code == 0 ){ |
|
|
|
this.imgSrc = res.response |
|
|
|
} else { |
|
|
|
this.$vux.toast.text(res.msg,"middle"); |
|
|
|
@ -144,12 +189,39 @@ |
|
|
|
//返回上一页 |
|
|
|
goBack() { |
|
|
|
history.go(-1); |
|
|
|
}, |
|
|
|
getParam(name) { |
|
|
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); |
|
|
|
var url = window.location.href; |
|
|
|
url = window.location.href.substring(url.indexOf("?") + 1, url.length); |
|
|
|
var r = url.match(reg); |
|
|
|
if (r != null) return unescape(r[2]); |
|
|
|
return null; |
|
|
|
}, |
|
|
|
//判断是否有no |
|
|
|
getNo (){ |
|
|
|
this.getCityName() |
|
|
|
this.getAddress() |
|
|
|
this.no = this.getParam("no") |
|
|
|
this.sourceType = this.getParam("sourceType") |
|
|
|
|
|
|
|
if ( this.sourceType == 2 ){ |
|
|
|
this.getPoster2() |
|
|
|
} else { |
|
|
|
this.getPoster() |
|
|
|
} |
|
|
|
}, |
|
|
|
//点击生成海报按钮 |
|
|
|
create (){ |
|
|
|
if ( this.sourceType == 2 ){ |
|
|
|
this.createPoster2() |
|
|
|
} else { |
|
|
|
this.createPoster() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
this.getCityName() |
|
|
|
this.getPoster(); |
|
|
|
this.getAddress() |
|
|
|
this.getNo() |
|
|
|
} |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|