Browse Source

报价单复制

lxf 2 years ago
parent
commit
3691fd7214

+ 76 - 43
src/components/process/PriceSheet.vue

@@ -11,42 +11,36 @@
           <el-row style="margin-top: 20px; width: 100%">
           <el-row style="margin-top: 20px; width: 100%">
             <el-col :span="8">
             <el-col :span="8">
               <el-form-item label="地址" prop="sellCountryId">
               <el-form-item label="地址" prop="sellCountryId">
-                <el-select v-model="formData.data.sellCountryId" placeholder="国家" disabled>
-                  <el-option v-for="item in sellCountryData" :label="item.chineseName" :value="item.id"> </el-option>
-                </el-select>
+                <el-input v-model="formData.data.sellCountryId" placeholder="请输入国家" />
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
             <el-col :span="8">
             <el-col :span="8">
               <el-form-item label=" " prop="sellProvinceId">
               <el-form-item label=" " prop="sellProvinceId">
-                <el-select v-model="formData.data.sellProvinceId" placeholder="省/洲" disabled>
-                  <el-option v-for="item in sellProvinceData" :label="item.name" :value="item.id"> </el-option>
-                </el-select>
+                <el-input v-model="formData.data.sellProvinceId" placeholder="请输入省/州" />
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
             <el-col :span="8">
             <el-col :span="8">
               <el-form-item label=" " prop="sellCityId">
               <el-form-item label=" " prop="sellCityId">
-                <el-select v-model="formData.data.sellCityId" placeholder="城市" disabled>
-                  <el-option v-for="item in sellCityData" :label="item.name" :value="item.id"> </el-option>
-                </el-select>
+                <el-input v-model="formData.data.sellCityId" placeholder="请输入城市" />
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
           </el-row>
           </el-row>
           <el-row style="margin-top: 20px; width: 100%">
           <el-row style="margin-top: 20px; width: 100%">
             <el-col :span="24">
             <el-col :span="24">
               <el-form-item prop="sellAddress">
               <el-form-item prop="sellAddress">
-                <el-input v-model="formData.data.sellAddress" type="textarea" disabled> </el-input>
+                <el-input v-model="formData.data.sellAddress" type="textarea"> </el-input>
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
           </el-row>
           </el-row>
           <el-row style="margin-top: 20px; width: 100%">
           <el-row style="margin-top: 20px; width: 100%">
             <el-col :span="8">
             <el-col :span="8">
               <el-form-item label="联系人" prop="sellContactName">
               <el-form-item label="联系人" prop="sellContactName">
-                <el-input v-model="formData.data.sellContactName" placeholder="请输入联系人" disabled />
+                <el-input v-model="formData.data.sellContactName" placeholder="请输入联系人" />
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
             <el-col :span="16">
             <el-col :span="16">
               <el-form-item label=" " prop="sellContactNumber">
               <el-form-item label=" " prop="sellContactNumber">
-                <el-input v-model="formData.data.sellContactNumber" placeholder="请输入联系人电话" disabled />
+                <el-input v-model="formData.data.sellContactNumber" placeholder="请输入联系人电话" />
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
           </el-row>
           </el-row>
@@ -354,15 +348,12 @@ const shippingMethod = ref([]);
 const templateList = ref([]);
 const templateList = ref([]);
 const corporationList = ref([]);
 const corporationList = ref([]);
 const customerList = ref([]);
 const customerList = ref([]);
-const sellCountryData = ref([]);
-const sellProvinceData = ref([]);
-const sellCityData = ref([]);
 const countryData = ref([]);
 const countryData = ref([]);
 const provinceData = ref([]);
 const provinceData = ref([]);
 const cityData = ref([]);
 const cityData = ref([]);
 const customerUserList = ref([]);
 const customerUserList = ref([]);
 const openProduct = ref(false);
 const openProduct = ref(false);
-let formData = reactive({
+const formData = reactive({
   data: {
   data: {
     amount: undefined,
     amount: undefined,
     quotationProductList: [],
     quotationProductList: [],
@@ -545,38 +536,46 @@ const getDict = () => {
   });
   });
 };
 };
 getDict();
 getDict();
-const getSellCityData = (id, type, isChange) => {
-  proxy.post("/areaInfo/list", { parentId: id }).then((res) => {
-    if (type === "20") {
-      sellProvinceData.value = res;
-      if (isChange) {
-        formData.data.provinceId = "";
-        formData.data.cityId = "";
-      }
-    } else if (type === "30") {
-      sellCityData.value = res;
-      if (isChange) {
-        formData.data.cityId = "";
-      }
-    } else {
-      sellCountryData.value = res;
-    }
-  });
-};
-getSellCityData("0");
 const changeTemplate = (val) => {
 const changeTemplate = (val) => {
   if (val) {
   if (val) {
     proxy.post("/contractTemplate/detail", { id: val }).then(
     proxy.post("/contractTemplate/detail", { id: val }).then(
       (res) => {
       (res) => {
+        proxy.post("/areaInfo/list", { parentId: "0" }).then((resCountry) => {
+          let sellCountryData = resCountry.filter((item) => item.id === res.countryId);
+          if (sellCountryData && sellCountryData.length > 0) {
+            formData.data.sellCountryId = sellCountryData[0].chineseName;
+          } else {
+            formData.data.sellCountryId = "";
+          }
+        });
+        if (res.countryId) {
+          proxy.post("/areaInfo/list", { parentId: res.countryId }).then((resProvince) => {
+            let sellProvinceData = resProvince.filter((item) => item.id === res.provinceId);
+            if (sellProvinceData && sellProvinceData.length > 0) {
+              formData.data.sellProvinceId = sellProvinceData[0].name;
+            } else {
+              formData.data.sellProvinceId = "";
+            }
+          });
+        } else {
+          formData.data.sellProvinceId = "";
+        }
+        if (res.provinceId) {
+          proxy.post("/areaInfo/list", { parentId: res.provinceId }).then((resCity) => {
+            let sellCityData = resCity.filter((item) => item.id === res.cityId);
+            if (sellCityData && sellCityData.length > 0) {
+              formData.data.sellCityId = sellCityData[0].name;
+            } else {
+              formData.data.sellCityId = "";
+            }
+          });
+        } else {
+          formData.data.sellCityId = "";
+        }
         formData.data.sellCorporationId = res.corporationId;
         formData.data.sellCorporationId = res.corporationId;
         formData.data.sellContactName = res.contactName;
         formData.data.sellContactName = res.contactName;
         formData.data.sellContactNumber = res.contactNumber;
         formData.data.sellContactNumber = res.contactNumber;
-        formData.data.sellCountryId = res.countryId;
-        formData.data.sellProvinceId = res.provinceId;
-        formData.data.sellCityId = res.cityId;
         formData.data.sellAddress = res.address;
         formData.data.sellAddress = res.address;
-        getSellCityData(formData.data.sellCountryId, "20");
-        getSellCityData(formData.data.sellProvinceId, "30");
       },
       },
       (err) => {
       (err) => {
         console.log(err);
         console.log(err);
@@ -604,19 +603,20 @@ const getCityData = (id, type, isChange) => {
     if (type === "20") {
     if (type === "20") {
       provinceData.value = res;
       provinceData.value = res;
       if (isChange) {
       if (isChange) {
-        formData.data.provinceId = "";
-        formData.data.cityId = "";
+        formData.data.buyProvinceId = "";
+        formData.data.buyCityId = "";
       }
       }
     } else if (type === "30") {
     } else if (type === "30") {
       cityData.value = res;
       cityData.value = res;
       if (isChange) {
       if (isChange) {
-        formData.data.cityId = "";
+        formData.data.buyCityId = "";
       }
       }
     } else {
     } else {
       countryData.value = res;
       countryData.value = res;
     }
     }
   });
   });
 };
 };
+getCityData("0");
 const changeCustomer = (val) => {
 const changeCustomer = (val) => {
   formData.data.buyContactName = "";
   formData.data.buyContactName = "";
   formData.data.buyContactNumber = "";
   formData.data.buyContactNumber = "";
@@ -785,6 +785,39 @@ const handleSubmit = async () => {
   }
   }
   return status;
   return status;
 };
 };
+// 接收父组件的传值
+const props = defineProps({
+  queryData: String,
+});
+onMounted(() => {
+  if (props.queryData.id) {
+    proxy.post("/saleQuotation/detail", { id: props.queryData.id }).then((res) => {
+      for (var text in res) {
+        formData.data[text] = res[text];
+      }
+      delete formData.data.id;
+      delete formData.data.code;
+      getCityData(formData.data.buyCountryId, "20");
+      getCityData(formData.data.buyProvinceId, "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,
+          };
+        });
+      }
+    });
+  }
+});
 // 向父组件暴露
 // 向父组件暴露
 defineExpose({
 defineExpose({
   submitData: formData.data,
   submitData: formData.data,

+ 45 - 7
src/views/salesMange/saleContract/priceSheet/index.vue

@@ -17,9 +17,15 @@
         @get-list="getList">
         @get-list="getList">
         <template #amount="{ item }">
         <template #amount="{ item }">
           <div>
           <div>
+            <span style="padding-right: 4px">{{ item.currency }}</span>
             <span>{{ moneyFormat(item.amount, 2) }}</span>
             <span>{{ moneyFormat(item.amount, 2) }}</span>
           </div>
           </div>
         </template>
         </template>
+        <template #advanceRatio="{ item }">
+          <div>
+            <span>{{ item.advanceRatio }}%</span>
+          </div>
+        </template>
       </byTable>
       </byTable>
     </div>
     </div>
   </div>
   </div>
@@ -28,11 +34,11 @@
 <script setup>
 <script setup>
 import { computed, ref } from "vue";
 import { computed, ref } from "vue";
 import byTable from "@/components/byTable/index";
 import byTable from "@/components/byTable/index";
-import useUserStore from "@/store/modules/user";
 
 
 const { proxy } = getCurrentInstance();
 const { proxy } = getCurrentInstance();
 const accountList = ref([]);
 const accountList = ref([]);
 const corporationList = ref([]);
 const corporationList = ref([]);
+const customerList = ref([]);
 const status = ref([
 const status = ref([
   {
   {
     label: "草稿",
     label: "草稿",
@@ -125,18 +131,28 @@ const config = computed(() => {
         label: "客户名称",
         label: "客户名称",
         prop: "buyCorporationId",
         prop: "buyCorporationId",
       },
       },
+      render(type) {
+        let text = "";
+        if (customerList.value && customerList.value.length > 0) {
+          let data = customerList.value.filter((item) => item.value == type);
+          if (data && data.length > 0) {
+            text = data[0].label;
+          }
+        }
+        return text;
+      },
     },
     },
     {
     {
       attrs: {
       attrs: {
         label: "报价金额",
         label: "报价金额",
-        prop: "amount",
-        width: 120,
+        slot: "amount",
+        width: 140,
       },
       },
     },
     },
     {
     {
       attrs: {
       attrs: {
         label: "预付比例",
         label: "预付比例",
-        prop: "advanceRatio",
+        slot: "advanceRatio",
         width: 120,
         width: 120,
       },
       },
     },
     },
@@ -173,12 +189,12 @@ const config = computed(() => {
             },
             },
             el: "button",
             el: "button",
             click() {
             click() {
-              clickPrint(row);
+              clickCopy(row);
             },
             },
           },
           },
           {
           {
             attrs: {
             attrs: {
-              label: "查看",
+              label: "打印",
               type: "primary",
               type: "primary",
               text: true,
               text: true,
             },
             },
@@ -210,11 +226,20 @@ const getDict = () => {
       };
       };
     });
     });
   });
   });
+  proxy.post("/customer/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    customerList.value = res.rows.map((item) => {
+      return {
+        ...item,
+        label: item.name,
+        value: item.id,
+      };
+    });
+  });
 };
 };
 const getList = async (req) => {
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
   loading.value = true;
-  proxy.post("/pay/page", sourceList.value.pagination).then((res) => {
+  proxy.post("/saleQuotation/page", sourceList.value.pagination).then((res) => {
     sourceList.value.data = res.rows;
     sourceList.value.data = res.rows;
     sourceList.value.pagination.total = res.total;
     sourceList.value.pagination.total = res.total;
     setTimeout(() => {
     setTimeout(() => {
@@ -233,6 +258,19 @@ const newPriceSheet = () => {
     },
     },
   });
   });
 };
 };
+const clickCopy = (item) => {
+  proxy.$router.replace({
+    path: "/platform_manage/process/processApproval",
+    query: {
+      flowKey: "sale_quotation_flow",
+      flowName: "报价审批流程",
+      id: item.id,
+    },
+  });
+};
+const clickPrint = (item) => {
+  console.log(item);
+};
 </script>
 </script>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>