|
@@ -66,14 +66,14 @@
|
|
|
<div style="border: 1px solid #edf0f5">
|
|
|
<el-table :data="[item]" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
|
|
|
<el-table-column label="产品" width="300">
|
|
|
- <template #default="{ row, $index }">
|
|
|
+ <template #default="{ row }">
|
|
|
<div style="width: 100%">
|
|
|
<div style="line-height: 28px">品号: {{ item.code }}</div>
|
|
|
<div style="line-height: 28px; word-break: break-all">品名: {{ item.name }}</div>
|
|
|
<div style="line-height: 28px; display: flex">
|
|
|
<span style="width: 37px">数量:</span>
|
|
|
<el-form-item
|
|
|
- :prop="'orderSkuList.' + $index + '.quantity'"
|
|
|
+ :prop="'orderSkuList.' + index + '.quantity'"
|
|
|
:rules="rules.quantity"
|
|
|
:inline-message="true"
|
|
|
style="width: calc(100% - 37px)">
|
|
@@ -84,7 +84,8 @@
|
|
|
style="width: 100%"
|
|
|
:controls="false"
|
|
|
:min="0"
|
|
|
- :precision="0" />
|
|
|
+ :precision="0"
|
|
|
+ @change="changeQuantity(index)" />
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
<div style="line-height: 28px">加工费: {{ item.customProcessingFee }}</div>
|
|
@@ -93,38 +94,95 @@
|
|
|
<div style="line-height: 28px">包装人工费: {{ item.packingLabor }}</div>
|
|
|
<div style="line-height: 28px">单价: ¥{{ item.unitPrice }}</div>
|
|
|
<div style="line-height: 28px">小计: ¥{{ item.subtotal }}</div>
|
|
|
+ <div style="line-height: 28px">
|
|
|
+ <span style="width: 37px">打印:</span>
|
|
|
+ <el-form-item
|
|
|
+ :prop="'orderSkuList.' + index + '.printType'"
|
|
|
+ :rules="rules.printType"
|
|
|
+ :inline-message="true"
|
|
|
+ style="width: calc(100% - 37px)">
|
|
|
+ <el-radio-group v-model="item.printType">
|
|
|
+ <el-radio v-for="(itemType, index) in printType" :key="index" :label="itemType.dictKey">{{ itemType.dictValue }}</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="图稿(设计图)" width="180">
|
|
|
- <template #default="{ row, $index }">
|
|
|
- <el-form-item :prop="'orderSkuList.' + $index + '.productImgUrl'">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-form-item :prop="'orderSkuList.' + index + '.productImgUrl'">
|
|
|
<el-upload
|
|
|
class="avatar-uploader"
|
|
|
action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
|
|
|
- :data="uploadData"
|
|
|
+ :data="uploadProductData"
|
|
|
:show-file-list="false"
|
|
|
:on-success="
|
|
|
(response, uploadFile) => {
|
|
|
- return handleSuccess(uploadFile, $index);
|
|
|
+ return handleProductSuccess(uploadFile, index);
|
|
|
}
|
|
|
"
|
|
|
- :before-upload="uploadFile">
|
|
|
+ :before-upload="uploadProductFile">
|
|
|
<el-image v-if="row.productImgUrl" :src="row.productImgUrl" fit="scale-down" class="avatar" />
|
|
|
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
|
|
|
</el-upload>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="图稿(生产文件)" width="280" />
|
|
|
+ <el-table-column label="图稿(生产文件)" width="320">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <div style="color: black">共享文件夹路径(点击下方链接并上传文件):</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="包材配件/单品" min-width="400">
|
|
|
- <template #default="{ row, $index }">
|
|
|
- <div>{{ row }}</div>
|
|
|
+ <template #default="{ row }">
|
|
|
+ <div style="width: 100%">
|
|
|
+ <div style="margin-bottom: 10px">
|
|
|
+ <el-button type="primary" @click="clickPackingFittings(index)">选择包材配件</el-button>
|
|
|
+ </div>
|
|
|
+ <el-table :data="row.orderSkuBomList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
|
|
|
+ <el-table-column label="单价¥" width="80">
|
|
|
+ <template #default="props">
|
|
|
+ {{ moneyFormat(props.row.unitPrice, 2) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="数量" width="100">
|
|
|
+ <template #default="props">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'orderSkuList.' + index + '.orderSkuBomList.' + props.$index + '.quantity'"
|
|
|
+ :rules="rules.quantity"
|
|
|
+ :inline-message="true"
|
|
|
+ style="width: 100%">
|
|
|
+ <el-input-number
|
|
|
+ onmousewheel="return false;"
|
|
|
+ v-model="props.row.quantity"
|
|
|
+ placeholder="数量"
|
|
|
+ style="width: 100%"
|
|
|
+ :controls="false"
|
|
|
+ :min="0"
|
|
|
+ @change="changeBOMQuantity(index)" />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="名称" prop="name" min-width="150" />
|
|
|
+ <el-table-column label="总量" prop="allQuantity" width="80" />
|
|
|
+ <el-table-column label="小计¥" width="100">
|
|
|
+ <template #default="props">
|
|
|
+ {{ moneyFormat(props.row.allUnitPrice, 2) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" align="center" fixed="right" width="60">
|
|
|
+ <template #default="props">
|
|
|
+ <el-button type="danger" @click="clickDeletePackingFittings(index, props.$index)" text>删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" align="center" fixed="right" width="60">
|
|
|
- <template #default="{ $index }">
|
|
|
- <el-button type="primary" @click="clickDelete($index)" text>删除</el-button>
|
|
|
+ <template #default="{}">
|
|
|
+ <el-button type="primary" @click="clickDelete(index)" text>删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -135,42 +193,23 @@
|
|
|
<div style="display: flex; padding: 8px 10px 0px">
|
|
|
<div style="flex: 1; padding: 0px 10px">
|
|
|
<div>包装要求:</div>
|
|
|
+ <div v-if="route.query && route.query.detailId">
|
|
|
+ <div v-html="getStyle(item.packageRemark)"></div>
|
|
|
+ </div>
|
|
|
<Editor
|
|
|
+ v-else
|
|
|
:value="item.packageRemark"
|
|
|
@updateValue="
|
|
|
(val) => {
|
|
|
return updatePackageRemark(val, index);
|
|
|
}
|
|
|
"
|
|
|
- :ref="'editor' + index" />
|
|
|
+ :ref="'editor_' + index" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-collapse-item>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <!-- <el-collapse-item title="Consistency" name="1">
|
|
|
- <div>
|
|
|
- Consistent with real life: in line with the process and logic of real life, and comply with languages and habits that the users are used to;
|
|
|
- </div>
|
|
|
- <div>Consistent within interface: all elements should be consistent, such as: design style, icons and texts, position of elements, etc.</div>
|
|
|
- </el-collapse-item>
|
|
|
- <el-collapse-item title="Feedback" name="2">
|
|
|
- <div>Operation feedback: enable the users to clearly perceive their operations by style updates and interactive effects;</div>
|
|
|
- <div>Visual feedback: reflect current state by updating or rearranging elements of the page.</div>
|
|
|
- </el-collapse-item>
|
|
|
- <el-collapse-item title="Efficiency" name="3">
|
|
|
- <div>Simplify the process: keep operating process simple and intuitive;</div>
|
|
|
- <div>Definite and clear: enunciate your intentions clearly so that the users can quickly understand and make decisions;</div>
|
|
|
- <div>
|
|
|
- Easy to identify: the interface should be straightforward, which helps the users to identify and frees them from memorizing and recalling.
|
|
|
- </div>
|
|
|
- </el-collapse-item>
|
|
|
- <el-collapse-item title="Controllability" name="4">
|
|
|
- <div>Decision making: giving advices about operations is acceptable, but do not make decisions for the users;</div>
|
|
|
- <div>
|
|
|
- Controlled consequences: users should be granted the freedom to operate, including canceling, aborting or terminating current operation.
|
|
|
- </div>
|
|
|
- </el-collapse-item> -->
|
|
|
</el-collapse>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -200,11 +239,22 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<template #attachments>
|
|
|
- <div style="width: 100%"></div>
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-upload
|
|
|
+ v-model:fileList="fileList"
|
|
|
+ action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
|
|
|
+ :data="uploadData"
|
|
|
+ multiple
|
|
|
+ :before-upload="uploadFile"
|
|
|
+ :on-success="handleSuccess"
|
|
|
+ :on-preview="onPreviewFile">
|
|
|
+ <el-button style="background: #20b2aa; color: #fff; border: 1px solid #20b2aa">上传</el-button>
|
|
|
+ </el-upload>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<template #remark>
|
|
|
<div style="width: 100%">
|
|
|
- <div v-if="route.query && route.query.id">
|
|
|
+ <div v-if="route.query && route.query.detailId">
|
|
|
<div v-html="getStyle(formData.data.remark)"></div>
|
|
|
</div>
|
|
|
<Editor v-else :value="formData.data.remark" @updateValue="updateValue" ref="editor" />
|
|
@@ -212,19 +262,26 @@
|
|
|
</template>
|
|
|
</byForm>
|
|
|
<div style="width: 100%; text-align: center; margin: 10px">
|
|
|
- <el-button @click="clickCancel()" size="large">取 消</el-button>
|
|
|
- <el-button type="primary" @click="submitForm()" :disabled="btnDisabled" size="large">确 定</el-button>
|
|
|
+ <el-button @click="clickCancel()" v-if="route.query && route.query.detailId" size="large">关 闭</el-button>
|
|
|
+ <el-button @click="clickCancel()" v-if="!(route.query && route.query.detailId)" size="large">取 消</el-button>
|
|
|
+ <el-button @click="submitForm('0')" v-if="!(route.query && route.query.detailId)" :disabled="btnDisabled" size="large">暂存</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm('10')" v-if="!(route.query && route.query.detailId)" :disabled="btnDisabled" size="large">确 定</el-button>
|
|
|
</div>
|
|
|
</el-card>
|
|
|
|
|
|
- <el-dialog title="选择产品" v-if="openProduct" v-model="openProduct" width="84%">
|
|
|
+ <el-dialog title="选择产品" v-if="openProduct" v-model="openProduct" width="90%">
|
|
|
<SelectProduct :selectStatus="true" @selectProduct="selectProduct"></SelectProduct>
|
|
|
<template #footer>
|
|
|
<el-button @click="openProduct = false" size="large">关 闭</el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
|
|
|
- <!-- <SelectBOM :selectStatus="true" @selectBOM="selectBOM"></SelectBOM> -->
|
|
|
+ <el-dialog title="选择包材配件" v-if="openPackingFittings" v-model="openPackingFittings" width="90%">
|
|
|
+ <SelectBOM :selectStatus="true" :bomClassifyIdList="[2, 3]" @selectBOM="selectPackingFittings"></SelectBOM>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="openPackingFittings = false" size="large">关 闭</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -235,7 +292,9 @@ import Editor from "@/components/Editor/index.vue";
|
|
|
import { useRouter, useRoute } from "vue-router";
|
|
|
import useTagsViewStore from "@/store/modules/tagsView.js";
|
|
|
import SelectProduct from "@/views/group/product/management/index";
|
|
|
-// import SelectBOM from "@/views/group/BOM/management/index";
|
|
|
+import SelectBOM from "@/views/group/BOM/management/index";
|
|
|
+import useUserStore from "@/store/modules/tagsView";
|
|
|
+import { get } from "@vueuse/core";
|
|
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
const router = useRouter();
|
|
@@ -253,6 +312,7 @@ const formOption = reactive({
|
|
|
const formData = reactive({
|
|
|
data: {
|
|
|
remark: "",
|
|
|
+ fileList: [],
|
|
|
orderSkuList: [],
|
|
|
},
|
|
|
});
|
|
@@ -365,38 +425,72 @@ const getDepartment = () => {
|
|
|
});
|
|
|
};
|
|
|
getDepartment();
|
|
|
+const uploadProductData = ref({});
|
|
|
+const uploadProductFile = async (file) => {
|
|
|
+ const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
|
|
|
+ uploadProductData.value = res.uploadBody;
|
|
|
+ file.id = res.id;
|
|
|
+ file.fileName = res.fileName;
|
|
|
+ file.fileUrl = res.fileUrl;
|
|
|
+ return true;
|
|
|
+};
|
|
|
+const handleProductSuccess = (uploadFile, index) => {
|
|
|
+ formData.data.orderSkuList[index].productImgUrl = uploadFile.raw.fileUrl;
|
|
|
+};
|
|
|
const uploadData = ref({});
|
|
|
+const fileList = ref([]);
|
|
|
const uploadFile = async (file) => {
|
|
|
const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
|
|
|
uploadData.value = res.uploadBody;
|
|
|
file.id = res.id;
|
|
|
file.fileName = res.fileName;
|
|
|
file.fileUrl = res.fileUrl;
|
|
|
+ file.uploadState = true;
|
|
|
return true;
|
|
|
};
|
|
|
-const handleSuccess = (uploadFile, index) => {
|
|
|
- formData.data.orderSkuList[index].productImgUrl = uploadFile.raw.fileUrl;
|
|
|
+const handleSuccess = (any, UploadFile) => {
|
|
|
+ UploadFile.raw.uploadState = false;
|
|
|
+};
|
|
|
+const onPreviewFile = (file) => {
|
|
|
+ window.open(file.raw.fileUrl, "_blank");
|
|
|
};
|
|
|
const updatePackageRemark = (val, index) => {
|
|
|
formData.data.orderSkuList[index].packageRemark = val;
|
|
|
};
|
|
|
const clickDelete = (index) => {
|
|
|
formData.data.orderSkuList.splice(index, 1);
|
|
|
+ calculatedAmount();
|
|
|
};
|
|
|
const updateValue = (val) => {
|
|
|
formData.data.remark = val;
|
|
|
};
|
|
|
const btnDisabled = ref(false);
|
|
|
-const submitForm = () => {
|
|
|
- console.log(formData.data);
|
|
|
+const submitForm = (status) => {
|
|
|
submit.value.handleSubmit(() => {
|
|
|
if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
|
|
|
+ if (fileList.value && fileList.value.length > 0) {
|
|
|
+ for (let i = 0; i < fileList.value.length; i++) {
|
|
|
+ if (fileList.value[i].raw.uploadState) {
|
|
|
+ return ElMessage("文件上传中,请稍后提交");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ formData.data.fileList = fileList.value.map((item) => {
|
|
|
+ return {
|
|
|
+ id: item.raw.id,
|
|
|
+ fileName: item.raw.fileName,
|
|
|
+ fileUrl: item.raw.fileUrl,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ formData.data.fileList = [];
|
|
|
+ }
|
|
|
let type = "add";
|
|
|
if (formData.data.id) {
|
|
|
type = "edit";
|
|
|
}
|
|
|
+ formData.data.status = status;
|
|
|
btnDisabled.value = true;
|
|
|
- proxy.post("/sku/" + type, formData.data).then(
|
|
|
+ proxy.post("/orderInfo/" + type, formData.data).then(
|
|
|
() => {
|
|
|
ElMessage({
|
|
|
message: type == "add" ? "添加成功" : "编辑成功",
|
|
@@ -410,7 +504,7 @@ const submitForm = () => {
|
|
|
}
|
|
|
);
|
|
|
} else {
|
|
|
- return ElMessage("请添加规格");
|
|
|
+ return ElMessage("请添加产品");
|
|
|
}
|
|
|
});
|
|
|
};
|
|
@@ -422,18 +516,63 @@ const clickCancel = () => {
|
|
|
});
|
|
|
};
|
|
|
onMounted(() => {
|
|
|
- // formOption.disabled = props.detailStatus;
|
|
|
- // if (props.rowData && props.rowData.id) {
|
|
|
- // proxy.post("/sku/detail", { id: props.rowData.id }).then((res) => {
|
|
|
- // for (var text in res) {
|
|
|
- // formData.data[text] = res[text];
|
|
|
- // }
|
|
|
- // if (!props.detailStatus) {
|
|
|
- // proxy.$refs.editor.changeHtml(formData.data.remark);
|
|
|
- // }
|
|
|
- // });
|
|
|
- // }
|
|
|
+ if (route.query && (route.query.id || route.query.detailId)) {
|
|
|
+ useUserStore().visitedViews = useUserStore().visitedViews.map((item) => {
|
|
|
+ if (item.query && item.query.random === route.query.random) {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ name: route.query.text,
|
|
|
+ title: route.query.text,
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ });
|
|
|
+ getOrderDetail({ id: route.query.id || route.query.detailId });
|
|
|
+ }
|
|
|
});
|
|
|
+const getOrderDetail = (parameter) => {
|
|
|
+ proxy.post("/orderInfo/detail", parameter).then((res) => {
|
|
|
+ formData.data = res;
|
|
|
+ if (route.query.id) {
|
|
|
+ proxy.$refs.editor.changeHtml(formData.data.remark);
|
|
|
+ }
|
|
|
+ if (route.query.detailId) {
|
|
|
+ let allIndex = [];
|
|
|
+ for (let i = 0; i < formData.data.orderSkuList.length; i++) {
|
|
|
+ allIndex.push(i);
|
|
|
+ }
|
|
|
+ activeNames.value = allIndex;
|
|
|
+ formOption.disabled = true;
|
|
|
+ }
|
|
|
+ let list = [res.id];
|
|
|
+ if (res.orderSkuList && res.orderSkuList.length > 0) {
|
|
|
+ list = list.concat(res.orderSkuList.map((item) => item.id));
|
|
|
+ }
|
|
|
+ proxy.post("/fileInfo/getList", { businessIdList: list }).then((fileObj) => {
|
|
|
+ if (fileObj) {
|
|
|
+ if (fileObj[res.id] && fileObj[res.id].length > 0) {
|
|
|
+ fileList.value = fileObj[res.id].map((item) => {
|
|
|
+ return {
|
|
|
+ raw: item,
|
|
|
+ name: item.fileName,
|
|
|
+ url: item.fileUrl,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
|
|
|
+ for (let i = 0; i < formData.data.orderSkuList.length; i++) {
|
|
|
+ if (fileObj[formData.data.orderSkuList[i].id] && fileObj[formData.data.orderSkuList[i].id].length > 0) {
|
|
|
+ formData.data.orderSkuList[i].productImgUrl = fileObj[formData.data.orderSkuList[i].id][0];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+};
|
|
|
const getStyle = (text) => {
|
|
|
if (text) {
|
|
|
return text.replace(/\n|\r\n/g, "<br>");
|
|
@@ -445,6 +584,16 @@ const openProduct = ref(false);
|
|
|
const clickAddProduct = () => {
|
|
|
openProduct.value = true;
|
|
|
};
|
|
|
+const printType = ref([
|
|
|
+ {
|
|
|
+ dictKey: "1",
|
|
|
+ dictValue: "单面",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ dictKey: "2",
|
|
|
+ dictValue: "双面",
|
|
|
+ },
|
|
|
+]);
|
|
|
const selectProduct = (row) => {
|
|
|
if (row.id) {
|
|
|
let list = formData.data.orderSkuList.filter((item) => item.skuSpecId === row.id);
|
|
@@ -462,7 +611,7 @@ const selectProduct = (row) => {
|
|
|
deliveryMaterialsFee: "",
|
|
|
packingLabor: "",
|
|
|
unitPrice: "",
|
|
|
- printType: "",
|
|
|
+ printType: "1",
|
|
|
packageRemark: "",
|
|
|
subtotal: "",
|
|
|
orderSkuBomList: [],
|
|
@@ -473,9 +622,148 @@ const selectProduct = (row) => {
|
|
|
}
|
|
|
};
|
|
|
const rowIndex = ref(null);
|
|
|
-const clickRemoveBOM = (index) => {
|
|
|
- formData.data.orderSkuList[index].bomSpecId = "";
|
|
|
- formData.data.orderSkuList[index].bomSpecName = "";
|
|
|
+const openPackingFittings = ref(false);
|
|
|
+const clickPackingFittings = (index) => {
|
|
|
+ rowIndex.value = index;
|
|
|
+ openPackingFittings.value = true;
|
|
|
+};
|
|
|
+const clickDeletePackingFittings = (index, indexTwo) => {
|
|
|
+ formData.data.orderSkuList[index].orderSkuBomList.splice(indexTwo, 1);
|
|
|
+ calculatedAmount();
|
|
|
+};
|
|
|
+const selectPackingFittings = (data) => {
|
|
|
+ if (formData.data.orderSkuList[rowIndex.value].orderSkuBomList && formData.data.orderSkuList[rowIndex.value].orderSkuBomList.length > 0) {
|
|
|
+ let list = formData.data.orderSkuList[rowIndex.value].orderSkuBomList.filter((item) => item.bomSpecId === data.id);
|
|
|
+ if (list && list.length > 0) {
|
|
|
+ return ElMessage("包材配件已添加");
|
|
|
+ }
|
|
|
+ formData.data.orderSkuList[rowIndex.value].orderSkuBomList.push({
|
|
|
+ bomSpecId: data.id,
|
|
|
+ unitPrice: data.costPrice,
|
|
|
+ quantity: undefined,
|
|
|
+ name: data.name,
|
|
|
+ allQuantity: 0,
|
|
|
+ allUnitPrice: 0,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ formData.data.orderSkuList[rowIndex.value].orderSkuBomList = [
|
|
|
+ {
|
|
|
+ bomSpecId: data.id,
|
|
|
+ unitPrice: data.costPrice,
|
|
|
+ quantity: undefined,
|
|
|
+ name: data.name,
|
|
|
+ allQuantity: 0,
|
|
|
+ allUnitPrice: 0,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ ElMessage({ message: "添加成功", type: "success" });
|
|
|
+};
|
|
|
+const changeQuantity = (index) => {
|
|
|
+ if (formData.data.orderSkuList[index].quantity) {
|
|
|
+ proxy
|
|
|
+ .post("/orderInfo/getSkuSpecPrice", { skuSpecId: formData.data.orderSkuList[index].skuSpecId, quantity: formData.data.orderSkuList[index].quantity })
|
|
|
+ .then((res) => {
|
|
|
+ formData.data.orderSkuList[index].customProcessingFee = res.customProcessingFee;
|
|
|
+ formData.data.orderSkuList[index].deliveryMaterialsFee = res.deliveryMaterialsFee;
|
|
|
+ formData.data.orderSkuList[index].lssueFee = res.lssueFee;
|
|
|
+ formData.data.orderSkuList[index].packingLabor = res.packingLabor;
|
|
|
+ formData.data.orderSkuList[index].unitPrice = res.unitPrice;
|
|
|
+ formData.data.orderSkuList[index].subtotal = Number(Math.round(Number(res.unitPrice) * Number(formData.data.orderSkuList[index].quantity) * 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();
|
|
|
+};
|
|
|
+const calculatedAmount = () => {
|
|
|
+ let productTotalAmount = 0;
|
|
|
+ let customProcessingFee = 0;
|
|
|
+ let lssueFee = 0;
|
|
|
+ let deliveryMaterialsFee = 0;
|
|
|
+ let packingLabor = 0;
|
|
|
+ let packagingMaterialCost = 0;
|
|
|
+ let totalAmount = 0;
|
|
|
+ if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
|
|
|
+ for (let i = 0; i < formData.data.orderSkuList.length; i++) {
|
|
|
+ if (formData.data.orderSkuList[i].quantity) {
|
|
|
+ if (formData.data.orderSkuList[i].customProcessingFee) {
|
|
|
+ customProcessingFee = Number(
|
|
|
+ Math.round((customProcessingFee + formData.data.orderSkuList[i].customProcessingFee * formData.data.orderSkuList[i].quantity) * 100) / 100
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if (formData.data.orderSkuList[i].lssueFee) {
|
|
|
+ lssueFee = Number(Math.round((lssueFee + formData.data.orderSkuList[i].lssueFee * formData.data.orderSkuList[i].quantity) * 100) / 100);
|
|
|
+ }
|
|
|
+ if (formData.data.orderSkuList[i].deliveryMaterialsFee) {
|
|
|
+ deliveryMaterialsFee = Number(
|
|
|
+ Math.round((deliveryMaterialsFee + formData.data.orderSkuList[i].deliveryMaterialsFee * formData.data.orderSkuList[i].quantity) * 100) / 100
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if (formData.data.orderSkuList[i].packingLabor) {
|
|
|
+ packingLabor = Number(Math.round((packingLabor + formData.data.orderSkuList[i].packingLabor * formData.data.orderSkuList[i].quantity) * 100) / 100);
|
|
|
+ }
|
|
|
+ if (formData.data.orderSkuList[i].unitPrice) {
|
|
|
+ productTotalAmount = Number(
|
|
|
+ Math.round((productTotalAmount + formData.data.orderSkuList[i].unitPrice * formData.data.orderSkuList[i].quantity) * 100) / 100
|
|
|
+ );
|
|
|
+ }
|
|
|
+ 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++) {
|
|
|
+ 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 *
|
|
|
+ formData.data.orderSkuList[i].quantity) *
|
|
|
+ 100
|
|
|
+ ) / 100
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ formData.data.productTotalAmount = productTotalAmount;
|
|
|
+ formData.data.customProcessingFee = customProcessingFee;
|
|
|
+ formData.data.lssueFee = lssueFee;
|
|
|
+ formData.data.deliveryMaterialsFee = deliveryMaterialsFee;
|
|
|
+ formData.data.packingLabor = packingLabor;
|
|
|
+ formData.data.packagingMaterialCost = packagingMaterialCost;
|
|
|
+ totalAmount = Number(
|
|
|
+ Math.round((productTotalAmount + customProcessingFee + lssueFee + deliveryMaterialsFee + packingLabor + packagingMaterialCost) * 100) / 100
|
|
|
+ );
|
|
|
+ formData.data.totalAmount = totalAmount;
|
|
|
};
|
|
|
</script>
|
|
|
|