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 () {