From f77ce18c5ebaffcfb02942ae85c150db968a236c Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Wed, 6 Mar 2024 17:36:51 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20=E7=BB=84=E5=90=88=E5=95=86?= =?UTF-8?q?=E5=93=81=E6=96=B0=E5=A2=9E=E5=85=AC=E4=BC=97=E5=8F=B7=E9=A2=86?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- combining.html | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/combining.html b/combining.html index 46acc97..61f941c 100644 --- a/combining.html +++ b/combining.html @@ -105,6 +105,7 @@ receive_time: '', message: '', loading: false, + openId: localStorage.getItem('openid'), copyLink: '', form: { confirm: null, @@ -151,9 +152,8 @@ /* ******************************************** 官方领取 ******************************************** */ /* 直接领取 */ directSubmit () { - const openid = localStorage.getItem('openid'); /* 公众号打开 */ - if (this.goods.group_info.channel == 2 && this.goods.group_info.is_webview == 1 && !openid) { + if (this.goods.group_info.channel == 2 && this.goods.group_info.is_webview == 1 && !this.openId) { const linkId = localStorage.getItem('linkId'); location.href = `https://openapi.1688sup.com/wechat/oauth?jump=${location.origin}/${linkId}/${this.key}`; return; @@ -164,7 +164,6 @@ token: this.token, code_batch_id: this.code_batch_id, receive_mode: 1, - openid }; req.axiosPost("/key/couponGroupUsage", data) @@ -175,7 +174,7 @@ this.toLinkAlipay(); } else if (this.goods.group_info.channel == 2) { if (this.goods.group_info.is_webview == 1) { - this.message = '领取成功'; + this.publicCollection(); } else { /* 微信官方领取 */ window.location.replace(res.data.redirect_url); @@ -189,6 +188,26 @@ .catch((err) => { this.loading = false; }); }, + /* 公众号领取 */ + publicCollection () { + let params = { + token: this.token, + code_batch_id: this.code_batch_id, + channel_user_id: this.openId + }; + req.axiosPost("/voucher/groupVoucherGrant", params) + .then((res) => { + if (res.code == 200) { + this.message = '领取成功'; + this.getProductDetail(); + } else { + this.axiosErrorFun(res.code, res.message); + } + }) + .catch((err) => { this.loading = false; }); + ; + }, + /* 支付宝官方领取H5跳转 */ toLinkAlipay () { let self = this; @@ -211,6 +230,7 @@ } }, + /* ******************************************** 账号领取 ******************************************** */ /* 立即领取 */ submit () {