diff --git a/xw-pages/wx-combining.html b/xw-pages/wx-combining.html
index 01fe948..96bcfe1 100644
--- a/xw-pages/wx-combining.html
+++ b/xw-pages/wx-combining.html
@@ -494,58 +494,46 @@
/* ******************************************** 官方领取 ******************************************** */
/* 直接领取 */
directSubmit() {
- const self = this;
+ let self = this;
self.loading = true;
setTimeout(() => {
self.loading = false;
}, 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 = {
- key: this.key,
- token: this.token,
- code_batch_id: this.code_batch_id,
+ key: self.key,
+ token: self.token,
+ code_batch_id: self.code_batch_id,
receive_mode: 1
};
req.axiosPost("/key/couponGroupUsage", data)
.then((res) => {
if (res.code == 200) {
- if (this.goods.group_info.channel == 1 && this.goods.group_info.receive_mode == 1) {
- /* 支付宝官方领取 */
- this.toLinkAlipay();
- } else if (this.goods.group_info.channel == 2) {
- if (this.goods.group_info.is_webview == 1) {
- /* 公众号 */
- this.publicCollection();
- } else {
- /* 小程序 */
- window.location.replace(res.data.redirect_url);
- self.timeGet = setInterval(() => {
- self.getProductDetail(); //
- // self.groupProductVoucherDetail(); // 没有返回值,解决不了
- }, 3000);
- }
+ // 第一步:是否是微信环境 -> 公众号授权
+ if (self.openId && navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1) {
+ self.publicCollection(res.data.order_number);
+ } else {
+ /* 小程序 */
+ window.location.replace(res.data.redirect_url);
+ self.timeGet = setInterval(() => {
+ self.getProductDetail(); //
+ // self.groupProductVoucherDetail(); // 没有返回值,解决不了
+ }, 3000);
}
} else {
- this.axiosErrorFun(res.code, res.message);
+ self.axiosErrorFun(res.code, res.message);
}
})
- .catch((err) => { this.loading = false; });
+ .catch((err) => { self.loading = false; });
},
-
/* 公众号领取 */
publicCollection() {
let params = {
token: this.token,
code_batch_id: this.code_batch_id,
channel_user_id: this.openId,
- is_webview: 1
+ is_webview: 1,
+ grant_channel: "wechat"
};
req.axiosPost("/voucher/groupVoucherGrant", params)
.then((res) => {
@@ -584,20 +572,7 @@
/* ******************************************** 账号领取 ******************************************** */
/* 立即领取 */
submit() {
- if (this.goods.group_info.channel == 3 || this.goods.group_info.channel == 1 && this.goods.group_info.receive_mode == 2) {
- 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();
- }
-
+ this.directSubmit();
},
// 提交函数
submitOne(data) {
@@ -627,33 +602,6 @@
.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() {
if (this.backAble) {