浏览代码

报价单页面增加“生成合同”功能

lxf 1 年之前
父节点
当前提交
5b3289c5a9

+ 60 - 8
src/components/process/Contract.vue

@@ -974,17 +974,10 @@ const pushGoods = (goods) => {
     );
     formData.data.contractShipmentList = formData.data.contractShipmentList.concat(
       afterFiltering.map((item) => {
-        let name = item.name;
-        if (item.standardJson) {
-          let standardJson = JSON.parse(item.standardJson);
-          if (standardJson && standardJson.englishName) {
-            name = standardJson.englishName;
-          }
-        }
         return {
           code: item.code,
           productId: item.id,
-          productName: name,
+          productName: item.name,
           shipmentTime: "",
           quantity: undefined,
         };
@@ -1282,6 +1275,65 @@ const acquireSelectList = () => {
   }
   return data;
 };
+onMounted(() => {
+  if (props.queryData.priceSheetId) {
+    proxy.post("/saleQuotation/detail", { id: props.queryData.priceSheetId }).then((res) => {
+      console.log(res);
+      res.countryId = res.buyCountryId;
+      res.provinceId = res.buyProvinceId;
+      res.cityId = res.buyCityId;
+      for (var text in res) {
+        formData.data[text] = res[text];
+      }
+      if (formData.data.quotationProductList && formData.data.quotationProductList.length > 0) {
+        formData.data.contractProductList = formData.data.quotationProductList.map((item) => {
+          delete item.id;
+          return {
+            ...item,
+          };
+        });
+        formData.data.contractShipmentList = proxy.deepClone(
+          formData.data.contractProductList.map((item) => {
+            return {
+              ...item,
+              quantity: undefined,
+            };
+          })
+        );
+        for (let i = 0; i < formData.data.contractProductList.length; i++) {
+          proxy.post("/productInfo/detail", { id: formData.data.contractProductList[i].productId }).then((resProduct) => {
+            let name = resProduct.name;
+            if (resProduct.standardJson) {
+              let standardJson = JSON.parse(resProduct.standardJson);
+              if (standardJson && standardJson.englishName) {
+                name = standardJson.englishName;
+              }
+            }
+            formData.data.contractProductList[i].name = resProduct.name;
+            formData.data.contractProductList[i].productName = name;
+            formData.data.contractProductList[i].code = resProduct.code;
+            formData.data.contractProductList[i].unit = resProduct.unit;
+            formData.data.contractShipmentList[i].code = resProduct.code;
+          });
+        }
+      }
+      delete formData.data.id;
+      delete formData.data.code;
+      getCityData(formData.data.countryId, "20");
+      if (formData.data.provinceId) {
+        getCityData(formData.data.provinceId, "30");
+      }
+      if (formData.data.quotationPayList && formData.data.quotationPayList.length > 0) {
+        formData.data.contractProjectList = formData.data.quotationPayList.map((item) => {
+          delete item.id;
+          return {
+            ...item,
+          };
+        });
+      }
+    });
+  }
+});
 </script>
 
 <style lang="scss" scoped>

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

@@ -146,7 +146,7 @@
                 </div>
               </template>
             </el-table-column>
-            <el-table-column prop="unit" label="单位" width="100" />
+            <el-table-column prop="unit" label="单位" width="100" :formatter="(row) => dictValueLabel(row.unit, productUnit)" />
             <el-table-column label="数量" width="150">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
@@ -358,6 +358,7 @@ const accountCurrency = ref([]);
 const fundsPaymentMethod = ref([]);
 const tradeMethods = ref([]);
 const shippingMethod = ref([]);
+const productUnit = ref([]);
 const templateList = ref([]);
 const corporationList = ref([]);
 const customerList = ref([]);
@@ -456,7 +457,6 @@ 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" }],
   paymentMethod: [{ required: true, message: "请选择付款方式", trigger: "change" }],
   advanceRatio: [{ required: true, message: "请输入预付比例", trigger: "blur" }],
   tradeMethods: [{ required: true, message: "请选择贸易方式", trigger: "change" }],
@@ -465,7 +465,7 @@ const rules = ref({
   remark: [{ required: true, message: "请输入付款条件", trigger: "blur" }],
 });
 const getDict = () => {
-  proxy.getDictOne(["account_currency", "funds_payment_method", "trade_methods", "shipping_method"]).then((res) => {
+  proxy.getDictOne(["account_currency", "funds_payment_method", "trade_methods", "shipping_method", "unit"]).then((res) => {
     accountCurrency.value = res["account_currency"].map((x) => ({
       label: x.dictValue,
       value: x.dictKey,
@@ -482,6 +482,10 @@ const getDict = () => {
       label: x.dictValue,
       value: x.dictKey,
     }));
+    productUnit.value = res["unit"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
   });
   proxy.post("/contractTemplate/page", { pageNum: 1, pageSize: 999 }).then((res) => {
     templateList.value = res.rows.map((item) => {
@@ -679,12 +683,19 @@ const pushGoods = (goods) => {
         if (item.fileList && item.fileList.length > 0) {
           fileUrl = item.fileList[0].fileUrl;
         }
+        let name = item.name;
+        if (item.standardJson) {
+          let standardJson = JSON.parse(item.standardJson);
+          if (standardJson && standardJson.englishName) {
+            name = standardJson.englishName;
+          }
+        }
         return {
           fileUrl: fileUrl,
           code: item.code,
           productId: item.id,
           name: item.name,
-          productName: item.name,
+          productName: name,
           productModel: item.spec,
           unit: item.unit,
           quantity: undefined,
@@ -825,10 +836,14 @@ onMounted(() => {
       }
       if (formData.data.quotationProductList && formData.data.quotationProductList.length > 0) {
         for (let i = 0; i < formData.data.quotationProductList.length; i++) {
+          delete formData.data.quotationProductList[i].id;
           proxy.post("/productInfo/detail", { id: formData.data.quotationProductList[i].productId }).then((resProduct) => {
+            formData.data.quotationProductList[i].name = resProduct.name;
             formData.data.quotationProductList[i].code = resProduct.code;
+            formData.data.quotationProductList[i].unit = resProduct.unit;
           });
         }
+        console.log(formData.data.quotationProductList);
         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++) {
@@ -844,14 +859,6 @@ onMounted(() => {
       if (formData.data.provinceId) {
         getCityData(formData.data.provinceId, "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;

+ 27 - 3
src/views/salesMange/saleContract/priceSheet/index.vue

@@ -375,7 +375,7 @@ const config = computed(() => {
     {
       attrs: {
         label: "操作",
-        width: "120",
+        width: "180",
         align: "center",
         fixed: "right",
       },
@@ -403,6 +403,19 @@ const config = computed(() => {
               clickPrint(row);
             },
           },
+          row.status == 30
+            ? {
+                attrs: {
+                  label: "生成合同",
+                  type: "primary",
+                  text: true,
+                },
+                el: "button",
+                click() {
+                  generateContract(row);
+                },
+              }
+            : {},
         ];
       },
     },
@@ -499,8 +512,8 @@ const getList = async (req) => {
   });
 };
 getDict();
-if(route.query.code){
-    sourceList.value.pagination.keyword=route.query.code
+if (route.query.code) {
+  sourceList.value.pagination.keyword = route.query.code;
 }
 getList();
 const newPriceSheet = () => {
@@ -568,6 +581,17 @@ const getAllMoney = (num) => {
   }
   return money;
 };
+const generateContract = (row) => {
+  proxy.$router.replace({
+    path: "/platform_manage/process/processApproval",
+    query: {
+      flowKey: "contract_flow",
+      flowName: "销售合同审批流程",
+      random: proxy.random(),
+      priceSheetId: row.id,
+    },
+  });
+};
 </script>
 
 <style lang="scss" scoped>