snow 7 月之前
父節點
當前提交
fffcb93836

文件差異過大導致無法顯示
+ 0 - 0
dist/index.html


文件差異過大導致無法顯示
+ 0 - 0
dist/static/css/app.9dbec3ae.css


二進制
dist/static/css/app.9dbec3ae.css.gz


二進制
dist/static/css/app.d699289b.css.gz


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/app.22e3ba13.js


二進制
dist/static/js/app.22e3ba13.js.gz


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/app.5d8ca809.js


二進制
dist/static/js/app.5d8ca809.js.gz


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

@@ -0,0 +1,188 @@
+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(){}

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

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

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

@@ -2,21 +2,10 @@
   <div v-loading="loading">
   <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="平台公司">
       <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">
       <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"
         <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"
           :editable="false" :disabled="isEmpty" :clearable="false" :size="'small'" format="yyyy-MM-dd" type="date"
           align="right" placeholder="选择日期"
           align="right" placeholder="选择日期"
@@ -24,6 +13,170 @@
       </div>
       </div>
     </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-row style="margin-top:10px;margin-top:10px" v-if="!isEmpty">
       <el-table border size="mini" :data="tableData" :header-cell-class-name="setHeaderClassName"
       <el-table border size="mini" :data="tableData" :header-cell-class-name="setHeaderClassName"
         :cell-class-name="setCellClassName">
         :cell-class-name="setCellClassName">
@@ -61,7 +214,9 @@
                {{ unit2TenThousand(scope.row.msale_total, isTenThound) }}
                {{ unit2TenThousand(scope.row.msale_total, isTenThound) }}
                 <el-popover placement="right" :width="200" trigger="click">
                 <el-popover placement="right" :width="200" trigger="click">
                   <div class="table-size">
                   <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][1].monthinfo.msale_total, isTenThound) }}</p>
                     <p>供应商端: {{ unit2TenThousand(scope.row.info[0][2].monthinfo.msale_total, isTenThound) }}</p>
                     <p>供应商端: {{ unit2TenThousand(scope.row.info[0][2].monthinfo.msale_total, isTenThound) }}</p>
                   </div>
                   </div>
@@ -156,6 +311,7 @@ import { addition, unit2TenThousand, subtraction, multiplication, division } fro
 import asyncRequest from "@/api/newResults";
 import asyncRequest from "@/api/newResults";
 import { mapCompany } from "./mapCompany";
 import { mapCompany } from "./mapCompany";
 import dayjs from "dayjs"
 import dayjs from "dayjs"
+import { amountData } from "./calc"
 
 
 export default {
 export default {
   props: ['companies', 'costField', 'isTenThound'],
   props: ['companies', 'costField', 'isTenThound'],
@@ -164,6 +320,7 @@ export default {
       daytime: "",
       daytime: "",
       loading: false,
       loading: false,
       tableData: [],
       tableData: [],
+      topTable: [],
       companyNo: "",
       companyNo: "",
       plat_cp_companies:[],
       plat_cp_companies:[],
       cp_companies: [],
       cp_companies: [],
@@ -178,6 +335,8 @@ export default {
     const zsIndex = this.companies.findIndex((item) => item.label === "北京知事文化产业发展有限公司");
     const zsIndex = this.companies.findIndex((item) => item.label === "北京知事文化产业发展有限公司");
 
 
     if (jxIndex !== -1 || prIndex !== -1 || zsIndex !== -1) hasCompose = true;
     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 !== "北京知事文化产业发展有限公司")
     this.cp_companies = this.companies.filter((item) => item.label !== "北京锦兴弘昌科技有限公司" && item.label !== "北京普润心堂商贸有限公司" && item.label !== "北京知事文化产业发展有限公司")
     if (hasCompose) this.cp_companies = [...this.cp_companies, { value: "GS2302231124114965", label: "普润&锦兴&知事" }]
     if (hasCompose) this.cp_companies = [...this.cp_companies, { value: "GS2302231124114965", label: "普润&锦兴&知事" }]
 
 
@@ -200,19 +359,21 @@ export default {
         label = '预订单E企购'
         label = '预订单E企购'
       }
       }
 
 
-      if (item.label === '结算单E企购') {
+      if (item.label === '自营订单') {
         label = '结算单E企购'
         label = '结算单E企购'
       }
       }
 
 
+      if (item.label === '地推订单') {
+        label = '地推订单'
+      }
+
       if (item.label === "普润&锦兴&知事") label = `业务公司: 普润&锦兴&知事`
       if (item.label === "普润&锦兴&知事") label = `业务公司: 普润&锦兴&知事`
       if (label === '') label = `业务公司: ${mapCompany[item.label]}`;
       if (label === '') label = `业务公司: ${mapCompany[item.label]}`;
       return ({ ...item, label })
       return ({ ...item, label })
     })
     })
 
 
 
 
-    let plat_list = ['所有平台公司','平台公司: 万宇', '平台公司: 泰文创', '预订单E企购', '结算单E企购']
-
-    // let bu_list = ['所有业务公司','平台公司: 万宇','业务公司: 百辰','业务公司: 泓源','业务公司: 普润&锦兴&知事', '平台公司: 泰文创'];
+    let plat_list = ['所有平台公司','平台公司: 万宇', '平台公司: 泰文创', '预订单E企购', '结算单E企购', '地推订单']
     
     
     const plat_cp_list = this.cp_companies.map((item) => item.label);
     const plat_cp_list = this.cp_companies.map((item) => item.label);
     plat_list = plat_list.filter(item => plat_cp_list.includes(item));
     plat_list = plat_list.filter(item => plat_cp_list.includes(item));
@@ -228,7 +389,42 @@ export default {
     this.requestData();
     this.requestData();
   },
   },
   methods: {
   methods: {
+    isNaN(value){
+      return value === 'NaN' || Number.isNaN(value)
+    },
     unit2TenThousand,
     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) {
     getCurrentRateStyle(current) {
       const days = dayjs(this.daytime).daysInMonth();
       const days = dayjs(this.daytime).daysInMonth();
       const oneDay = Number(division(100, days)).toFixed(2);
       const oneDay = Number(division(100, days)).toFixed(2);
@@ -353,11 +549,8 @@ export default {
 
 
       if (res.code === 0 && res.data && res.data.length > 0) {
       if (res.code === 0 && res.data && res.data.length > 0) {
         res.data.forEach(({ companyName,companyNo ,monthinfo, dayinfo, total_tips, cost_tips }) => {
         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)
           const types = Object.keys(mapResponseType)
-
           let prev_sale_total = 0;
           let prev_sale_total = 0;
           let prev_msale_total = 0;
           let prev_msale_total = 0;
           let prev_cost_total = 0;
           let prev_cost_total = 0;
@@ -366,34 +559,24 @@ export default {
           const item = types.map(type => {
           const item = types.map(type => {
             const _monthinfo = monthinfo.find(month => String(month.type) === type) || {}
             const _monthinfo = monthinfo.find(month => String(month.type) === type) || {}
             const _dayinfo = dayinfo.find(day => String(day.type) === type) || {}
             const _dayinfo = dayinfo.find(day => String(day.type) === type) || {}
-
             /** 月营业收入 = 月销售额 - 月退货额  */
             /** 月营业收入 = 月销售额 - 月退货额  */
             let msale_total = 0;
             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 sale_total = subtraction(_dayinfo.sale_total, _dayinfo.th_total) || 0;
             /** 日成本 = 日采购额 - 日退货额 */
             /** 日成本 = 日采购额 - 日退货额 */
             const cost_total = subtraction(_dayinfo.cgd_total, _dayinfo.cgd_th_total) || 0;
             const cost_total = subtraction(_dayinfo.cgd_total, _dayinfo.cgd_th_total) || 0;
-
             /** 月成本 = 月采购额 - 月退货额 */
             /** 月成本 = 月采购额 - 月退货额 */
             let mcost_total = 0;
             let mcost_total = 0;
-
             if(Number(type) !== 4){
             if(Number(type) !== 4){
               mcost_total = subtraction(_monthinfo.mcgd_total, _monthinfo.mcgd_th_total) || 0;
               mcost_total = subtraction(_monthinfo.mcgd_total, _monthinfo.mcgd_th_total) || 0;
             }else{
             }else{
               mcost_total = Number(_monthinfo.mcgd_total || 0).toFixed(2);
               mcost_total = Number(_monthinfo.mcgd_total || 0).toFixed(2);
             }
             }
-
-
             prev_sale_total = Number(addition(prev_sale_total, sale_total)).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_msale_total = Number(addition(prev_msale_total, msale_total)).toFixed(2);
             prev_cost_total = Number(addition(prev_cost_total, cost_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);
             prev_mcost_total = Number(addition(prev_mcost_total, mcost_total)).toFixed(2);
-
-
             return {
             return {
               type: mapResponseType[type],
               type: mapResponseType[type],
               dayinfo: { ..._dayinfo, sale_total },
               dayinfo: { ..._dayinfo, sale_total },
@@ -425,19 +608,35 @@ export default {
         })
         })
 
 
 
 
-        let i = ["北京万宇恒通国际科贸有限公司", '北京泰文创供应链管理有限公司' ,"北京元隆雅图文化传播股份有限公司", "结算单E企购"];
-        const values = this.plat_cp_companies.map(({value}) => value)
-
 
 
+        let i = ["北京万宇恒通国际科贸有限公司", '北京泰文创供应链管理有限公司' ,"北京元隆雅图文化传播股份有限公司", "结算单E企购", "地推订单"];
+        const values = this.plat_cp_companies.map(({value}) => value)
         const l = this.tableData.map(item => item.companyName);
         const l = this.tableData.map(item => item.companyName);
         i = i.filter(item => l.includes(item));
         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 = 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 {
       } else {
         this.tableData = [];
         this.tableData = [];
+        this.topTable = [];
       }
       }
-      // this.getHeight();
       this.loading = false;
       this.loading = false;
     }
     }
   }
   }

+ 1 - 3
src/pages/newReport.vue

@@ -144,9 +144,7 @@ export default {
        this.state.loading = true;
        this.state.loading = true;
        const openid = getOpenid()
        const openid = getOpenid()
        const code = getParameterByName('code')
        const code = getParameterByName('code')
-       const result = await userRequest.userinfo({ 
-          ...( openid ? { openid } :  { code })
-        })
+       const result = await userRequest.userinfo({  ...( openid ? { openid } :  { code }) })
 
 
       // const result ={
       // const result ={
       // "code": 0,
       // "code": 0,

部分文件因文件數量過多而無法顯示