From 6cc534c1ea6b947894fa523335f5a419f1772e8c Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期一, 16 十月 2023 20:29:09 +0800
Subject: [PATCH] 跟进记录:联系人、销售机会、销售线索根据客户名称进行筛选

---
 src/views/other/commonDialog/SelectChanceDialog.vue    |    7 +
 src/views/sales/salesReturn/DetailReturn.vue           |    3 
 src/views/sales/subOrder/DetailSubOrder.vue            |    3 
 src/views/sales/salesDetails/AddSalesDetailsDialog.vue |   96 ++++++++++++++++++-------------
 src/views/other/commonDialog/SelectCommonDialog.vue    |   43 ++++++++++++++
 src/views/sales/refundForm/index.vue                   |    2 
 src/views/service/serviceContract/index.vue            |    4 
 7 files changed, 111 insertions(+), 47 deletions(-)

diff --git a/src/views/other/commonDialog/SelectChanceDialog.vue b/src/views/other/commonDialog/SelectChanceDialog.vue
index 2d8af06..182923d 100644
--- a/src/views/other/commonDialog/SelectChanceDialog.vue
+++ b/src/views/other/commonDialog/SelectChanceDialog.vue
@@ -54,8 +54,8 @@
         return {
           editVisible: false,
           title: "",
-          infomation: {},
-          search_map:{}
+          clientId: 0,
+          infomation: {}
         }
       }
     }
@@ -83,6 +83,9 @@
     }
   },
   created() {
+    this.search_map = {
+      client_id: this.editConfig.clientId
+    }
     this.setTable()
     this.getData()
   },
diff --git a/src/views/other/commonDialog/SelectCommonDialog.vue b/src/views/other/commonDialog/SelectCommonDialog.vue
index 4ea3c14..3df5f0c 100644
--- a/src/views/other/commonDialog/SelectCommonDialog.vue
+++ b/src/views/other/commonDialog/SelectCommonDialog.vue
@@ -55,6 +55,7 @@
 import { getServiceOrderList } from "@/api/serviceManage/clientServiceOrder"
 import { getProductList } from "@/api/common/other"
 import { getSalesReturnList } from "@/api/sales/salesReturn"
+import { getSubOrderList } from "@/api/sales/subOrder"
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
 export default {
   name: "EditSelCommonDialog",
@@ -214,6 +215,20 @@
           tableColumn: this.setColumnVisible(this.showCol)
         }
         this.searchSel = { value: "number", label: "閿�鍞��璐у崟缂栧彿" }
+      } else if (this.editConfig.title === "閿�鍞瓙鍗�") {
+        this.tableColumn = [
+          { label: "鍗曟嵁缂栧彿", prop: "number", isClick: true, default: true }, // 鍗曟嵁缂栧彿
+          { label: "璐熻矗浜�", prop: "member_name" } // 璐熻矗浜�
+        ]
+        this.showCol = ["鍗曟嵁缂栧彿", "璐熻矗浜�"]
+        this.tableList = {
+          selectIndex: true,
+          tableInfomation: [],
+          allcol: [],
+          showcol: this.showCol,
+          tableColumn: this.setColumnVisible(this.showCol)
+        }
+        this.searchSel = { value: "number", label: "鍗曟嵁缂栧彿" }
       }
       this.tableList.allcol = this.tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
       this.searchOptions = []
@@ -252,6 +267,8 @@
         this.getProductList()
       } else if (this.editConfig.title === "閿�鍞��璐у崟") {
         this.getSalesReturnList()
+      } else if (this.editConfig.title === "閿�鍞瓙鍗�") {
+        this.getSubOrderList()
       }
     },
     // 閿�鍞�诲崟
@@ -435,6 +452,30 @@
         this.loading = false
       })
     },
+    // 閿�鍞瓙鍗�
+    async getSubOrderList() {
+      await getSubOrderList({
+        search_map: this.search_map,
+        page: this.pagerOptions.currPage,
+        pageSize: this.pagerOptions.pageSize
+      }).then((res) => {
+        if (res.code === 200) {
+          if (res.data.list && res.data.list.length > 0) {
+            const list = res.data.list.map((item) => {
+              return {
+                ...item,
+                member_name: item.member.username
+              }
+            })
+            this.tableList.tableInfomation = list || []
+            this.pagerOptions.totalCount = res.data.count
+          } else {
+            this.tableList.tableInfomation = []
+          }
+        }
+        this.loading = false
+      })
+    },
     handleClose() {
       this.editConfig.editVisible = false
     },
@@ -454,6 +495,8 @@
         this.$emit("selClient", row, "productName")
       } else if (this.editConfig.title === "閿�鍞��璐у崟") {
         this.$emit("selClient", row, "salesReturn")
+      } else if (this.editConfig.title === "閿�鍞瓙鍗�") {
+        this.$emit("selClient", row, "subbill")
       }
     },
     // 鎼滅储
diff --git a/src/views/sales/refundForm/index.vue b/src/views/sales/refundForm/index.vue
index 51638cf..77593ed 100644
--- a/src/views/sales/refundForm/index.vue
+++ b/src/views/sales/refundForm/index.vue
@@ -237,7 +237,7 @@
     addBtnClick() {
       this.editConfig.visible = true
       this.editConfig.title = "鏂板缓"
-      this.editConfig.infomation = { currency: "浜烘皯甯�" }
+      this.editConfig.infomation = { currency: "浜烘皯甯�", ...this.addConfig }
     },
     // 缂栬緫
     handleClick(row) {
diff --git a/src/views/sales/salesDetails/AddSalesDetailsDialog.vue b/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
index 6e15d36..6166496 100644
--- a/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
+++ b/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
@@ -119,7 +119,7 @@
                       @select="handleSelectClient('subbill', $event)"
                       :disabled="isNameChanceEdit"
                     ></el-autocomplete>
-                    <div v-if="!isNameChanceEdit" class="common-select-btn" @click="selClientClick('client')">
+                    <div v-if="!isNameChanceEdit" class="common-select-btn" @click="selClientClick('subbill')">
                       <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i>
                     </div>
                     <div
@@ -403,6 +403,12 @@
         :edit-common-config="editSelectChanceConfig"
         @selClient="selClient"
       />
+      <!-- 閿�鍞瓙鍗� -->
+      <SelectCommonDialog
+        v-if="editSelCommonConfig.editVisible"
+        :edit-common-config="editSelCommonConfig"
+        @selClient="selClient"
+      />
       <!-- 鏂板缓 鏀舵璁″垝 -->
       <AddCollectionPlan v-if="addCollectionConfig.visible" :edit-common-config="addCollectionConfig" />
     </el-dialog>
@@ -417,10 +423,11 @@
 import SelectChanceDialog from "@/views/other/commonDialog/SelectChanceDialog"
 import AddCollectionPlan from "@/views/other/payment/collectionPlan/AddCollectionPlan"
 import codeMixin from "@/views/client/followupRecords/mixin/codeMixin"
-import { getSaleChanceList} from "@/api/sales/salesOpportunity"
+import { getSaleChanceList } from "@/api/sales/salesOpportunity"
 import { getSubOrderList } from "@/api/sales/subOrder"
+import SelectCommonDialog from "@/views/other/commonDialog/SelectCommonDialog"
 
-import {mapActions} from "vuex"
+import { mapActions } from "vuex"
 
 export default {
   name: "AddSalesDetailsDialog",
@@ -437,17 +444,17 @@
       }
     }
   },
-  components: { CommonFormTableView, SelectClientDialog, SelectChanceDialog, AddCollectionPlan },
+  components: { CommonFormTableView, SelectClientDialog, SelectChanceDialog, AddCollectionPlan, SelectCommonDialog },
   computed: {
     clientList() {
       return this.$store.state.getClientName.clientList
-    },
-    saleChancelist() {
-      return this.$store.state.getClientName.saleChancelist
-    },
-    subOrderList(){
-      return this.$store.state.getClientName.subOrderList
     }
+    // saleChancelist() {
+    //   return this.$store.state.getClientName.saleChancelist
+    // },
+    // subOrderList() {
+    //   return this.$store.state.getClientName.subOrderList
+    // }
   },
   data() {
     return {
@@ -483,9 +490,14 @@
         title: "",
         infomation: {}
       },
+      editSelCommonConfig: {
+        editVisible: false,
+        title: "",
+        infomation: {}
+      },
       clientId: this.editCommonConfig.infomation.client_id,
       saleChanceId: this.editCommonConfig.infomation.saleChanceId,
-      subbillId:this.editCommonConfig.infomation.subbillId,
+      subbillId: this.editCommonConfig.infomation.subbillId,
       productId: 1,
       isNoProduct: true,
       addCollectionConfig: {
@@ -499,8 +511,8 @@
   },
   created() {
     this.$store.dispatch("geClient")
-    this.$store.dispatch("geChance")
-    this.$store.dispatch("getSubunit")
+    // this.$store.dispatch("geChance")
+    // this.$store.dispatch("getSubunit")
     this.setTableForm()
     this.getCommonData()
     this.formInfo()
@@ -522,7 +534,7 @@
     }
   },
   methods: {
-    ...mapActions(["getChanceFilter","getSubunitFliter"]), 
+    ...mapActions(["getChanceFilter", "getSubunitFliter"]),
     formInfo() {
       this.objCode.type = "閿�鍞槑缁嗙紪鐮�"
       this.objCode.codeStandID = ""
@@ -642,16 +654,11 @@
       var restaurants = []
       if (value === "client") {
         restaurants = this.clientList
-        console.log(restaurants,"瀹㈡埛鍗�")
+        console.log(restaurants, "瀹㈡埛鍗�")
       } else if (value === "chance") {
         restaurants = this.saleChancelist
-      }else if(value==="subbill"){
-        let arr=[]
-         this.subOrderList.map((item)=>{
-          arr.push(item.client)
-         })
-         restaurants=arr
-        console.log("瀛愪腹",restaurants,arr)
+      } else if (value === "subbill") {
+        restaurants = this.subOrderList
       }
       var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
       cb(results)
@@ -667,34 +674,43 @@
         this.editConfig.infomation.client_name = item.name
         // 闇�瑕佷慨鏀�
         await getSaleChanceList({
-          client_id:this.clientId
-        }).then((res)=>{
+          page: 1,
+          pageSize: 15,
+          search_map: {
+            client_id: item.id
+          }
+        }).then((res) => {
+          console.log(res)
+          this.saleChancelist = res.data.list
         })
         await getSubOrderList({
-          page:1,
-          pageSize:15,
-          search_map:{
-            client_id:item.id
+          page: 1,
+          pageSize: 15,
+          search_map: {
+            client_id: item.id
           }
-        }).then((res)=>{
-          this.getSubunitFliter(res.data.list)
+        }).then((res) => {
+          this.subOrderList = res.data.list
         })
       } else if (value === "chance") {
         this.saleChanceId = item.id
         this.editConfig.infomation.client_name = item.name
-      }else if(value==="subbill"){
-        console.log("涓嬫媺妗嗙偣鍑�",item)
+      } else if (value === "subbill") {
+        console.log("涓嬫媺妗嗙偣鍑�", item)
         this.subbillId = item.id
-        this.editConfig.infomation.subbill_name = item.name
+        this.editConfig.infomation.subbill_name = item.number
       }
     },
     selClientClick(value) {
       if (value === "client") {
         this.editSelectClientConfig.editVisible = true
       } else if (value === "chance") {
+        this.editSelectChanceConfig.clientId = this.clientId
         this.editSelectChanceConfig.editVisible = true
-      }else if(value==="subbill"){
-        this.editSelectChanceConfig.editVisible = true
+      } else if (value === "subbill") {
+        this.editSelCommonConfig.title = "閿�鍞瓙鍗�"
+        this.editSelCommonConfig.editVisible = true
+        this.editSelCommonConfig.clientId = this.clientId
       }
     },
     selClient(row, value) {
@@ -704,9 +720,9 @@
       } else if (value === "chance") {
         this.editConfig.infomation.sale_chance_name = row.name
         this.saleChanceId = row.id
-      }else if(value==="subbill"){
-        this.editConfig.infomation.subbill_name = row.name
-        this.subbillId=row.id
+      } else if (value === "subbill") {
+        this.editConfig.infomation.subbill_name = row.number
+        this.subbillId = row.id
       }
     },
     // 娓呴櫎宸查�夋嫨鐢ㄦ埛
@@ -717,9 +733,9 @@
       } else if (value === "chance") {
         this.editConfig.infomation.sale_chance_name = ""
         this.saleChanceId = 0
-      }else if(value==="subbill"){
+      } else if (value === "subbill") {
         this.editConfig.infomation.subbill_name = ""
-        this.subbillId=0
+        this.subbillId = 0
       }
     },
     // 娣诲姞闄勪欢
diff --git a/src/views/sales/salesReturn/DetailReturn.vue b/src/views/sales/salesReturn/DetailReturn.vue
index bd1d6f5..d482301 100644
--- a/src/views/sales/salesReturn/DetailReturn.vue
+++ b/src/views/sales/salesReturn/DetailReturn.vue
@@ -178,7 +178,8 @@
       client_name: this.detailConfig.infomation.client.name,
       contact_name: this.detailConfig.infomation.contact_name,
       client_id: this.detailConfig.infomation.client_id,
-      contact_id: this.detailConfig.infomation.contact_id
+      contact_id: this.detailConfig.infomation.contact_id,
+      sale_return_nunber: this.detailConfig.infomation.number
     }
     this.setTableForm()
   },
diff --git a/src/views/sales/subOrder/DetailSubOrder.vue b/src/views/sales/subOrder/DetailSubOrder.vue
index 64b3d2f..9046af6 100644
--- a/src/views/sales/subOrder/DetailSubOrder.vue
+++ b/src/views/sales/subOrder/DetailSubOrder.vue
@@ -136,7 +136,8 @@
       client_name: this.detailConfig.infomation.client.name,
       contact_name: this.detailConfig.infomation.contact_name,
       client_id: this.detailConfig.infomation.client_id,
-      contact_id: this.detailConfig.infomation.contact_id
+      contact_id: this.detailConfig.infomation.contact_id,
+      subbill_name: this.detailConfig.infomation.number
     }
     this.setTableForm()
   },
diff --git a/src/views/service/serviceContract/index.vue b/src/views/service/serviceContract/index.vue
index 7bc06b1..d56d3d6 100644
--- a/src/views/service/serviceContract/index.vue
+++ b/src/views/service/serviceContract/index.vue
@@ -271,9 +271,9 @@
       this.editConfig.infomation = {
         ...this.addConfig,
         currency: "浜烘皯甯�",
-        client_name: "",
+        client_name: Object.keys(this.addConfig).length === 0 ? "" : this.addConfig.client_name,
         contact_name: "",
-        sale_chance_name: "",
+        sale_chance_name: Object.keys(this.addConfig).length === 0 ? "" : this.addConfig.sale_chance_name,
         contract_number: "",
         quotation_number: ""
       }

--
Gitblit v1.8.0