fix: 增加重试接口

This commit is contained in:
zhangds 2024-04-06 13:54:28 +08:00
parent 31ecd253ef
commit 3a4210df51
2 changed files with 53 additions and 17 deletions

View File

@ -491,3 +491,6 @@ body {
margin: 0.2rem auto;
padding: 0.05rem 0.2rem;
}
.err-list-p {
padding: 0.05rem;
}

View File

@ -157,8 +157,10 @@
请根据界面错误原因进行调整后再重试
</p>
<div v-if="errListShow" style="padding: 0 0.2rem;overflow-y: scroll;height: 2rem;text-align: left;">
<p class="err-list-p" v-for="(item,index) in goods.err_msg">错误{{index + 1}}: {{ item }}</p>
<div v-if="errListShow"
style="padding: 0 0.2rem;overflow-y: scroll;max-height: 2rem;text-align: left;">
<p class="err-list-p" v-for="(item,index) in goods.err_msg">错误{{Number(index) + 1}}: {{ item }}
</p>
</div>
<button class="tip-btn" v-show="goods.send_status === 2 || goods.send_status === 3"
@ -475,7 +477,10 @@
let el = self.goods.product.find(items => items.id === item.id);
if (el) {
item.order_voucher.forEach(row => {
all_err.push(row.receive_error); // 存储错误
if (row.receive_error !== "") {
all_err.push(row.receive_error); // 存储错误
}
let obj = {
id: item.id,
type: item.type,
@ -559,6 +564,15 @@
// 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 === 4) {
let all_product_length = res.data.product.length;
let is_err_length = res.data.product.filter(item => item.voucher.status === 5).length;
self.isOKLength = all_product_length - is_err_length;
self.isErrLength = is_err_length;
}
// 发放中 轮循
if (res.data.send_status === 1) {
self.timeGet = setInterval(() => {
@ -681,6 +695,33 @@
}
},
// 提交函数
submitOne(data) {
/* 领取立减金 */
req.axiosPost("/key/couponGroupUsage", data)
.then(({ code, message }) => {
if (code == 200) {
this.getProductDetail();
} else {
this.axiosErrorFun(code, message);
}
})
.catch((err) => { this.loading = false; });
},
// 重试函数
resetSubmit(data) {
/* 领取立减金 */
req.axiosPost("/voucher/groupVoucherRetry", data)
.then(({ code, message }) => {
if (code == 200) {
this.getProductDetail();
} else {
this.axiosErrorFun(code, message);
}
})
.catch((err) => { this.loading = false; });
},
/* 验证后 最终提交 */
finalSubmit() {
@ -693,24 +734,16 @@
account: this.form.receive_account,
receive_mode: 2
};
// 重试
if (this.goods.send_status === 3 || this.goods.send_status === 4) {
data.retry = 1;
}
setTimeout(() => {
this.loading = false;
}, 2000)
/* 领取立减金 */
req.axiosPost("/key/couponGroupUsage", data)
.then(({ code, message }) => {
if (code == 200) {
this.getProductDetail();
} else {
this.axiosErrorFun(code, message);
}
})
.catch((err) => { this.loading = false; });
if (this.goods.send_status === 3 || this.goods.send_status === 4) {
this.resetSubmit(data); // 重试
} else {
this.submitOne(data); // 普通提交
}
},
/* 返回 */