feat: 组合商品新增公众号领取

This commit is contained in:
wangsongsole 2024-03-06 17:36:51 +08:00
parent 920a406d6f
commit f77ce18c5e
1 changed files with 24 additions and 4 deletions

View File

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