snow vor 7 Monaten
Ursprung
Commit
4bc1d310f2

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/index.html


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/css/app.6eeaeac7.css


BIN
dist/static/css/app.6eeaeac7.css.gz


BIN
dist/static/css/app.9dbec3ae.css.gz


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/js/app.5d8ca809.js


BIN
dist/static/js/app.5d8ca809.js.gz


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/js/app.b028fa84.js


BIN
dist/static/js/app.b028fa84.js.gz


+ 6 - 1
src/api/newResults/index.js

@@ -2,10 +2,15 @@
 import http from "@/api/axios";
 
 const onlineReportApi = "http://rep.report.caixiao365.com/admin/Everyday/"
+const onlineReportApi1 = "http://rep.report.caixiao365.com/admin/everyday/"
 
 export default {
   departmentEveryDay: (data, params) => http(onlineReportApi + "departEveryDay", data, "post", params),
   departmentEveryMonth: (data, params) => http(onlineReportApi + "departEveryMonth", data, "post", params),
-  companyEveryMonth: (data, params) => http(onlineReportApi + "companyEveryMonth", data, "post", params),
   companyEvery: (data, params) => http(onlineReportApi + "companyEvery", data, "post", params),
+  companyEveryMonth: (data, params) => http(onlineReportApi + "companyEveryMonth", data, "post", params),
+
+  platform: (data, params) =>  http(onlineReportApi + "platformEvery", data, "post", params),
+
+  supplier: (data, params) => http(onlineReportApi1 + "supplierEvery", data, "post", params)
 };

+ 2 - 2
src/components/newResultInfo/calc.js

@@ -1,6 +1,6 @@
 export const amountData = {
-  "companyNo": "",
-  "companyName": "合计",
+  "companyNo": "yyyt",
+  "companyName": "合计-元隆雅图",
   "cost_tips": "0",
   "total_tips": "0",
   "info": [

+ 19 - 53
src/components/newResultInfo/company-bu.vue

@@ -13,17 +13,22 @@
       </div>
 
       <div style="float:right">
-          <!--
-                    <el-select size="small" style="margin-right:10px;width:150px" v-model="companyNo" @change="requestData"
-          :disabled="isEmpty">
-          <el-option v-for="company in plat_cp_companies" :key="company.value" :value="company.value" :label="company.label" />
-        </el-select>
-          -->
-
-        <el-date-picker class="fr picker no-padding" v-model="daytime" style="width:95px" value-format="yyyy-MM-dd"
-          :editable="false" :disabled="isEmpty" :clearable="false" :size="'small'" format="yyyy-MM-dd" type="date"
-          align="right" placeholder="选择日期"
-          :picker-options="{ disabledDate(time) { return time.getTime() > Date.now(); } }" @change="requestData" />
+        <el-date-picker 
+          class="fr picker no-padding" 
+          v-model="daytime" 
+          style="width:95px" 
+          value-format="yyyy-MM-dd"
+          :editable="false" 
+          :disabled="isEmpty" 
+          :clearable="false" 
+          :size="'small'" 
+          format="yyyy-MM-dd" 
+          type="date"
+          align="right"
+          placeholder="选择日期"
+          @change="requestData"
+          :picker-options="{ disabledDate(time) { return time.getTime() > Date.now(); } }"
+        />
       </div>
     </div>
 
@@ -271,9 +276,8 @@ export default {
         }),
       }
     },
-    setCellClassName({ column ,row }) {
+    setCellClassName({ column, row }) {
       const { label } = column;
-
       let base = ''
 
       if(row.companyName === "北京万宇恒通国际科贸有限公司") {
@@ -326,41 +330,12 @@ export default {
     async requestData() {
       this.loading = true;
       this.tableData = [];
-
       const res = await asyncRequest.companyEveryMonth({ daytime: this.daytime });
 
-      // const jxIndex = res.data.findIndex((item) => item.companyName === "北京锦兴弘昌科技有限公司");
-      // let prIndex = res.data.findIndex((item) => item.companyName === "北京普润心堂商贸有限公司");
-      // let zsIndex = res.data.findIndex((item) => item.companyName === "北京知事文化产业发展有限公司")
-      // if (jxIndex >= 0 && prIndex >= 0) {
-      //   const jxItem = res.data[jxIndex];
-      //   res.data[prIndex] = this.addDataToCompany(jxItem, res.data[prIndex]);
-      //   res.data.splice(jxIndex, 1);
-      // }
-      // prIndex = res.data.findIndex((item) => item.companyName === "北京普润心堂商贸有限公司");
-      // zsIndex = res.data.findIndex((item) => item.companyName === "北京知事文化产业发展有限公司")
-      // if (zsIndex >= 0 && prIndex >= 0) {
-      //   const zsItem = res.data[zsIndex];
-      //   res.data[prIndex] = this.addDataToCompany(zsItem, res.data[prIndex]);
-      //   res.data.splice(zsIndex, 1);
-      // }
-      // if (this.companyNo === "GS2302231124114965") {
-      //   const jxResult = await asyncRequest.companyEveryMonth({ daytime: this.daytime, companyNo: "GS2304031312553746" });
-      //   const zsResult = await asyncRequest.companyEveryMonth({ daytime: this.daytime, companyNo: "GS2401181650538135" });
-      //   res.data[prIndex] = this.addDataToCompany(jxResult.data[0], res.data[prIndex]);
-      //   if(zsResult.data.length !== 0) {
-      //     res.data[prIndex] = this.addDataToCompany(zsResult.data[0], res.data[prIndex]);
-      //   }
-      // }
-      // const isBeforeDate = this.getDiffDay() < 0 && this.companyNo === "GS2302231323386950"
-
       if (res.code === 0 && res.data && res.data.length > 0) {
         res.data.forEach(({ companyName,companyNo, monthinfo, dayinfo, total_tips, cost_tips }) => {
-
           const mapResponseType = { '1': '自营', '2': '渠道', '3': '供应商端' ,'4' : '物流费用'}
-
           const types = Object.keys(mapResponseType)
-
           let prev_sale_total = 0;
           let prev_msale_total = 0;
           let prev_cost_total = 0;
@@ -372,31 +347,24 @@ export default {
 
             /** 月营业收入 = 月销售额 - 月退货额  */
             let msale_total = 0;
-            if(Number(type) !== 4){
-              msale_total = subtraction(_monthinfo.msale_total, _monthinfo.mth_total) || 0
-            }
-
+            if(Number(type) !== 4){ msale_total = subtraction(_monthinfo.msale_total, _monthinfo.mth_total) || 0 }
             /** 日营业收入 = 日销售额 - 日退货额 */
             const sale_total = subtraction(_dayinfo.sale_total, _dayinfo.th_total) || 0;
             /** 日成本 = 日采购额 - 日退货额 */
             const cost_total = subtraction(_dayinfo.cgd_total, _dayinfo.cgd_th_total) || 0;
-
             /** 月成本 = 月采购额 - 月退货额 */
             let mcost_total = 0;
-
             if(Number(type) !== 4){
               mcost_total = subtraction(_monthinfo.mcgd_total, _monthinfo.mcgd_th_total) || 0;
             }else{
               mcost_total = Number(_monthinfo.mcgd_total || 0).toFixed(2);
             }
 
-
             prev_sale_total = Number(addition(prev_sale_total, sale_total)).toFixed(2);
             prev_msale_total = Number(addition(prev_msale_total, msale_total)).toFixed(2);
             prev_cost_total = Number(addition(prev_cost_total, cost_total)).toFixed(2);
             prev_mcost_total = Number(addition(prev_mcost_total, mcost_total)).toFixed(2);
 
-
             return {
               type: mapResponseType[type],
               dayinfo: { ..._dayinfo, sale_total },
@@ -427,12 +395,10 @@ export default {
           ]
         })
 
-        let i = ["北京百辰荣达国际科贸有限公司", '北京泓源广诚国际商贸有限公司' ,"北京普润心堂商贸有限公司"];
+        let i = ["北京百辰荣达国际科贸有限公司", '北京泓源广诚国际商贸有限公司' ,"北京普润心堂商贸有限公司", ""];
         const l = this.tableData.map(item => item.companyName);
 
         const values = this.plat_cp_companies.map(({value}) => value)
-
-
         i = i.filter(item => l.includes(item));
         this.tableData = i.map(item => this.tableData.find(l => l.companyName === item));
         this.tableData  = this.tableData.filter(({companyNo}) => values.includes(companyNo))

+ 12 - 0
src/components/newResultInfo/company-month.vue

@@ -137,9 +137,21 @@ export default {
 
     let list = ['所有公司','平台公司: 万宇','业务公司: 百辰','业务公司: 泓源','业务公司: 普润&锦兴&知事','平台公司: 泰文创', '预订单E企购', '结算单E企购']
     const cp_list = this.cp_companies.map((item) => item.label);
+
     list = list.filter(item => cp_list.includes(item));
+
     this.cp_companies = list.map((item) => this.cp_companies.find((cp_item) => cp_item.label === item));
+
+    // if(this.cp_companies.length >= 4){
+    //   this.cp_companies = [{
+    //     value:'',
+    //     label:'所有公司'
+    //   },...this.cp_companies];
+    // }
+
+
     this.companyNo = this.cp_companies[0].value;
+
     this.daytime = this.transformTime();
     this.requestData();
   },

+ 153 - 284
src/components/newResultInfo/company.vue

@@ -1,10 +1,15 @@
 <template>
   <div v-loading="loading">
-    <div class="search clear" style="align-items: center;;">
+    <div class="search clear" style="align-items: center;">
       <el-tooltip placement="top" width="50px" trigger="hover" content="平台公司">
-          <i class="el-icon-warning-outline" style="font-size:16px;cursor:pointer;;display:inline-block;padding-right: 5px" ></i>
-      </el-tooltip>
-      <span style="font-size: 15px;">月度完成情况</span>
+            <i
+              class="el-icon-warning-outline"
+              style="font-size:16px;cursor:pointer;;display:inline-block;padding-right: 5px"
+            ></i>
+        </el-tooltip>
+
+        <span style="font-size: 15px;">月度完成情况</span>
+
       <div style="float:right">
         <el-date-picker class="fr picker no-padding" v-model="daytime" style="width:95px" value-format="yyyy-MM-dd"
           :editable="false" :disabled="isEmpty" :clearable="false" :size="'small'" format="yyyy-MM-dd" type="date"
@@ -13,55 +18,68 @@
       </div>
     </div>
 
-    <el-row style="margin-top:10px;margin-top:10px;margin-bottom:10px" v-if="!isEmpty">
-      <el-table border size="mini" :data="topTable" :header-cell-class-name="setHeaderClassName"
-        :cell-class-name="setCellClassName">
-        <el-table-column fixed="left" label="公司" prop="companyName" align="center" width="70px">
+    <el-row style="margin-top:10px;margin-top:10px" v-if="!isEmpty">
+      <el-table 
+        border 
+        size="mini" 
+        :data="tableData" 
+        :header-cell-class-name="setHeaderClassName"
+        :cell-class-name="setCellClassName"
+        default-expand-all
+        row-key="companyNo"
+        :load="load"
+        lazy
+       >
+
+        <el-table-column fixed="left" label="公司" prop="companyName" align="center" width="120px">
           <template slot-scope="scope">
-            <div v-if="scope.row.companyName === '结算单E企购'">
-              自营订单
-            </div>
-            <div v-else>
-              {{ scope.row.companyName }}
-            </div>
+            <span v-if="scope.row.companyName.indexOf('元隆雅图') === -1">
+              {{ mapCompany[scope.row.companyName] || scope.row.companyName }}
+            </span>
+
+            <span v-else>
+              元隆雅图
+            </span>
           </template>
         </el-table-column>
+
+
         <el-table-column label="当日营业收入" align="center" width="95px">
           <template slot-scope="scope">
-            {{ scope.row.companyName === '合计' ? unit2TenThousand(calcAmount('sale_total'), isTenThound)  : unit2TenThousand(scope.row.sale_total, isTenThound) }}
+            {{ scope.row.companyName === '合计-元隆雅图' ? unit2TenThousand(calcAmount('sale_total'), isTenThound)  : unit2TenThousand(scope.row.sale_total, isTenThound) }}
           </template>
         </el-table-column>
 
           <el-table-column label="营收目标" align="center" min-width="95px">
             <template slot-scope="scope">
-              {{ scope.row.companyName === '合计' ? unit2TenThousand(calcAmount('total_tips'), isTenThound)  : unit2TenThousand(scope.row.total_tips, isTenThound) }}
+              {{ scope.row.companyName === '合计-元隆雅图' ? unit2TenThousand(calcAmount('total_tips'), isTenThound)  : unit2TenThousand(scope.row.total_tips, isTenThound) }}
             </template>
           </el-table-column>
 
           <el-table-column label="营业收入(净)" align="center" min-width="115px">
             <template slot-scope="scope">
-              <div style="display:flex;justify-content:center" :style="`${scope.row.companyName === '合计' ? '' :getCurrentValueStyle(scope.row.msale_total, scope.row.total_tips)}`">
+              <div style="display:flex;justify-content:center" :style="`${scope.row.companyName === '合计-元隆雅图' ? '' :getCurrentValueStyle(scope.row.msale_total, scope.row.total_tips)}`">
                {{ 
-                  scope.row.companyName === '合计' 
+                  scope.row.companyName === '合计-元隆雅图' 
                   ? unit2TenThousand(calcAmount('msale_total'), isTenThound)
                   : unit2TenThousand(scope.row.msale_total, isTenThound) 
                 }}
                 <el-popover placement="right" :width="200" trigger="click">
                   <div class="table-size">
                     <p>直营/自营: {{ 
-                    scope.row.companyName === '合计' 
+                    scope.row.companyName === '合计-元隆雅图' 
                         ? unit2TenThousand(calcAmount('0.0.monthinfo.msale_total', true), isTenThound) 
-                        : unit2TenThousand(scope.row.info[0][0].monthinfo.msale_total, isTenThound) 
+                        : unit2TenThousand(scope.row.info[0].monthinfo.msale_total, isTenThound) 
                       }}</p>
                     <p>支付渠道: {{ 
-                    scope.row.companyName === '合计' 
+                    scope.row.companyName === '合计-元隆雅图' 
                        ? unit2TenThousand(calcAmount('0.1.monthinfo.msale_total', true), isTenThound)
-                       : unit2TenThousand(scope.row.info[0][1].monthinfo.msale_total, isTenThound) 
+                       : unit2TenThousand(scope.row.info[1].monthinfo.msale_total, isTenThound) 
                       }}</p>
                     <p>供应商端: {{ 
-                      scope.row.companyName === '合计' 
+                      scope.row.companyName === '合计-元隆雅图' 
                       ?  unit2TenThousand(calcAmount('0.2.monthinfo.msale_total', true), isTenThound)
-                      :  unit2TenThousand(scope.row.info[0][2].monthinfo.msale_total, isTenThound) }}
+                      :  unit2TenThousand(scope.row.info[2].monthinfo.msale_total, isTenThound) }}
                     </p>
                   </div>
 
@@ -77,8 +95,8 @@
 
           <el-table-column label="营收完成%" align="center" min-width="85px">
             <template slot-scope="scope">
-              <div :style="`${scope.row.companyName === '合计' ? '' : getCurrentRateStyle(scope.row.completion_rate)}`">
-                {{ scope.row.companyName === '合计' ? calcAmountCompletionRate() : (String(scope.row.completion_rate) === 'NaN' ? 0 :  scope.row.completion_rate) + "%" }}
+              <div :style="`${scope.row.companyName === '合计-元隆雅图' ? '' : getCurrentRateStyle(scope.row.completion_rate)}`">
+                {{ scope.row.companyName === '合计-元隆雅图' ? calcAmountCompletionRate() : (String(scope.row.completion_rate) === 'NaN' ? 0 :  scope.row.completion_rate) + "%" }}
               </div>
             </template>
           </el-table-column>
@@ -89,7 +107,7 @@
               <template slot-scope="scope">
                 {{ 
                   costField 
-                  ? scope.row.companyName === '合计' ? unit2TenThousand(calcAmount('cost_tips'), isTenThound) : unit2TenThousand(scope.row.cost_tips, isTenThound) 
+                  ? scope.row.companyName === '合计-元隆雅图' ? unit2TenThousand(calcAmount('cost_tips'), isTenThound) : unit2TenThousand(scope.row.cost_tips, isTenThound) 
                   : '***' 
                 }}
               </template>
@@ -97,9 +115,9 @@
 
             <el-table-column label="毛利完成" align="center" min-width="90px">
               <template slot-scope="scope">
-                <div :style="`${scope.row.companyName === '合计' ? '' : getCurrentValueStyle(scope.row.gross_completion, scope.row.cost_tips)}`">
+                <div :style="`${scope.row.companyName === '合计-元隆雅图' ? '' : getCurrentValueStyle(scope.row.gross_completion, scope.row.cost_tips)}`">
                   {{ costField 
-                    ?  scope.row.companyName === '合计' ? unit2TenThousand(calcAmount('gross_completion'), isTenThound) : unit2TenThousand(scope.row.gross_completion, isTenThound) 
+                    ?  scope.row.companyName === '合计-元隆雅图' ? unit2TenThousand(calcAmount('gross_completion'), isTenThound) : unit2TenThousand(scope.row.gross_completion, isTenThound) 
                     : '***' 
                   }}
                 </div>
@@ -107,11 +125,10 @@
             </el-table-column>
             </template>
 
-
             <el-table-column label="毛利完成%" align="center" min-width="85px">
               <template slot-scope="scope">
-                <div :style="scope.row.companyName === '合计' ? '' : getCurrentRateStyle(scope.row.gross_completion_rate)">
-                  {{  scope.row.companyName === '合计' ? calcAmountGrossCompletionRate() : scope.row.gross_completion_rate + '%' }}
+                <div :style="scope.row.companyName === '合计-元隆雅图' ? '' : getCurrentRateStyle(scope.row.gross_completion_rate)">
+                  {{  scope.row.companyName === '合计-元隆雅图' ? calcAmountGrossCompletionRate() : scope.row.gross_completion_rate + '%' }}
                 </div>
               </template>
             </el-table-column>
@@ -120,7 +137,7 @@
             <el-table-column label="成本合计" align="center" min-width="125px">
               <template slot-scope="scope">
                 <div style="display:flex;justify-content:center" v-if="costField">
-                  {{ scope.row.companyName === '合计' 
+                  {{ scope.row.companyName === '合计-元隆雅图'
                     ? unit2TenThousand(calcAmount('mcost_total'), isTenThound) 
                     : unit2TenThousand(scope.row.mcost_total, isTenThound) 
                   }}
@@ -128,28 +145,28 @@
                     <div class="table-size">
                       <p>直营/自营: 
                         {{
-                          scope.row.companyName === '合计'
+                          scope.row.companyName === '合计-元隆雅图'
                           ? unit2TenThousand(calcAmount('0.0.monthinfo.mcost_total',true),isTenThound)
-                          : unit2TenThousand(scope.row.info[0][0].monthinfo.mcost_total, isTenThound) 
+                          : unit2TenThousand(scope.row.info[0].monthinfo.mcost_total, isTenThound) 
                         }}
                       </p>
                       <p>支付渠道: 
                         {{ 
-                          scope.row.companyName === '合计'
+                          scope.row.companyName ==='合计-元隆雅图'
                           ? unit2TenThousand(calcAmount('0.1.monthinfo.mcost_total', true), isTenThound)
-                          : unit2TenThousand(scope.row.info[0][1].monthinfo.mcost_total, isTenThound)
+                          : unit2TenThousand(scope.row.info[1].monthinfo.mcost_total, isTenThound)
                         }}</p>
                       <p>供应商端: 
                         {{ 
-                         scope.row.companyName === '合计'
+                         scope.row.companyName === '合计-元隆雅图'
                           ? unit2TenThousand(calcAmount('0.2.monthinfo.mcost_total', true),isTenThound)
-                          : unit2TenThousand(scope.row.info[0][2].monthinfo.mcost_total, isTenThound)  
+                          : unit2TenThousand(scope.row.info[2].monthinfo.mcost_total, isTenThound)  
                         }}</p>
                       <p>物流费用: 
                         {{
-                          scope.row.companyName === '合计'
+                          scope.row.companyName === '合计-元隆雅图'
                            ? unit2TenThousand(calcAmount('0.3.monthinfo.mcost_total', true), isTenThound)
-                           : unit2TenThousand(scope.row.info[0][3].monthinfo.mcost_total, isTenThound)
+                           : unit2TenThousand(scope.row.info[3].monthinfo.mcost_total, isTenThound)
                         }}
                       </p>
                     </div>
@@ -167,7 +184,7 @@
             <el-table-column label="实际毛利率" align="center" width="85px">
               <template slot-scope="scope">
                 {{ costField 
-                  ?  scope.row.companyName === '合计' ? calcAmountRealRate()  : unit2TenThousand(scope.row.gross_sale_completion_rate) + "%" 
+                  ?  scope.row.companyName === '合计-元隆雅图' ? calcAmountRealRate()  : unit2TenThousand(scope.row.gross_sale_completion_rate) + "%" 
                   : '***' 
                 }}
               </template>
@@ -176,128 +193,6 @@
       </el-table>
     </el-row>
 
-
-    <el-row style="margin-top:10px;margin-top:10px" v-if="!isEmpty">
-      <el-table border size="mini" :data="tableData" :header-cell-class-name="setHeaderClassName"
-        :cell-class-name="setCellClassName">
-        <el-table-column fixed="left" label="公司" prop="companyName" align="center" width="60px">
-          <template slot-scope="scope">
-            <div v-if="scope.row.companyName.indexOf('普润') === -1">
-              {{ mapCompany[scope.row.companyName] || scope.row.companyName }}
-            </div>
-
-            <div v-else>
-              <el-popover placement="right" width="200" trigger="hover" content="普润&锦兴&知事">
-                <template #reference>
-                  <i class="el-icon-warning-outline" style="font-size:14px;cursor:pointer"></i>
-                  普润
-                </template>
-              </el-popover>
-            </div>
-          </template>
-        </el-table-column>
-        <el-table-column label="当日营业收入" align="center" width="95px">
-          <template slot-scope="scope">
-            {{ unit2TenThousand(scope.row.sale_total, isTenThound) }}
-          </template>
-        </el-table-column>
-
-          <el-table-column label="营收目标" align="center" min-width="95px">
-            <template slot-scope="scope">
-              {{ unit2TenThousand(scope.row.total_tips, isTenThound) }}
-            </template>
-          </el-table-column>
-
-          <el-table-column label="营业收入(净)" align="center" min-width="115px">
-            <template slot-scope="scope">
-              <div style="display:flex;justify-content:center" :style="`${getCurrentValueStyle(scope.row.msale_total, scope.row.total_tips)}`">
-               {{ unit2TenThousand(scope.row.msale_total, isTenThound) }}
-                <el-popover placement="right" :width="200" trigger="click">
-                  <div class="table-size">
-                    <p>直营/自营: {{ 
-                      unit2TenThousand(scope.row.info[0][0].monthinfo.msale_total, isTenThound)
-                     }}</p>
-                    <p>支付渠道: {{ unit2TenThousand(scope.row.info[0][1].monthinfo.msale_total, isTenThound) }}</p>
-                    <p>供应商端: {{ unit2TenThousand(scope.row.info[0][2].monthinfo.msale_total, isTenThound) }}</p>
-                  </div>
-
-                  <template #reference>
-                    <div :style="`${getCurrentValueStyle(scope.row.msale_total, scope.row.total_tips)}`">
-                      <i class="el-icon-warning-outline trigger-hover" style="font-size:16px;cursor:pointer;margin-left:5px"></i>
-                    </div>
-                  </template>
-                </el-popover>
-              </div>
-            </template>
-          </el-table-column>
-
-          <el-table-column label="营收完成%" align="center" min-width="85px">
-            <template slot-scope="scope">
-              <div :style="`${getCurrentRateStyle(scope.row.completion_rate)}`">{{ (String(scope.row.completion_rate) === 'NaN' ? 0 :  scope.row.completion_rate) + "%" }}
-              </div>
-            </template>
-          </el-table-column>
-
-
-          <template v-if="costField">
-            <el-table-column label="毛利目标" align="center" min-width="90px">
-              <template slot-scope="scope">
-                {{ costField ? unit2TenThousand(scope.row.cost_tips, isTenThound) : '***' }}
-              </template>
-            </el-table-column>
-
-            <el-table-column label="毛利完成" align="center" min-width="90px">
-              <template slot-scope="scope">
-                <div :style="`${getCurrentValueStyle(scope.row.gross_completion, scope.row.cost_tips)}`">
-                  {{ costField ? unit2TenThousand(scope.row.gross_completion, isTenThound) : '***' }}
-                </div>
-              </template>
-            </el-table-column>
-            </template>
-
-
-            <el-table-column label="毛利完成%" align="center" min-width="85px">
-              <template slot-scope="scope">
-                <div :style="getCurrentRateStyle(scope.row.gross_completion_rate)">
-                  {{ scope.row.gross_completion_rate + '%' }}
-                </div>
-              </template>
-            </el-table-column>
-
-          <template v-if="costField">
-            <el-table-column label="成本合计" align="center" min-width="125px">
-              <template slot-scope="scope">
-                <div style="display:flex;justify-content:center" v-if="costField">
-                  {{ unit2TenThousand(scope.row.mcost_total, isTenThound) }}
-                  <el-popover placement="right" :width="200" trigger="click">
-                    <div class="table-size">
-                      <p>直营/自营: {{ unit2TenThousand(scope.row.info[0][0].monthinfo.mcost_total, isTenThound) }}</p>
-                      <p>支付渠道: {{ unit2TenThousand(scope.row.info[0][1].monthinfo.mcost_total, isTenThound) }}</p>
-                      <p>供应商端: {{ unit2TenThousand(scope.row.info[0][2].monthinfo.mcost_total, isTenThound) }}</p>
-                      <p>物流费用: {{ unit2TenThousand(scope.row.info[0][3].monthinfo.mcost_total, isTenThound) }}</p>
-                    </div>
-
-                    <template #reference>
-                      <i class="el-icon-warning-outline trigger-hover" style="font-size:16px;cursor:pointer;margin-left:5px"></i>
-                    </template>
-                  </el-popover>
-                </div>
-
-                <p v-else>***</p>
-              </template>
-            </el-table-column>
-
-            <el-table-column label="实际毛利率" align="center" width="85px">
-              <template slot-scope="scope">
-                <!-- <div :style="`${getCurrentRateStyle(scope.row.gross_sale_completion_rate)}`"> -->
-                {{ costField ? unit2TenThousand(scope.row.gross_sale_completion_rate) + "%" : '***' }}
-                <!-- </div> -->
-              </template>
-            </el-table-column>
-          </template>
-      </el-table>
-    </el-row>
-
     <template v-else>
       <div style="text-align:center;line-height:60px;user-select:none">当前账号没有访问权限</div>
     </template>
@@ -310,8 +205,9 @@
 import { addition, unit2TenThousand, subtraction, multiplication, division } from "../newReport/src/_utils";
 import asyncRequest from "@/api/newResults";
 import { mapCompany } from "./mapCompany";
-import dayjs from "dayjs"
+
 import { amountData } from "./calc"
+import dayjs from "dayjs"
 
 export default {
   props: ['companies', 'costField', 'isTenThound'],
@@ -320,7 +216,6 @@ export default {
       daytime: "",
       loading: false,
       tableData: [],
-      topTable: [],
       companyNo: "",
       plat_cp_companies:[],
       cp_companies: [],
@@ -335,64 +230,36 @@ export default {
     const zsIndex = this.companies.findIndex((item) => item.label === "北京知事文化产业发展有限公司");
 
     if (jxIndex !== -1 || prIndex !== -1 || zsIndex !== -1) hasCompose = true;
-
-    console.log(this.companies)
     this.cp_companies = this.companies.filter((item) => item.label !== "北京锦兴弘昌科技有限公司" && item.label !== "北京普润心堂商贸有限公司" && item.label !== "北京知事文化产业发展有限公司")
     if (hasCompose) this.cp_companies = [...this.cp_companies, { value: "GS2302231124114965", label: "普润&锦兴&知事" }]
 
     this.isEmpty = this.cp_companies.length === 0;
     if (this.isEmpty) return;
 
-    this.cp_companies = this.cp_companies.map((item, index) => {
-      let label = '';
-
-
-      if (item.label === '北京万宇恒通国际科贸有限公司') {
-        label = '平台公司: 万宇'
-      }
-
-      if (item.label === '北京泰文创供应链管理有限公司') {
-        label = '平台公司: 泰文创'
-      }
-
-      if (item.label === '北京元隆雅图文化传播股份有限公司') {
-        label = '预订单E企购'
-      }
-
-      if (item.label === '自营订单') {
-        label = '结算单E企购'
-      }
-
-      if (item.label === '地推订单') {
-        label = '地推订单'
-      }
+    const mapLabel = {
+       '北京万宇恒通国际科贸有限公司': '平台公司: 万宇',
+       '北京泰文创供应链管理有限公司': '平台公司: 泰文创',
+       '北京元隆雅图文化传播股份有限公司': '预订单E企购',
+    }
 
-      if (item.label === "普润&锦兴&知事") label = `业务公司: 普润&锦兴&知事`
-      if (label === '') label = `业务公司: ${mapCompany[item.label]}`;
+    this.cp_companies = this.cp_companies.map((item, index) => {
+      const label = mapLabel[item.label] || item.label
       return ({ ...item, label })
     })
 
 
-    let plat_list = ['所有平台公司','平台公司: 万宇', '平台公司: 泰文创', '预订单E企购', '结算单E企购', '地推订单']
-    
+    let plat_list = ['所有平台公司','平台公司: 万宇', '平台公司: 泰文创', '预订单E企购', '结算单E企购']
     const plat_cp_list = this.cp_companies.map((item) => item.label);
     plat_list = plat_list.filter(item => plat_cp_list.includes(item));
     this.plat_cp_companies = plat_list.map((item) => this.cp_companies.find((cp_item) => cp_item.label === item));
 
-
-    if(this.plat_cp_companies.length === 4){
-      this.plat_cp_companies =  [{ value: "", label: "所有平台公司" }, ...this.plat_cp_companies]
-    }
+    if(this.plat_cp_companies.length === 4){ this.plat_cp_companies =  [{ value: "", label: "所有平台公司" }, ...this.plat_cp_companies] }
 
     this.companyNo = this.plat_cp_companies[0].value;
     this.daytime = this.transformTime();
     this.requestData();
   },
   methods: {
-    isNaN(value){
-      return value === 'NaN' || Number.isNaN(value)
-    },
-    unit2TenThousand,
     calcAmountRealRate(){
       const msale_total = this.calcAmount('msale_total')
       const gross_completion = this.calcAmount('gross_completion') 
@@ -409,22 +276,25 @@ export default {
       return Number(multiplication(Number(division(msale_total, total_tips)).toFixed(2), 100)).toFixed(2) + '%'
     },
     calcAmount(prop, isInfo = false){
-      const sourceData = this.topTable.filter(({companyName}) => companyName !== '合计')
-
+      const sourceData = this.tableData.find(({companyName}) => companyName === '合计-元隆雅图')
       if(!isInfo){
-      console.log(sourceData,prop)
-        return sourceData.reduce((prev,current) => {
+        return sourceData.children.reduce((prev,current) => {
           const value = Number(addition(prev,isNaN(current[prop]) ? 0 : current[prop]))
           return value === 0 ? 0 : value.toFixed(2)
         }, 0)
       } else {
         const [i1, i2,i3, i4] = prop.split('.') 
-        return sourceData.reduce((prev,current) => {
+        return sourceData.children.reduce((prev,current) => {
           const value = Number(addition(prev, isNaN(current.info[i1][i2][i3][i4]) ? 0 : current.info[i1][i2][i3][i4]))
           return value === 0 ? 0 : value.toFixed(2)
         }, 0)
       }
     },
+    unit2TenThousand,
+    load(_1,_2,resolve){
+      const ylBusiness = this.tableData.find(({companyName}) => companyName.indexOf('元隆雅图') !== -1)
+      resolve(ylBusiness ? ylBusiness.children : [])
+    },
     getCurrentRateStyle(current) {
       const days = dayjs(this.daytime).daysInMonth();
       const oneDay = Number(division(100, days)).toFixed(2);
@@ -440,8 +310,6 @@ export default {
       return Number(currentTotalTip) > Number(current) ? 'color: red' : '';
     },
     addDataToCompany(c1, c2) {
-      // Number(addition(c1.total_tips,c2.total_tips)).toFixed(2)
-
       return {
         companyName: '普润',
         cost_tips: Number(c1.cost_tips).toFixed(2),
@@ -466,14 +334,12 @@ export default {
     },
     setCellClassName({ column ,row }) {
       const { label } = column;
-
       let base = ''
 
       if(row.companyName === "北京万宇恒通国际科贸有限公司") {
         base += 'font-bold '
       }
 
-
       if (label === "营收目标")  {
         base += "bg__success"
         return base
@@ -484,7 +350,6 @@ export default {
         return base;
       }
 
-
       if (label === "毛利目标") {
         base += "bg__primary"
         return base
@@ -498,7 +363,6 @@ export default {
         base += "bg__warning_1"
         return base;
       }
-
       return base
     },
     setHeaderClassName({ column }) {
@@ -516,67 +380,77 @@ export default {
       let d = time.getDate();
       return y + "-" + (M < 10 ? "0" + M : M) + "-" + (d < 10 ? "0" + d : d);
     },
-    async requestData() {
+
+    async getData({ isChildren } = { isChildren: false }){
       this.loading = true;
-      this.tableData = [];
-
-      const res = await asyncRequest.companyEveryMonth({ daytime: this.daytime });
-
-      // const jxIndex = res.data.findIndex((item) => item.companyName === "北京锦兴弘昌科技有限公司");
-      // let prIndex = res.data.findIndex((item) => item.companyName === "北京普润心堂商贸有限公司");
-      // let zsIndex = res.data.findIndex((item) => item.companyName === "北京知事文化产业发展有限公司")
-      // if (jxIndex >= 0 && prIndex >= 0) {
-      //   const jxItem = res.data[jxIndex];
-      //   res.data[prIndex] = this.addDataToCompany(jxItem, res.data[prIndex]);
-      //   res.data.splice(jxIndex, 1);
-      // }
-      // prIndex = res.data.findIndex((item) => item.companyName === "北京普润心堂商贸有限公司");
-      // zsIndex = res.data.findIndex((item) => item.companyName === "北京知事文化产业发展有限公司")
-      // if (zsIndex >= 0 && prIndex >= 0) {
-      //   const zsItem = res.data[zsIndex];
-      //   res.data[prIndex] = this.addDataToCompany(zsItem, res.data[prIndex]);
-      //   res.data.splice(zsIndex, 1);
-      // }
-      // if (this.companyNo === "GS2302231124114965") {
-      //   const jxResult = await asyncRequest.companyEveryMonth({ daytime: this.daytime, companyNo: "GS2304031312553746" });
-      //   const zsResult = await asyncRequest.companyEveryMonth({ daytime: this.daytime, companyNo: "GS2401181650538135" });
-      //   res.data[prIndex] = this.addDataToCompany(jxResult.data[0], res.data[prIndex]);
-      //   if(zsResult.data.length !== 0) {
-      //     res.data[prIndex] = this.addDataToCompany(zsResult.data[0], res.data[prIndex]);
-      //   }
-      // }
-      // const isBeforeDate = this.getDiffDay() < 0 && this.companyNo === "GS2302231323386950"
-
-      if (res.code === 0 && res.data && res.data.length > 0) {
-        res.data.forEach(({ companyName,companyNo ,monthinfo, dayinfo, total_tips, cost_tips }) => {
-          const mapResponseType = { '1': '自营', '2': '渠道', '3': '供应商端' ,'4' : '物流费用'} 
+
+      const api = isChildren ? asyncRequest.platform : asyncRequest.companyEveryMonth
+      const res = await api({ daytime: this.daytime });
+      this.loading = false;
+      let sourceData = []
+
+      if ((isChildren ? res.code === 1 : res.code === 0) && res.data && res.data.length > 0) {
+        res.data.forEach(({
+          platform_name,
+          platform_id,
+          companyName, 
+          companyNo , 
+          monthinfo = [], 
+          dayinfo = [], 
+          total_tips = 0, 
+          cost_tips = 0
+        }) => {
+          const mapResponseType = { '1': '自营', '2': '渠道', '3': '供应商端' ,'4' : '物流费用'}
           const types = Object.keys(mapResponseType)
+
           let prev_sale_total = 0;
           let prev_msale_total = 0;
           let prev_cost_total = 0;
           let prev_mcost_total = 0;
 
           const item = types.map(type => {
-            const _monthinfo = monthinfo.find(month => String(month.type) === type) || {}
-            const _dayinfo = dayinfo.find(day => String(day.type) === type) || {}
+            let _monthinfo = (Array.isArray(monthinfo) ? monthinfo : [monthinfo]).find(month => String(month.type) === type) 
+            let _dayinfo = (Array.isArray(dayinfo) ? dayinfo : [dayinfo]).find(day => String(day.type) === type)
+
+            const defaultMonthInfo = { mcgd_th_total :  "0.00", mcgd_total:"0.00", msale_total: "0.00", mth_total: "0.00", type }
+            const defaultDayinfo = { "sale_total": "0.00", "th_total": "0.00", "type": "1", "cgd_total": "0.00", "cgd_th_total": "0.00" }
+
+            if(!_monthinfo) _monthinfo = defaultMonthInfo
+            if(!_dayinfo) _dayinfo = defaultDayinfo
+
+            // 映射接口的字段
+            if(isChildren && 'sum_sale_total' in _dayinfo){
+              _dayinfo = {
+                cgd_total: _dayinfo.sum_cgd_total,
+                sale_total: _dayinfo.sum_sale_total,
+                cgd_th_total: _dayinfo.sum_cgd_th_total,
+                th_total: _dayinfo.sum_th_total,
+                type
+              }
+            }
+
             /** 月营业收入 = 月销售额 - 月退货额  */
             let msale_total = 0;
             if(Number(type) !== 4){ msale_total = subtraction(_monthinfo.msale_total, _monthinfo.mth_total) || 0 }
+
             /** 日营业收入 = 日销售额 - 日退货额 */
             const sale_total = subtraction(_dayinfo.sale_total, _dayinfo.th_total) || 0;
             /** 日成本 = 日采购额 - 日退货额 */
             const cost_total = subtraction(_dayinfo.cgd_total, _dayinfo.cgd_th_total) || 0;
             /** 月成本 = 月采购额 - 月退货额 */
             let mcost_total = 0;
+
             if(Number(type) !== 4){
               mcost_total = subtraction(_monthinfo.mcgd_total, _monthinfo.mcgd_th_total) || 0;
             }else{
               mcost_total = Number(_monthinfo.mcgd_total || 0).toFixed(2);
             }
+
             prev_sale_total = Number(addition(prev_sale_total, sale_total)).toFixed(2);
             prev_msale_total = Number(addition(prev_msale_total, msale_total)).toFixed(2);
             prev_cost_total = Number(addition(prev_cost_total, cost_total)).toFixed(2);
             prev_mcost_total = Number(addition(prev_mcost_total, mcost_total)).toFixed(2);
+
             return {
               type: mapResponseType[type],
               dayinfo: { ..._dayinfo, sale_total },
@@ -587,14 +461,14 @@ export default {
           const gross_completion = Number(subtraction(prev_msale_total, prev_mcost_total)).toFixed(2) //当月毛利完成 = 月营收 - 月成本
 
 
-          this.tableData = [
-            ...this.tableData,
+          sourceData = [
+            ...sourceData,
             {
-              companyNo,
-              companyName,  // 公司名称
+              companyNo: isChildren ? platform_id : companyNo,
+              companyName: isChildren ? platform_name : companyName,  // 公司名称
               cost_tips, // 当月成本指标
               total_tips, // 当月营收目标
-              info: [{ ...item }], // 直营..渠道 销售
+              info: item, // 直营..渠道 销售
               sale_total: prev_sale_total, // 当日营业收入
               cost_total: prev_cost_total, // 当日成本总额
               msale_total: prev_msale_total, // 当月营业收入
@@ -606,44 +480,39 @@ export default {
             }
           ]
         })
+      }else{
+        sourceData = []
+      }
 
-
-
-        let i = ["北京万宇恒通国际科贸有限公司", '北京泰文创供应链管理有限公司' ,"北京元隆雅图文化传播股份有限公司", "结算单E企购", "地推订单"];
-        const values = this.plat_cp_companies.map(({value}) => value)
-        const l = this.tableData.map(item => item.companyName);
-        i = i.filter(item => l.includes(item));
-
-        this.tableData = i.map(item => this.tableData.find(l => l.companyName === item));
-        this.tableData  = this.tableData.filter(({companyNo}) => values.includes(companyNo));
-        this.tableData.forEach(item => { if(item.companyName === '结算单E企购'){ item.companyName = '自营订单' } })
-        console.log(this.tableData)
-
-
-        const sourceData = JSON.parse(JSON.stringify(this.tableData))
-        this.tableData = sourceData.filter(item => item.companyName !== '自营订单' && item.companyName !== '地推订单')
-        const topTable = sourceData.filter((item) => item.companyName === '自营订单' || item.companyName === '地推订单')
-
-        if(topTable.length === 0 || topTable.length === 1){
-          this.topTable = [...topTable]
-        }else{
-          console.log(this.topTable)
-          this.topTable = [
-          amountData,
-            ...topTable
-          ]
-        }
-      } else {
-        this.tableData = [];
-        this.topTable = [];
+      return sourceData
+    },
+    async requestData() {
+      let platformlist = await this.getData()
+
+      //  显示的公司列表
+      let displayedCompanylist = ["北京万宇恒通国际科贸有限公司", '北京泰文创供应链管理有限公司' ,"北京元隆雅图文化传播股份有限公司"];
+      let values = this.plat_cp_companies.map(({value}) => value)
+      const l = platformlist.map(item => item.companyName);
+      displayedCompanylist = displayedCompanylist.filter(item => l.includes(item));
+      platformlist = displayedCompanylist.map(item => platformlist.find(l => l.companyName === item));
+      platformlist  = platformlist.filter(({ companyNo }) => values.includes(companyNo))
+      const composeCompanyIndex = platformlist.findIndex(({ companyNo }) => companyNo === 'GS2404151642335170')
+  
+      if(composeCompanyIndex !== -1){
+        const children = await this.getData({ isChildren: true })
+        const [composeCompany] = platformlist.splice(composeCompanyIndex, 1)
+        platformlist.unshift({ hasChildren: true, children ,...composeCompany })
       }
-      this.loading = false;
+
+      this.tableData = platformlist
     }
   }
 }
 </script>
 
 <style lang="scss" scoped>
+
+
 .new-results {
   .search {
     height: 36px;

+ 13 - 1
src/components/newResultInfo/mapCompany.js

@@ -6,6 +6,18 @@ export const mapCompany = {
   "北京普润心堂商贸有限公司":"普润",
   "北京知事文化产业发展有限公司": "知事",
   "北京泰文创供应链管理有限公司": "泰文创",
-  "北京元隆雅图文化传播股份有限公司": "预订单E企购",
+  "北京元隆雅图文化传播股份有限公司": "北京元隆雅图文化传播股份有限公司",
   "结算单E企购": "结算单E企购",
 }
+
+
+export const mapCompany2 = {
+  "北京百辰荣达国际科贸有限公司":"百辰荣达",
+  "北京泓源广诚国际商贸有限公司":"泓源广诚",
+  "北京万宇恒通国际科贸有限公司":"万宇恒通",
+  "北京锦兴弘昌科技有限公司":"锦兴弘昌",
+  "北京普润心堂商贸有限公司":"普润心堂",
+  "北京知事文化产业发展有限公司": "知事文化",
+  "湖北泽仁文化发展有限公司": "泽仁文化"
+}
+

+ 487 - 0
src/components/newResultInfo/supplier.vue

@@ -0,0 +1,487 @@
+<template>
+  <div v-loading="loading">
+    <div class="search clear" style="align-items: center;">
+      <!-- <el-tooltip
+        placement="top" 
+        trigger="hover" 
+        content="供应商"
+        width="50px"
+      >
+        <i 
+          class="el-icon-warning-outline" 
+          style="
+            font-size:16px;
+            cursor:pointer;
+            display:inline-block;
+            padding-right: 5px;"
+        />
+      </el-tooltip> -->
+
+      <span style="font-size: 15px;">结算单E企购-月度完成情况</span>
+
+      <div style="float:right">
+        <el-date-picker 
+          class="fr picker no-padding" 
+          v-model="daytime" 
+          style="width:95px" 
+          value-format="yyyy-MM-dd"
+          :editable="false" 
+          :disabled="isEmpty" 
+          :clearable="false" 
+          :size="'small'" 
+          format="yyyy-MM-dd" 
+          type="date"
+          align="right" 
+          placeholder="选择日期"
+          :picker-options="{ disabledDate: time => time.getTime() > Date.now() }"
+          @change="requestData"
+        />
+      </div>
+    </div>
+
+    <el-row style="margin-top:10px;margin-top:10px" v-if="!isEmpty">
+      <el-table 
+        border 
+        size="mini" 
+        :data="tableData" 
+        :header-cell-class-name="setHeaderClassName"
+        :cell-class-name="setCellClassName"
+        default-expand-all
+        row-key="companyNo"
+        :load="load"
+        lazy
+       >
+        <el-table-column fixed="left" label="公司" prop="companyName" align="center" width="120px">
+          <template slot-scope="scope">
+            <span v-if="scope.row.companyName.indexOf('合计-') === -1">
+              {{ mapCompany2[scope.row.companyName] || scope.row.companyName }}
+            </span>
+            <span v-else>
+              元隆雅图
+            </span>
+          </template>
+        </el-table-column>
+
+
+        <el-table-column label="当日营业收入" align="center" width="95px">
+          <template slot-scope="scope">
+            {{ 
+                isAmountProp(scope.row.companyName) 
+                  ? unit2TenThousand(calcAmount('sale_total', scope.row.companyNo), isTenThound)  
+                  : unit2TenThousand(scope.row.sale_total, isTenThound) 
+            }}
+          </template>
+        </el-table-column>
+
+          <el-table-column label="营收目标" align="center" min-width="95px">
+            <template slot-scope="scope">
+              {{ 
+                isAmountProp(scope.row.companyName)
+                  ? unit2TenThousand(calcAmount('total_tips',scope.row.companyNo), isTenThound)  
+                  : unit2TenThousand(scope.row.total_tips, isTenThound)
+              }}
+            </template>
+          </el-table-column>
+
+          <el-table-column label="营业收入(净)" align="center" min-width="115px">
+            <template slot-scope="scope">
+              <div style="display:flex;justify-content:center" :style="`${scope.row.companyName === '合计-元隆雅图' ? '' :getCurrentValueStyle(scope.row.msale_total, scope.row.total_tips)}`">
+               {{ 
+                isAmountProp( scope.row.companyName)
+                  ? unit2TenThousand(calcAmount('msale_total', scope.row.companyNo), isTenThound)
+                  : unit2TenThousand(scope.row.msale_total, isTenThound) 
+                }}
+              </div>
+            </template>
+          </el-table-column>
+
+          <el-table-column label="营收完成%" align="center" min-width="85px">
+            <template slot-scope="scope">
+              <div :style="`${isAmountProp(scope.row.companyName) ? '' : getCurrentRateStyle(scope.row.completion_rate)}`">
+                {{ isAmountProp(scope.row.companyName) ? calcAmountCompletionRate(scope.row.companyNo) : (String(scope.row.completion_rate) === 'NaN' ? 0 :  scope.row.completion_rate) + "%" }}
+              </div>
+            </template>
+          </el-table-column>
+
+
+          <template v-if="costField">
+            <el-table-column label="毛利目标" align="center" min-width="90px">
+              <template slot-scope="scope">
+                {{ 
+                  costField 
+                  ? isAmountProp(scope.row.companyName) ? unit2TenThousand(calcAmount('cost_tips',scope.row.companyNo), isTenThound) : unit2TenThousand(scope.row.cost_tips, isTenThound) 
+                  : '***' 
+                }}
+              </template>
+            </el-table-column>
+
+            <el-table-column label="毛利完成" align="center" min-width="90px">
+              <template slot-scope="scope">
+                <div :style="`${scope.row.companyName === '合计-元隆雅图' ? '' : getCurrentValueStyle(scope.row.gross_completion, scope.row.cost_tips)}`">
+                  {{ costField 
+                    ?  isAmountProp(scope.row.companyName) ? unit2TenThousand(calcAmount('gross_completion', scope.row.companyNo), isTenThound) : unit2TenThousand(scope.row.gross_completion, isTenThound) 
+                    : '***' 
+                  }}
+                </div>
+              </template>
+            </el-table-column>
+            </template>
+
+            <el-table-column label="毛利完成%" align="center" min-width="85px">
+              <template slot-scope="scope">
+                <div :style="scope.row.companyName === '合计-元隆雅图' ? '' : getCurrentRateStyle(scope.row.gross_completion_rate)">
+                  {{  isAmountProp(scope.row.companyName) ? calcAmountGrossCompletionRate(scope.row.companyNo) : scope.row.gross_completion_rate + '%' }}
+                </div>
+              </template>
+            </el-table-column>
+
+          <template v-if="costField">
+            <el-table-column label="成本合计" align="center" min-width="125px">
+              <template slot-scope="scope">
+                <div style="display:flex;justify-content:center" v-if="costField">
+                  {{  
+                    isAmountProp(scope.row.companyName)
+                      ? unit2TenThousand(calcAmount('mcost_total', scope.row.companyNo), isTenThound) 
+                      : unit2TenThousand(scope.row.mcost_total, isTenThound) 
+                  }}
+                </div>
+
+                <p v-else>***</p>
+              </template>
+            </el-table-column>
+
+            <el-table-column label="实际毛利率" align="center" width="85px">
+              <template slot-scope="scope">
+                {{ costField 
+                  ? isAmountProp(scope.row.companyName) ? calcAmountRealRate(scope.row.companyNo)  : unit2TenThousand(scope.row.gross_sale_completion_rate) + "%" 
+                  : '***' 
+                }}
+              </template>
+            </el-table-column>
+          </template>
+      </el-table>
+    </el-row>
+
+    <template v-else>
+      <div style="text-align:center;line-height:60px;user-select:none">当前账号没有访问权限</div>
+    </template>
+    <!--  -->
+  </div>
+</template>
+
+
+<script>
+import { addition, unit2TenThousand, subtraction, multiplication, division } from "../newReport/src/_utils";
+import asyncRequest from "@/api/newResults";
+import { mapCompany2 } from "./mapCompany";
+
+import { amountData } from "./calc"
+import dayjs from "dayjs"
+
+export default {
+  props: ['companies', 'costField', 'isTenThound'],
+  data() {
+    return {
+      daytime: "",
+      loading: false,
+      tableData: [],
+      companyNo: "",
+      plat_cp_companies:[],
+      cp_companies: [],
+      isEmpty: false,
+      mapCompany2,
+     composeCompanies: ['QS2206011447553544', 'QS2304031312553756', 'QS2203150147012961'],
+     otherCompanise: [],
+     notOtherCompanise: ['QS2206011447553544', 'QS2304031312553756', 'QS2203150147012961','QS2203150147013805','QS2203150147015222','QS2206011103304501']
+    }
+  },
+  mounted() {
+    let hasCompose = false;
+    const jxIndex = this.companies.findIndex((item) => item.label === "北京锦兴弘昌科技有限公司");
+    const prIndex = this.companies.findIndex((item) => item.label === "北京普润心堂商贸有限公司");
+    const zsIndex = this.companies.findIndex((item) => item.label === "北京知事文化产业发展有限公司");
+
+    if (jxIndex !== -1 || prIndex !== -1 || zsIndex !== -1) hasCompose = true;
+    this.cp_companies = this.companies.filter((item) => item.label !== "北京锦兴弘昌科技有限公司" && item.label !== "北京普润心堂商贸有限公司" && item.label !== "北京知事文化产业发展有限公司")
+    if (hasCompose) this.cp_companies = [...this.cp_companies, { value: "GS2302231124114965", label: "普润&锦兴&知事" }]
+
+    this.isEmpty = this.cp_companies.length === 0;
+    if (this.isEmpty) return;
+
+    this.cp_companies = this.cp_companies.map((item, index) => {
+      let label = '';
+      if (item.label === '北京万宇恒通国际科贸有限公司') { label = '平台公司: 万宇' }
+      if (item.label === '北京泰文创供应链管理有限公司') { label = '平台公司: 泰文创' }
+      if (item.label === '北京元隆雅图文化传播股份有限公司') { label = '预订单E企购' }
+      if (item.label === '结算单E企购') { label = '结算单E企购' }
+      if (item.label === "普润&锦兴&知事") label = `业务公司: 普润&锦兴&知事`
+      if (label === '') label = `业务公司: ${mapCompany2[item.label]}`;
+      return ({ ...item, label })
+    })
+
+
+    let plat_list = ['所有平台公司','平台公司: 万宇', '平台公司: 泰文创', '预订单E企购', '结算单E企购']
+    const plat_cp_list = this.cp_companies.map((item) => item.label);
+    plat_list = plat_list.filter(item => plat_cp_list.includes(item));
+    this.plat_cp_companies = plat_list.map((item) => this.cp_companies.find((cp_item) => cp_item.label === item));
+
+    if(this.plat_cp_companies.length === 4){ this.plat_cp_companies =  [{ value: "", label: "所有平台公司" }, ...this.plat_cp_companies] }
+
+    this.companyNo = this.plat_cp_companies[0].value;
+    this.daytime = this.transformTime();
+    this.requestData();
+  },
+  methods: {
+    calcAmountRealRate(companyNo){
+      // if(companyNo === 'otherSupplier') return '-'
+      const msale_total = this.calcAmount('msale_total',companyNo)
+      const gross_completion = this.calcAmount('gross_completion',companyNo) 
+      return Number(multiplication(Number(division(gross_completion, msale_total)).toFixed(2), 100)).toFixed(2) + '%'
+    },
+    calcAmountGrossCompletionRate(companyNo){
+       if(companyNo === 'otherSupplier') return '-%'
+      const gross_completion = this.calcAmount('gross_completion', companyNo)
+      const cost_tips = this.calcAmount('cost_tips', companyNo)
+      return Number(multiplication(Number(division(gross_completion, cost_tips)).toFixed(2), 100)).toFixed(2) + '%'
+    },
+    calcAmountCompletionRate(companyNo){
+      if(companyNo === 'otherSupplier') return '-%'
+      const msale_total = this.calcAmount('msale_total', companyNo)
+      const total_tips = this.calcAmount('total_tips', companyNo)
+      return Number(multiplication(Number(division(msale_total, total_tips)).toFixed(2), 100)).toFixed(2) + '%'
+    },
+    calcAmount(prop, companyNo){
+      let sourceData = []
+      if(companyNo === 'compoeseSupplier') {
+        sourceData = this.tableData.find(({companyName}) => companyName === '普润').children
+      }else{
+        if(prop === 'total_tips' || prop === 'cost_tips'){
+          return '-'
+        }
+        sourceData = this.otherCompanise
+      }
+
+      return sourceData.reduce((prev, current) => {
+        const value = Number(addition(prev,isNaN(current[prop]) ? 0 : current[prop]))
+        return value === 0 ? 0 : value.toFixed(2)
+      }, 0)
+    },
+    isAmountProp(companyName){
+      return companyName === '普润' || companyName === '其他'
+    },
+    load(_1,_2,resolve){
+      const ylBusiness = this.tableData.find(({companyNo}) => companyNo === 'compoeseSupplier')
+      resolve(ylBusiness ? ylBusiness.children : [])
+    },
+    unit2TenThousand,
+    getCurrentRateStyle(current) {
+      const days = dayjs(this.daytime).daysInMonth();
+      const oneDay = Number(division(100, days)).toFixed(2);
+      const currentDay = dayjs(this.daytime).date();
+      const currentTotalTip = Number(multiplication(currentDay, oneDay)).toFixed(2);
+      return Number(currentTotalTip) > Number(current) ? 'color:red' : ''
+    },
+    getCurrentValueStyle(current, total) {
+      const days = dayjs(this.daytime).daysInMonth();
+      const oneDay = Number(division(total, days)).toFixed(2);
+      const currentDay = dayjs(this.daytime).date();
+      const currentTotalTip = Number(multiplication(currentDay, oneDay)).toFixed(2);
+      return Number(currentTotalTip) > Number(current) ? 'color: red' : '';
+    },
+    setCellClassName({ column, row }) {
+      const { label } = column;
+      let base = ''
+
+      if(row.companyName === "北京万宇恒通国际科贸有限公司") {
+        base += 'font-bold '
+      }
+
+      if (label === "营收目标")  {
+        base += "bg__success"
+        return base
+      }
+
+      if ((label.indexOf('营业') !== -1 || label.indexOf('营收') !== -1) && label !== '当日营业收入') {
+        base += "bg__success_1"
+        return base;
+      }
+
+      if (label === "毛利目标") {
+        base += "bg__primary"
+        return base
+      }
+
+      if (label.indexOf('毛利') !== -1) {
+        base += "bg__primary_1"
+        return base;
+      }
+      if (label.indexOf('成本') !== -1) {
+        base += "bg__warning_1"
+        return base;
+      }
+      return base
+    },
+    setHeaderClassName({ column }) {
+      const { label } = column;
+      if (label === "营收目标") { return "bg__success" }
+      if ((label.indexOf('营业') !== -1 || label.indexOf('营收') !== -1) && label !== '当日营业收入'){
+         return "bg__success_1"
+      }
+
+      if (label === "毛利目标"){ return "bg__primary" }
+      if (label.indexOf('毛利') !== -1) { return "bg__primary_1" }
+      if (label.indexOf('成本') !== -1) { return "bg__warning_1" }
+    },
+    transformTime() {
+      let time = new Date();
+      let y = time.getFullYear();
+      let M = time.getMonth() + 1;
+      let d = time.getDate();
+      return y + "-" + (M < 10 ? "0" + M : M) + "-" + (d < 10 ? "0" + d : d);
+    },
+    async requestData() {
+      this.loading = true;
+      this.tableData = [];
+      const res = await asyncRequest.supplier({ daytime: this.daytime });
+      let sourceData = []
+      if (res.code === 1 && res.data && res.data.length > 0) {
+        res.data.forEach(({ 
+          supplierName,
+          supplierNo,
+          total_tips,
+          monthinfo, 
+          cost_tips,
+          dayinfo,
+          is_sup
+         }) => {
+          const mapResponseType = { '1': '自营'}
+          const types = Object.keys(mapResponseType)
+          let prev_sale_total = 0;
+          let prev_msale_total = 0;
+          let prev_cost_total = 0;
+          let prev_mcost_total = 0;
+
+          const item = types.map(type => {
+            let _monthinfo = (Array.isArray(monthinfo) ? monthinfo : [monthinfo])[0]
+            let _dayinfo = (Array.isArray(dayinfo) ? dayinfo : dayinfo)[0]
+            const defaultMonthInfo = { mcgd_th_total :  "0.00", mcgd_total:"0.00", msale_total: "0.00", mth_total: "0.00", type }
+            const defaultDayinfo = { "sale_total": "0.00", "th_total": "0.00", "type": "1", "cgd_total": "0.00", "cgd_th_total": "0.00" }
+            if(!_monthinfo) _monthinfo = defaultMonthInfo
+            if(!_dayinfo) _dayinfo = defaultDayinfo
+            /** 月营业收入 = 月销售额 - 月退货额  */
+            let msale_total = 0;
+            if('msale_th_total' in _monthinfo){ _monthinfo.mth_total = _monthinfo.msale_th_total }
+            // if(Number(type) !== 4){
+              msale_total = subtraction(_monthinfo.msale_total, _monthinfo.mth_total) || 0
+            // }
+            /** 日营业收入 = 日销售额 - 日退货额 */
+            const sale_total = subtraction(_dayinfo.sale_total, _dayinfo.th_total) || 0;
+            /** 日成本 = 日采购额 - 日退货额 */
+            const cost_total = subtraction(_dayinfo.cgd_total, _dayinfo.cgd_th_total) || 0;
+            /** 月成本 = 月采购额 - 月退货额 */
+            let mcost_total = 0;
+            // if(Number(type) !== 4){
+              mcost_total = subtraction(_monthinfo.mcgd_total, _monthinfo.mcgd_th_total) || 0;
+            // }else{
+            //   mcost_total = Number(_monthinfo.mcgd_total || 0).toFixed(2);
+            // }
+            prev_sale_total = Number(addition(prev_sale_total, sale_total)).toFixed(2);
+            prev_msale_total = Number(addition(prev_msale_total, msale_total)).toFixed(2);
+            prev_cost_total = Number(addition(prev_cost_total, cost_total)).toFixed(2);
+            prev_mcost_total = Number(addition(prev_mcost_total, mcost_total)).toFixed(2);
+
+            return {
+              type: mapResponseType[type],
+              dayinfo: { ..._dayinfo, sale_total },
+              monthinfo: { ...monthinfo, msale_total, mcost_total }
+            }
+          })
+
+          const gross_completion = Number(subtraction(prev_msale_total, prev_mcost_total)).toFixed(2) //当月毛利完成 = 月营收 - 月成本
+
+          console.log(supplierName, gross_completion, total_tips)
+
+          sourceData = [
+            ...sourceData,
+            {
+              is_sup,
+              companyNo: supplierNo,
+              companyName: supplierName,  // 公司名称
+              cost_tips, // 当月成本指标
+              total_tips, // 当月营收目标
+              info: item[0], // 直营..渠道 销售
+              sale_total: prev_sale_total, // 当日营业收入
+              cost_total: prev_cost_total, // 当日成本总额
+              msale_total: prev_msale_total, // 当月营业收入
+              mcost_total: prev_mcost_total,// 当月成本总额
+              gross_completion, //当月毛利完成 = 月营收 - 月成本
+              completion_rate: total_tips === '-' ? '-' : multiplication(division(prev_msale_total, total_tips), 100).toFixed(2), // 当月应收完成率
+              gross_completion_rate: cost_tips === '-' ? '-' :Number(cost_tips) === 0 ? 0 : multiplication(division(gross_completion, cost_tips) || 0, 100).toFixed(2), // 当月毛利完成率
+              gross_sale_completion_rate: Number(multiplication(division(gross_completion, prev_msale_total) || 0, 100)).toFixed(2), // 本月毛利率 =  当月毛利完成 / 当月营业收入
+            }
+          ]
+        })
+
+        const children = sourceData.filter(({companyNo}) => this.composeCompanies.includes(companyNo))
+        this.otherCompanise = sourceData.filter(({is_sup}) => is_sup === 1)
+        sourceData = sourceData.filter(({companyNo}) =>  !this.composeCompanies.includes(companyNo) && this.notOtherCompanise.includes(companyNo))
+        console.log(this.otherCompanise)
+
+        sourceData = [
+          {
+            ...amountData,
+            companyName: '普润',
+            companyNo: 'compoeseSupplier',
+            hasChildren: true,
+            children
+          },
+          ...sourceData,
+          {
+            ...amountData,
+            companyNo:'otherSupplier',
+            companyName: '其他'
+          }
+        ]
+
+
+        this.tableData = sourceData
+      } else {
+        this.tableData = [];
+      }
+      this.loading = false;
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+
+.new-results {
+  .search {
+    height: 36px;
+    padding: 0px 10px;
+    margin-top: 10px;
+    flex-wrap: wrap;
+  }
+}
+
+.table-size {
+  display: flex;
+  width: 200px;
+  border: 1px solid #ebeef5;
+  flex-direction: column;
+
+  p {
+    flex: 1;
+    border-bottom: 1px solid #ebeef5;
+    padding: 5px 10px;
+    margin: 0px;
+
+    &:last-child {
+      border: none;
+    }
+  }
+}
+</style>
+

+ 0 - 188
src/components/newResults/calc.js

@@ -1,188 +0,0 @@
-export const amountData = {
-  "companyNo": "",
-  "companyName": "合计",
-  "cost_tips": "0",
-  "total_tips": "0",
-  "info": [
-      {
-          "0": {
-              "type": "自营",
-              "dayinfo": {
-                  "sale_total": "0.00",
-                  "th_total": "0.00",
-                  "type": "1",
-                  "cgd_total": "0.00",
-                  "cgd_th_total": "0.00"
-              },
-              "monthinfo": {
-                  "0": {
-                      "msale_total": "0.00",
-                      "mth_total": "0.00",
-                      "mcgd_total": "0.00",
-                      "mcgd_th_total": "0.00",
-                      "type": "1"
-                  },
-                  "1": {
-                      "msale_total": "0.00",
-                      "mth_total": "0.00",
-                      "mcgd_total": "0.00",
-                      "mcgd_th_total": "0.00",
-                      "type": "2"
-                  },
-                  "2": {
-                      "msale_total": "0.00",
-                      "mth_total": "0.00",
-                      "mcgd_total": "0.00",
-                      "mcgd_th_total": "0.00",
-                      "type": "3"
-                  },
-                  "3": {
-                      "msale_total": "0.00",
-                      "mth_total": "0.00",
-                      "mcgd_total": "618.00",
-                      "mcgd_th_total": "0.00",
-                      "type": "4"
-                  },
-                  "msale_total": "0.00",
-                  "mcost_total": "0.00"
-              }
-          },
-          "1": {
-              "type": "渠道",
-              "dayinfo": {
-                  "sale_total": "0.00",
-                  "th_total": "0.00",
-                  "type": "2",
-                  "cgd_total": "327.60",
-                  "cgd_th_total": "0.00"
-              },
-              "monthinfo": {
-                  "0": {
-                      "msale_total": "5868465.56",
-                      "mth_total": "44010.00",
-                      "mcgd_total": "5680337.10",
-                      "mcgd_th_total": "42689.70",
-                      "type": "1"
-                  },
-                  "1": {
-                      "msale_total": "3545201.62",
-                      "mth_total": "1901822.96",
-                      "mcgd_total": "3352074.44",
-                      "mcgd_th_total": "1799760.03",
-                      "type": "2"
-                  },
-                  "2": {
-                      "msale_total": "1951934.40",
-                      "mth_total": "0.00",
-                      "mcgd_total": "0.00",
-                      "mcgd_th_total": "0.00",
-                      "type": "3"
-                  },
-                  "3": {
-                      "msale_total": "0.00",
-                      "mth_total": "0.00",
-                      "mcgd_total": "618.00",
-                      "mcgd_th_total": "0.00",
-                      "type": "4"
-                  },
-                  "msale_total": "1643378.66",
-                  "mcost_total": "1552314.41"
-              }
-          },
-          "2": {
-              "type": "供应商端",
-              "dayinfo": {
-                  "sale_total": "0.00",
-                  "th_total": "0.00",
-                  "type": "3",
-                  "cgd_total": "0.00",
-                  "cgd_th_total": "0.00"
-              },
-              "monthinfo": {
-                  "0": {
-                      "msale_total": "5868465.56",
-                      "mth_total": "44010.00",
-                      "mcgd_total": "5680337.10",
-                      "mcgd_th_total": "42689.70",
-                      "type": "1"
-                  },
-                  "1": {
-                      "msale_total": "3545201.62",
-                      "mth_total": "1901822.96",
-                      "mcgd_total": "3352074.44",
-                      "mcgd_th_total": "1799760.03",
-                      "type": "2"
-                  },
-                  "2": {
-                      "msale_total":0,
-                      "mth_total": "0.00",
-                      "mcgd_total": "0.00",
-                      "mcgd_th_total": "0.00",
-                      "type": "3"
-                  },
-                  "3": {
-                      "msale_total": "0.00",
-                      "mth_total": "0.00",
-                      "mcgd_total": "618.00",
-                      "mcgd_th_total": "0.00",
-                      "type": "4"
-                  },
-                  "msale_total": 0,
-                  "mcost_total": "0.00"
-              }
-          },
-          "3": {
-              "type": "物流费用",
-              "dayinfo": {
-                  "sale_total": "0.00",
-                  "th_total": "0.00",
-                  "type": "4",
-                  "cgd_total": "0.00",
-                  "cgd_th_total": "0.00"
-              },
-              "monthinfo": {
-                  "0": {
-                      "msale_total": 0,
-                      "mth_total": 0,
-                      "mcgd_total": 0,
-                      "mcgd_th_total": 0,
-                      "type": "1"
-                  },
-                  "1": {
-                      "msale_total":0,
-                      "mth_total": 0,
-                      "mcgd_total":0,
-                      "mcgd_th_total": 0,
-                      "type": "2"
-                  },
-                  "2": {
-                      "msale_total": 0,
-                      "mth_total": "0.00",
-                      "mcgd_total": "0.00",
-                      "mcgd_th_total": "0.00",
-                      "type": "3"
-                  },
-                  "3": {
-                      "msale_total": "0.00",
-                      "mth_total": "0.00",
-                      "mcgd_total": 0,
-                      "mcgd_th_total": "0.00",
-                      "type": "4"
-                  },
-                  "msale_total": 0,
-                  "mcost_total":0
-              }
-          }
-      }
-  ],
-  "sale_total": 0,
-  "cost_total": 0,
-  "msale_total": 0,
-  "mcost_total":0,
-  "gross_completion": 0,
-  "completion_rate":0,
-  "gross_completion_rate": 0,
-  "gross_sale_completion_rate": "0.00"
-}
-
-export function calcAmount(){}

+ 12 - 0
src/components/newResults/company-month.vue

@@ -137,9 +137,21 @@ export default {
 
     let list = ['所有公司','平台公司: 万宇','业务公司: 百辰','业务公司: 泓源','业务公司: 普润&锦兴&知事','平台公司: 泰文创', '预订单E企购', '结算单E企购']
     const cp_list = this.cp_companies.map((item) => item.label);
+
     list = list.filter(item => cp_list.includes(item));
+
     this.cp_companies = list.map((item) => this.cp_companies.find((cp_item) => cp_item.label === item));
+
+    // if(this.cp_companies.length >= 4){
+    //   this.cp_companies = [{
+    //     value:'',
+    //     label:'所有公司'
+    //   },...this.cp_companies];
+    // }
+
+
     this.companyNo = this.cp_companies[0].value;
+
     this.daytime = this.transformTime();
     this.requestData();
   },

+ 40 - 239
src/components/newResults/company.vue

@@ -2,10 +2,21 @@
   <div v-loading="loading">
     <div class="search clear" style="align-items: center;;">
       <el-tooltip placement="top" width="50px" trigger="hover" content="平台公司">
-          <i class="el-icon-warning-outline" style="font-size:16px;cursor:pointer;;display:inline-block;padding-right: 5px" ></i>
-      </el-tooltip>
-      <span style="font-size: 15px;">月度完成情况</span>
+            <i
+              class="el-icon-warning-outline"
+              style="font-size:16px;cursor:pointer;;display:inline-block;padding-right: 5px"
+            ></i>
+        </el-tooltip>
+
+        <span style="font-size: 15px;">月度完成情况</span>
+
       <div style="float:right">
+          <!--
+                    <el-select size="small" style="margin-right:10px;width:150px" v-model="companyNo" @change="requestData"
+          :disabled="isEmpty">
+          <el-option v-for="company in plat_cp_companies" :key="company.value" :value="company.value" :label="company.label" />
+        </el-select>
+          -->
         <el-date-picker class="fr picker no-padding" v-model="daytime" style="width:95px" value-format="yyyy-MM-dd"
           :editable="false" :disabled="isEmpty" :clearable="false" :size="'small'" format="yyyy-MM-dd" type="date"
           align="right" placeholder="选择日期"
@@ -13,170 +24,6 @@
       </div>
     </div>
 
-    <el-row style="margin-top:10px;margin-top:10px;margin-bottom:10px" v-if="!isEmpty">
-      <el-table border size="mini" :data="topTable" :header-cell-class-name="setHeaderClassName"
-        :cell-class-name="setCellClassName">
-        <el-table-column fixed="left" label="公司" prop="companyName" align="center" width="70px">
-          <template slot-scope="scope">
-            <div v-if="scope.row.companyName === '结算单E企购'">
-              自营订单
-            </div>
-            <div v-else>
-              {{ scope.row.companyName }}
-            </div>
-          </template>
-        </el-table-column>
-        <el-table-column label="当日营业收入" align="center" width="95px">
-          <template slot-scope="scope">
-            {{ scope.row.companyName === '合计' ? unit2TenThousand(calcAmount('sale_total'), isTenThound)  : unit2TenThousand(scope.row.sale_total, isTenThound) }}
-          </template>
-        </el-table-column>
-
-          <el-table-column label="营收目标" align="center" min-width="95px">
-            <template slot-scope="scope">
-              {{ scope.row.companyName === '合计' ? unit2TenThousand(calcAmount('total_tips'), isTenThound)  : unit2TenThousand(scope.row.total_tips, isTenThound) }}
-            </template>
-          </el-table-column>
-
-          <el-table-column label="营业收入(净)" align="center" min-width="115px">
-            <template slot-scope="scope">
-              <div style="display:flex;justify-content:center" :style="`${scope.row.companyName === '合计' ? '' :getCurrentValueStyle(scope.row.msale_total, scope.row.total_tips)}`">
-               {{ 
-                  scope.row.companyName === '合计' 
-                  ? unit2TenThousand(calcAmount('msale_total'), isTenThound)
-                  : unit2TenThousand(scope.row.msale_total, isTenThound) 
-                }}
-                <el-popover placement="right" :width="200" trigger="click">
-                  <div class="table-size">
-                    <p>直营/自营: {{ 
-                    scope.row.companyName === '合计' 
-                        ? unit2TenThousand(calcAmount('0.0.monthinfo.msale_total', true), isTenThound) 
-                        : unit2TenThousand(scope.row.info[0][0].monthinfo.msale_total, isTenThound) 
-                      }}</p>
-                    <p>支付渠道: {{ 
-                    scope.row.companyName === '合计' 
-                       ? unit2TenThousand(calcAmount('0.1.monthinfo.msale_total', true), isTenThound)
-                       : unit2TenThousand(scope.row.info[0][1].monthinfo.msale_total, isTenThound) 
-                      }}</p>
-                    <p>供应商端: {{ 
-                      scope.row.companyName === '合计' 
-                      ?  unit2TenThousand(calcAmount('0.2.monthinfo.msale_total', true), isTenThound)
-                      :  unit2TenThousand(scope.row.info[0][2].monthinfo.msale_total, isTenThound) }}
-                    </p>
-                  </div>
-
-                  <template #reference>
-                    <div :style="`${getCurrentValueStyle(scope.row.msale_total, scope.row.total_tips)}`">
-                      <i class="el-icon-warning-outline trigger-hover" style="font-size:16px;cursor:pointer;margin-left:5px"></i>
-                    </div>
-                  </template>
-                </el-popover>
-              </div>
-            </template>
-          </el-table-column>
-
-          <el-table-column label="营收完成%" align="center" min-width="85px">
-            <template slot-scope="scope">
-              <div :style="`${scope.row.companyName === '合计' ? '' : getCurrentRateStyle(scope.row.completion_rate)}`">
-                {{ scope.row.companyName === '合计' ? calcAmountCompletionRate() : (String(scope.row.completion_rate) === 'NaN' ? 0 :  scope.row.completion_rate) + "%" }}
-              </div>
-            </template>
-          </el-table-column>
-
-
-          <template v-if="costField">
-            <el-table-column label="毛利目标" align="center" min-width="90px">
-              <template slot-scope="scope">
-                {{ 
-                  costField 
-                  ? scope.row.companyName === '合计' ? unit2TenThousand(calcAmount('cost_tips'), isTenThound) : unit2TenThousand(scope.row.cost_tips, isTenThound) 
-                  : '***' 
-                }}
-              </template>
-            </el-table-column>
-
-            <el-table-column label="毛利完成" align="center" min-width="90px">
-              <template slot-scope="scope">
-                <div :style="`${scope.row.companyName === '合计' ? '' : getCurrentValueStyle(scope.row.gross_completion, scope.row.cost_tips)}`">
-                  {{ costField 
-                    ?  scope.row.companyName === '合计' ? unit2TenThousand(calcAmount('gross_completion'), isTenThound) : unit2TenThousand(scope.row.gross_completion, isTenThound) 
-                    : '***' 
-                  }}
-                </div>
-              </template>
-            </el-table-column>
-            </template>
-
-
-            <el-table-column label="毛利完成%" align="center" min-width="85px">
-              <template slot-scope="scope">
-                <div :style="scope.row.companyName === '合计' ? '' : getCurrentRateStyle(scope.row.gross_completion_rate)">
-                  {{  scope.row.companyName === '合计' ? calcAmountGrossCompletionRate() : scope.row.gross_completion_rate + '%' }}
-                </div>
-              </template>
-            </el-table-column>
-
-          <template v-if="costField">
-            <el-table-column label="成本合计" align="center" min-width="125px">
-              <template slot-scope="scope">
-                <div style="display:flex;justify-content:center" v-if="costField">
-                  {{ scope.row.companyName === '合计' 
-                    ? unit2TenThousand(calcAmount('mcost_total'), isTenThound) 
-                    : unit2TenThousand(scope.row.mcost_total, isTenThound) 
-                  }}
-                  <el-popover placement="right" :width="200" trigger="click">
-                    <div class="table-size">
-                      <p>直营/自营: 
-                        {{
-                          scope.row.companyName === '合计'
-                          ? unit2TenThousand(calcAmount('0.0.monthinfo.mcost_total',true),isTenThound)
-                          : unit2TenThousand(scope.row.info[0][0].monthinfo.mcost_total, isTenThound) 
-                        }}
-                      </p>
-                      <p>支付渠道: 
-                        {{ 
-                          scope.row.companyName === '合计'
-                          ? unit2TenThousand(calcAmount('0.1.monthinfo.mcost_total', true), isTenThound)
-                          : unit2TenThousand(scope.row.info[0][1].monthinfo.mcost_total, isTenThound)
-                        }}</p>
-                      <p>供应商端: 
-                        {{ 
-                         scope.row.companyName === '合计'
-                          ? unit2TenThousand(calcAmount('0.2.monthinfo.mcost_total', true),isTenThound)
-                          : unit2TenThousand(scope.row.info[0][2].monthinfo.mcost_total, isTenThound)  
-                        }}</p>
-                      <p>物流费用: 
-                        {{
-                          scope.row.companyName === '合计'
-                           ? unit2TenThousand(calcAmount('0.3.monthinfo.mcost_total', true), isTenThound)
-                           : unit2TenThousand(scope.row.info[0][3].monthinfo.mcost_total, isTenThound)
-                        }}
-                      </p>
-                    </div>
-
-                    <template #reference>
-                      <i class="el-icon-warning-outline trigger-hover" style="font-size:16px;cursor:pointer;margin-left:5px"></i>
-                    </template>
-                  </el-popover>
-                </div>
-
-                <p v-else>***</p>
-              </template>
-            </el-table-column>
-
-            <el-table-column label="实际毛利率" align="center" width="85px">
-              <template slot-scope="scope">
-                {{ costField 
-                  ?  scope.row.companyName === '合计' ? calcAmountRealRate()  : unit2TenThousand(scope.row.gross_sale_completion_rate) + "%" 
-                  : '***' 
-                }}
-              </template>
-            </el-table-column>
-          </template>
-      </el-table>
-    </el-row>
-
-
     <el-row style="margin-top:10px;margin-top:10px" v-if="!isEmpty">
       <el-table border size="mini" :data="tableData" :header-cell-class-name="setHeaderClassName"
         :cell-class-name="setCellClassName">
@@ -214,9 +61,7 @@
                {{ unit2TenThousand(scope.row.msale_total, isTenThound) }}
                 <el-popover placement="right" :width="200" trigger="click">
                   <div class="table-size">
-                    <p>直营/自营: {{ 
-                      unit2TenThousand(scope.row.info[0][0].monthinfo.msale_total, isTenThound)
-                     }}</p>
+                    <p>直营/自营: {{ unit2TenThousand(scope.row.info[0][0].monthinfo.msale_total, isTenThound) }}</p>
                     <p>支付渠道: {{ unit2TenThousand(scope.row.info[0][1].monthinfo.msale_total, isTenThound) }}</p>
                     <p>供应商端: {{ unit2TenThousand(scope.row.info[0][2].monthinfo.msale_total, isTenThound) }}</p>
                   </div>
@@ -311,7 +156,6 @@ import { addition, unit2TenThousand, subtraction, multiplication, division } fro
 import asyncRequest from "@/api/newResults";
 import { mapCompany } from "./mapCompany";
 import dayjs from "dayjs"
-import { amountData } from "./calc"
 
 export default {
   props: ['companies', 'costField', 'isTenThound'],
@@ -320,7 +164,6 @@ export default {
       daytime: "",
       loading: false,
       tableData: [],
-      topTable: [],
       companyNo: "",
       plat_cp_companies:[],
       cp_companies: [],
@@ -335,8 +178,6 @@ export default {
     const zsIndex = this.companies.findIndex((item) => item.label === "北京知事文化产业发展有限公司");
 
     if (jxIndex !== -1 || prIndex !== -1 || zsIndex !== -1) hasCompose = true;
-
-    console.log(this.companies)
     this.cp_companies = this.companies.filter((item) => item.label !== "北京锦兴弘昌科技有限公司" && item.label !== "北京普润心堂商贸有限公司" && item.label !== "北京知事文化产业发展有限公司")
     if (hasCompose) this.cp_companies = [...this.cp_companies, { value: "GS2302231124114965", label: "普润&锦兴&知事" }]
 
@@ -359,21 +200,19 @@ export default {
         label = '预订单E企购'
       }
 
-      if (item.label === '自营订单') {
+      if (item.label === '结算单E企购') {
         label = '结算单E企购'
       }
 
-      if (item.label === '地推订单') {
-        label = '地推订单'
-      }
-
       if (item.label === "普润&锦兴&知事") label = `业务公司: 普润&锦兴&知事`
       if (label === '') label = `业务公司: ${mapCompany[item.label]}`;
       return ({ ...item, label })
     })
 
 
-    let plat_list = ['所有平台公司','平台公司: 万宇', '平台公司: 泰文创', '预订单E企购', '结算单E企购', '地推订单']
+    let plat_list = ['所有平台公司','平台公司: 万宇', '平台公司: 泰文创', '预订单E企购', '结算单E企购']
+
+    // let bu_list = ['所有业务公司','平台公司: 万宇','业务公司: 百辰','业务公司: 泓源','业务公司: 普润&锦兴&知事', '平台公司: 泰文创'];
     
     const plat_cp_list = this.cp_companies.map((item) => item.label);
     plat_list = plat_list.filter(item => plat_cp_list.includes(item));
@@ -389,42 +228,7 @@ export default {
     this.requestData();
   },
   methods: {
-    isNaN(value){
-      return value === 'NaN' || Number.isNaN(value)
-    },
     unit2TenThousand,
-    calcAmountRealRate(){
-      const msale_total = this.calcAmount('msale_total')
-      const gross_completion = this.calcAmount('gross_completion') 
-      return Number(multiplication(Number(division(gross_completion, msale_total)).toFixed(2), 100)).toFixed(2) + '%'
-    },
-    calcAmountGrossCompletionRate(){
-      const gross_completion = this.calcAmount('gross_completion')
-      const cost_tips = this.calcAmount('cost_tips')
-      return Number(multiplication(Number(division(gross_completion, cost_tips)).toFixed(2), 100)).toFixed(2) + '%'
-    },
-    calcAmountCompletionRate(){
-      const msale_total = this.calcAmount('msale_total')
-      const total_tips = this.calcAmount('total_tips')
-      return Number(multiplication(Number(division(msale_total, total_tips)).toFixed(2), 100)).toFixed(2) + '%'
-    },
-    calcAmount(prop, isInfo = false){
-      const sourceData = this.topTable.filter(({companyName}) => companyName !== '合计')
-
-      if(!isInfo){
-      console.log(sourceData,prop)
-        return sourceData.reduce((prev,current) => {
-          const value = Number(addition(prev,isNaN(current[prop]) ? 0 : current[prop]))
-          return value === 0 ? 0 : value.toFixed(2)
-        }, 0)
-      } else {
-        const [i1, i2,i3, i4] = prop.split('.') 
-        return sourceData.reduce((prev,current) => {
-          const value = Number(addition(prev, isNaN(current.info[i1][i2][i3][i4]) ? 0 : current.info[i1][i2][i3][i4]))
-          return value === 0 ? 0 : value.toFixed(2)
-        }, 0)
-      }
-    },
     getCurrentRateStyle(current) {
       const days = dayjs(this.daytime).daysInMonth();
       const oneDay = Number(division(100, days)).toFixed(2);
@@ -549,8 +353,11 @@ export default {
 
       if (res.code === 0 && res.data && res.data.length > 0) {
         res.data.forEach(({ companyName,companyNo ,monthinfo, dayinfo, total_tips, cost_tips }) => {
-          const mapResponseType = { '1': '自营', '2': '渠道', '3': '供应商端' ,'4' : '物流费用'} 
+
+          const mapResponseType = { '1': '自营', '2': '渠道', '3': '供应商端' ,'4' : '物流费用'}
+
           const types = Object.keys(mapResponseType)
+
           let prev_sale_total = 0;
           let prev_msale_total = 0;
           let prev_cost_total = 0;
@@ -559,24 +366,34 @@ export default {
           const item = types.map(type => {
             const _monthinfo = monthinfo.find(month => String(month.type) === type) || {}
             const _dayinfo = dayinfo.find(day => String(day.type) === type) || {}
+
             /** 月营业收入 = 月销售额 - 月退货额  */
             let msale_total = 0;
-            if(Number(type) !== 4){ msale_total = subtraction(_monthinfo.msale_total, _monthinfo.mth_total) || 0 }
+            if(Number(type) !== 4){
+              msale_total = subtraction(_monthinfo.msale_total, _monthinfo.mth_total) || 0
+            }
+
             /** 日营业收入 = 日销售额 - 日退货额 */
             const sale_total = subtraction(_dayinfo.sale_total, _dayinfo.th_total) || 0;
             /** 日成本 = 日采购额 - 日退货额 */
             const cost_total = subtraction(_dayinfo.cgd_total, _dayinfo.cgd_th_total) || 0;
+
             /** 月成本 = 月采购额 - 月退货额 */
             let mcost_total = 0;
+
             if(Number(type) !== 4){
               mcost_total = subtraction(_monthinfo.mcgd_total, _monthinfo.mcgd_th_total) || 0;
             }else{
               mcost_total = Number(_monthinfo.mcgd_total || 0).toFixed(2);
             }
+
+
             prev_sale_total = Number(addition(prev_sale_total, sale_total)).toFixed(2);
             prev_msale_total = Number(addition(prev_msale_total, msale_total)).toFixed(2);
             prev_cost_total = Number(addition(prev_cost_total, cost_total)).toFixed(2);
             prev_mcost_total = Number(addition(prev_mcost_total, mcost_total)).toFixed(2);
+
+
             return {
               type: mapResponseType[type],
               dayinfo: { ..._dayinfo, sale_total },
@@ -608,35 +425,19 @@ export default {
         })
 
 
-
-        let i = ["北京万宇恒通国际科贸有限公司", '北京泰文创供应链管理有限公司' ,"北京元隆雅图文化传播股份有限公司", "结算单E企购", "地推订单"];
+        let i = ["北京万宇恒通国际科贸有限公司", '北京泰文创供应链管理有限公司' ,"北京元隆雅图文化传播股份有限公司", "结算单E企购"];
         const values = this.plat_cp_companies.map(({value}) => value)
+
+
         const l = this.tableData.map(item => item.companyName);
         i = i.filter(item => l.includes(item));
-
         this.tableData = i.map(item => this.tableData.find(l => l.companyName === item));
-        this.tableData  = this.tableData.filter(({companyNo}) => values.includes(companyNo));
-        this.tableData.forEach(item => { if(item.companyName === '结算单E企购'){ item.companyName = '自营订单' } })
-        console.log(this.tableData)
-
-
-        const sourceData = JSON.parse(JSON.stringify(this.tableData))
-        this.tableData = sourceData.filter(item => item.companyName !== '自营订单' && item.companyName !== '地推订单')
-        const topTable = sourceData.filter((item) => item.companyName === '自营订单' || item.companyName === '地推订单')
-
-        if(topTable.length === 0 || topTable.length === 1){
-          this.topTable = [...topTable]
-        }else{
-          console.log(this.topTable)
-          this.topTable = [
-          amountData,
-            ...topTable
-          ]
-        }
+
+        this.tableData  = this.tableData.filter(({companyNo}) => values.includes(companyNo))
       } else {
         this.tableData = [];
-        this.topTable = [];
       }
+      // this.getHeight();
       this.loading = false;
     }
   }

+ 108 - 62
src/pages/newResultsInfo.vue

@@ -3,37 +3,72 @@
     <div v-if="!state.error && isShow">
       <div
         style="
-        color:red;
-        display: flex;
-        align-items: center;
-        justify-content: space-between;
-        width:100%;
-        padding:5px 10px;
-        box-sizing:border-box;
-        "
+          color:red;
+          width:100%;
+          display: flex;
+          padding:5px 10px;
+          align-items: center;
+          box-sizing:border-box;
+          justify-content: space-between
+        ">
+        <ElPopover
+          :width="200" 
+          trigger="hover"
+          placement="top-start"
+          content=" 以下报表一小时更新一次"
         >
-
-        <el-popover placement="top-start":width="200" trigger="hover"
-          content=" 以下报表一小时更新一次">
           <template #reference>
-            <i class="el-icon-warning-outline" style="font-size:22px;cursor:pointer"></i>
+            <i class="el-icon-warning-outline" style="font-size:22px;cursor:pointer" />
           </template>
-        </el-popover>
+        </ElPopover>
 
-        <el-switch v-model="isTenThound" active-text="万元" inactive-text="元" />
+        <ElSwitch 
+          v-model="isTenThound" 
+          active-text="万元" 
+          inactive-text="元" 
+        />
       </div>
 
 
       <div class="container">
-        <result-company :companies="companies" :isTenThound="isTenThound" :costField="costField" />
-        <result-company-bu :companies="companies" :isTenThound="isTenThound" :costField="costField" />
-        <result-department :companies="companies" :isTenThound="isTenThound" :costField="costField" />
-        <result-company-month :companies="companies" :isTenThound="isTenThound" :costField="costField" />
+        <result-company 
+          :companies="companies"
+          :costField="costField" 
+          :isTenThound="isTenThound" 
+        />
+
+        <result-company-bu 
+          :companies="companies"
+          :costField="costField" 
+          :isTenThound="isTenThound" 
+        />
+
+        <result-supplier 
+          :companies="companies" 
+          :costField="costField" 
+          :isTenThound="isTenThound" 
+        />
+
+        <result-department 
+          :companies="companies"
+          :costField="costField" 
+          :isTenThound="isTenThound" 
+        />
+
+        <result-company-month 
+          :companies="companies"
+          :costField="costField" 
+          :isTenThound="isTenThound" 
+        />
       </div>
     </div>
 
     <template v-else-if="!state.loading">
-      <unusual-state :hasPermission="isShow" :message="state.message" path="newReport" />
+      <unusual-state 
+        :hasPermission="isShow" 
+        :message="state.message" 
+        path="newReport" 
+      />
     </template>
   </div>
 </template>
@@ -43,31 +78,34 @@ import PeriodDatePicker from "../components/period-date-picker";
 import UnusualState from "@/components/unusual/index.vue";
 import ResultCompany from "@/components/newResultInfo/company.vue"
 import ResultCompanyBu from "@/components/newResultInfo/company-bu.vue"
+import ResultSupplier from "@/components/newResultInfo/supplier.vue"
+
 import ResultDepartment from "@/components/newResultInfo/department.vue"
 import ResultCompanyMonth from "@/components/newResultInfo/company-month.vue"
 import { getOpenid, getParameterByName, removeOpenid, setOpenid } from "../utils/auth";
 import userRequest from "@/api/index";
 
 export default {
-  name: "newReport",
+  name: "newReportsInfo",
   components: {
     UnusualState,
     ResultCompany,
-    ResultDepartment,
+    ResultSupplier,
+    ResultCompanyBu,
     PeriodDatePicker,
-    ResultCompanyMonth,
-    ResultCompanyBu
+    ResultDepartment,
+    ResultCompanyMonth
   },
   data() {
     return {
-      companies: [],
-      costField: false,
-      zxTotal: 0,
-      daytime: "",
+      state: { message: '', error: false, loading: false },
       hasPermission:false,
-      isDisplay: false,
       isTenThound: false,
-      state: { message: '', error: false, loading: false }
+      isDisplay: false,
+      costField: false,
+      companies: [],
+      daytime: "",
+      zxTotal: 0
     };
   },
   mounted() {
@@ -82,56 +120,64 @@ export default {
       const { startTime, endTime } = e;
       this.start = startTime || "";
       this.end = endTime || "";
-
       const { start, end } = this;
-      if ((start !== "" && end === "") || (start === "" && end !== "")) {
+      if (
+        (start !== "" && end === "") || 
+        (start === "" && end !== "")
+      ) {
         this.$message.warning("时间区间不完整!");
         this.date = []
         return;
       }
 
+
       if (this.start && this.end) {
         this.date = [this.start + " 00:00:00", this.end + " 23:59:59"]
       } else {
         this.date = [this.start, this.end]
       }
-    },
+    }, 
     async requestUserinfo() {
       this.state.loading = true
       const openid = getOpenid()
       const code = getParameterByName('code')
       const result = await userRequest.userinfo({ ...(openid ? { openid } : { code }) })
-  //  const result = {
-  //         "code": 0,
-  //         "message": "获取成功",
-  //         "data": {
-  //           "openid": "oOpc26KiZFBKIm7SB8knFGvov1qg",
-  //           "subscribe_time": "2022-12-21 15:52:14",
-  //           "updatetime": "2023-05-09 16:22:33",
-  //           "addtime": "2023-04-10 18:11:17",
-  //           "is_show": ["1", "2", "4", "6", "cost_field"],
-  //           "nickname": "雪寒",
-  //           "addr": "\/\/",
-  //           "gender": "0",
-  //           "mobile": "",
-  //           "avatar": "",
-  //           "status": "1",
-  //           "id": "8",
-  //           "companyArr": [
-  //             {"companyNo": "GS2302231125079621","companyName": "北京百辰荣达国际科贸有限公司", "info": [1, 2, 6]}, 
-  //             {"companyNo": "GS2302231323386950","companyName": "北京泓源广诚国际商贸有限公司", "info": [1, 2, 6]}, 
-  //             {"companyNo": "GS2203161855277894","companyName": "北京万宇恒通国际科贸有限公司", "info": [1, 2, 6]},
-  //             {"companyNo": "GS2304031312553746","companyName": "北京锦兴弘昌科技有限公司",  "info": [1, 2, 6]}, 
-  //             {"companyNo": "GS2302231124114965","companyName": "北京普润心堂商贸有限公司", "info": [1, 2, 6]},
-  //             {"companyNo": "GS2401181650538135","companyName": "北京知事文化产业发展有限公司", "info": [1, 2, 6]}
-  //           ]
-  //       	}
-  //       }
-
-      const permissions = ['oOpc26KiZFBKIm7SB8knFGvov1qg','oOpc26KDBFTU71t-vWvJ_jTOPhGU','oOpc26LU21JoejLExJxOmjG7_E2I','oOpc26GnkwTcASDd1kHGd6TR23PE'];
-      this.hasPermission = permissions.includes(result.data.openid);
 
-      console.log(this.hasPermission,result.data)
+      //  const result = {
+      //  "code": 0,
+      //  "message": "获取成功",
+      //  "data": {
+      //   "openid": "oOpc26KiZFBKIm7SB8knFGvov1qg",
+      //   "subscribe_time": "2022-12-21 15:52:14",
+      //   "updatetime": "2023-05-09 16:22:33",
+      //   "addtime": "2023-04-10 18:11:17",
+      //   "is_show": ["1", "2", "4", "6", "cost_field"],
+      //   "nickname": "雪寒",
+      //   "addr": "\/\/",
+      //   "gender": "0",
+      //   "mobile": "",
+      //   "avatar": "",
+      //   "status": "1",
+      //   "id": "8",
+      //   "companyArr": [
+      //     {"companyNo": "GS2302231125079621","companyName": "北京百辰荣达国际科贸有限公司", "info": [1, 2, 6]}, 
+      //     {"companyNo": "GS2302231323386950","companyName": "北京泓源广诚国际商贸有限公司", "info": [1, 2, 6]}, 
+      //     {"companyNo": "GS2203161855277894","companyName": "北京万宇恒通国际科贸有限公司", "info": [1, 2, 6]},
+      //     {"companyNo": "GS2304031312553746","companyName": "北京锦兴弘昌科技有限公司",  "info": [1, 2, 6]}, 
+      //     {"companyNo": "GS2302231124114965","companyName": "北京普润心堂商贸有限公司", "info": [1, 2, 6]},
+      //     {"companyNo": "GS2401181650538135","companyName": "北京知事文化产业发展有限公司", "info": [1, 2, 6]}
+      //   ]
+      //  }
+      // }
+
+      const permissions = [
+        'oOpc26KiZFBKIm7SB8knFGvov1qg',
+        'oOpc26KDBFTU71t-vWvJ_jTOPhGU',
+        'oOpc26LU21JoejLExJxOmjG7_E2I',
+        'oOpc26GnkwTcASDd1kHGd6TR23PE'
+      ];
+
+      this.hasPermission = permissions.includes(result.data.openid);
       this.companies = result.data.companyArr.reduce((prev, current) => {
         return current.info.includes(6) || current.info.includes('6') ? [...prev, {
           value: current.companyNo,

+ 29 - 19
src/pages/newStock.vue

@@ -1,17 +1,30 @@
 <template>
   <div class="new-report" v-loading="state.loading || loading" style="min-height:300px;padding:10px">
     <div v-if="!state.error && isShow">
-      <div style="display:flex;justify-content:flex-end">
-      </div>
-
-      <div :xs="24" style="display: flex;justify-content: flex-end;align-items: center;margin-bottom: 10px;">
+      <div 
+        :xs="24" 
+        style="
+          display: flex;
+          justify-content: flex-end; 
+          align-items: center; 
+          margin-bottom: 10px;
+        "
+      >
         <!-- <period-date-picker :start="date[0]" :end="date[1]" size="mini" width="130px" @timeReturned="time($event)" style="padding-left: 0px;"/> -->
-        <el-date-picker size="mini" v-model="date"
-          :picker-options="{ disbaledData(time) { return time.getTime() > Date.now(); } }" type="daterange"
-          value-format="yyyy-MM-dd" format="yyyy-MM-dd" @change="onSearch" start-placeholder="开始日期"
-          end-placeholder="结束日期" :clearable="false" />
+        <el-date-picker 
+          size="mini" 
+          v-model="date"
+          type="daterange"
+          format="yyyy-MM-dd" 
+          @change="onSearch" 
+          :clearable="false" 
+          value-format="yyyy-MM-dd"
+          end-placeholder="结束日期" 
+          start-placeholder="开始日期"
+          :picker-options="{ disabledDate: (time) => time.getTime() > Date.now() }"
+        />
       </div>
-
+       
       <el-table border size="mini" :data="tableData">
         <el-table-column label="责任业务公司" min-width="95px" prop="companyName" />
         <el-table-column label="新备SKU量" min-width="85px" prop="spu_num" />
@@ -21,29 +34,26 @@
             {{ unit2TenThousand(scope.row.spu_total) }}
           </template>
         </el-table-column>
-        <el-table-column label="可用库存品SKU总量" min-width="130px" prop="stock_num"></el-table-column>
+
+        <el-table-column label="可用库存品SKU总量" min-width="130px" prop="stock_num" />
+        
         <el-table-column label="出库金额" min-width="80px" prop="out_total">
           <template slot-scope="scope">
             {{ unit2TenThousand(scope.row.out_total) }}
           </template>
         </el-table-column>
+        
         <el-table-column label="无地址销售金额" min-width="100px" prop="out_total">
           <template slot-scope="scope">
             {{ unit2TenThousand(scope.row.waddr_num) }}
           </template>
         </el-table-column>
+        
         <el-table-column label="当前可用库存金额" min-width="120px" prop="stock_total">
           <template slot-scope="scope">
             {{ unit2TenThousand(scope.row.stock_total) }}
           </template>
         </el-table-column>
-        <!-- <el-table-column label="超过12个月可用库存品金额" width="180px" prop="Two_stock">
-          <template slot-scope="scope">
-            <span style="color:red">
-              {{ unit2TenThousand(scope.row.Two_stock) }}
-            </span>
-          </template>
-        </el-table-column>-->
       </el-table>
     </div>
 
@@ -60,8 +70,8 @@ import { getOpenid, getParameterByName, removeOpenid, setOpenid } from "../utils
 import userRequest from "@/api/index";
 import asyncRequest from "@/api/newStock";
 
-import dayjs from "dayjs"
 import { unit2TenThousand } from "../components/newReport/src/_utils";
+import dayjs from "dayjs"
 
 
 export default {
@@ -87,7 +97,7 @@ export default {
   async mounted() {
     document.title = "6.库存情况"
 
-    if (!getParameterByName('code')) {
+    if (!getParameterByName('coed')) {
       this.login()
     } else {
       await this.requestUserinfo()

+ 4 - 0
src/styles/index.scss

@@ -17,6 +17,10 @@
   }
 }
 
+.el-table__indent {
+  display: none !important;
+}
+
 .bg__success {
   background-color: #e1f3d8 !important;
 }

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.