Browse Source

财务系统,销售统计表-销售排名,筛选条件框修改

hbchen 11 months ago
parent
commit
49b0bff970
1 changed files with 46 additions and 23 deletions
  1. 46 23
      src/views/financialStatistics/salesStatistics.vue

+ 46 - 23
src/views/financialStatistics/salesStatistics.vue

@@ -1,6 +1,6 @@
 <script setup>
   import {getSellerGroupStatisticsList,getSellerStatisticsList} from '@/api/financialStatistics'
-  import {getSellerGroupList} from '@/api/crm'
+  import {getSellerGroupList,getSellerTeamList} from '@/api/crm'
   import {downloadByFlow} from '@/utils/common-methods'
   const moment = inject('$moment')
 
@@ -9,7 +9,8 @@
   const dateButtonData=[{text:'近1周',tabId:1,type:'week',diff:1},{text:'近1月',tabId:2,type:'month',diff:1},
   {text:'近2月',tabId:3,type:'month',diff:2},{text:'近3月',tabId:4,type:'month',diff:3},{text:'今年以来',tabId:5,type:'year',diff:1}]
 
-  let groupList=ref([])
+  // let groupList=ref([])
+  let sellerSellerTeamList=ref([])
   const tabType=ref(1)
   const statisticsData=reactive({
     tableData:[],
@@ -19,7 +20,8 @@
   const searchParams=reactive({
     current:1,
     page_size:10,
-    group_id:'',
+    // group_id:'',
+    seller_ids:'',
     start_date:'',
     end_date:'',
     // 排序字段: 1-开票金额; 2-组别占比
@@ -51,17 +53,19 @@
     
   })
   // 销售类型缓存 为了减少请求次数
-  let sellerTypeCache=0
+  // let sellerTypeCache=0
 
   const changeTab=(tab)=>{
     if(tabType.value==tab) return 
     tabType.value=tab
-    if(tab==2 && sellerTypeCache!=searchParams.seller_type){
-      getSellerGroup()
-    }
+    // if(tab==2 && sellerTypeCache!=searchParams.seller_type){
+      // getSellerGroup()
+    getSellerListFun()
+    // }
     searchParams.current=1
     searchParams.page_size=10
-    searchParams.group_id=''
+    // searchParams.group_id=''
+    searchParams.seller_ids=''
     searchParams.sort_field=''
     searchParams.sort_type=''
     searchParams.company_type=0
@@ -74,6 +78,13 @@
       createtime.value=null
     }
   }
+
+  const sellerChange=(value)=>{
+    console.log(value);
+    searchParams.seller_ids=(value&&value.length)?value.join(','):''
+    statisticsList()
+  }
+
   // 获取列表
   const statisticsList=()=>{
     if(tabType.value==1){
@@ -83,7 +94,6 @@
         statisticsData.total = 0
       })
     }else if(tabType.value==2){
-
       // 销售排名
       getSellerStatisticsList(searchParams).then(res=>{
         statisticsData.tableData = res.data.list || []
@@ -94,20 +104,28 @@
   }
 
   // 获取销售组别
-  const getSellerGroup=()=>{
-    sellerTypeCache=searchParams.seller_type
-    getSellerGroupList({seller_type:searchParams.seller_type}).then(res=>{
-      groupList.value=res.data || []
+  // const getSellerGroup=()=>{
+  //   sellerTypeCache=searchParams.seller_type
+  //   getSellerGroupList({seller_type:searchParams.seller_type}).then(res=>{
+  //     groupList.value=res.data || []
+  //   })
+  // }
+
+  //获取销售列表
+  const getSellerListFun=()=>{
+    getSellerTeamList().then(res=>{
+      sellerSellerTeamList.value = res.data.all_list || []
     })
   }
+  
   // 切换销售类型
-  const changeSellerType=()=>{
-    if(tabType.value==2&&sellerTypeCache!=searchParams.seller_type){
-      searchParams.group_id=''
-      getSellerGroup()
-    }
-    searchStatistics()
-  }
+  // const changeSellerType=()=>{
+    // if(tabType.value==2&&sellerTypeCache!=searchParams.seller_type){
+    //   searchParams.group_id=''
+    //   getSellerGroup()
+    // }
+  //   searchStatistics()
+  // }
 
   // 日期选项改变
   const changeDateType=()=>{
@@ -170,14 +188,19 @@
       <div class="statistics-top-zone">
         <div class="statistics-search-zone">
           <el-select v-model="searchParams.seller_type" placeholder="请选择销售类型"
-          @change="changeSellerType" class="statistics-search-item" >
+          @change="searchStatistics" class="statistics-search-item" v-show="tabType==1">
             <el-option label="FICC销售" :value="1"></el-option>
             <el-option label="权益销售" :value="2"></el-option>
           </el-select>
-          <el-select v-model="searchParams.group_id" placeholder="请选择销售组别" class="statistics-search-item"
+          <!-- <el-select v-model="searchParams.group_id" placeholder="请选择销售组别" class="statistics-search-item"
           @change="searchStatistics" v-show="tabType==2" clearable >
             <el-option :label="item.group_name" :value="item.group_id" v-for="item in groupList"></el-option>
-          </el-select>
+          </el-select> -->
+          <el-cascader :options="sellerSellerTeamList" style="width: 240px;margin:0 30px 8px 0;" filterable collapse-tags-tooltip
+            @change="sellerChange" placeholder="请选择销售" clearable collapse-tags :show-all-levels="false"
+            :props="{multiple:true,label:'seller_name',value:'seller_id',children:'child',emitPath:false}" key="seller" 
+            v-if="tabType==2">
+          </el-cascader>
           <el-checkbox v-model="searchParams.show_resign" style="margin: 0 30px 8px 0;"
           v-show="tabType==2" @change="searchStatistics">显示离职销售</el-checkbox>
           <el-radio-group v-model="searchParams.company_type" size="large" @change="searchStatistics"