Ver Fonte

销售合同发起

lxf há 2 anos atrás
pai
commit
bc2bf0bfcb
2 ficheiros alterados com 244 adições e 51 exclusões
  1. 243 32
      src/components/process/Contract.vue
  2. 1 19
      src/components/process/PriceSheet.vue

+ 243 - 32
src/components/process/Contract.vue

@@ -176,8 +176,9 @@
               </template>
             </el-table-column>
             <el-table-column prop="amount" label="金额" width="140" />
-            <el-table-column label="操作" width="80">
+            <el-table-column align="center" label="操作" width="120">
               <template #default="{ row, $index }">
+                <el-button type="primary" link @click="handleHandover(row, $index)">交接单</el-button>
                 <el-button type="primary" link @click="handleRemove($index)">删除</el-button>
               </template>
             </el-table-column>
@@ -192,18 +193,7 @@
               <template #default="{ row, $index }">
                 <div style="width: 100%">
                   <el-form-item :prop="'quotationPayList.' + $index + '.payName'" :rules="rules.payName" :inline-message="true">
-                    <el-autocomplete
-                      v-model="row.payName"
-                      :fetch-suggestions="querySearch"
-                      clearable
-                      class="inline-input w-50"
-                      placeholder="请输入收费项目"
-                      @select="
-                        (item) => {
-                          return handleName(item, row);
-                        }
-                      ">
-                    </el-autocomplete>
+                    <el-autocomplete v-model="row.payName" :fetch-suggestions="querySearch" clearable class="inline-input w-50" placeholder="请输入收费项目" />
                   </el-form-item>
                 </div>
               </template>
@@ -233,7 +223,7 @@
                 </div>
               </template>
             </el-table-column>
-            <el-table-column label="操作" width="80">
+            <el-table-column align="center" label="操作" width="80">
               <template #default="{ row, $index }">
                 <el-button type="primary" link @click="handleDelete($index)">删除</el-button>
               </template>
@@ -282,6 +272,13 @@
                   :max="100" />
               </el-form-item>
             </el-col>
+            <el-col :span="7">
+              <el-form-item label="收款账号" prop="shroffAccountId">
+                <el-select v-model="formData.data.shroffAccountId" placeholder="请选择收款账号" style="width: 100%">
+                  <el-option v-for="item in accountList" :key="item.value" :label="item.label" :value="item.value" />
+                </el-select>
+              </el-form-item>
+            </el-col>
           </el-row>
         </div>
       </template>
@@ -326,11 +323,77 @@
           </el-row>
         </div>
       </template>
+      <template #shipment>
+        <div style="width: 100%">
+          <el-table :data="formData.data.contractShipmentList" style="width: 100%; margin-top: 16px">
+            <el-table-column prop="code" label="商品编码" width="120" />
+            <el-table-column prop="productName" label="商品名称" />
+            <el-table-column label="出货日期" width="220">
+              <template #default="{ row, $index }">
+                <div style="width: 100%">
+                  <el-form-item :prop="'contractShipmentList.' + $index + '.shipmentTime'" :rules="rules.shipmentTime" :inline-message="true">
+                    <el-date-picker v-model="row.shipmentTime" type="date" placeholder="请选择出货日期" value-format="YYYY-MM-DD" />
+                  </el-form-item>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="数量" width="160">
+              <template #default="{ row, $index }">
+                <div style="width: 100%">
+                  <el-form-item :prop="'contractShipmentList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
+                    <el-input-number
+                      v-model="row.quantity"
+                      placeholder="请输入数量"
+                      style="width: 100%"
+                      :precision="0"
+                      :controls="false"
+                      :min="0"
+                      @change="calculationAmount()" />
+                  </el-form-item>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="操作" width="120">
+              <template #default="{ row, $index }">
+                <el-button type="primary" link @click="clickSplit(row)">拆分</el-button>
+                <el-button type="primary" link @click="clickDelete($index)">删除</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+      </template>
     </byForm>
 
     <el-dialog v-model="openProduct" title="选择商品" width="70%" append-to-body>
       <SelectGoods @cancel="openProduct = false" @pushGoods="pushGoods"></SelectGoods>
     </el-dialog>
+
+    <el-dialog title="交接单" v-if="openHandover" v-model="openHandover" width="800">
+      <byForm :formConfig="formHandoverConfig" :formOption="formOption" v-model="productRow.data">
+        <template #remark>
+          <div style="width: 100%">
+            <Editor :value="productRow.data.remark" @updateValue="updateContent" />
+          </div>
+        </template>
+        <template #file>
+          <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-preview="onPreviewFile">
+              <el-button>选择</el-button>
+            </el-upload>
+          </div>
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="openHandover = false" size="large">取 消</el-button>
+        <el-button type="primary" @click="submitHandoverForm()" size="large">确 定</el-button>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
@@ -339,8 +402,10 @@ import byForm from "@/components/byForm/index";
 import useUserStore from "@/store/modules/user";
 import SelectGoods from "@/components/product/SelectGoods";
 import { ElMessage } from "element-plus";
+import Editor from "@/components/Editor/index.vue";
 
 const { proxy } = getCurrentInstance();
+const contractType = ref([]);
 const accountCurrency = ref([]);
 const fundsPaymentMethod = ref([]);
 const tradeMethods = ref([]);
@@ -352,12 +417,14 @@ const countryData = ref([]);
 const provinceData = ref([]);
 const cityData = ref([]);
 const customerUserList = ref([]);
+const accountList = ref([]);
 const openProduct = ref(false);
-let formData = reactive({
+const formData = reactive({
   data: {
     amount: undefined,
     quotationProductList: [],
     quotationPayList: [],
+    contractShipmentList: [],
   },
 });
 const submit = ref(null);
@@ -374,12 +441,20 @@ const formConfig = computed(() => {
     },
     {
       type: "select",
+      label: "合同类型",
+      prop: "contractType",
+      data: contractType.value,
+      itemWidth: 25,
+    },
+    {
+      type: "select",
       label: "选择合同模板",
       prop: "contractTemplateId",
       data: templateList.value,
       fn: (val) => {
         changeTemplate(val);
       },
+      itemWidth: 26,
     },
     {
       type: "slot",
@@ -413,9 +488,15 @@ const formConfig = computed(() => {
       slotName: "delivery",
       label: "交付信息",
     },
+    {
+      type: "slot",
+      slotName: "shipment",
+      label: "出货计划",
+    },
   ];
 });
 const rules = ref({
+  contractType: [{ required: true, message: "请选择合同类型", trigger: "change" }],
   contractTemplateId: [{ required: true, message: "请选择合同模板", trigger: "change" }],
   buyCorporationId: [{ required: true, message: "请选择公司", trigger: "change" }],
   buyCountryId: [{ required: true, message: "请选择国家", trigger: "change" }],
@@ -429,10 +510,12 @@ const rules = ref({
   quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
   amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
   payName: [{ required: true, message: "请输入收费项目", trigger: ["change", "blur"] }],
+  shipmentTime: [{ required: true, message: "请选择出货日期", trigger: ["change", "blur"] }],
   currency: [{ required: true, message: "请选择币种", trigger: "change" }],
   effective: [{ required: true, message: "请输入报价有效期", trigger: "blur" }],
   paymentMethod: [{ required: true, message: "请选择付款方式", trigger: "change" }],
   advanceRatio: [{ required: true, message: "请输入预付比例", trigger: "blur" }],
+  shroffAccountId: [{ required: true, message: "请选择收款账号", trigger: "change" }],
   tradeMethods: [{ required: true, message: "请选择贸易方式", trigger: "change" }],
   transportMethod: [{ required: true, message: "请选择运输方式", trigger: "change" }],
   transportRemark: [{ required: true, message: "请输入运输说明", trigger: "blur" }],
@@ -443,6 +526,23 @@ const getDict = () => {
     .post("/dictTenantData/page", {
       pageNum: 1,
       pageSize: 999,
+      dictCode: "contract_type",
+      tenantId: useUserStore().user.tenantId,
+    })
+    .then((res) => {
+      if (res.rows && res.rows.length > 0) {
+        contractType.value = res.rows.map((item) => {
+          return {
+            label: item.dictValue,
+            value: item.dictKey,
+          };
+        });
+      }
+    });
+  proxy
+    .post("/dictTenantData/page", {
+      pageNum: 1,
+      pageSize: 999,
       dictCode: "account_currency",
       tenantId: useUserStore().user.tenantId,
     })
@@ -534,6 +634,14 @@ const getDict = () => {
       };
     });
   });
+  proxy.post("/accountManagement/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    accountList.value = res.rows.map((item) => {
+      return {
+        label: item.alias,
+        value: item.id,
+      };
+    });
+  });
 };
 getDict();
 const changeTemplate = (val) => {
@@ -688,7 +796,19 @@ const pushGoods = (goods) => {
           quantity: undefined,
           price: undefined,
           amount: "",
-          remark: item.remark,
+          remark: "",
+          fileList: [],
+        };
+      })
+    );
+    formData.data.contractShipmentList = formData.data.contractShipmentList.concat(
+      goods.map((item) => {
+        return {
+          code: item.code,
+          productId: item.id,
+          productName: item.name,
+          shipmentTime: "",
+          quantity: undefined,
         };
       })
     );
@@ -704,6 +824,98 @@ const pushGoods = (goods) => {
 const onPicture = (path) => {
   window.open(path, "_blank");
 };
+const productRow = reactive({
+  data: {
+    productName: "",
+    productModel: "",
+    remark: "",
+  },
+});
+const productIndex = ref(0);
+const openHandover = ref(false);
+const fileList = ref([]);
+const uploadData = ref({});
+const formHandoverConfig = computed(() => {
+  return [
+    {
+      label: "产品信息",
+    },
+    {
+      type: "input",
+      prop: "productName",
+      label: "产品名称",
+      itemType: "text",
+      disabled: true,
+    },
+    {
+      type: "input",
+      prop: "productModel",
+      label: "规格型号",
+      itemType: "text",
+      disabled: true,
+    },
+    {
+      type: "slot",
+      slotName: "remark",
+      label: "交接单",
+    },
+    {
+      type: "slot",
+      prop: "file",
+      slotName: "file",
+      label: "上传附件",
+    },
+  ];
+});
+const handleHandover = (row, index) => {
+  productRow.data = {
+    productName: row.productName,
+    productModel: row.productModel,
+    remark: row.remark,
+  };
+  if (row.fileList && row.fileList.length > 0) {
+    fileList.value = row.fileList.map((item) => {
+      return {
+        raw: item,
+        name: item.fileName,
+        url: item.fileUrl,
+      };
+    });
+  }
+  productIndex.value = index;
+  openHandover.value = true;
+};
+const updateContent = (val) => {
+  productRow.data.remark = val;
+};
+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;
+  return true;
+};
+const onPreviewFile = (file) => {
+  window.open(file.raw.fileUrl, "_blank");
+};
+const submitHandoverForm = () => {
+  if (fileList.value && fileList.value.length > 0) {
+    formData.data.quotationProductList[productIndex.value].remark = productRow.data.remark;
+    if (fileList.value && fileList.value.length > 0) {
+      formData.data.quotationProductList[productIndex.value].fileList = fileList.value.map((item) => {
+        return {
+          id: item.raw.id,
+          fileName: item.raw.fileName,
+          fileUrl: item.raw.fileUrl,
+        };
+      });
+    } else {
+      formData.data.quotationProductList[productIndex.value].fileList = [];
+    }
+    openHandover.value = false;
+  }
+};
 const handleRemove = (index) => {
   formData.data.quotationProductList.splice(index, 1);
 };
@@ -766,13 +978,18 @@ const querySearch = (queryString, callback) => {
     }
   });
 };
-const handleName = (item, row) => {
-  row.amount = item.amount;
-  row.remark = item.remark;
-  nextTick(() => {
-    totalAmount();
+const clickSplit = (item) => {
+  formData.data.contractShipmentList.push({
+    code: item.code,
+    productId: item.productId,
+    productName: item.productName,
+    shipmentTime: "",
+    quantity: undefined,
   });
 };
+const clickDelete = (index) => {
+  formData.data.contractShipmentList.splice(index, 1);
+};
 const handleSubmit = async () => {
   let status = await submit.value.handleSubmit(() => {});
   if (status) {
@@ -785,21 +1002,15 @@ const handleSubmit = async () => {
   }
   return status;
 };
-// 向父组件暴露
-defineExpose({
-  submitData: formData.data,
-  handleSubmit,
-});
 // 接收父组件的传值
 const props = defineProps({
   queryData: String,
 });
-onMounted(() => {
-  if (props.queryData.id) {
-    proxy.post("/saleQuotation/detail", { id: props.queryData.id }).then((res) => {
-      console.log(res);
-    });
-  }
+onMounted(() => {});
+// 向父组件暴露
+defineExpose({
+  submitData: formData.data,
+  handleSubmit,
 });
 </script>
 

+ 1 - 19
src/components/process/PriceSheet.vue

@@ -192,18 +192,7 @@
               <template #default="{ row, $index }">
                 <div style="width: 100%">
                   <el-form-item :prop="'quotationPayList.' + $index + '.payName'" :rules="rules.payName" :inline-message="true">
-                    <el-autocomplete
-                      v-model="row.payName"
-                      :fetch-suggestions="querySearch"
-                      clearable
-                      class="inline-input w-50"
-                      placeholder="请输入收费项目"
-                      @select="
-                        (item) => {
-                          return handleName(item, row);
-                        }
-                      ">
-                    </el-autocomplete>
+                    <el-autocomplete v-model="row.payName" :fetch-suggestions="querySearch" clearable class="inline-input w-50" placeholder="请输入收费项目" />
                   </el-form-item>
                 </div>
               </template>
@@ -766,13 +755,6 @@ const querySearch = (queryString, callback) => {
     }
   });
 };
-const handleName = (item, row) => {
-  row.amount = item.amount;
-  row.remark = item.remark;
-  nextTick(() => {
-    totalAmount();
-  });
-};
 const handleSubmit = async () => {
   let status = await submit.value.handleSubmit(() => {});
   if (status) {