Your Name 1 ano atrás
pai
commit
84acac8d0d
3 arquivos alterados com 93 adições e 34 exclusões
  1. 20 1
      src/api/develop.js
  2. 55 24
      src/pages/reader/develop.vue
  3. 18 9
      src/pages/reader/develop2.vue

+ 20 - 1
src/api/develop.js

@@ -62,7 +62,10 @@ export function getCascaderChannel(params) {
 export function getSaleUser(params) {
   console.log(process.env.NODE_ENV);
   return service({
-    url: process.env.NODE_ENV == "production"?'http://reader-api.efunbox.cn/cms'+"/sale/user":'http://resources.ai160.com/cms'+"/sale/user",
+    url:
+      process.env.NODE_ENV == "production"
+        ? "http://reader-api.efunbox.cn/cms" + "/sale/user"
+        : "http://resources.ai160.com/cms" + "/sale/user",
     method: "get",
     params
   });
@@ -75,3 +78,19 @@ export function getChannelData(params) {
     params
   });
 }
+// 获取数据统计
+export function getTotalData(params) {
+  return service({
+    url: "/statistics/develop/summary",
+    method: "get",
+    params
+  });
+}
+// 获取数据统计2
+export function getTotalData2(params) {
+  return service({
+    url: "/statistics/develop/summary1",
+    method: "get",
+    params
+  });
+}

+ 55 - 24
src/pages/reader/develop.vue

@@ -19,15 +19,16 @@
           <el-button type="primary" @click="submitForm">搜索</el-button>
         </el-form-item>
       </el-form>
-      <el-table id="table" ref="table1" :data="tableData" border style="width: 100%" :height="tableHeight">
-        <el-table-column label="日期" fixed align="left" header-align="center" min-width="140px">
+      <el-table id="table" ref="table1" :data="tableData" border style="width: 100%" show-summary
+        :summary-method="getSummaries">
+        <el-table-column label="日期" fixed align="center" header-align="center" min-width="140px">
           <template slot-scope="scope">
-            <span>{{changeDate(scope.row.day)}}</span>
+            <span>{{scope.row.day?changeDate(scope.row.day):'总计'}}</span>
           </template>
         </el-table-column>
         <el-table-column label="渠道" fixed align="left" header-align="center" min-width="140px">
           <template slot-scope="scope">
-            <span>{{changeDate(scope.row.day)}}</span>
+            <span>{{scope.row.channelCode||''}}</span>
           </template>
         </el-table-column>
         <el-table-column label="用户数量" header-align="center">
@@ -41,28 +42,44 @@
             min-width="100px"></el-table-column>
         </el-table-column>
         <el-table-column label="新增订单数量" header-align="center">
-          <el-table-column label="月包" prop="dailyAddMonthCount" align="right" header-align="center" min-width="100px"></el-table-column>
-          <el-table-column label="年包" prop="dailyAddYearCount" align="right" header-align="center" min-width="100px"></el-table-column>
-          <el-table-column label="终身" prop="dailyAddLifelongCount" align="right" header-align="center" min-width="100px"></el-table-column>
-          <el-table-column label="小计" prop="dailyAddCount" align="right" header-align="center" min-width="100px"></el-table-column>
+          <el-table-column label="月包" prop="dailyAddMonthCount" align="right" header-align="center"
+            min-width="100px"></el-table-column>
+          <el-table-column label="年包" prop="dailyAddYearCount" align="right" header-align="center"
+            min-width="100px"></el-table-column>
+          <el-table-column label="终身" prop="dailyAddLifelongCount" align="right" header-align="center"
+            min-width="100px"></el-table-column>
+          <el-table-column label="小计" prop="dailyAddCount" align="right" header-align="center"
+            min-width="100px"></el-table-column>
         </el-table-column>
         <el-table-column label="新增销售金额" header-align="center">
-          <el-table-column label="月包" prop="dailyAddMonthAmount" align="right" header-align="center" min-width="100px"></el-table-column>
-          <el-table-column label="年包" prop="dailyAddYearAmount" align="right" header-align="center" min-width="100px"></el-table-column>
-          <el-table-column label="终身" prop="dailyAddLifelongAmount" align="right" header-align="center" min-width="100px"></el-table-column>
-          <el-table-column label="小计" prop="dailyAddAmount" align="right" header-align="center" min-width="100px"></el-table-column>
+          <el-table-column label="月包" prop="dailyAddMonthAmount" align="right" header-align="center"
+            min-width="100px"></el-table-column>
+          <el-table-column label="年包" prop="dailyAddYearAmount" align="right" header-align="center"
+            min-width="100px"></el-table-column>
+          <el-table-column label="终身" prop="dailyAddLifelongAmount" align="right" header-align="center"
+            min-width="100px"></el-table-column>
+          <el-table-column label="小计" prop="dailyAddAmount" align="right" header-align="center"
+            min-width="100px"></el-table-column>
         </el-table-column>
         <el-table-column label="退订订单数量" header-align="center">
-          <el-table-column label="月包" prop="dailyRefundMonthCount" align="right" header-align="center" min-width="100px"></el-table-column>
-          <el-table-column label="年包" prop="dailyRefundYearCount" align="right" header-align="center" min-width="100px"></el-table-column>
-          <el-table-column label="终身" prop="dailyRefundLifelongCount" align="right" header-align="center" min-width="100px"></el-table-column>
-          <el-table-column label="小计" prop="dailyRefundCount" align="right" header-align="center" min-width="100px"></el-table-column>
+          <el-table-column label="月包" prop="dailyRefundMonthCount" align="right" header-align="center"
+            min-width="100px"></el-table-column>
+          <el-table-column label="年包" prop="dailyRefundYearCount" align="right" header-align="center"
+            min-width="100px"></el-table-column>
+          <el-table-column label="终身" prop="dailyRefundLifelongCount" align="right" header-align="center"
+            min-width="100px"></el-table-column>
+          <el-table-column label="小计" prop="dailyRefundCount" align="right" header-align="center"
+            min-width="100px"></el-table-column>
         </el-table-column>
         <el-table-column label="退订销售金额" header-align="center">
-          <el-table-column label="月包" prop="dailyRefundMonthAmount" align="right" header-align="center" min-width="100px"></el-table-column>
-          <el-table-column label="年包" prop="dailyRefundYearAmount" align="right" header-align="center" min-width="100px"></el-table-column>
-          <el-table-column label="终身" prop="dailyRefundLifelongAmount" align="right" header-align="center" min-width="100px"></el-table-column>
-          <el-table-column label="小计" prop="dailyRefundAmount" align="right" header-align="center" min-width="100px"></el-table-column>
+          <el-table-column label="月包" prop="dailyRefundMonthAmount" align="right" header-align="center"
+            min-width="100px"></el-table-column>
+          <el-table-column label="年包" prop="dailyRefundYearAmount" align="right" header-align="center"
+            min-width="100px"></el-table-column>
+          <el-table-column label="终身" prop="dailyRefundLifelongAmount" align="right" header-align="center"
+            min-width="100px"></el-table-column>
+          <el-table-column label="小计" prop="dailyRefundAmount" align="right" header-align="center"
+            min-width="100px"></el-table-column>
         </el-table-column>
       </el-table>
       <el-pagination style="text-align: center;" @current-change="handleCurrentChange"
@@ -74,11 +91,10 @@
 </template>
 <script>
 import formatDate from "../../utils/formatTime";
-import { getCascaderChannel, getChannelData } from '@/api/develop.js'
+import { getCascaderChannel, getChannelData, getTotalData } from '@/api/develop.js'
 export default {
   data() {
     return {
-      tableHeight: 500,
       tableData: [],
       skillParams: {
         startDay: "",
@@ -90,13 +106,13 @@ export default {
         pageNo: 1,
         totalSize: 0
       },
-      options: []
+      options: [],
+      totalData: {}
     };
   },
   async created() {
     this.skillParams.startDay = this.getYesterDay();
     this.skillParams.endDay = this.getYesterDay();
-    this.tableHeight = document.documentElement.clientHeight * 0.75;
     let res = await getCascaderChannel()
     let se = this.filterEmptyChildren(res.data)
     console.log(se, 'sss');
@@ -123,10 +139,20 @@ export default {
           this.tableData = res.data.list
           this.pagination.totalSize = res.data.totalSize
           this.pagination.pageNo = res.data.pageNo
+
+          let totalData = await getTotalData({
+            oneLevelCode: this.skillParams.channel[0],
+            twoLevelCode: this.skillParams.channel[1] ? this.skillParams.channel[1] : '',
+            threeLevelCode: this.skillParams.channel[2] ? this.skillParams.channel[2] : '',
+            startDay: this.skillParams.startDay, endDay: this.skillParams.endDay
+          })
+          this.totalData = totalData.data
+
         } else {
           return false;
         }
       });
+
     },
     filterEmptyChildren(child) {
       let arr = []
@@ -165,6 +191,11 @@ export default {
     changeDate(date) {
       return formatDate(date, 4)
     },
+    getSummaries() {
+      let value = ['合计', '']
+      value.push(...Object.values(this.totalData))
+      return value
+    }
   }
 };
 </script>

+ 18 - 9
src/pages/reader/develop2.vue

@@ -20,15 +20,16 @@
           <el-button type="primary" @click="submitForm">搜索</el-button>
         </el-form-item>
       </el-form>
-      <el-table id="table" ref="table1" :data="tableData" border style="width: 100%" :height="tableHeight">
-        <el-table-column label="日期" fixed align="left" header-align="center" min-width="140px">
+      <el-table id="table" ref="table1" :data="tableData" border style="width: 100%" show-summary 
+        :summary-method="getSummaries">
+        <el-table-column label="日期" fixed align="center" header-align="center" min-width="140px">
           <template slot-scope="scope">
-            <span>{{changeDate(scope.row.day)}}</span>
+            <span>{{scope.row.day?changeDate(scope.row.day):'总计'}}</span>
           </template>
         </el-table-column>
         <el-table-column label="渠道" fixed align="left" header-align="center" min-width="140px">
           <template slot-scope="scope">
-            <span>{{changeDate(scope.row.day)}}</span>
+            <span>{{scope.row.channelCode||''}}</span>
           </template>
         </el-table-column>
         <el-table-column label="用户数量" header-align="center">
@@ -91,11 +92,10 @@
 </template>
 <script>
 import formatDate from "../../utils/formatTime";
-import { getSaleUser, getChannelData } from '@/api/develop.js'
+import { getSaleUser, getChannelData, getTotalData2 } from '@/api/develop.js'
 export default {
   data() {
     return {
-      tableHeight: 500,
       tableData: [],
       skillParams: {
         startDay: "",
@@ -107,15 +107,14 @@ export default {
         pageNo: 1,
         totalSize: 0
       },
-      options: []
+      options: [],
+      totalData: {}
     };
   },
   async created() {
     this.skillParams.startDay = this.getYesterDay();
     this.skillParams.endDay = this.getYesterDay();
-    this.tableHeight = document.documentElement.clientHeight * 0.75;
     let res = await getSaleUser()
-    console.log(res.data, 'sss');
     this.options = res.data
   },
   methods: {
@@ -137,6 +136,11 @@ export default {
           this.tableData = res.data.list
           this.pagination.totalSize = res.data.totalSize
           this.pagination.pageNo = res.data.pageNo
+          let totalData = await getTotalData2({
+            saleUserId: this.skillParams.saleUserId,
+            startDay: this.skillParams.startDay, endDay: this.skillParams.endDay
+          })
+          this.totalData = totalData.data
         } else {
           return false;
         }
@@ -165,6 +169,11 @@ export default {
     changeDate(date) {
       return formatDate(date, 4)
     },
+    getSummaries() {
+      let value = ['合计', '']
+      value.push(...Object.values(this.totalData))
+      return value
+    }
   }
 };
 </script>