|
@@ -234,15 +234,19 @@
|
|
|
style="width: 100%"
|
|
|
:controls="false"
|
|
|
:min="0"
|
|
|
- @change="changeBOMQuantity(index)" />
|
|
|
+ @change="calculatedAmount()" />
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="名称" prop="bomSpecName" min-width="150" />
|
|
|
- <el-table-column label="总量" prop="allQuantity" width="80" />
|
|
|
+ <el-table-column label="总量" width="80">
|
|
|
+ <template #default="props">
|
|
|
+ {{ computeQuantity(index, props.$index) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="小计¥" width="100">
|
|
|
<template #default="props">
|
|
|
- {{ moneyFormat(props.row.allUnitPrice, 2) }}
|
|
|
+ {{ moneyFormat(computeMoney(index, props.$index), 2) }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" align="center" fixed="right" width="60" v-if="!(route.query && route.query.detailId)">
|
|
@@ -615,32 +619,15 @@ const getOrderDetail = (parameter) => {
|
|
|
);
|
|
|
if (formData.data.orderSkuList[i].orderSkuBomList && formData.data.orderSkuList[i].orderSkuBomList.length > 0) {
|
|
|
for (let j = 0; j < formData.data.orderSkuList[i].orderSkuBomList.length; j++) {
|
|
|
- let allQuantity = 0;
|
|
|
- let allUnitPrice = 0;
|
|
|
- if (formData.data.orderSkuList[i].orderSkuBomList[j].quantity) {
|
|
|
- allQuantity = Number(
|
|
|
- Math.round(formData.data.orderSkuList[i].orderSkuBomList[j].quantity * formData.data.orderSkuList[i].quantity * 100) / 100
|
|
|
+ if (formData.data.orderSkuList[i].orderSkuBomList[j].quantity && formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice) {
|
|
|
+ packagingMaterialCost = Number(
|
|
|
+ Math.round(
|
|
|
+ (packagingMaterialCost +
|
|
|
+ formData.data.orderSkuList[i].orderSkuBomList[j].quantity * formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice) *
|
|
|
+ 100
|
|
|
+ ) / 100
|
|
|
);
|
|
|
- if (formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice) {
|
|
|
- allUnitPrice = Number(
|
|
|
- Math.round(
|
|
|
- formData.data.orderSkuList[i].orderSkuBomList[j].quantity *
|
|
|
- formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice *
|
|
|
- formData.data.orderSkuList[i].quantity *
|
|
|
- 100
|
|
|
- ) / 100
|
|
|
- );
|
|
|
- packagingMaterialCost = Number(
|
|
|
- Math.round(
|
|
|
- (packagingMaterialCost +
|
|
|
- formData.data.orderSkuList[i].orderSkuBomList[j].quantity * formData.data.orderSkuList[i].orderSkuBomList[j].unitPrice) *
|
|
|
- 100
|
|
|
- ) / 100
|
|
|
- );
|
|
|
- }
|
|
|
}
|
|
|
- formData.data.orderSkuList[i].orderSkuBomList[j].allQuantity = allQuantity;
|
|
|
- formData.data.orderSkuList[i].orderSkuBomList[j].allUnitPrice = allUnitPrice;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -675,37 +662,54 @@ const printType = ref([
|
|
|
dictValue: "双面",
|
|
|
},
|
|
|
]);
|
|
|
-const selectProduct = (row, bom) => {
|
|
|
+const selectProduct = (row, SKU) => {
|
|
|
if (row.id) {
|
|
|
let list = formData.data.orderSkuList.filter((item) => item.skuSpecId === row.id && item.bomSpecId === row.bomSpecId);
|
|
|
if (list && list.length > 0) {
|
|
|
return ElMessage("该产品已添加");
|
|
|
}
|
|
|
- formData.data.orderSkuList.push({
|
|
|
- wlnSkuName: bom.name,
|
|
|
- skuId: row.skuId,
|
|
|
- code: row.code,
|
|
|
- name: row.name,
|
|
|
- skuSpecId: row.id,
|
|
|
- bomSpecId: row.bomSpecId,
|
|
|
- quantity: undefined,
|
|
|
- customProcessingFee: "",
|
|
|
- customProcessingType: "",
|
|
|
- lssueFee: "",
|
|
|
- deliveryMaterialsFee: "",
|
|
|
- packingLabor: "",
|
|
|
- managementFee: "",
|
|
|
- unitPrice: "",
|
|
|
- printType: "1",
|
|
|
- packageRemark: "",
|
|
|
- subtotal: "",
|
|
|
- orderSkuBomList: [],
|
|
|
- blueprint: row.designImgUrl,
|
|
|
- productionDocument: row.sharedFolder,
|
|
|
- // formData.data.orderSkuList[drawingFileIndex.value].blueprint = row.imgUrl;
|
|
|
- // formData.data.orderSkuList[drawingFileIndex.value].productionDocument = row.fileUrl;
|
|
|
+ console.log(row, SKU);
|
|
|
+ proxy.post("/sku/detail", { id: SKU.id }).then((res) => {
|
|
|
+ let orderSkuBomList = [];
|
|
|
+ if (res.skuSpecList && res.skuSpecList.length > 0) {
|
|
|
+ let listTwo = res.skuSpecList.filter((item) => item.id === row.id);
|
|
|
+ if (listTwo && listTwo.length > 0) {
|
|
|
+ if (listTwo[0].packagingMaterialList && listTwo[0].packagingMaterialList.length > 0) {
|
|
|
+ orderSkuBomList = listTwo[0].packagingMaterialList.map((item) => {
|
|
|
+ return {
|
|
|
+ bomSpecId: item.id,
|
|
|
+ unitPrice: item.costPrice,
|
|
|
+ quantity: item.quantity,
|
|
|
+ bomSpecName: item.name,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ formData.data.orderSkuList.push({
|
|
|
+ wlnSkuName: SKU.name,
|
|
|
+ skuId: row.skuId,
|
|
|
+ code: row.code,
|
|
|
+ name: row.name,
|
|
|
+ skuSpecId: row.id,
|
|
|
+ bomSpecId: row.bomSpecId,
|
|
|
+ quantity: undefined,
|
|
|
+ customProcessingFee: "",
|
|
|
+ customProcessingType: "",
|
|
|
+ lssueFee: "",
|
|
|
+ deliveryMaterialsFee: "",
|
|
|
+ packingLabor: "",
|
|
|
+ managementFee: "",
|
|
|
+ unitPrice: "",
|
|
|
+ printType: "1",
|
|
|
+ packageRemark: "",
|
|
|
+ subtotal: "",
|
|
|
+ orderSkuBomList: orderSkuBomList,
|
|
|
+ blueprint: row.designImgUrl,
|
|
|
+ productionDocument: row.sharedFolder,
|
|
|
+ });
|
|
|
+ ElMessage({ message: "添加成功", type: "success" });
|
|
|
});
|
|
|
- ElMessage({ message: "添加成功", type: "success" });
|
|
|
} else {
|
|
|
ElMessage("添加失败");
|
|
|
}
|
|
@@ -731,8 +735,6 @@ const selectPackingFittings = (data) => {
|
|
|
unitPrice: data.costPrice,
|
|
|
quantity: undefined,
|
|
|
bomSpecName: data.name,
|
|
|
- allQuantity: 0,
|
|
|
- allUnitPrice: 0,
|
|
|
});
|
|
|
} else {
|
|
|
formData.data.orderSkuList[rowIndex.value].orderSkuBomList = [
|
|
@@ -741,8 +743,6 @@ const selectPackingFittings = (data) => {
|
|
|
unitPrice: data.costPrice,
|
|
|
quantity: undefined,
|
|
|
bomSpecName: data.name,
|
|
|
- allQuantity: 0,
|
|
|
- allUnitPrice: 0,
|
|
|
},
|
|
|
];
|
|
|
}
|
|
@@ -767,39 +767,9 @@ const changeQuantity = (index) => {
|
|
|
100
|
|
|
) / 100
|
|
|
);
|
|
|
- changeBOMQuantity(index);
|
|
|
- });
|
|
|
- }
|
|
|
-};
|
|
|
-const changeBOMQuantity = (index) => {
|
|
|
- if (formData.data.orderSkuList[index].orderSkuBomList && formData.data.orderSkuList[index].orderSkuBomList.length > 0) {
|
|
|
- if (formData.data.orderSkuList[index].quantity) {
|
|
|
- formData.data.orderSkuList[index].orderSkuBomList = formData.data.orderSkuList[index].orderSkuBomList.map((item) => {
|
|
|
- let allQuantity = 0;
|
|
|
- let allUnitPrice = 0;
|
|
|
- if (item.quantity) {
|
|
|
- allQuantity = Number(Math.round(Number(item.quantity) * Number(formData.data.orderSkuList[index].quantity)));
|
|
|
- }
|
|
|
- if (item.unitPrice) {
|
|
|
- allUnitPrice = Number(Math.round(Number(item.unitPrice) * Number(allQuantity) * 100) / 100);
|
|
|
- }
|
|
|
- return {
|
|
|
- ...item,
|
|
|
- allQuantity: allQuantity,
|
|
|
- allUnitPrice: allUnitPrice,
|
|
|
- };
|
|
|
- });
|
|
|
- } else {
|
|
|
- formData.data.orderSkuList[index].orderSkuBomList = formData.data.orderSkuList[index].orderSkuBomList.map((item) => {
|
|
|
- return {
|
|
|
- ...item,
|
|
|
- allQuantity: 0,
|
|
|
- allUnitPrice: 0,
|
|
|
- };
|
|
|
+ calculatedAmount();
|
|
|
});
|
|
|
- }
|
|
|
}
|
|
|
- calculatedAmount();
|
|
|
};
|
|
|
const calculatedAmount = () => {
|
|
|
let productTotalAmount = 0;
|
|
@@ -905,6 +875,33 @@ const uploadImgFile = async (file) => {
|
|
|
const handleImgSuccess = (UploadFile, index) => {
|
|
|
formData.data.orderSkuList[index].blueprint = UploadFile.raw.fileUrl;
|
|
|
};
|
|
|
+const computeQuantity = (index, indexSKU) => {
|
|
|
+ let quantity = 0;
|
|
|
+ if (formData.data.orderSkuList[index].quantity && formData.data.orderSkuList[index].orderSkuBomList[indexSKU].quantity) {
|
|
|
+ quantity = Number(
|
|
|
+ Math.round(formData.data.orderSkuList[index].orderSkuBomList[indexSKU].quantity * formData.data.orderSkuList[index].quantity * 100) / 100
|
|
|
+ );
|
|
|
+ }
|
|
|
+ return quantity;
|
|
|
+};
|
|
|
+const computeMoney = (index, indexSKU) => {
|
|
|
+ let money = 0;
|
|
|
+ if (
|
|
|
+ formData.data.orderSkuList[index].quantity &&
|
|
|
+ formData.data.orderSkuList[index].orderSkuBomList[indexSKU].quantity &&
|
|
|
+ formData.data.orderSkuList[index].orderSkuBomList[indexSKU].unitPrice
|
|
|
+ ) {
|
|
|
+ money = Number(
|
|
|
+ Math.round(
|
|
|
+ formData.data.orderSkuList[index].orderSkuBomList[indexSKU].quantity *
|
|
|
+ formData.data.orderSkuList[index].orderSkuBomList[indexSKU].unitPrice *
|
|
|
+ formData.data.orderSkuList[index].quantity *
|
|
|
+ 100
|
|
|
+ ) / 100
|
|
|
+ );
|
|
|
+ }
|
|
|
+ return money;
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|