diff --git a/combining.html b/combining.html index 4096582..c09e457 100644 --- a/combining.html +++ b/combining.html @@ -151,12 +151,22 @@ /* ******************************************** 官方领取 ******************************************** */ /* 直接领取 */ directSubmit () { + const openid = localStorage.getItem('openid'); + /* 公众号打开 */ + if (this.goods.group_info.channel == 2 && this.goods.group_info.is_webview == 1 && !openid) { + const linkId = localStorage.getItem('linkId'); + location.href = `https://openapi.1688sup.com/wechat/oauth?jump=${location.origin}/${linkId}/${this.key}`; + return; + } + const data = { key: this.key, token: this.token, code_batch_id: this.code_batch_id, - receive_mode: 1 + receive_mode: 1, + openid }; + req.axiosPost("/key/couponGroupUsage", data) .then((res) => { if (res.code == 200) { diff --git a/index.html b/index.html index 5f4336c..9ae60f9 100644 --- a/index.html +++ b/index.html @@ -122,7 +122,6 @@ let linkId = this.getQueryString('id'); let keyCode = this.getQueryString('key'); let openid = this.getQueryString('openid'); - debugger; openid && localStorage.setItem('openid', openid); if (!linkId) {//地址栏无携带id let path = window.location.pathname; diff --git a/reduce.html b/reduce.html index f28f360..60d17cf 100644 --- a/reduce.html +++ b/reduce.html @@ -188,6 +188,15 @@ } }, receiveFn () { + const openid = localStorage.getItem('openid'); + /* 公众号打开 */ + if (this.goodInfo.entity.channel == 2 && this.goodInfo.entity.is_webview == 1 && !openid) { + const key = localStorage.getItem('key'); + const linkId = localStorage.getItem('linkId'); + location.href = `https://openapi.1688sup.com/wechat/oauth?jump=${location.origin}/${linkId}/${key}`; + return; + } + if (this.loading) return; this.loading = true; let self = this; @@ -201,6 +210,7 @@ goods_id: this.goodInfo.entity.goods_id, code_batch_id: this.goodInfo.code_batch_id, token: localStorage.getItem("token"), + openid }; req.axiosPost("/key/usage", data) .then((res) => {