|
@@ -233,7 +233,7 @@
|
|
|
<div style="width: 100%">
|
|
|
<el-button type="primary" @click="openProductCompany = true" plain>标准产品库</el-button>
|
|
|
<el-button type="primary" @click="clickCustomerProduct()" plain>客户产品库</el-button>
|
|
|
- <el-table :data="formData.data.quotationProductList" style="width: 100%; margin-top: 16px">
|
|
|
+ <el-table :data="formData.data.contractProductList" style="width: 100%; margin-top: 16px">
|
|
|
<el-table-column label="商品图片" width="80">
|
|
|
<template #default="{ row }">
|
|
|
<div v-if="row.productId">
|
|
@@ -246,7 +246,7 @@
|
|
|
<template #default="{ row, $index }">
|
|
|
<div style="width: 100%">
|
|
|
<el-form-item
|
|
|
- :prop="'quotationProductList.' + $index + '.productName'"
|
|
|
+ :prop="'contractProductList.' + $index + '.productName'"
|
|
|
:rules="rules.productName"
|
|
|
:inline-message="true"
|
|
|
class="shrinkPadding">
|
|
@@ -259,7 +259,7 @@
|
|
|
<template #default="{ row, $index }">
|
|
|
<div style="width: 100%">
|
|
|
<el-form-item
|
|
|
- :prop="'quotationProductList.' + $index + '.productModel'"
|
|
|
+ :prop="'contractProductList.' + $index + '.productModel'"
|
|
|
:rules="rules.productModel"
|
|
|
:inline-message="true"
|
|
|
class="shrinkPadding">
|
|
@@ -271,7 +271,7 @@
|
|
|
<el-table-column label="数量" width="130">
|
|
|
<template #default="{ row, $index }">
|
|
|
<div style="width: 100%">
|
|
|
- <el-form-item :prop="'quotationProductList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true" class="shrinkPadding">
|
|
|
+ <el-form-item :prop="'contractProductList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true" class="shrinkPadding">
|
|
|
<el-input-number
|
|
|
v-model="row.quantity"
|
|
|
placeholder="请输入"
|
|
@@ -287,7 +287,7 @@
|
|
|
<el-table-column label="单价" width="140">
|
|
|
<template #default="{ row, $index }">
|
|
|
<div style="width: 100%">
|
|
|
- <el-form-item :prop="'quotationProductList.' + $index + '.price'" :rules="rules.price" :inline-message="true" class="shrinkPadding">
|
|
|
+ <el-form-item :prop="'contractProductList.' + $index + '.price'" :rules="rules.price" :inline-message="true" class="shrinkPadding">
|
|
|
<el-input-number
|
|
|
v-model="row.price"
|
|
|
placeholder="请输入"
|
|
@@ -304,7 +304,7 @@
|
|
|
<template #default="{ row, $index }">
|
|
|
<div style="width: 100%">
|
|
|
<el-form-item
|
|
|
- :prop="'quotationProductList.' + $index + '.tradeMethods'"
|
|
|
+ :prop="'contractProductList.' + $index + '.tradeMethods'"
|
|
|
:rules="rules.tradeMethods"
|
|
|
:inline-message="true"
|
|
|
class="shrinkPadding">
|
|
@@ -318,7 +318,7 @@
|
|
|
<el-table-column label="包装方式" width="180">
|
|
|
<template #default="{ row, $index }">
|
|
|
<div style="width: 100%">
|
|
|
- <el-form-item :prop="'quotationProductList.' + $index + '.packMethod'" :rules="rules.packMethod" :inline-message="true" class="shrinkPadding">
|
|
|
+ <el-form-item :prop="'contractProductList.' + $index + '.packMethod'" :rules="rules.packMethod" :inline-message="true" class="shrinkPadding">
|
|
|
<el-input v-model="row.packMethod" placeholder="请输入" />
|
|
|
</el-form-item>
|
|
|
</div>
|
|
@@ -349,11 +349,11 @@
|
|
|
<template #otherCharge>
|
|
|
<div style="width: 100%">
|
|
|
<el-button type="primary" @click="clickAdd()">添加行</el-button>
|
|
|
- <el-table :data="formData.data.quotationPayList" style="width: 100%; margin-top: 16px">
|
|
|
+ <el-table :data="formData.data.contractProjectList" style="width: 100%; margin-top: 16px">
|
|
|
<el-table-column label="收费项目" width="220">
|
|
|
<template #default="{ row, $index }">
|
|
|
<div style="width: 100%">
|
|
|
- <el-form-item :prop="'quotationPayList.' + $index + '.payName'" :rules="rules.payName" :inline-message="true">
|
|
|
+ <el-form-item :prop="'contractProjectList.' + $index + '.payName'" :rules="rules.payName" :inline-message="true">
|
|
|
<el-autocomplete v-model="row.payName" :fetch-suggestions="querySearch" clearable class="inline-input w-50" placeholder="请输入收费项目" />
|
|
|
</el-form-item>
|
|
|
</div>
|
|
@@ -362,7 +362,7 @@
|
|
|
<el-table-column label="备注">
|
|
|
<template #default="{ row, $index }">
|
|
|
<div style="width: 100%">
|
|
|
- <el-form-item :prop="'quotationPayList.' + $index + '.remark'">
|
|
|
+ <el-form-item :prop="'contractProjectList.' + $index + '.remark'">
|
|
|
<el-input v-model="row.remark" placeholder="请输入备注" />
|
|
|
</el-form-item>
|
|
|
</div>
|
|
@@ -371,7 +371,7 @@
|
|
|
<el-table-column :label="'金额 ( ' + formData.data.currency + ' )'" width="130">
|
|
|
<template #default="{ row, $index }">
|
|
|
<div style="width: 100%">
|
|
|
- <el-form-item :prop="'quotationPayList.' + $index + '.amount'" :rules="rules.amount" :inline-message="true" class="shrinkPadding">
|
|
|
+ <el-form-item :prop="'contractProjectList.' + $index + '.amount'" :rules="rules.amount" :inline-message="true" class="shrinkPadding">
|
|
|
<el-input-number
|
|
|
v-model="row.amount"
|
|
|
placeholder="请输入金额"
|
|
@@ -481,8 +481,8 @@ const formData = reactive({
|
|
|
data: {
|
|
|
currency: "¥",
|
|
|
amount: undefined,
|
|
|
- quotationProductList: [],
|
|
|
- quotationPayList: [],
|
|
|
+ contractProductList: [],
|
|
|
+ contractProjectList: [],
|
|
|
fileList: [],
|
|
|
contractShipmentList: [],
|
|
|
},
|
|
@@ -741,7 +741,7 @@ const getCityData = (id, type, isChange) => {
|
|
|
};
|
|
|
getCityData("0");
|
|
|
const changeCustomer = (val) => {
|
|
|
- formData.data.quotationProductList = [];
|
|
|
+ formData.data.contractProductList = [];
|
|
|
formData.data.customerName = "";
|
|
|
formData.data.customerTel = "";
|
|
|
if (val) {
|
|
@@ -796,7 +796,7 @@ const handlePerson = (item) => {
|
|
|
};
|
|
|
const selectProduct = (goods) => {
|
|
|
if (goods && goods.id) {
|
|
|
- let data = formData.data.quotationProductList.filter((item) => item.productId === goods.id);
|
|
|
+ let data = formData.data.contractProductList.filter((item) => item.productId === goods.id);
|
|
|
if (data && data.length > 0) {
|
|
|
return ElMessage("该产品已添加");
|
|
|
}
|
|
@@ -825,8 +825,8 @@ const selectProduct = (goods) => {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- if (formData.data.quotationProductList && formData.data.quotationProductList.length > 0) {
|
|
|
- formData.data.quotationProductList.push({
|
|
|
+ if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
|
|
|
+ formData.data.contractProductList.push({
|
|
|
fileUrl: fileUrl,
|
|
|
productId: goods.id,
|
|
|
productName: goods.name,
|
|
@@ -838,7 +838,7 @@ const selectProduct = (goods) => {
|
|
|
packMethod: packMethod,
|
|
|
});
|
|
|
} else {
|
|
|
- formData.data.quotationProductList = [
|
|
|
+ formData.data.contractProductList = [
|
|
|
{
|
|
|
fileUrl: fileUrl,
|
|
|
productId: goods.id,
|
|
@@ -870,19 +870,20 @@ const selectProduct = (goods) => {
|
|
|
const onPicture = (path) => {
|
|
|
window.open(path, "_blank");
|
|
|
};
|
|
|
-const handleRemove = (index, row) => {
|
|
|
- formData.data.quotationProductList.splice(index, 1);
|
|
|
+const handleRemove = async (index, row) => {
|
|
|
formData.data.contractShipmentList = formData.data.contractShipmentList.filter((item) => item.productId !== row.productId);
|
|
|
+ await formData.data.contractProductList.splice(index, 1);
|
|
|
+ totalAmount();
|
|
|
};
|
|
|
const calculationAmount = () => {
|
|
|
nextTick(() => {
|
|
|
- if (formData.data.quotationProductList && formData.data.quotationProductList.length > 0) {
|
|
|
- for (let i = 0; i < formData.data.quotationProductList.length; i++) {
|
|
|
+ if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
|
|
|
+ for (let i = 0; i < formData.data.contractProductList.length; i++) {
|
|
|
let money = 0;
|
|
|
- if (formData.data.quotationProductList[i].quantity && formData.data.quotationProductList[i].price) {
|
|
|
- money = parseFloat(Number(formData.data.quotationProductList[i].quantity) * Number(formData.data.quotationProductList[i].price)).toFixed(2);
|
|
|
+ if (formData.data.contractProductList[i].quantity && formData.data.contractProductList[i].price) {
|
|
|
+ money = parseFloat(Number(formData.data.contractProductList[i].quantity) * Number(formData.data.contractProductList[i].price)).toFixed(2);
|
|
|
}
|
|
|
- formData.data.quotationProductList[i].amount = money;
|
|
|
+ formData.data.contractProductList[i].amount = money;
|
|
|
}
|
|
|
}
|
|
|
nextTick(() => {
|
|
@@ -892,35 +893,36 @@ const calculationAmount = () => {
|
|
|
};
|
|
|
const totalAmount = () => {
|
|
|
let money = 0;
|
|
|
- if (formData.data.quotationProductList && formData.data.quotationProductList.length > 0) {
|
|
|
- for (let i = 0; i < formData.data.quotationProductList.length; i++) {
|
|
|
- if (formData.data.quotationProductList[i].amount) {
|
|
|
- money = parseFloat(Number(money) + Number(formData.data.quotationProductList[i].amount)).toFixed(2);
|
|
|
+ if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
|
|
|
+ for (let i = 0; i < formData.data.contractProductList.length; i++) {
|
|
|
+ if (formData.data.contractProductList[i].amount) {
|
|
|
+ money = parseFloat(Number(money) + Number(formData.data.contractProductList[i].amount)).toFixed(2);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (formData.data.quotationPayList && formData.data.quotationPayList.length > 0) {
|
|
|
- for (let i = 0; i < formData.data.quotationPayList.length; i++) {
|
|
|
- if (formData.data.quotationPayList[i].amount) {
|
|
|
- money = parseFloat(Number(money) + Number(formData.data.quotationPayList[i].amount)).toFixed(2);
|
|
|
+ if (formData.data.contractProjectList && formData.data.contractProjectList.length > 0) {
|
|
|
+ for (let i = 0; i < formData.data.contractProjectList.length; i++) {
|
|
|
+ if (formData.data.contractProjectList[i].amount) {
|
|
|
+ money = parseFloat(Number(money) + Number(formData.data.contractProjectList[i].amount)).toFixed(2);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
formData.data.amount = money;
|
|
|
};
|
|
|
const clickAdd = () => {
|
|
|
- if (formData.data.quotationPayList && formData.data.quotationPayList.length > 0) {
|
|
|
- formData.data.quotationPayList.push({
|
|
|
+ if (formData.data.contractProjectList && formData.data.contractProjectList.length > 0) {
|
|
|
+ formData.data.contractProjectList.push({
|
|
|
payName: "",
|
|
|
amount: undefined,
|
|
|
remark: "",
|
|
|
});
|
|
|
} else {
|
|
|
- formData.data.quotationPayList = [{ payName: "", amount: undefined, remark: "" }];
|
|
|
+ formData.data.contractProjectList = [{ payName: "", amount: undefined, remark: "" }];
|
|
|
}
|
|
|
};
|
|
|
-const handleDelete = (index) => {
|
|
|
- formData.data.quotationPayList.splice(index, 1);
|
|
|
+const handleDelete = async (index) => {
|
|
|
+ await formData.data.contractProjectList.splice(index, 1);
|
|
|
+ totalAmount();
|
|
|
};
|
|
|
const querySearch = (queryString, callback) => {
|
|
|
proxy.post("/quotationPay/page", { payName: queryString }).then((res) => {
|
|
@@ -940,17 +942,30 @@ const querySearch = (queryString, callback) => {
|
|
|
const handleSubmit = async () => {
|
|
|
let status = await submit.value.handleSubmit(() => {});
|
|
|
if (status) {
|
|
|
- if (formData.data.quotationProductList && formData.data.quotationProductList.length > 0) {
|
|
|
- return true;
|
|
|
- } else {
|
|
|
+ if (!(formData.data.contractProductList && formData.data.contractProductList.length > 0)) {
|
|
|
ElMessage("请添加至少一件商品");
|
|
|
+ return false;
|
|
|
}
|
|
|
- if (formData.data.fileList && formData.data.fileList.length > 0) {
|
|
|
- return true;
|
|
|
- } else {
|
|
|
+ if (!(formData.data.fileList && formData.data.fileList.length > 0)) {
|
|
|
ElMessage("请上传交接单");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (formData.data.contractShipmentList && formData.data.contractShipmentList.length > 0) {
|
|
|
+ for (let i = 0; i < formData.data.contractProductList.length; i++) {
|
|
|
+ let data = formData.data.contractShipmentList.filter((item) => item.productId === formData.data.contractProductList[i].productId);
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ let quantity = 0;
|
|
|
+ for (let j = 0; j < data.length; j++) {
|
|
|
+ quantity = parseFloat(Number(quantity) + Number(data[j].quantity));
|
|
|
+ }
|
|
|
+ if (quantity > formData.data.contractProductList[i].quantity) {
|
|
|
+ ElMessage("出货数量不能大于商品数量");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- return false;
|
|
|
+ return true;
|
|
|
} else {
|
|
|
setTimeout(() => {
|
|
|
const errorDiv = document.getElementsByClassName("is-error");
|
|
@@ -963,62 +978,6 @@ const handleSubmit = async () => {
|
|
|
const props = defineProps({
|
|
|
queryData: Object,
|
|
|
});
|
|
|
-onMounted(() => {
|
|
|
- if (props.queryData.priceSheetId) {
|
|
|
- proxy.post("/saleQuotation/detail", { id: props.queryData.priceSheetId }).then((res) => {
|
|
|
- for (var text in res) {
|
|
|
- formData.data[text] = res[text];
|
|
|
- }
|
|
|
- if (formData.data.ehsdJson) {
|
|
|
- let ehsdJson = JSON.parse(formData.data.ehsdJson);
|
|
|
- if (ehsdJson.deliveryTime) {
|
|
|
- formData.data.deliveryTime = ehsdJson.deliveryTime;
|
|
|
- }
|
|
|
- }
|
|
|
- if (formData.data.quotationProductList && formData.data.quotationProductList.length > 0) {
|
|
|
- for (let i = 0; i < formData.data.quotationProductList.length; i++) {
|
|
|
- if (formData.data.quotationProductList[i].ehsdJson) {
|
|
|
- let ehsdJsonProduct = JSON.parse(formData.data.quotationProductList[i].ehsdJson);
|
|
|
- if (ehsdJsonProduct.packMethod) {
|
|
|
- formData.data.quotationProductList[i].packMethod = ehsdJsonProduct.packMethod;
|
|
|
- }
|
|
|
- if (ehsdJsonProduct.tradeMethods) {
|
|
|
- formData.data.quotationProductList[i].tradeMethods = ehsdJsonProduct.tradeMethods;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- let fileIds = formData.data.quotationProductList.map((item) => item.productId);
|
|
|
- proxy.post("/fileInfo/getList", { businessIdList: fileIds }).then((resFile) => {
|
|
|
- for (let i = 0; i < formData.data.quotationProductList.length; i++) {
|
|
|
- if (resFile[formData.data.quotationProductList[i].productId] && resFile[formData.data.quotationProductList[i].productId].length > 0) {
|
|
|
- formData.data.quotationProductList[i].fileUrl = resFile[formData.data.quotationProductList[i].productId][0].fileUrl;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- delete formData.data.id;
|
|
|
- delete formData.data.code;
|
|
|
- getCityData(formData.data.customerCountryId, "20");
|
|
|
- getCityData(formData.data.customerState, "30");
|
|
|
- if (formData.data.quotationProductList && formData.data.quotationProductList.length > 0) {
|
|
|
- formData.data.quotationProductList = formData.data.quotationProductList.map((item) => {
|
|
|
- delete item.id;
|
|
|
- return {
|
|
|
- ...item,
|
|
|
- };
|
|
|
- });
|
|
|
- }
|
|
|
- if (formData.data.quotationPayList && formData.data.quotationPayList.length > 0) {
|
|
|
- formData.data.quotationPayList = formData.data.quotationPayList.map((item) => {
|
|
|
- delete item.id;
|
|
|
- return {
|
|
|
- ...item,
|
|
|
- };
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-});
|
|
|
const clickCustomerProduct = () => {
|
|
|
if (!formData.data.buyCorporationId) {
|
|
|
return ElMessage("请先选择客户");
|