// 快递面单打印小于500单的调用一下函数
if (this.object.loadingwaveData && this.object.flag) {
let waveIdIndex = 0;
const processWaveId = (waveIdIndex) => {
this.processFlag = true;
if (waveIdIndex >= waveIds.length) {
return Promise.resolve(); // 结束递归
}
return self.$refs.printHot.printMutipleBatch(
waveIds[waveIdIndex],
self.myVersion,
self.wavePrintNumForm.printStartNum,
[waveIds[waveIdIndex]],
orderNum,
pageTotal,
pageSize,
current
).then((result) => {
console.log('result22222: ', result);
if (result) {
return processWaveId(waveIdIndex + 1); // 请求成功或者不是200和不是500 失败的情况都递归
}
});
};
processWaveId(waveIdIndex)
.then(() => {
this.processFlag = false
console.log('All waveIds processed.');
})
.catch((error) => {
console.error('Error processing waveIds:', error);
});
}
网友评论