feat: 增加组合商品
This commit is contained in:
parent
4d41195f75
commit
b23cffc3b9
|
@ -494,58 +494,46 @@
|
||||||
/* ******************************************** 官方领取 ******************************************** */
|
/* ******************************************** 官方领取 ******************************************** */
|
||||||
/* 直接领取 */
|
/* 直接领取 */
|
||||||
directSubmit() {
|
directSubmit() {
|
||||||
const self = this;
|
let self = this;
|
||||||
self.loading = true;
|
self.loading = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
self.loading = false;
|
self.loading = false;
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
/* 公众号打开 */
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
key: this.key,
|
key: self.key,
|
||||||
token: this.token,
|
token: self.token,
|
||||||
code_batch_id: this.code_batch_id,
|
code_batch_id: self.code_batch_id,
|
||||||
receive_mode: 1
|
receive_mode: 1
|
||||||
};
|
};
|
||||||
req.axiosPost("/key/couponGroupUsage", data)
|
req.axiosPost("/key/couponGroupUsage", data)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
if (this.goods.group_info.channel == 1 && this.goods.group_info.receive_mode == 1) {
|
// 第一步:是否是微信环境 -> 公众号授权
|
||||||
/* 支付宝官方领取 */
|
if (self.openId && navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1) {
|
||||||
this.toLinkAlipay();
|
self.publicCollection(res.data.order_number);
|
||||||
} else if (this.goods.group_info.channel == 2) {
|
} else {
|
||||||
if (this.goods.group_info.is_webview == 1) {
|
/* 小程序 */
|
||||||
/* 公众号 */
|
window.location.replace(res.data.redirect_url);
|
||||||
this.publicCollection();
|
self.timeGet = setInterval(() => {
|
||||||
} else {
|
self.getProductDetail(); //
|
||||||
/* 小程序 */
|
// self.groupProductVoucherDetail(); // 没有返回值,解决不了
|
||||||
window.location.replace(res.data.redirect_url);
|
}, 3000);
|
||||||
self.timeGet = setInterval(() => {
|
|
||||||
self.getProductDetail(); //
|
|
||||||
// self.groupProductVoucherDetail(); // 没有返回值,解决不了
|
|
||||||
}, 3000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.axiosErrorFun(res.code, res.message);
|
self.axiosErrorFun(res.code, res.message);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => { this.loading = false; });
|
.catch((err) => { self.loading = false; });
|
||||||
},
|
},
|
||||||
|
|
||||||
/* 公众号领取 */
|
/* 公众号领取 */
|
||||||
publicCollection() {
|
publicCollection() {
|
||||||
let params = {
|
let params = {
|
||||||
token: this.token,
|
token: this.token,
|
||||||
code_batch_id: this.code_batch_id,
|
code_batch_id: this.code_batch_id,
|
||||||
channel_user_id: this.openId,
|
channel_user_id: this.openId,
|
||||||
is_webview: 1
|
is_webview: 1,
|
||||||
|
grant_channel: "wechat"
|
||||||
};
|
};
|
||||||
req.axiosPost("/voucher/groupVoucherGrant", params)
|
req.axiosPost("/voucher/groupVoucherGrant", params)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
@ -584,20 +572,7 @@
|
||||||
/* ******************************************** 账号领取 ******************************************** */
|
/* ******************************************** 账号领取 ******************************************** */
|
||||||
/* 立即领取 */
|
/* 立即领取 */
|
||||||
submit() {
|
submit() {
|
||||||
if (this.goods.group_info.channel == 3 || this.goods.group_info.channel == 1 && this.goods.group_info.receive_mode == 2) {
|
this.directSubmit();
|
||||||
const { confirm, receive_account } = this.form;
|
|
||||||
if (this.loading) return;
|
|
||||||
if (confirm !== receive_account) return this.tips('两次输入账号不一致');
|
|
||||||
/* 云闪付校验手机号 支付宝校验手机号/邮箱号 */
|
|
||||||
if ((phoneReg.test(receive_account) && this.goods.group_info.channel == 3 || this.goods.group_info.channel == 1 && (emailReg.test(receive_account) || phoneReg.test(receive_account)))) {
|
|
||||||
this.finalSubmit();
|
|
||||||
} else {
|
|
||||||
this.tips('请输入正确的账号');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.directSubmit();
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
// 提交函数
|
// 提交函数
|
||||||
submitOne(data) {
|
submitOne(data) {
|
||||||
|
@ -627,33 +602,6 @@
|
||||||
.catch((err) => { this.loading = false; });
|
.catch((err) => { this.loading = false; });
|
||||||
},
|
},
|
||||||
|
|
||||||
/* 验证后 最终提交 */
|
|
||||||
finalSubmit() {
|
|
||||||
const self = this;
|
|
||||||
self.loading = true;
|
|
||||||
setTimeout(() => {
|
|
||||||
self.loading = false;
|
|
||||||
}, 5000);
|
|
||||||
|
|
||||||
if (this.goods.send_status === 3 || this.goods.send_status === 4) {
|
|
||||||
let params = {
|
|
||||||
token: localStorage.getItem("token"),
|
|
||||||
code_batch_id: this.code_batch_id,
|
|
||||||
channel_user_id: this.form.receive_account
|
|
||||||
};
|
|
||||||
this.resetSubmit(params); // 重试
|
|
||||||
} else {
|
|
||||||
let params = {
|
|
||||||
key: this.key,
|
|
||||||
code_batch_id: this.code_batch_id,
|
|
||||||
token: localStorage.getItem("token"),
|
|
||||||
account: this.form.receive_account,
|
|
||||||
receive_mode: 2
|
|
||||||
};
|
|
||||||
this.submitOne(params); // 普通提交
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/* 返回 */
|
/* 返回 */
|
||||||
backGoodsFn() {
|
backGoodsFn() {
|
||||||
if (this.backAble) {
|
if (this.backAble) {
|
||||||
|
|
Loading…
Reference in New Issue