|
@@ -162,7 +162,7 @@ export default {
|
|
|
this.setPrintData(data);
|
|
|
} catch (error) {
|
|
|
this.$endLoading();
|
|
|
- this.$errorMsg(error)
|
|
|
+ this.$errorMsg(error);
|
|
|
console.error("获取打印数据失败");
|
|
|
}
|
|
|
loadingLen--;
|
|
@@ -236,7 +236,7 @@ export default {
|
|
|
}
|
|
|
await funcType(requestParams);
|
|
|
//清空当前克隆数据,避免重复添加次数
|
|
|
- this.clonelData = []
|
|
|
+ this.clonelData = [];
|
|
|
} catch (error) {
|
|
|
console.error("添加打印次数失败");
|
|
|
}
|
|
@@ -277,12 +277,17 @@ export default {
|
|
|
let salesOrderId, invoiceId; //出库单号,发货单号 默认数据中的第一个
|
|
|
salesOrderId = data.invoicePickBeans[0].salesOrderId;
|
|
|
invoiceId = data.invoicePickBeans[0].invoiceId;
|
|
|
- let refUseUnit,refEnginRecordNo
|
|
|
- refUseUnit=data.refUseUnit|| data.invoicePickBeans[0].refUseUnit || ''
|
|
|
- refEnginRecordNo=data.refEnginRecordNo|| data.invoicePickBeans[0].refEnginRecordNo || ''
|
|
|
- let tuiHuoRen = data.createBy
|
|
|
+ let refUseUnit, refEnginRecordNo;
|
|
|
+ refUseUnit = data.refUseUnit || data.invoicePickBeans[0].refUseUnit || "";
|
|
|
+ refEnginRecordNo =
|
|
|
+ data.refEnginRecordNo ||
|
|
|
+ data.invoicePickBeans[0].refEnginRecordNo ||
|
|
|
+ "";
|
|
|
+ let remark;
|
|
|
+ remark = data.invoicePickBeans[0].remark;
|
|
|
+ let tuiHuoRen = data.createBy;
|
|
|
// 数量合计
|
|
|
- let total = 0
|
|
|
+ let total = 0;
|
|
|
// 初始化打印次数
|
|
|
let printNum = 0;
|
|
|
//避免数据发生改变
|
|
@@ -300,7 +305,7 @@ export default {
|
|
|
const newInvoicePickBeans = invoicePickBeans.splice(0, 5);
|
|
|
for (let e = newInvoicePickBeans.length; e > 0; e--) {
|
|
|
const tempData = newInvoicePickBeans[e - 1];
|
|
|
- total += Math.abs(+tempData.refundableQty)
|
|
|
+ total += Math.abs(+tempData.refundableQty);
|
|
|
|
|
|
//添加表格数据
|
|
|
table.push({
|
|
@@ -309,7 +314,9 @@ export default {
|
|
|
? this.dateToDayFilter(data.createTime)
|
|
|
: "",
|
|
|
enginOrderType:
|
|
|
- tempData.orderType == "HOME" || tempData.orderType == "TRADE" || tempData.orderType === "REQUISITION_TRADE" ||
|
|
|
+ tempData.orderType == "HOME" ||
|
|
|
+ tempData.orderType == "TRADE" ||
|
|
|
+ tempData.orderType === "REQUISITION_TRADE" ||
|
|
|
tempData.orderType === "REQUISITION_HOME"
|
|
|
? tempData.enginOrderNo
|
|
|
: tempData.mainOrderId,
|
|
@@ -326,14 +333,14 @@ export default {
|
|
|
printNum: printNum + 1,
|
|
|
salesId: salesOrderId,
|
|
|
invoiceId: invoiceId,
|
|
|
- refUseUnit:refUseUnit,
|
|
|
- refEnginRecordNo:refEnginRecordNo,
|
|
|
+ refUseUnit: refUseUnit,
|
|
|
+ refEnginRecordNo: refEnginRecordNo,
|
|
|
type: data.type,
|
|
|
tiTui: data.type === 2 ? `退货人` : `提货人`,
|
|
|
takerPhone: data.takerPhone || "",
|
|
|
- headerRemark: data.remark,
|
|
|
+ headerRemark: remark,
|
|
|
total_num: data.total_num,
|
|
|
- total:total,
|
|
|
+ total: total,
|
|
|
company:
|
|
|
data.type === 2
|
|
|
? `${this.company}销售退货单`
|
|
@@ -344,7 +351,7 @@ export default {
|
|
|
nowDate: this.nowDate(),
|
|
|
takerName:
|
|
|
data.type === 2
|
|
|
- ? `退货人:${tuiHuoRen|| ""}`
|
|
|
+ ? `退货人:${tuiHuoRen || ""}`
|
|
|
: `提货人:${data.takerName || ""}`,
|
|
|
customerName: data.customerName || "",
|
|
|
correspondName: data.correspondName,
|
|
@@ -434,73 +441,73 @@ export default {
|
|
|
</div>
|
|
|
`;
|
|
|
},
|
|
|
- /**
|
|
|
- * 备份方法
|
|
|
+ /**
|
|
|
+ * 备份方法
|
|
|
* 获取需要打印数据详情
|
|
|
* @param {Array} ids
|
|
|
*/
|
|
|
- async getDateils(ids, funcType = "getDeliverDetail") {
|
|
|
- this.$startLoading();
|
|
|
- let loadingLen;
|
|
|
- // 兼容多个打印数据
|
|
|
- ids = ids instanceof Array ? ids : [ids];
|
|
|
- console.log(ids);
|
|
|
- // 清空之前打印的数据
|
|
|
- this.outputData = [];
|
|
|
- // 筛选id
|
|
|
- let formatting = [];
|
|
|
+ async getDateils(ids, funcType = "getDeliverDetail") {
|
|
|
+ this.$startLoading();
|
|
|
+ let loadingLen;
|
|
|
+ // 兼容多个打印数据
|
|
|
+ ids = ids instanceof Array ? ids : [ids];
|
|
|
+ console.log(ids);
|
|
|
+ // 清空之前打印的数据
|
|
|
+ this.outputData = [];
|
|
|
+ // 筛选id
|
|
|
+ let formatting = [];
|
|
|
|
|
|
- // 仓库认证请求接口参数
|
|
|
- let params = [];
|
|
|
+ // 仓库认证请求接口参数
|
|
|
+ let params = [];
|
|
|
|
|
|
- // 获取数据id
|
|
|
- for (let i = ids.length; i > 0; i--) {
|
|
|
- formatting.push(ids[i - 1].id || ids[i - 1]);
|
|
|
- if (funcType === "getDtailPrintDis") {
|
|
|
- params.push({
|
|
|
- id: ids[i - 1].id,
|
|
|
- invoiceId: ids[i - 1].invoiceId,
|
|
|
- });
|
|
|
- this.addIds.push(ids[i - 1].id);
|
|
|
- }
|
|
|
- }
|
|
|
+ // 获取数据id
|
|
|
+ for (let i = ids.length; i > 0; i--) {
|
|
|
+ formatting.push(ids[i - 1].id || ids[i - 1]);
|
|
|
+ if (funcType === "getDtailPrintDis") {
|
|
|
+ params.push({
|
|
|
+ id: ids[i - 1].id,
|
|
|
+ invoiceId: ids[i - 1].invoiceId,
|
|
|
+ });
|
|
|
+ this.addIds.push(ids[i - 1].id);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (funcType === "getDtailPrintDis") {
|
|
|
- const requestParams = params;
|
|
|
- try {
|
|
|
- const { data } = await getDtailPrintDis(requestParams);
|
|
|
- loadingLen = data.length;
|
|
|
- for (let i = data.length; i > 0; i--) {
|
|
|
- const newData = data[i - 1];
|
|
|
- await this.setPrintData(newData);
|
|
|
- loadingLen--;
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- this.$endLoading();
|
|
|
- console.error("获取打印数据失败");
|
|
|
- }
|
|
|
- } else {
|
|
|
- // id 去重
|
|
|
- formatting = [...new Set(formatting)];
|
|
|
- loadingLen = formatting.length;
|
|
|
- for (let i = formatting.length; i > 0; i--) {
|
|
|
- const requestParams = {
|
|
|
- id: formatting[i - 1],
|
|
|
- };
|
|
|
- try {
|
|
|
- const { data } = await getDeliverDetail(requestParams);
|
|
|
- this.setPrintData(data);
|
|
|
- } catch (error) {
|
|
|
- this.$endLoading();
|
|
|
- this.$errorMsg(error)
|
|
|
- console.error("获取打印数据失败");
|
|
|
- }
|
|
|
- loadingLen--;
|
|
|
- }
|
|
|
+ if (funcType === "getDtailPrintDis") {
|
|
|
+ const requestParams = params;
|
|
|
+ try {
|
|
|
+ const { data } = await getDtailPrintDis(requestParams);
|
|
|
+ loadingLen = data.length;
|
|
|
+ for (let i = data.length; i > 0; i--) {
|
|
|
+ const newData = data[i - 1];
|
|
|
+ await this.setPrintData(newData);
|
|
|
+ loadingLen--;
|
|
|
}
|
|
|
- if (loadingLen == 0) {
|
|
|
- return Promise.resolve();
|
|
|
+ } catch (error) {
|
|
|
+ this.$endLoading();
|
|
|
+ console.error("获取打印数据失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // id 去重
|
|
|
+ formatting = [...new Set(formatting)];
|
|
|
+ loadingLen = formatting.length;
|
|
|
+ for (let i = formatting.length; i > 0; i--) {
|
|
|
+ const requestParams = {
|
|
|
+ id: formatting[i - 1],
|
|
|
+ };
|
|
|
+ try {
|
|
|
+ const { data } = await getDeliverDetail(requestParams);
|
|
|
+ this.setPrintData(data);
|
|
|
+ } catch (error) {
|
|
|
+ this.$endLoading();
|
|
|
+ this.$errorMsg(error);
|
|
|
+ console.error("获取打印数据失败");
|
|
|
}
|
|
|
- },
|
|
|
+ loadingLen--;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (loadingLen == 0) {
|
|
|
+ return Promise.resolve();
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
};
|