|
|
@@ -1849,6 +1849,22 @@
|
|
|
this.$message.warning('未获取到物品类型!');
|
|
|
}
|
|
|
|
|
|
+ const mergedList = [];
|
|
|
+ this.detailList.forEach((item) => {
|
|
|
+ const key = `${item.productCode}_${item.batchNo}_${item.colorKey}_${item.warehouseId}_${item.modelType}`;
|
|
|
+ const existIndex = mergedList.findIndex(
|
|
|
+ (m) => `${m.productCode}_${m.batchNo}_${m.colorKey}_${m.warehouseId}_${m.modelType}` === key
|
|
|
+ );
|
|
|
+ if (existIndex > -1) {
|
|
|
+ mergedList[existIndex].quantity += item.quantity;
|
|
|
+ mergedList[existIndex].packingWeight += item.packingWeight;
|
|
|
+ mergedList[existIndex].packingQuantity += item.packingQuantity;
|
|
|
+
|
|
|
+ } else {
|
|
|
+ mergedList.push({ ...item });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
// 包装列表 this.detailList
|
|
|
// 获取主数据物品详情
|
|
|
// let { category } = await getDetails(this.form.categoryId);
|
|
|
@@ -1924,7 +1940,7 @@
|
|
|
// );
|
|
|
|
|
|
// 生成产品列表
|
|
|
- this.productList = this.detailList.map((filtersItem, index) => {
|
|
|
+ this.productList = mergedList.map((filtersItem, index) => {
|
|
|
|
|
|
let item = res.find(
|
|
|
(detailItem) =>
|
|
|
@@ -1961,7 +1977,7 @@
|
|
|
) {
|
|
|
weight = this.form.totalWeight;
|
|
|
} else {
|
|
|
- switch (item.weightUnit.toUpperCase()) {
|
|
|
+ switch (filtersItem.weightUnit.toUpperCase()) {
|
|
|
case 'KG':
|
|
|
if (this.form.totalWeight > -1) {
|
|
|
weight = this.$math.format(
|
|
|
@@ -2024,8 +2040,8 @@
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- let packingUnit = item.packingUnit;
|
|
|
- let singleWeight = item.singleWeight || 0; // 单重重量
|
|
|
+ let packingUnit = filtersItem.packingUnit;
|
|
|
+ let singleWeight = filtersItem.singleWeight || 0; // 单重重量
|
|
|
|
|
|
return {
|
|
|
index: this.productList.length + index,
|
|
|
@@ -2082,12 +2098,13 @@
|
|
|
? filtersItem.quantity
|
|
|
: this.form.totalCount, // 计量数量
|
|
|
measureUnit: filtersItem.measuringUnit, // 计量单位
|
|
|
- measureType: filtersItem.measureType, // 计量方式
|
|
|
+ measureType: item.measureType, // 计量方式
|
|
|
netWeight: item.netWeight > -1 ? item.netWeight : 0, // 净重
|
|
|
weight: weight || 0, // 重量
|
|
|
singleWeight: singleWeight || 0,
|
|
|
weightUnit: item.weightUnit, // 重量单位
|
|
|
- totalMoney: item.totalPrice, // 总价
|
|
|
+ totalMoney: filtersItem.totalPrice, // 总价
|
|
|
+ pricingWay: filtersItem.pricingWay, //计价方式
|
|
|
unitPrice: item.unitPrice, // 单价
|
|
|
purpose: '', // 用途
|
|
|
isUnpack: item.isUnpack, // 是否允许拆包
|
|
|
@@ -2098,12 +2115,12 @@
|
|
|
? filtersItem?.warehouseName
|
|
|
: this.form.warehouseName, // 仓库名称
|
|
|
warehouseIds: this.isMoreProduct
|
|
|
- ? this.detailList
|
|
|
+ ? mergedList
|
|
|
.filter((val) => val.productCode == item.code)
|
|
|
.map((item) => item.warehouseId)
|
|
|
: warehouseIds,
|
|
|
warehouseNames: this.isMoreProduct
|
|
|
- ? this.detailList
|
|
|
+ ? mergedList
|
|
|
.filter((val) => val.productCode == item.code)
|
|
|
.map((item) => item.warehouseName)
|
|
|
: warehouseNames
|
|
|
@@ -2120,7 +2137,7 @@
|
|
|
batchNum: val.productBrand
|
|
|
? val.productBrand
|
|
|
: val.batchNo,
|
|
|
- num: val.packingQuantity
|
|
|
+ num: 1
|
|
|
};
|
|
|
})
|
|
|
: [
|