|
@@ -127,11 +127,12 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="code" label="商品编码" width="120" />
|
|
|
- <el-table-column label="商品名称" min-width="200">
|
|
|
+ <el-table-column prop="name" label="商品中文名" width="160" />
|
|
|
+ <el-table-column label="商品英文名" min-width="200">
|
|
|
<template #default="{ row, $index }">
|
|
|
<div style="width: 100%">
|
|
|
<el-form-item :prop="'contractProductList.' + $index + '.productName'" :rules="rules.productName" :inline-message="true">
|
|
|
- <el-input v-model="row.productName" placeholder="请输入商品名称" />
|
|
|
+ <el-input v-model="row.productName" placeholder="请输入商品英文名" />
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -139,7 +140,6 @@
|
|
|
<el-table-column label="规格型号" width="180">
|
|
|
<template #default="{ row, $index }">
|
|
|
<div style="width: 100%">
|
|
|
- <!-- :rules="rules.productModel" -->
|
|
|
<el-form-item :prop="'contractProductList.' + $index + '.productModel'" :inline-message="true">
|
|
|
<el-input v-model="row.productModel" placeholder="请输入规格型号" />
|
|
|
</el-form-item>
|
|
@@ -147,7 +147,7 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="unit" label="单位" width="100" :formatter="(row) => dictValueLabel(row.unit, productUnit)" />
|
|
|
- <el-table-column label="数量" width="160">
|
|
|
+ <el-table-column label="数量" width="150">
|
|
|
<template #default="{ row, $index }">
|
|
|
<div style="width: 100%">
|
|
|
<el-form-item :prop="'contractProductList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
|
|
@@ -181,7 +181,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="amount" label="金额" width="140" />
|
|
|
+ <el-table-column prop="amount" label="金额" width="100" />
|
|
|
<el-table-column align="center" label="操作" width="120" fixed="right">
|
|
|
<template #default="{ row, $index }">
|
|
|
<el-button type="primary" link @click="handleHandover(row, $index)">交接单</el-button>
|
|
@@ -373,8 +373,16 @@
|
|
|
</el-row>
|
|
|
<el-row style="margin-top: 20px; width: 100%">
|
|
|
<el-col :span="7">
|
|
|
- <el-form-item label="交货期限" prop="deliveryTime">
|
|
|
- <el-date-picker v-model="formData.data.deliveryTime" type="date" placeholder="请选择交货期限" value-format="YYYY-MM-DD" />
|
|
|
+ <el-form-item label="交货期限 (天)" prop="deliveryTime">
|
|
|
+ <!-- <el-date-picker v-model="formData.data.deliveryTime" type="date" placeholder="请选择交货期限" value-format="YYYY-MM-DD" /> -->
|
|
|
+ <el-input-number
|
|
|
+ onmousewheel="return false;"
|
|
|
+ v-model="formData.data.deliveryTime"
|
|
|
+ placeholder="请输入交货期限"
|
|
|
+ style="width: 100%"
|
|
|
+ :precision="0"
|
|
|
+ :controls="false"
|
|
|
+ :min="0" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="7">
|
|
@@ -434,8 +442,8 @@
|
|
|
</template>
|
|
|
</byForm>
|
|
|
|
|
|
- <el-dialog v-model="openProduct" title="选择商品" width="70%" append-to-body>
|
|
|
- <SelectGoods @cancel="openProduct = false" @pushGoods="pushGoods"></SelectGoods>
|
|
|
+ <el-dialog v-if="openProduct" v-model="openProduct" title="选择商品" width="70%" append-to-body>
|
|
|
+ <SelectGoods :selectList="acquireSelectList()" @cancel="openProduct = false" @pushGoods="pushGoods"></SelectGoods>
|
|
|
</el-dialog>
|
|
|
|
|
|
<el-dialog title="交接单" v-if="openHandover" v-model="openHandover" width="800">
|
|
@@ -475,6 +483,7 @@ import { ElMessage } from "element-plus";
|
|
|
import Editor from "@/components/Editor/index.vue";
|
|
|
import selectCity from "@/components/selectCity/index.vue";
|
|
|
import { useRoute } from "vue-router";
|
|
|
+import Pubsub from "pubsub-js";
|
|
|
|
|
|
const route = useRoute();
|
|
|
// 接收父组件的传值
|
|
@@ -500,6 +509,7 @@ const openProduct = ref(false);
|
|
|
const activeName = ref("");
|
|
|
const formData = reactive({
|
|
|
data: {
|
|
|
+ contractType: "1",
|
|
|
amount: undefined,
|
|
|
contractProductList: [],
|
|
|
contractProjectList: [],
|
|
@@ -595,7 +605,7 @@ const rules = ref({
|
|
|
buyAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
|
|
|
buyContactName: [{ required: true, message: "请输入联系人", trigger: ["change", "blur"] }],
|
|
|
buyContactNumber: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
|
|
|
- productName: [{ required: true, message: "请输入商品名称", trigger: "blur" }],
|
|
|
+ productName: [{ required: true, message: "请输入商品英文名", trigger: "blur" }],
|
|
|
productModel: [{ required: true, message: "请输入规格型号", trigger: "blur" }],
|
|
|
quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
|
|
|
price: [{ required: true, message: "请输入单价", trigger: "blur" }],
|
|
@@ -603,7 +613,7 @@ const rules = ref({
|
|
|
payName: [{ required: true, message: "请输入收费项目", trigger: ["change", "blur"] }],
|
|
|
currency: [{ required: true, message: "请选择币种", trigger: "change" }],
|
|
|
effective: [{ required: true, message: "请输入报价有效期", trigger: "blur" }],
|
|
|
- deliveryTime: [{ required: true, message: "请选择交货期限", trigger: "change" }],
|
|
|
+ deliveryTime: [{ required: true, message: "请选择交货期限", trigger: "blur" }],
|
|
|
paymentMethod: [{ required: true, message: "请选择付款方式", trigger: "change" }],
|
|
|
advanceRatio: [{ required: true, message: "请输入预付比例", trigger: "blur" }],
|
|
|
shroffAccountId: [{ required: true, message: "请选择收款账号", trigger: "change" }],
|
|
@@ -694,8 +704,65 @@ const changeTemplate = (val) => {
|
|
|
if (detailCorporation.countryEnStr) {
|
|
|
formData.data.sellCountryName = detailCorporation.countryEnStr;
|
|
|
}
|
|
|
+ if (res.provinceEnStr) {
|
|
|
+ formData.data.sellProvinceName = detailCorporation.provinceEnStr;
|
|
|
+ }
|
|
|
+ if (res.cityEnStr) {
|
|
|
+ formData.data.sellCityName = detailCorporation.cityEnStr;
|
|
|
+ }
|
|
|
+ if (detailCorporation.countryEnStr) {
|
|
|
+ formData.data.sellCountryName = detailCorporation.countryEnStr;
|
|
|
+ } else {
|
|
|
+ proxy.post("/customizeArea/list", { parentId: "0" }).then((resCountry) => {
|
|
|
+ let sellCountryData = resCountry.filter((item) => item.id === detailCorporation.countryId);
|
|
|
+ if (sellCountryData && sellCountryData.length > 0) {
|
|
|
+ formData.data.sellCountryName = sellCountryData[0].chineseName;
|
|
|
+ } else {
|
|
|
+ formData.data.sellCountryName = "";
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
if (detailCorporation.provinceEnStr) {
|
|
|
formData.data.sellProvinceName = detailCorporation.provinceEnStr;
|
|
|
+ } else if (detailCorporation.countryId) {
|
|
|
+ proxy
|
|
|
+ .post("/customizeArea/list", {
|
|
|
+ parentId: detailCorporation.countryId,
|
|
|
+ })
|
|
|
+ .then((resProvince) => {
|
|
|
+ let sellProvinceData = resProvince.filter((item) => item.id === detailCorporation.provinceId);
|
|
|
+ if (sellProvinceData && sellProvinceData.length > 0) {
|
|
|
+ formData.data.sellProvinceName = sellProvinceData[0].name;
|
|
|
+ } else {
|
|
|
+ formData.data.sellProvinceName = "";
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ formData.data.sellProvinceName = "";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (detailCorporation.cityEnStr) {
|
|
|
+ formData.data.sellCityName = detailCorporation.cityEnStr;
|
|
|
+ } else if (detailCorporation.provinceId) {
|
|
|
+ proxy
|
|
|
+ .post("/customizeArea/list", {
|
|
|
+ parentId: detailCorporation.provinceId,
|
|
|
+ })
|
|
|
+ .then((resCity) => {
|
|
|
+ let sellCityData = resCity.filter((item) => item.id === detailCorporation.cityId);
|
|
|
+ if (sellCityData && sellCityData.length > 0) {
|
|
|
+ formData.data.sellCityName = sellCityData[0].name;
|
|
|
+ } else {
|
|
|
+ formData.data.sellCityName = "";
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ formData.data.sellCityName = "";
|
|
|
+ }
|
|
|
+ if (detailCorporation.addressEn) {
|
|
|
+ formData.data.sellAddress = detailCorporation.addressEn;
|
|
|
+ } else {
|
|
|
+ formData.data.sellAddress = detailCorporation.address;
|
|
|
}
|
|
|
if (detailCorporation.cityEnStr) {
|
|
|
formData.data.sellCityName = detailCorporation.cityEnStr;
|
|
@@ -820,6 +887,92 @@ const changeCustomer = (val) => {
|
|
|
formData.data.buyPostalCode = "";
|
|
|
formData.data.buyAddress = "";
|
|
|
}
|
|
|
+ getDecisionAids();
|
|
|
+};
|
|
|
+let auxiliaryData = ref([
|
|
|
+ {
|
|
|
+ label: "最近合同",
|
|
|
+ data: [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "产品价格",
|
|
|
+ data: [],
|
|
|
+ },
|
|
|
+]);
|
|
|
+const emit = defineEmits(["auxiliaryChange"]);
|
|
|
+const getDecisionAids = () => {
|
|
|
+ let data = {
|
|
|
+ buyCorporationId: formData.data.buyCorporationId,
|
|
|
+ productIdList: [],
|
|
|
+ };
|
|
|
+ if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
|
|
|
+ data.productIdList = formData.data.contractProductList.map((item) => item.productId);
|
|
|
+ }
|
|
|
+ proxy.post("/contract/decisionAid", data).then((res) => {
|
|
|
+ if (res.lastContractList && res.lastContractList.length > 0) {
|
|
|
+ auxiliaryData.value[0].data = res.lastContractList.map((item) => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ label: "合同编号",
|
|
|
+ value: item.code,
|
|
|
+ style: {
|
|
|
+ color: "#0084FF",
|
|
|
+ },
|
|
|
+ id: item.id,
|
|
|
+ num: 1,
|
|
|
+ // fn: () => {},
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "下单日期",
|
|
|
+ value: item.createTime,
|
|
|
+ id: item.id,
|
|
|
+ num: 1,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "合同金额",
|
|
|
+ value: item.currency + item.amount,
|
|
|
+ id: item.id,
|
|
|
+ num: 1,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ auxiliaryData.value[0].data = [];
|
|
|
+ }
|
|
|
+ if (res.productPriceList && res.productPriceList.length > 0) {
|
|
|
+ auxiliaryData.value[1].data = res.productPriceList.map((item) => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ label: "产品名称",
|
|
|
+ value: item.name,
|
|
|
+ id: item.id,
|
|
|
+ num: 1,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "最近价格",
|
|
|
+ value: item.lastPrice,
|
|
|
+ id: item.id,
|
|
|
+ num: 1,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "历史最高",
|
|
|
+ value: item.maxPrice,
|
|
|
+ id: item.id,
|
|
|
+ num: 1,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "历史最低",
|
|
|
+ value: item.minPrice,
|
|
|
+ id: item.id,
|
|
|
+ num: 1,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ auxiliaryData.value[1].data = [];
|
|
|
+ }
|
|
|
+ emit("auxiliaryChange", auxiliaryData.value);
|
|
|
+ });
|
|
|
};
|
|
|
const createFilter = (queryString) => {
|
|
|
return (restaurant) => {
|
|
@@ -835,8 +988,20 @@ const handlePerson = (item) => {
|
|
|
};
|
|
|
const pushGoods = (goods) => {
|
|
|
if (goods && goods.length > 0) {
|
|
|
+ let afterFiltering = [];
|
|
|
+ if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
|
|
|
+ afterFiltering = goods.filter((item) => {
|
|
|
+ let data = formData.data.contractProductList.filter((itemProduct) => itemProduct.productId === item.id);
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ afterFiltering = goods;
|
|
|
+ }
|
|
|
formData.data.contractProductList = formData.data.contractProductList.concat(
|
|
|
- goods.map((item) => {
|
|
|
+ afterFiltering.map((item) => {
|
|
|
let fileUrl = "";
|
|
|
if (item.fileList && item.fileList.length > 0) {
|
|
|
fileUrl = item.fileList[0].fileUrl;
|
|
@@ -852,6 +1017,7 @@ const pushGoods = (goods) => {
|
|
|
fileUrl: fileUrl,
|
|
|
code: item.code,
|
|
|
productId: item.id,
|
|
|
+ name: item.name,
|
|
|
productName: name,
|
|
|
productModel: item.spec,
|
|
|
unit: item.unit,
|
|
@@ -864,7 +1030,7 @@ const pushGoods = (goods) => {
|
|
|
})
|
|
|
);
|
|
|
formData.data.contractShipmentList = formData.data.contractShipmentList.concat(
|
|
|
- goods.map((item) => {
|
|
|
+ afterFiltering.map((item) => {
|
|
|
let name = item.name;
|
|
|
if (item.standardJson) {
|
|
|
let standardJson = JSON.parse(item.standardJson);
|
|
@@ -886,6 +1052,7 @@ const pushGoods = (goods) => {
|
|
|
type: "success",
|
|
|
});
|
|
|
openProduct.value = false;
|
|
|
+ getDecisionAids();
|
|
|
} else {
|
|
|
ElMessage("请选择至少一件商品");
|
|
|
}
|
|
@@ -1009,6 +1176,7 @@ 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();
|
|
|
+ getDecisionAids();
|
|
|
};
|
|
|
const calculationAmount = () => {
|
|
|
nextTick(() => {
|
|
@@ -1159,6 +1327,18 @@ watch(
|
|
|
deep: true,
|
|
|
}
|
|
|
);
|
|
|
+const acquireSelectList = () => {
|
|
|
+ let data = [];
|
|
|
+ if (formData.data.contractProductList && formData.data.contractProductList.length > 0) {
|
|
|
+ data = formData.data.contractProductList.map((item) => {
|
|
|
+ return {
|
|
|
+ id: item.productId,
|
|
|
+ name: item.name,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return data;
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|