fix: 调整轮训接口

This commit is contained in:
zhangds 2024-04-06 17:55:40 +08:00
parent 4afcec316d
commit 9de02b0688
4 changed files with 21 additions and 90 deletions

View File

@ -394,11 +394,10 @@
// 轮循
groupProductVoucherDetail() {
let self = this;
req.axiosGet('/key/group/groupProductVoucherDetail', {
req.axiosPost('/key/group/groupProductVoucherDetail', {
token: this.token,
code_batch_id: this.code_batch_id
}).then(res => {
if (res.code === 200) {
// send_status 1发放中2全部成功 3全部失败4部分失败 5未领取
@ -432,33 +431,6 @@
}
})
// res.data.product.forEach(item => {
// let el = self.goods.product.find(items => items.id === item.id);
// if (el) {
// item.order_voucher.forEach(row => {
// // 存储错误
// if (row.receive_error !== "") {
// all_err.push(row.receive_error);
// }
// let obj = {
// id: item.id,
// type: item.type,
// voucher: {
// denomination: el.voucher.denomination,
// reduce_amount: el.voucher.reduce_amount,
// status: self.formatStatus(row.status),
// num: self.formatStatus(row.status) === 3 ? 0 : 1,
// send_num: 1
// }
// }
// product_all.push(obj)
// debugger;
// })
// }
// })
// 第二步:更新商品数据
self.goods.product = product_all;
@ -471,6 +443,14 @@
let ffLength = product_all.filter(item => item.voucher.status === 2);
if (ffLength.length > 0) {
self.goods.send_status = 1;
setTimeout(() => {
if (self.cont > 10) {
// 放弃
return;
}
self.groupProductVoucherDetail();
self.cont++;
}, 5000);
return;
}
@ -484,8 +464,6 @@
self.goods.err_msg = [...new Set(all_err)];
self.popMsg = true;
clearInterval(self.timeGet);
self.timeGet = null;
return
} else if (errLength.length > 0 && product_all.length > errLength.length) {
// 领取失败数,小于全部数量 -> send_status 4 部分失败
@ -496,8 +474,6 @@
self.goods.send_status = 4;
self.popMsg = true;
clearInterval(self.timeGet);
self.timeGet = null;
return
}
@ -507,13 +483,8 @@
self.goods.send_status = 2;
self.popMsg = true;
clearInterval(self.timeGet);
self.timeGet = null;
return
}
} else {
clearInterval(self.timeGet);
self.timeGet = null;
}
})
},
@ -542,12 +513,7 @@
// 发放中 轮循
if (res.data.send_status === 1) {
self.timeGet = setInterval(() => {
// 安全值
if (self.cont > 10) {
clearInterval(self.timeGet);
self.timeGet = null;
}
setTimeout(() => {
self.groupProductVoucherDetail();
self.cont++;
}, 5000)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 586 B

View File

@ -10,7 +10,6 @@
charset="utf-8"></script>
<script type="text/javascript" src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/axios.js?v=1367936144999">
</script>
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/css/loading.css">
<link rel="stylesheet" href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/css/index.css">
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/loading.js"></script>
@ -71,7 +70,6 @@
</div>
</body>
<script>
debugger
new Vue({
el: '#app',
data() {
@ -124,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

@ -421,33 +421,6 @@
}
})
// res.data.product.forEach(item => {
// let el = self.goods.product.find(items => items.id === item.id);
// if (el) {
// item.order_voucher.forEach(row => {
// // 存储错误
// if (row.receive_error !== "") {
// all_err.push(row.receive_error);
// }
// let obj = {
// id: item.id,
// type: item.type,
// voucher: {
// denomination: el.voucher.denomination,
// reduce_amount: el.voucher.reduce_amount,
// status: self.formatStatus(row.status),
// num: self.formatStatus(row.status) === 3 ? 0 : 1,
// send_num: 1
// }
// }
// product_all.push(obj)
// debugger;
// })
// }
// })
// 第二步:更新商品数据
self.goods.product = product_all;
@ -460,6 +433,14 @@
let ffLength = product_all.filter(item => item.voucher.status === 2);
if (ffLength.length > 0) {
self.goods.send_status = 1;
setTimeout(() => {
if (self.cont > 10) {
// 放弃
return;
}
self.groupProductVoucherDetail();
self.cont++;
}, 5000);
return;
}
@ -472,8 +453,6 @@
// 错误去重
self.goods.err_msg = [...new Set(all_err)];
self.popMsg = true;
clearInterval(self.timeGet);
self.timeGet = null;
return
} else if (errLength.length > 0 && product_all.length > errLength.length) {
@ -484,8 +463,6 @@
self.isErrLength = errLength.length;
self.goods.send_status = 4;
self.popMsg = true;
clearInterval(self.timeGet);
self.timeGet = null;
return
}
@ -495,14 +472,9 @@
if (allOkLength.length > 0 && allOkLength.length === product_all.length) {
self.goods.send_status = 2;
self.popMsg = true;
clearInterval(self.timeGet);
self.timeGet = null;
return
}
} else {
clearInterval(self.timeGet);
self.timeGet = null;
}
})
},
@ -531,12 +503,7 @@
// 发放中 轮循
if (res.data.send_status === 1) {
self.timeGet = setInterval(() => {
// 安全值
if (self.cont > 10) {
clearInterval(self.timeGet);
self.timeGet = null;
}
setTimeout(() => {
self.groupProductVoucherDetail();
self.cont++;
}, 5000)