From 5bc926157420e0ce7e2b4fbef901617ee9f98115 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期三, 28 二月 2024 17:36:35 +0800
Subject: [PATCH] 报价单,销售明细单 2个模块初始时请求对应的销售机会,销售报价单的列表并且给下拉列表赋值

---
 src/views/sales/quotation/AddQuotationDialog.vue       |   22 ++++++++--
 src/views/sales/salesDetails/AddSalesDetailsDialog.vue |   45 ++++++++++++++--------
 2 files changed, 46 insertions(+), 21 deletions(-)

diff --git a/src/views/sales/quotation/AddQuotationDialog.vue b/src/views/sales/quotation/AddQuotationDialog.vue
index 241096a..a1c541e 100644
--- a/src/views/sales/quotation/AddQuotationDialog.vue
+++ b/src/views/sales/quotation/AddQuotationDialog.vue
@@ -453,6 +453,9 @@
       saleChancelist: []
     }
   },
+  mounted(){
+    this.getSaleChanceList()
+  },
   created() {
     this.$store.dispatch("geClient")
     this.$store.dispatch("geContact")
@@ -676,13 +679,22 @@
     },
     // 閿�鍞満浼氬垪琛�
     async getSaleChanceList(item) {
-      await getSaleChanceList({
-        page: 1,
-        pageSize: 15,
-        search_map: {
+      let params={}
+      if(item){
+        params={
+          page: 1,
+          pageSize: 15,
+        }
+        params.search_map={
           client_id: item.id
         }
-      }).then((res) => {
+      }else{
+        params={
+          page: 0,
+          pageSize: 0,
+        }
+      }
+      await getSaleChanceList(params).then((res) => {
         console.log(res)
         this.saleChancelist = res.data.list
       })
diff --git a/src/views/sales/salesDetails/AddSalesDetailsDialog.vue b/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
index a7a24a2..0b87219 100644
--- a/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
+++ b/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
@@ -554,7 +554,7 @@
   computed: {
     clientList() {
       return this.$store.state.getClientName.clientList
-    }
+    },
     // saleChancelist() {
     //   return this.$store.state.getClientName.saleChancelist
     // },
@@ -637,6 +637,10 @@
         }
       }
     }
+  },
+  mounted(){
+    this.getSaleChanceList()
+    this.getQuotation()
   },
   created() {
     if (this.editConfig.title !== "鏂板缓") {
@@ -820,13 +824,16 @@
     },
     // 鑾峰彇鎶ヤ环鍗�
     getQuotation(id, value) {
-      getQuotationList({
-        page: 0,
+     let params={
+         page: 0,
         pageSize: 0,
-        search_map: {
-          sale_chance_id: id
-        }
-      }).then((res) => {
+     }
+     if(id){
+      params.search_map={
+        sale_chance_id: id
+      }
+     }
+      getQuotationList(params).then((res) => {
         if (res.code == 200) {
           console.log(res)
           this.quotationList = res.data.list
@@ -856,15 +863,12 @@
         restaurants = this.clientList
         console.log(restaurants, "瀹㈡埛鍗�")
       } else if (value === "chance") {
-        if (this.editConfig.infomation.client_name) {
           restaurants = this.saleChancelist
-        }
       } else if (value === "subbill") {
         restaurants = this.subOrderList
       } else if (value === "quotation") {
-        if (this.editConfig.infomation.sale_chance_name) {
           restaurants = this.quotationList
-        }
+        console.log(this.quotationList,'quotationList')
       }
       var results = queryString ? restaurants.filter(this.createStateFilter(queryString, value)) : restaurants
       cb(results)
@@ -880,13 +884,22 @@
     },
     // 閿�鍞満浼氬垪琛�
     async getSaleChanceList(item) {
-      await getSaleChanceList({
-        page: 1,
-        pageSize: 15,
-        search_map: {
+      let params={}
+      if(item){
+        params={
+          page: 1,
+          pageSize: 15,
+        }
+        params.search_map={
           client_id: item.id
         }
-      }).then((res) => {
+      }else{
+        params={
+          page: 0,
+          pageSize: 0,
+        }
+      }
+      await getSaleChanceList(params).then((res) => {
         console.log(res)
         this.saleChancelist = res.data.list
       })

--
Gitblit v1.8.0