From 8e5ec095fc4ba9cac7c91b681b06846d3e4155ae Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期一, 16 十月 2023 21:17:29 +0800
Subject: [PATCH] 销售明细,退货单、退款单根据客户进行筛选

---
 src/views/sales/salesOpportunity/DetailOpportunity.vue |  237 +++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 148 insertions(+), 89 deletions(-)

diff --git a/src/views/sales/salesOpportunity/DetailOpportunity.vue b/src/views/sales/salesOpportunity/DetailOpportunity.vue
index cd2476c..48b87cf 100644
--- a/src/views/sales/salesOpportunity/DetailOpportunity.vue
+++ b/src/views/sales/salesOpportunity/DetailOpportunity.vue
@@ -9,7 +9,7 @@
     >
       <template slot="title">
         <div class="header">
-          <span class="header-label">鏈轰細鍚嶇О</span>
+          <span class="header-label">閿�鍞満浼�</span>
           <span class="header-title">{{ detailConfig.infomation.name }}</span>
         </div>
       </template>
@@ -22,7 +22,7 @@
                 <div>璺熻繘璁板綍<el-badge type="primary" :value="2"> </el-badge></div>
               </template> -->
             </el-tab-pane>
-            <el-tab-pane label="鏀舵棰勬祴" name="collectionForecast"></el-tab-pane>
+            <!-- <el-tab-pane label="鏀舵棰勬祴" name="collectionForecast"></el-tab-pane> -->
             <el-tab-pane label="鎶ヤ环鍗�" name="quotation"></el-tab-pane>
             <el-tab-pane label="閿�鍞槑缁嗗崟" name="detail"></el-tab-pane>
             <el-tab-pane label="鏈嶅姟鍚堝悓" name="serviceContract"></el-tab-pane>
@@ -38,13 +38,16 @@
             </div>
             <div v-show="isSchduleExpand" class="basic-info-content">
               <div class="step-view">
-                <el-steps :active="active" align-center>
-                  <el-step :active-color="'#fff'" :title="item.title" :key="index" v-for="(item, index) in stepsList">
+                <el-steps :active="sale_active" align-center>
+                  <el-step :active-color="'#fff'" :title="item.name" :key="item.id" v-for="(item, index) in stepsList">
                     <template slot="title">
                       <div class="step-title-view">
-                        <div class="step-label">{{ item.title }}</div>
-                        <div v-show="index === active" class="step-btn" @click="advanceClick(item)">鎺ㄨ繘</div>
-                        <div class="step-desc">{{ item.desc }}</div>
+                        <div class="step-label">{{ item.name }}</div>
+                        <div v-show="sale_active === index" class="step-btn" @click="advanceClick(item)">
+                          <!--  && sale_stage_id !== stepsList.length -->
+                          鎺ㄨ繘
+                        </div>
+                        <!-- <div class="step-desc">{{ item.desc }}</div> -->
                       </div>
                     </template>
                   </el-step>
@@ -64,11 +67,11 @@
                 <li v-for="(item, i) in basicInfoList" :key="i">
                   <div class="left">
                     <div class="content-title">{{ item.leftStr + "锛�" }}</div>
-                    <div class="content-data">{{ item.leftValue }}</div>
+                    <div class="content-data">{{ item.leftValue ? item.leftValue : "--" }}</div>
                   </div>
-                  <div class="right">
-                    <div class="content-title">{{ item.rightStr }}</div>
-                    <div class="content-data">{{ item.rightValue }}</div>
+                  <div v-if="item.rightStr" class="right">
+                    <div class="content-title">{{ item.rightStr + "锛�" }}</div>
+                    <div class="content-data">{{ item.rightValue ? item.rightValue : "--" }}</div>
                   </div>
                 </li>
               </ul>
@@ -86,11 +89,11 @@
                 <li v-for="(item, i) in forecastList" :key="i">
                   <div class="left">
                     <div class="content-title">{{ item.leftStr + "锛�" }}</div>
-                    <div class="content-data">{{ item.leftValue }}</div>
+                    <div class="content-data">{{ item.leftValue ? item.leftValue : "--" }}</div>
                   </div>
-                  <div class="right">
-                    <div class="content-title">{{ item.rightStr }}</div>
-                    <div class="content-data">{{ item.rightValue }}</div>
+                  <div v-if="item.rightStr" class="right">
+                    <div class="content-title">{{ item.rightStr + "锛�" }}</div>
+                    <div class="content-data">{{ item.rightValue ? item.rightValue : "--" }}</div>
                   </div>
                 </li>
               </ul>
@@ -108,11 +111,11 @@
                 <li v-for="(item, i) in dynamicInfoList" :key="i">
                   <div class="left">
                     <div class="content-title">{{ item.leftStr + "锛�" }}</div>
-                    <div class="content-data">{{ item.leftValue }}</div>
+                    <div class="content-data">{{ item.leftValue ? item.leftValue : "--" }}</div>
                   </div>
-                  <div class="right">
-                    <div class="content-title">{{ item.rightStr }}</div>
-                    <div class="content-data">{{ item.rightValue }}</div>
+                  <div v-if="item.rightStr" class="right">
+                    <div class="content-title">{{ item.rightStr + "锛�" }}</div>
+                    <div class="content-data">{{ item.rightValue ? item.rightValue : "--" }}</div>
                   </div>
                 </li>
               </ul>
@@ -150,8 +153,8 @@
                     <div class="content-title">{{ item.leftStr + "锛�" }}</div>
                     <div class="content-data">{{ item.leftValue }}</div>
                   </div>
-                  <div class="right">
-                    <div class="content-title">{{ item.rightStr }}</div>
+                  <div v-if="item.rightStr" class="right">
+                    <div class="content-title">{{ item.rightStr + "锛�" }}</div>
                     <div class="content-data">{{ item.rightValue }}</div>
                   </div>
                 </li>
@@ -170,11 +173,11 @@
                 <li v-for="(item, i) in addressInfoList" :key="i">
                   <div class="left">
                     <div class="content-title">{{ item.leftStr + "锛�" }}</div>
-                    <div class="content-data">{{ item.leftValue }}</div>
+                    <div class="content-data">{{ item.leftValue ? item.leftValue : "--" }}</div>
                   </div>
-                  <div class="right">
-                    <div class="content-title">{{ item.rightStr }}</div>
-                    <div class="content-data">{{ item.rightValue }}</div>
+                  <div v-if="item.rightStr" class="right">
+                    <div class="content-title">{{ item.rightStr + "锛�" }}</div>
+                    <div class="content-data">{{ item.rightValue ? item.rightValue : "--" }}</div>
                   </div>
                 </li>
               </ul>
@@ -192,14 +195,14 @@
                 <li>
                   <div class="left remark">
                     <div class="content-title">{{ "澶囨敞锛�" }}</div>
-                    <div class="content-data">{{ "澶囨敞鍐呭" }}</div>
+                    <div class="content-data">{{ detailConfig.infomation.remark }}</div>
                   </div>
                 </li>
               </ul>
             </div>
           </div>
           <!-- 闄勪欢淇℃伅 -->
-          <div class="basic-info">
+          <!-- <div class="basic-info">
             <div class="basic-info-label" @click="expandClick('annex')">
               <i v-if="isAnnexExpand" class="el-icon-arrow-down"></i>
               <i v-else class="el-icon-arrow-up"></i>
@@ -215,9 +218,9 @@
                 </li>
               </ul>
             </div>
-          </div>
+          </div> -->
           <!-- 閿�鍞満浼氶樁娈垫帹杩涘巻鍙� -->
-          <div class="basic-info">
+          <!-- <div class="basic-info">
             <div class="basic-info-label" @click="expandClick('history')">
               <i v-if="isHistoryExpand" class="el-icon-arrow-down"></i>
               <i v-else class="el-icon-arrow-up"></i>
@@ -234,26 +237,26 @@
                 </li>
               </ul>
             </div>
-          </div>
+          </div> -->
         </div>
         <div v-if="activeName === 'second'" class="second">
-          <FollowupRecords :isDetail="true" />
+          <FollowupRecords :isDetail="true" :add-config="addConfig" />
         </div>
         <div v-if="activeName === 'collectionForecast'" class="second">
           <!-- <SalesOpportunity :isDetail="true" /> -->
         </div>
         <div v-if="activeName === 'quotation'" class="second">
-          <Quotation :isDetail="true" />
+          <Quotation :isDetail="true" :add-config="addConfig" />
         </div>
         <div v-if="activeName === 'detail'" class="second">
-          <SalesDetails :isDetail="true" />
+          <SalesDetails :isDetail="true" :add-config="addConfig" />
         </div>
         <div v-if="activeName === 'serviceContract'" class="second">
-          <ServiceContract :isDetail="true" />
+          <ServiceContract :isDetail="true" :add-config="addConfig" />
         </div>
       </div>
       <!-- 鎺ㄨ繘 -->
-      <DetailAdvanceDialog v-if="advanceConfig.visible" :advance-config="advanceConfig" />
+      <DetailAdvanceDialog v-if="advanceConfig.visible" :advance-config="advanceConfig" @pushed="updatePushData" />
     </el-drawer>
   </div>
 </template>
@@ -264,6 +267,8 @@
 import SalesDetails from "@/views/sales/salesDetails"
 import ServiceContract from "@/views/service/serviceContract"
 import DetailAdvanceDialog from "@/views/sales/salesOpportunity/DetailAdvanceDialog"
+import { getSaleStageList } from "@/api/sales/salesOpportunity"
+import {getAllData} from "@/api/client/client";
 export default {
   name: "DetailClientManage",
   props: {
@@ -281,17 +286,11 @@
   computed: {},
   data() {
     return {
+      statusList: [],
       detailConfig: this.opportunityDetail,
       activeName: "first",
       isSchduleExpand: true, // 杩涘害杩借釜
-      stepsList: [
-        { title: "鍒濇湡娌熼��", desc: "鍋滅暀: 1鏈�8澶�20灏忔椂" },
-        { title: "闇�姹傚垎鏋�", desc: "" },
-        { title: "鏂规鎶ヤ环", desc: "" },
-        { title: "鍟嗗姟璋堝垽", desc: "" },
-        { title: "鎴愬姛缁撴", desc: "" },
-        { title: "澶辫触缁撴", desc: "" }
-      ],
+      stepsList: [],
       isBasicExpand: true, // 鍩烘湰淇℃伅灞曞紑
       basicInfoList: [],
       isForecastExpand: true, // 閿�鍞娴�
@@ -308,81 +307,122 @@
       isAnnexExpand: true, // 闄勪欢淇℃伅
       isHistoryExpand: true, // 鎺ㄨ繘鍘嗗彶
       historyList: [],
-      active: 2,
+      sale_active: 0,
       advanceConfig: {
         visible: false,
-        active: ""
-      }
+        active: "",
+        allOptions: [],
+        options: []
+      },
+      addConfig: {}
     }
   },
   created() {
-    this.setData()
+    this.setData(this.detailConfig.infomation)
+    this.addConfig = {
+      id_name: "sale_chance_id",
+      keywordType: "閿�鍞満浼�",
+      keyword: this.detailConfig.infomation.name,
+      id: this.detailConfig.infomation.id,
+      common_name: this.detailConfig.infomation.name,
+      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,
+      sale_chance_name: this.detailConfig.infomation.name,
+      sale_chance_id: this.detailConfig.infomation.id
+    }
+    this.getSaleStageList().then(()=>{
+      return  this.getAllData()
+    }).then((statusList)=>{
+      this.statusList =statusList
+
+      this.setData(this.detailConfig.infomation)
+
+    })
+    console.log('this.detailConfig.infomation',this.detailConfig.infomation)
   },
   mounted() {},
   methods: {
-    setData() {
+    /**
+     * 鏇存柊鎺ㄨ繘璁板綍
+     */
+    updatePushData(e){
+      this.sale_active = e.step - 1
+    },
+    async getSaleStageList() {
+      await getSaleStageList().then((res) => {
+        this.stepsList = res.data.list
+        res.data.list.map((item, index) => {
+          if (item.id === this.detailConfig.infomation.sale_stage_id) {
+            this.sale_active = index
+          }
+        })
+      })
+    },
+    setData(item) {
       this.basicInfoList = [
         {
           leftStr: "瀹㈡埛鍚嶇О",
-          leftValue: "",
+          leftValue: item.client_name,
           rightStr: "閿�鍞満浼氱紪鍙�",
-          rightValue: ""
+          rightValue: item.id
         },
         {
           leftStr: "鏈轰細鍚嶇О",
-          leftValue: "",
+          leftValue: item.name,
           rightStr: "鑱旂郴浜哄鍚�",
-          rightValue: ""
+          rightValue: item.contact_name
         },
         {
           leftStr: "鍟嗘満鏉ユ簮",
-          leftValue: "",
+          leftValue: item.sales_sources.name,
           rightStr: "鍟嗘満绫诲瀷",
-          rightValue: ""
+          rightValue: item.sale_type.name
         },
         {
           leftStr: "閿�鍞樁娈�",
-          leftValue: "",
+          leftValue: item.sale_stage_name,
           rightStr: "閿�鍞礋璐d汉",
-          rightValue: ""
+          rightValue: item.member.username
         },
         {
           leftStr: "鑰佸鎴疯惀閿�",
-          leftValue: "",
-          rightStr: "绛惧埌",
+          leftValue: item.regular_customers.name,
+          rightStr: "瀹℃壒鐘舵��",
           rightValue: ""
         },
         {
-          leftStr: "瀹℃壒鐘舵��",
-          leftValue: "",
-          rightStr: "绔炰簤瀵规墜",
+          leftStr: "绔炰簤瀵规墜",
+          leftValue: item.competitors,
+          rightStr: "鍒涘缓浜�",
           rightValue: ""
         },
         {
-          leftStr: "鍒涘缓浜�",
+          leftStr: "鍒涘缓鏃堕棿",
           leftValue: "",
-          rightStr: "鍒涘缓鏃堕棿",
+          rightStr: "",
           rightValue: ""
         }
       ]
       this.forecastList = [
         {
           leftStr: "鍙兘鎬�(%)",
-          leftValue: "",
+          leftValue: item.possibility.name,
           rightStr: "甯佺",
-          rightValue: ""
+          rightValue: "浜烘皯甯�"
         },
         {
           leftStr: "棰勭畻缁濆鍊�",
-          leftValue: "",
+          leftValue: item.capital_budget,
           rightStr: "棰勮鎴愪氦鏃ユ湡",
-          rightValue: ""
+          rightValue: item.expected_time
         },
         {
           leftStr: "棰勮鍚堝悓閲戦",
-          leftValue: "",
+          leftValue: item.projected_amount,
           rightStr: "褰撳墠鐘舵��",
-          rightValue: ""
+          rightValue: this.statusList.find(ele=>ele.id === item.status_id)?.name ?? ''
         }
       ]
       this.dynamicInfoList = [
@@ -408,63 +448,63 @@
       this.businessInfoList = [
         {
           leftStr: "瀹㈡埛闇�姹傛垨鐥涚偣锛坵hy锛�",
-          leftValue: ""
+          leftValue: item.pain_points
         },
         {
           leftStr: "鏄惁宸茬粡绔嬮」锛坧lan锛�",
-          leftValue: ""
+          leftValue: item.whether_established
         },
         {
           leftStr: "璧勯噾棰勭畻鏄灏戯紙plan锛�",
-          leftValue: ""
+          leftValue: item.capital_budget
         },
         {
           leftStr: "鍏抽敭鍐崇瓥浜烘槸璋侊紙who锛�",
-          leftValue: ""
+          leftValue: item.key_maker
         },
         {
           leftStr: "鍏抽敭鍐崇瓥鍥犵礌鏈夊摢浜涳紙what锛�",
-          leftValue: ""
+          leftValue: item.key_factors
         },
         {
           leftStr: "鍐崇瓥娴佺▼鏄�庢牱鐨勶紙what锛�",
-          leftValue: ""
+          leftValue: item.process
         },
         {
           leftStr: "绔炰簤瀵规墜鎻愪緵鐨勬柟妗堬紙what锛�",
-          leftValue: ""
+          leftValue: item.solutions
         }
       ]
       this.swotInfoList = [
         {
           leftStr: "浼樺娍(S)",
-          leftValue: "",
+          leftValue: item.advantages,
           rightStr: "鍔e娍(W)",
-          rightValue: ""
+          rightValue: item.disadvantages
         },
         {
           leftStr: "鏈轰細(O)",
-          leftValue: "",
+          leftValue: item.opportunities,
           rightStr: "濞佽儊(T)",
-          rightValue: ""
+          rightValue: item.threats
         }
       ]
       this.addressInfoList = [
         {
           leftStr: "鍥藉",
-          leftValue: "",
+          leftValue: "涓浗",
           rightStr: "鐪佷唤",
-          rightValue: ""
+          rightValue: item.Province.name
         },
         {
           leftStr: "鍩庡競",
-          leftValue: "",
-          rightStr: "鍖哄煙",
+          leftValue: item.City.name,
+          rightStr: "",
           rightValue: ""
         },
         {
           leftStr: "璇︾粏鍦板潃",
-          leftValue: "",
+          leftValue: item.detail_address,
           rightStr: "",
           rightValue: ""
         }
@@ -484,6 +524,7 @@
     },
     handleClose() {
       this.detailConfig.visible = false
+      this.$parent.getData()
     },
     // tab鍒囨崲
     tabsClick(tab, event) {
@@ -516,9 +557,27 @@
     },
     // 鎺ㄨ繘
     advanceClick(item) {
-      console.log(item)
-      this.advanceConfig.visible = true
-      this.advanceConfig.active = item.title
+      let options = []
+      for (let i = 0; i < this.stepsList.length; i++) {
+        options.push(this.stepsList[i])
+      }
+      this.advanceConfig = {
+        visible: true,
+        active: item.id,
+        allOptions: this.stepsList,
+        options: options,
+        id: this.detailConfig.infomation.id
+      }
+    },
+
+    getAllData(){
+     return getAllData()
+          .then((res) => {
+            return res.data.status
+          })
+          .catch((err) => {
+            console.log(err)
+          })
     }
   }
 }
@@ -629,7 +688,7 @@
             }
             .step-view {
               padding: 30px 60px 5px;
-              height: 100px;
+              height: 80px;
               .step-title-view {
                 margin-top: 10px;
                 font-size: 12px;

--
Gitblit v1.8.0