Jelajahi Sumber

客户统计数据接口拆分

cxmo 1 tahun lalu
induk
melakukan
45e6756500

+ 22 - 0
src/api/modules/overseasCustom.js

@@ -72,6 +72,28 @@ export const overseasCustomInterence = {
      */
     setCustomStatus:(params)=>{
         return http.post('/overseas_custom/custom/status_set',params)
+    },
+    /**
+     * 获取客户统计信息
+     * @param {Object} params
+     * @param {String} params.Keywords
+     * @param {String} params.SellerId
+     * @param {Number} params.CustomType
+     * @returns 
+     */
+    getStatisticData:(params)=>{
+        return http.get('/overseas_custom/custom/statistics',params)
+    },
+    /**
+     * 获取客户试用统计信息
+     * @param {Object} params
+     * @param {String} params.Keywords
+     * @param {String} params.SellerId
+     * @param {Number} params.CustomType
+     * @returns 
+     */
+    overseasCustomInterence:(params)=>{
+        return http.get('/overseas_custom/custom/label/statistics',params)
     }
 
 }

+ 48 - 9
src/views/custom_manage/overseasList/overseasCustomList.vue

@@ -149,7 +149,7 @@
                     layout="total,prev,pager,next,jumper" 
                     background 
                     :current-page="currentPage"
-                    @current-change="handlePageChange"
+                    @current-change="(page)=>handlePageChange(page,'sort')"
                     :page-size="pageSize"
                     :total="total"
                     style="text-align: right;margin-top:20px"/>
@@ -269,7 +269,7 @@ export default {
                 tryStatusSelect:0,
             }
             this.$refs.overseasTable&&this.$refs.overseasTable.clearSort()
-            this.handlePageChange(1)
+            this.handlePageChange(1,'static')
         }
     },
     methods: {
@@ -302,9 +302,16 @@ export default {
             })
         },
         //客户列表
-        getTableData() {
+        async getTableData(type) {
             this.tableLoading = true
             const {Keywords,SortField,SortDesc,SellerId,CompanyStatus,tryStatusSelect} = this.tableParams
+            //重新请求统计数据
+            if(type!=='sort'){
+                await this.getStatisticData()
+                if(CompanyStatus==='试用'){
+                    await this.getTryStatisticData()
+                }
+            }
             overseasCustomInterence.getCustomList({
                 PageSize: this.pageSize,
                 CurrentIndex: this.currentPage,
@@ -317,7 +324,7 @@ export default {
                 this.tableLoading = false
                 if(res.Ret!==200) return 
                 if(!res.Data) return 
-                //客户状态
+                /* //客户状态
                 this.tableTabs = res.Data.StatisticsData||[]
                 //手动添加一个全部
                 let total = this.tableTabs.map(i=>(i.Total)).reduce((acc,curr)=>acc+curr,0)
@@ -330,12 +337,44 @@ export default {
                     OverseasLabel:tab.OverseasLabel}))
                 //手动添加一个全部
                 let tryTotal = this.tryTabs.map(i=>(i.Total)).reduce((acc,curr)=>acc+curr,0)
-                this.tryTabs.unshift({TryStatus:'全部',Total:tryTotal,OverseasLabel:0})
+                this.tryTabs.unshift({TryStatus:'全部',Total:tryTotal,OverseasLabel:0}) */
                 //客户列表
                 this.tableData = res.Data.List||[]
                 this.total = res.Data.Paging.Totals||0
             })
         },
+        //获取客户统计数据
+        async getStatisticData(){
+            const {Keywords,SellerId,CompanyStatus} = this.tableParams
+            const statisticRes = await overseasCustomInterence.getStatisticData({
+                CustomType:this.pageSelect,
+                SellerId,Keywords
+            })
+            if(statisticRes.Ret!==200) return 
+            //客户状态
+            this.tableTabs = statisticRes.Data||[]
+            //手动添加一个全部
+            let total = this.tableTabs.map(i=>(i.Total)).reduce((acc,curr)=>acc+curr,0)
+            this.tableTabs.unshift({CompanyStatus:'全部',Total:total})
+        },
+        //客户试用状态统计数据
+        async getTryStatisticData(){
+            const {Keywords,SellerId} = this.tableParams
+            const statisticTryRes = await overseasCustomInterence.overseasCustomInterence({
+                CustomType:this.pageSelect,
+                SellerId,Keywords
+            })
+            if(statisticTryRes.Ret!==200) return 
+            //客户试用状态
+            this.tryTabs = statisticTryRes.Data||[]
+            this.tryTabs = this.tryTabs.map(tab=>({
+                TryStatus:tryArr[tab.OverseasLabel],
+                Total:tab.Total,
+                OverseasLabel:tab.OverseasLabel}))
+            //手动添加一个全部
+            let tryTotal = this.tryTabs.map(i=>(i.Total)).reduce((acc,curr)=>acc+curr,0)
+            this.tryTabs.unshift({TryStatus:'全部',Total:tryTotal,OverseasLabel:0})
+        },
         //切换客户状态
         changeStatus(item) {
             this.tableParams.CompanyStatus = item.CompanyStatus;
@@ -355,12 +394,12 @@ export default {
         handleSortChange({prop,order}) {
             this.tableParams.SortDesc = order==='ascending'?2:1
             this.tableParams.SortField = order?prop:'ViewTotal'
-            this.handlePageChange(1)
+            this.handlePageChange(1,'sort')
          },
         //切换页码
-        handlePageChange(page) {
+        handlePageChange(page,type) {
             this.currentPage = page;
-            this.getTableData();
+            this.getTableData(type);
         },
         //跳转至客户详情
         toCustomDetail(data) { 
@@ -416,7 +455,7 @@ export default {
     },
     mounted() {
         this.getSavedSales()
-        this.getTableData();
+        this.getTableData('static');
     },
 };
 </script>