fix: 增加轮循

This commit is contained in:
zhangds 2024-04-05 16:27:08 +08:00
parent ba320aae11
commit ce9939e523
2 changed files with 41 additions and 3 deletions

View File

@ -122,8 +122,8 @@
});
let self = this;
//获取链接携带的参数
// let linkId = getQueryString('id');
let linkId = "2253"
let linkId = getQueryString('id');
// let linkId = "2253"
let keyCode = getQueryString('key');
if (!linkId) {//地址栏无携带id

View File

@ -327,7 +327,9 @@
popMsg: false,
popboxshow: false,
maskshow: false,
tiptext: ""
tiptext: "",
cont: 0,
timeGet: null
};
},
@ -424,6 +426,28 @@
this.tiptext = tip;
this.popboxshow = true;
},
// 轮循
groupProductVoucherDetail() {
req.axiosGet('/key/group/groupProductVoucherDetail', {
token: this.token,
code_batch_id: this.code_batch_id
}).then(res => {
if (res.code === 200) {
// 状态不为 发放中 停止轮循
if (res.data.send_status !== 1) {
this.goods = {
...this.goods,
...res.data,
}
clearInterval(this.timeGet);
this.timeGet = null;
}
} else {
clearInterval(this.timeGet);
this.timeGet = null;
}
})
},
//获取商品详情
getProductDetail() {
req.axiosGet('/key/group/groupProductDetail', {
@ -436,6 +460,20 @@
// send_status 1发放中2全部成功 3全部失败4部分失败 5未领取
this.popMsg = res.data.send_status === 2 || res.data.send_status === 3 || res.data.send_status === 4 ? true : false;
// 发放中 轮循
if (res.data.send_status === 1) {
this.timeGet = setInterval(() => {
// 安全值
if (this.cont > 10) {
clearInterval(this.timeGet);
this.timeGet = null;
}
this.groupProductVoucherDetail();
this.cont++;
}, 5000)
}
// 代码暂时这样
if (res.data.group_info.channel == 1 && res.data.group_info.receive_mode == 1) {