From f373ff3250fc2c4ca7066a41aab1279733834f5e Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Wed, 6 Mar 2024 16:41:31 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20=E6=96=B0=E5=A2=9E=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E5=85=AC=E4=BC=97=E5=8F=B7=E6=89=93=E5=BC=80=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- combining.html | 12 +++++++++++- index.html | 1 - reduce.html | 10 ++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) 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) => {