snow 7 сар өмнө
parent
commit
1f519ac68b

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/index.html


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/css/app.d699289b.css


BIN
dist/static/css/app.d699289b.css.gz


BIN
dist/static/css/app.da6f9e22.css.gz


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/app.22e3ba13.js


BIN
dist/static/js/app.22e3ba13.js.gz


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
dist/static/js/app.a11b02d7.js


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


+ 188 - 0
src/components/newResultInfo/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(){}

+ 477 - 0
src/components/newResultInfo/company-bu.vue

@@ -0,0 +1,477 @@
+<template>
+  <div v-loading="loading">
+    <div class="search clear" style="align-items: center;;">
+      <div style="float:left;line-height:30px;display:flex;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>
+      </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" />
+      </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">
+        <el-table-column fixed="left" label="公司" prop="companyName" align="center" width="65px">
+          <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>
+    <!--  -->
+  </div>
+</template>
+
+
+<script>
+import { addition, unit2TenThousand, subtraction, multiplication, division } from "../newReport/src/_utils";
+import asyncRequest from "@/api/newResults";
+import { mapCompany } from "./mapCompany";
+import dayjs from "dayjs"
+
+export default {
+  props: ['companies', 'costField', 'isTenThound'],
+  data() {
+    return {
+      daytime: "",
+      loading: false,
+      tableData: [],
+      companyNo: "",
+      plat_cp_companies:[],
+      cp_companies: [],
+      isEmpty: false,
+      mapCompany
+    }
+  },
+  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 = '平台公司: 元隆'
+      }
+
+      if (item.label === '结算单E企购') {
+        label = '结算单E企购'
+      }
+
+      if (item.label === "普润&锦兴&知事") label = `业务公司: 普润&锦兴&知事`
+      if (label === '') label = `业务公司: ${mapCompany[item.label]}`;
+      return ({ ...item, label })
+    })
+
+
+    let plat_list = ['所有业务公司','业务公司: 百辰', '业务公司: 泓源', '业务公司: 普润&锦兴&知事']
+
+    // 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));
+    this.plat_cp_companies = plat_list.map((item) => this.cp_companies.find((cp_item) => cp_item.label === item));
+
+
+    if(this.plat_cp_companies.length === 3){
+      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: {
+    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' : '';
+    },
+    addDataToCompany(c1, c2) {
+      // Number(addition(c1.total_tips,c2.total_tips)).toFixed(2)
+
+      return {
+        companyName: '普润',
+        cost_tips: Number(c1.cost_tips).toFixed(2),
+        total_tips: Number(c1.total_tips).toFixed(2),
+        monthinfo: c1.monthinfo.map((item, index) => ({
+          mcgd_th_total: Number(addition(item.mcgd_th_total, c2.monthinfo[index].mcgd_th_total)).toFixed(2),
+          mcgd_total: Number(addition(item.mcgd_total, c2.monthinfo[index].mcgd_total)).toFixed(2),
+          msale_total: Number(addition(item.msale_total, c2.monthinfo[index].msale_total)).toFixed(2),
+          mth_total: Number(addition(item.mth_total, c2.monthinfo[index].mth_total)).toFixed(2),
+          type: item.type
+        })),
+        dayinfo: c1.dayinfo.map((item, index) => {
+          return {
+            cgd_th_total: Number(addition(item.cgd_th_total, c2.dayinfo[index].cgd_th_total)).toFixed(2),
+            cgd_total: Number(addition(item.cgd_total, c2.dayinfo[index].cgd_total)).toFixed(2),
+            sale_total: Number(addition(item.sale_total, c2.dayinfo[index].sale_total)).toFixed(2),
+            th_total: Number(addition(item.th_total, c2.dayinfo[index].th_total)).toFixed(2),
+            type: item.type
+          }
+        }),
+      }
+    },
+    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.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;
+          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 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 },
+              monthinfo: { ...monthinfo, msale_total, mcost_total }
+            }
+          })
+
+          const gross_completion = Number(subtraction(prev_msale_total, prev_mcost_total)).toFixed(2) //当月毛利完成 = 月营收 - 月成本
+
+
+          this.tableData = [
+            ...this.tableData,
+            {
+              companyNo,
+              companyName,  // 公司名称
+              cost_tips, // 当月成本指标
+              total_tips, // 当月营收目标
+              info: [{ ...item }], // 直营..渠道 销售
+              sale_total: prev_sale_total, // 当日营业收入
+              cost_total: prev_cost_total, // 当日成本总额
+              msale_total: prev_msale_total, // 当月营业收入
+              mcost_total: prev_mcost_total,// 当月成本总额
+              gross_completion, //当月毛利完成 = 月营收 - 月成本
+              completion_rate: multiplication(division(prev_msale_total, total_tips), 100).toFixed(2), // 当月应收完成率
+              gross_completion_rate: 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), // 本月毛利率 =  当月毛利完成 / 当月营业收入
+            }
+          ]
+        })
+
+        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))
+      } else {
+        this.tableData = [];
+      }
+      // this.getHeight();
+      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>
+

+ 50 - 15
src/components/newResultInfo/company-month.vue

@@ -1,7 +1,7 @@
 <template>
 <template>
   <div v-loading="loading">
   <div v-loading="loading">
     <div class="search" style="align-items: center;">
     <div class="search" style="align-items: center;">
-      <div style="float:left;font-size:16px;line-height:30px">
+      <div style="float:left;font-size:15px;line-height:30px">
         年度完成情况
         年度完成情况
       </div>
       </div>
 
 
@@ -11,7 +11,7 @@
           <el-option v-for="depart in cp_companies" :key="depart.id" :value="depart.value" :label="depart.label" />
           <el-option v-for="depart in cp_companies" :key="depart.id" :value="depart.value" :label="depart.label" />
         </el-select>
         </el-select>
 
 
-        <el-date-picker class="fr picker no-padding" v-model="daytime" style=";width:65px" value-format="yyyy"
+        <el-date-picker class="fr picker no-padding" v-model="daytime" style="width:65px" value-format="yyyy"
           :editable="false" :disabled="isEmpty" :clearable="false" :size="'small'" type="year" format="yyyy" align="right"
           :editable="false" :disabled="isEmpty" :clearable="false" :size="'small'" type="year" format="yyyy" align="right"
           placeholder="选择日期" :picker-options="{ disabledDate(time) { return time.getTime() > Date.now(); } }"
           placeholder="选择日期" :picker-options="{ disabledDate(time) { return time.getTime() > Date.now(); } }"
           @change="requestData" />
           @change="requestData" />
@@ -21,14 +21,12 @@
     <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" :row-class-name="setRowClassName"
       <el-table border size="mini" :data="tableData" :header-cell-class-name="setHeaderClassName" :row-class-name="setRowClassName"
         :cell-class-name="setCellClassName">
         :cell-class-name="setCellClassName">
-        <el-table-column fixed="left" label="月度" prop="month" align="center" width="45px" />
+        <el-table-column fixed="left" label="月度" prop="month" align="center" width="70px" />
         <el-table-column label="营收目标" align="center" min-width="115px">
         <el-table-column label="营收目标" align="center" min-width="115px">
           <template slot-scope="scope">
           <template slot-scope="scope">
             {{ unit2TenThousand(scope.row.total_tips, isTenThound) }}
             {{ unit2TenThousand(scope.row.total_tips, isTenThound) }}
           </template>
           </template>
         </el-table-column>
         </el-table-column>
-
-
         <el-table-column label="营业收入(净)" align="center" min-width="115px">
         <el-table-column label="营业收入(净)" align="center" min-width="115px">
           <template slot-scope="scope">
           <template slot-scope="scope">
             <div :style="getCurrentValueStyle(scope.row.pure_sale, scope.row.total_tips, scope.row.month)">
             <div :style="getCurrentValueStyle(scope.row.pure_sale, scope.row.total_tips, scope.row.month)">
@@ -36,8 +34,6 @@
             </div>
             </div>
           </template>
           </template>
         </el-table-column>
         </el-table-column>
-        
-        
         <el-table-column label="营收完成%" align="center" min-width="95px">
         <el-table-column label="营收完成%" align="center" min-width="95px">
           <template slot-scope="scope">
           <template slot-scope="scope">
             <div :style="getCurrentRateStyle(scope.row.completion_rate, scope.row.month)">
             <div :style="getCurrentRateStyle(scope.row.completion_rate, scope.row.month)">
@@ -49,16 +45,18 @@
         <template v-if="costField">
         <template v-if="costField">
           <el-table-column label="毛利目标" align="center" min-width="115px">
           <el-table-column label="毛利目标" align="center" min-width="115px">
             <template slot-scope="scope">
             <template slot-scope="scope">
-              {{ unit2TenThousand(scope.row.cost_tips, isTenThound) }}
+              {{  costField ? unit2TenThousand(scope.row.cost_tips, isTenThound) : '***' }}
             </template>
             </template>
           </el-table-column>
           </el-table-column>
           <el-table-column label="毛利完成" align="center" min-width="115px">
           <el-table-column label="毛利完成" align="center" min-width="115px">
             <template slot-scope="scope">
             <template slot-scope="scope">
               <div :style="getCurrentValueStyle(scope.row.pure_profit, scope.row.cost_tips, scope.row.month)">
               <div :style="getCurrentValueStyle(scope.row.pure_profit, scope.row.cost_tips, scope.row.month)">
-                {{ unit2TenThousand(scope.row.pure_profit, isTenThound) }}
+                {{ costField ? unit2TenThousand(scope.row.pure_profit, isTenThound) : '***' }}
               </div>
               </div>
             </template>
             </template>
           </el-table-column>
           </el-table-column>
+        </template>
+
           <el-table-column label="毛利完成%" align="center" min-width="95px">
           <el-table-column label="毛利完成%" align="center" min-width="95px">
             <template slot-scope="scope">
             <template slot-scope="scope">
               <div :style="getCurrentRateStyle(scope.row.cost_rate, scope.row.month)">
               <div :style="getCurrentRateStyle(scope.row.cost_rate, scope.row.month)">
@@ -66,7 +64,6 @@
               </div>
               </div>
             </template>
             </template>
           </el-table-column>
           </el-table-column>
-        </template>
       </el-table>
       </el-table>
       <div style="height:100px"></div>
       <div style="height:100px"></div>
     </el-row>
     </el-row>
@@ -105,7 +102,6 @@ export default {
     if (jxIndex !== -1 || prIndex !== -1 || zsIndex !== -1) hasCompose = true;
     if (jxIndex !== -1 || prIndex !== -1 || zsIndex !== -1) hasCompose = true;
     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: "GS2401181650538135", label: "普润&锦兴&知事" }]
     if (hasCompose) this.cp_companies = [...this.cp_companies, { value: "GS2401181650538135", label: "普润&锦兴&知事" }]
-    // if (this.cp_companies.length === 4) this.cp_companies = [{ value: "", label: "所有公司" }, ...this.cp_companies];
 
 
     this.isEmpty = this.cp_companies.length === 0;
     this.isEmpty = this.cp_companies.length === 0;
     if (this.isEmpty) return;
     if (this.isEmpty) return;
@@ -117,23 +113,33 @@ export default {
         label = '所有公司'
         label = '所有公司'
       }
       }
 
 
-
       if (item.label === '北京万宇恒通国际科贸有限公司') {
       if (item.label === '北京万宇恒通国际科贸有限公司') {
         label = '平台公司: 万宇'
         label = '平台公司: 万宇'
       }
       }
 
 
+      if (item.label === '北京泰文创供应链管理有限公司') {
+        label = '平台公司: 泰文创'
+      }
+
+      if (item.label === '北京元隆雅图文化传播股份有限公司') {
+        label = '预订单E企购'
+      }
+
+      if (item.label === '结算单E企购') {
+        label = '结算单E企购'
+      }
+
 
 
       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 list = ['所有公司','平台公司: 万宇','业务公司: 百辰','业务公司: 泓源','业务公司: 普润&锦兴&知事']
+    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));
     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();
   },
   },
@@ -141,6 +147,7 @@ export default {
     unit2TenThousand,
     unit2TenThousand,
     setRowClassName({row}){
     setRowClassName({row}){
       if(row.month === '合计') return 'table-header-color'
       if(row.month === '合计') return 'table-header-color'
+      if(row.month === '当前合计') return 'font-bold'
     },
     },
     getCurrentRateStyle(current, month) {
     getCurrentRateStyle(current, month) {
       const days = dayjs().daysInMonth();
       const days = dayjs().daysInMonth();
@@ -256,6 +263,34 @@ export default {
           })
           })
 
 
 
 
+          const currentTotal = new Array(Number(dayjs().format('M'))).fill(0).reduce((prev,_,index) => {
+            return {
+              pure_sale: Number(addition(prev.pure_sale, this.tableData[index].pure_sale)).toFixed(2),
+              pure_purch: Number( addition(prev.pure_purch,  this.tableData[index].pure_purch)).toFixed(2),
+              pure_profit: Number(addition(prev.pure_profit,  this.tableData[index].pure_profit)).toFixed(2),
+              completion_rate:Number( addition(prev.completion_rate,  this.tableData[index].completion_rate)).toFixed(2),
+              pure_interest_rate:Number( addition(prev.pure_interest_rate,  this.tableData[index].pure_interest_rate)).toFixed(2),
+              total_tips:Number( addition(prev.total_tips,  this.tableData[index].total_tips)).toFixed(2),
+              cost_tips:Number( addition(prev.cost_tips,  this.tableData[index].cost_tips)).toFixed(2),
+              cost_rate:Number( addition(prev.cost_rate,  this.tableData[index].cost_rate)).toFixed(2),
+              month: '当前合计',
+            }
+          },{
+            pure_sale: 0,
+            pure_purch: 0,
+            pure_profit: 0,
+            completion_rate: 0,
+            pure_interest_rate: 0,
+            month: '当前合计',
+            cost_tips: 0,
+            total_tips: 0,
+            cost_rate: 0
+          })
+
+          currentTotal.completion_rate = multiplication(division(currentTotal.pure_sale, currentTotal.total_tips) || 0, 100)
+          currentTotal.cost_rate = Number(currentTotal.cost_tips) === 0 ? 0 : multiplication(division(currentTotal.pure_profit, currentTotal.cost_tips) || 0, 100).toFixed(2)
+
+
           const totalItem = this.tableData.reduce((prev, curr) => {
           const totalItem = this.tableData.reduce((prev, curr) => {
             return {
             return {
               pure_sale: Number(addition(prev.pure_sale, curr.pure_sale)).toFixed(2),
               pure_sale: Number(addition(prev.pure_sale, curr.pure_sale)).toFixed(2),
@@ -282,7 +317,7 @@ export default {
 
 
           totalItem.completion_rate = multiplication(division(totalItem.pure_sale, totalItem.total_tips) || 0, 100)
           totalItem.completion_rate = multiplication(division(totalItem.pure_sale, totalItem.total_tips) || 0, 100)
           totalItem.cost_rate = Number(totalItem.cost_tips) === 0 ? 0 : multiplication(division(totalItem.pure_profit, totalItem.cost_tips) || 0, 100).toFixed(2)
           totalItem.cost_rate = Number(totalItem.cost_tips) === 0 ? 0 : multiplication(division(totalItem.pure_profit, totalItem.cost_tips) || 0, 100).toFixed(2)
-          this.tableData = [...this.tableData, totalItem];
+          this.tableData = [currentTotal,...this.tableData, totalItem];
 
 
           // const totalItem = createTotalItem(tableData)
           // const totalItem = createTotalItem(tableData)
           // totalItem.month = "年度合计"
           // totalItem.month = "年度合计"

+ 442 - 129
src/components/newResultInfo/company.vue

@@ -1,87 +1,307 @@
 <template>
 <template>
   <div v-loading="loading">
   <div v-loading="loading">
     <div class="search clear" style="align-items: center;;">
     <div class="search clear" style="align-items: center;;">
-      <div style="float:left;line-height:30px;font-size:16px">
-        月度完成情况
-      </div>
-
+      <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>
       <div style="float:right">
       <div style="float:right">
-        <el-select size="small" style="margin-right:10px;width:140px" v-model="companyNo" @change="requestData"
-          :disabled="isEmpty">
-          <el-option v-for="company in 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="选择日期"
           :picker-options="{ disabledDate(time) { return time.getTime() > Date.now(); } }" @change="requestData" />
           :picker-options="{ disabledDate(time) { return time.getTime() > Date.now(); } }" @change="requestData" />
       </div>
       </div>
     </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" :span-method="spanMethod">
-        <el-table-column fixed="left" label="公司" prop="companyName" align="center" width="65px">
+    <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">
           <template slot-scope="scope">
-            <div v-if="scope.row.companyName.indexOf('普润') === -1">
-              {{ mapCompany[scope.row.companyName] || scope.row.companyName }}
+            <div v-if="scope.row.companyName === '结算单E企购'">
+              自营订单
             </div>
             </div>
-
             <div v-else>
             <div v-else>
-              <el-popover placement="top" width="200" trigger="hover" content="普润&锦兴&知事">
-                <template #reference>
-                  <i class="el-icon-warning-outline" style="font-size:14px;cursor:pointer"></i>
-                  普润
-                </template>
-              </el-popover>
+              {{ scope.row.companyName }}
             </div>
             </div>
           </template>
           </template>
         </el-table-column>
         </el-table-column>
-
-        <el-table-column label="业绩类型" prop="type" align="center" width="100px"></el-table-column>
-        
-        <el-table-column label="当月销售" prop="monthSale" align="center" min-width="100px">
+        <el-table-column label="当日营业收入" align="center" width="95px">
           <template slot-scope="scope">
           <template slot-scope="scope">
-            {{unit2TenThousand(scope.row.monthSale,isTenThound)}}
+            {{ scope.row.companyName === '合计' ? unit2TenThousand(calcAmount('sale_total'), isTenThound)  : unit2TenThousand(scope.row.sale_total, isTenThound) }}
           </template>
           </template>
         </el-table-column>
         </el-table-column>
 
 
-        <el-table-column label="销售退货" prop="monthReturn" align="center" min-width="100px">
-          <template slot-scope="scope">
-            {{unit2TenThousand(scope.row.monthReturn,isTenThound)}}
+          <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>
           </template>
-        </el-table-column>
+      </el-table>
+    </el-row>
 
 
 
 
-        <el-table-column label="销售合计" prop="monthSaleAmount" align="center" min-width="100px">
+    <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">
           <template slot-scope="scope">
-            {{unit2TenThousand(scope.row.monthSaleAmount,isTenThound)}}
-          </template>
-        </el-table-column>
+            <div v-if="scope.row.companyName.indexOf('普润') === -1">
+              {{ mapCompany[scope.row.companyName] || scope.row.companyName }}
+            </div>
 
 
-        <el-table-column label="当月成本" prop="monthCost" align="center" min-width="100px">
-          <template slot-scope="scope">
-            {{unit2TenThousand(scope.row.monthCost,isTenThound)}}
+            <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>
           </template>
         </el-table-column>
         </el-table-column>
-
-        <el-table-column label="当月成本退货" prop="monthCost" align="center" min-width="100px">
+        <el-table-column label="当日营业收入" align="center" width="95px">
           <template slot-scope="scope">
           <template slot-scope="scope">
-            {{unit2TenThousand(scope.row.monthCostReturn,isTenThound)}}
+            {{ unit2TenThousand(scope.row.sale_total, isTenThound) }}
           </template>
           </template>
         </el-table-column>
         </el-table-column>
 
 
-        <el-table-column label="成本合计" prop="monthCost" align="center" min-width="100px">
-          <template slot-scope="scope">
-            {{unit2TenThousand(scope.row.monthCostAmount,isTenThound)}}
+          <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>
           </template>
-        </el-table-column>
       </el-table>
       </el-table>
     </el-row>
     </el-row>
 
 
     <template v-else>
     <template v-else>
       <div style="text-align:center;line-height:60px;user-select:none">当前账号没有访问权限</div>
       <div style="text-align:center;line-height:60px;user-select:none">当前账号没有访问权限</div>
     </template>
     </template>
+    <!--  -->
   </div>
   </div>
 </template>
 </template>
 
 
@@ -91,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'],
@@ -99,7 +320,9 @@ export default {
       daytime: "",
       daytime: "",
       loading: false,
       loading: false,
       tableData: [],
       tableData: [],
+      topTable: [],
       companyNo: "",
       companyNo: "",
+      plat_cp_companies:[],
       cp_companies: [],
       cp_companies: [],
       isEmpty: false,
       isEmpty: false,
       mapCompany
       mapCompany
@@ -112,41 +335,96 @@ 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: "普润&锦兴&知事" }]
-    if (this.cp_companies.length === 4) this.cp_companies = [{ value: "", label: "所有公司" }, ...this.cp_companies];
 
 
     this.isEmpty = this.cp_companies.length === 0;
     this.isEmpty = this.cp_companies.length === 0;
     if (this.isEmpty) return;
     if (this.isEmpty) return;
 
 
     this.cp_companies = this.cp_companies.map((item, index) => {
     this.cp_companies = this.cp_companies.map((item, index) => {
       let label = '';
       let label = '';
-      if (item.label === '所有公司') {
-        label = '所有公司'
-      }
 
 
 
 
       if (item.label === '北京万宇恒通国际科贸有限公司') {
       if (item.label === '北京万宇恒通国际科贸有限公司') {
         label = '平台公司: 万宇'
         label = '平台公司: 万宇'
       }
       }
 
 
+      if (item.label === '北京泰文创供应链管理有限公司') {
+        label = '平台公司: 泰文创'
+      }
+
+      if (item.label === '北京元隆雅图文化传播股份有限公司') {
+        label = '预订单E企购'
+      }
+
+      if (item.label === '自营订单') {
+        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 list = ['所有公司','平台公司: 万宇','业务公司: 百辰','业务公司: 泓源','业务公司: 普润&锦兴&知事']
-    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));
-    this.companyNo = this.cp_companies[0].value;
+    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.daytime = this.transformTime();
     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);
@@ -222,38 +500,6 @@ export default {
       }
       }
 
 
       return base
       return base
-    },
-        /* 表格合并列和行 */
-    spanMethod({ rowIndex, columnIndex }) {
-      if (columnIndex === 0) {
-        const _row = this.flitterData(this.tableData).one[rowIndex];
-        const _col = _row > 0 ? 1 : 0;
-        return { rowspan: _row, colspan: _col };
-      }
-    },
-    /**合并表格的第一列,处理表格数据 */
-    flitterData(arr) {
-      let spanOneArr = [];
-      let concatOne = 0;
-
-      arr.forEach((item, index) => {
-        if (index === 0) {
-          spanOneArr.push(1);
-        } else {
-          //注意这里的quarterly是表格绑定的字段,根据自己的需求来改
-          if (
-            (item.companyName === arr[index - 1].companyName)) {
-            //第一列需合并相同内容的判断条件
-            spanOneArr[concatOne] += 1;
-            spanOneArr.push(0);
-          } else {
-            spanOneArr.push(1);
-            concatOne = index;
-          }
-        }
-      });
-
-      return { one: spanOneArr };
     },
     },
     setHeaderClassName({ column }) {
     setHeaderClassName({ column }) {
       const { label } = column;
       const { label } = column;
@@ -273,57 +519,124 @@ export default {
     async requestData() {
     async requestData() {
       this.loading = true;
       this.loading = true;
       this.tableData = [];
       this.tableData = [];
-      const res = await asyncRequest.companyEveryMonth({ daytime: this.daytime, companyNo: this.companyNo });
-      const mapResponseType = {  '1':'自营',  '2':'渠道',  '3':'供应商端'}
 
 
-      if (res.code === 0 && res.data && res.data.length > 0) {
-        const list = [];
+      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"
 
 
-        let i = ["北京万宇恒通国际科贸有限公司","北京百辰荣达国际科贸有限公司","北京泓源广诚国际商贸有限公司",'北京普润心堂商贸有限公司'];
-        const l = res.data.map(item => item.companyName);
-        i = i.filter(item => l.includes(item));
-        res.data = i.map(item => res.data.find(l => l.companyName === item));
-
-        res.data.forEach(i => {
-          let totalItem = {
-              companyName:i.companyName,
-              type: '合计',
-              monthSale:'--',
-              monthReturn:'--',
-              monthSaleAmount:0,
-              monthCost:'--',
-              monthCostReturn:'--',
-              monthCostAmount:0
-          };
-
-          (i.monthinfo || []).forEach((month,index) => {
-            const monthSaleAmount = Number(subtraction(month.msale_total,month.mth_total)).toFixed(2);
-            const monthCostAmount = Number(subtraction(month.mcgd_total,month.mcgd_th_total)).toFixed(2);
-
-            const item = {
-              companyName:i.companyName,
-              type: mapResponseType[month.type],
-              monthSale:month.msale_total,
-              monthReturn:month.mth_total,
-              monthSaleAmount,
-              monthCost:month.mcgd_total,
-              monthCostReturn:month.mcgd_th_total,
-              monthCostAmount
+      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;
+          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 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 },
+              monthinfo: { ...monthinfo, msale_total, mcost_total }
             }
             }
-
-            totalItem.monthSaleAmount = Number(addition(item.monthSaleAmount,totalItem.monthSaleAmount)).toFixed(2);
-            totalItem.monthCostAmount = Number(addition(item.monthCostAmount,totalItem.monthCostAmount)).toFixed(2);
-            list.push(item);
-            if(index === 2){  list.push(totalItem);}
           })
           })
+
+          const gross_completion = Number(subtraction(prev_msale_total, prev_mcost_total)).toFixed(2) //当月毛利完成 = 月营收 - 月成本
+
+
+          this.tableData = [
+            ...this.tableData,
+            {
+              companyNo,
+              companyName,  // 公司名称
+              cost_tips, // 当月成本指标
+              total_tips, // 当月营收目标
+              info: [{ ...item }], // 直营..渠道 销售
+              sale_total: prev_sale_total, // 当日营业收入
+              cost_total: prev_cost_total, // 当日成本总额
+              msale_total: prev_msale_total, // 当月营业收入
+              mcost_total: prev_mcost_total,// 当月成本总额
+              gross_completion, //当月毛利完成 = 月营收 - 月成本
+              completion_rate: multiplication(division(prev_msale_total, total_tips), 100).toFixed(2), // 当月应收完成率
+              gross_completion_rate: 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), // 本月毛利率 =  当月毛利完成 / 当月营业收入
+            }
+          ]
         })
         })
 
 
-        this.tableData = list;
-        // console.log(list);
+
+
+        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 {
       } else {
         this.tableData = [];
         this.tableData = [];
+        this.topTable = [];
       }
       }
-      // this.getHeight();
       this.loading = false;
       this.loading = false;
     }
     }
   }
   }

+ 281 - 84
src/components/newResultInfo/department.vue

@@ -9,13 +9,15 @@
               style="font-size:16px;cursor:pointer;padding-top:5px;padding-right:5px;display:inline-block"
               style="font-size:16px;cursor:pointer;padding-top:5px;padding-right:5px;display:inline-block"
             ></i>
             ></i>
           </template>
           </template>
-        </el-popover>部门完成情况
+        </el-popover>
+
+        <span style="font-size: 15px;">部门完成情况</span>
       </div>
       </div>
 
 
       <div style="float:right">
       <div style="float:right">
         <el-select
         <el-select
           size="small"
           size="small"
-          style="margin-right:10px;width:135px"
+          style="margin-right:10px;width:165px"
           v-model="companyNo"
           v-model="companyNo"
           @change="requestData"
           @change="requestData"
           :disabled="isEmpty"
           :disabled="isEmpty"
@@ -53,10 +55,8 @@
         :data="list"
         :data="list"
         :header-cell-class-name="setHeaderClassName"
         :header-cell-class-name="setHeaderClassName"
         :cell-class-name="setCellClassName"
         :cell-class-name="setCellClassName"
-        :span-method="spanMethod"
       >
       >
         <!-- <el-table-column fixed="left" label="公司" prop="company" align="center" width="45px" /> -->
         <!-- <el-table-column fixed="left" label="公司" prop="company" align="center" width="45px" /> -->
-
         <el-table-column fixed="left" label="部门" prop="depart" align="center" width="60px">
         <el-table-column fixed="left" label="部门" prop="depart" align="center" width="60px">
           <template slot-scope="scope">
           <template slot-scope="scope">
             <p
             <p
@@ -66,30 +66,90 @@
             >{{ chunk }}</p>
             >{{ chunk }}</p>
           </template>
           </template>
         </el-table-column>
         </el-table-column>
-
-        <el-table-column label="业绩类型" align="center" min-width="105px">
-          <template slot-scope="scope">{{ scope.row.type }}</template>
+        <el-table-column label="当日营业收入" align="center" min-width="105px">
+          <template
+            slot-scope="scope"
+          >{{ unit2TenThousand(scope.row.dayinfo.sale_total, isTenThound) }}</template>
         </el-table-column>
         </el-table-column>
 
 
-        <el-table-column label="当月销售(已减退货)" align="center" min-width="105px">
-          <template slot-scope="scope">{{ unit2TenThousand(scope.row.monthSale,isTenThound) }}</template>
-        </el-table-column>
-         
-         <el-table-column label="当月销售(未减退货)" align="center" min-width="105px">
-          <template slot-scope="scope">{{ unit2TenThousand(scope.row.monthSaleNotReturn,isTenThound) }}</template>
+        <el-table-column label="当月营收目标" align="center" min-width="115px">
+          <template slot-scope="scope">{{ unit2TenThousand(scope.row.total_tips, isTenThound) }}</template>
         </el-table-column>
         </el-table-column>
 
 
-        <el-table-column label="当月退货" align="center" min-width="105px">
-          <template slot-scope="scope">{{ unit2TenThousand(scope.row.monthReturn,isTenThound) }}</template>
+        <el-table-column label="当月营业收入(净)" align="center" min-width="120px">
+          <template slot-scope="scope">
+            <div style="display:flex;flex-direction: column;">
+              <div style="display:flex;justify-content:center;align-items:center" :style="`text-align: center;${getCurrentValueStyle(scope.row.monthinfo.monthNetSales, scope.row.total_tips)}`">
+                {{ unit2TenThousand(scope.row.monthinfo.monthNetSales, isTenThound) }}
+                <el-popover placement="right" :width="200" trigger="click">
+                  <div class="table-size">
+                    <p>直营/自营: {{ unit2TenThousand(scope.row.currentMonthPure[0].zy, isTenThound) }}</p>
+                    <p>支付渠道: {{ unit2TenThousand(scope.row.currentMonthPure[0].qd, isTenThound) }}</p>
+                  </div>
+                  <template #reference>
+                    <p
+                      :style="`text-align: center;${getCurrentValueStyle(scope.row.monthinfo.monthNetSales, scope.row.total_tips)}`"
+                    >
+                      <i
+                        class="el-icon-warning-outline trigger-hover"
+                        style="font-size:16px;cursor:pointer;margin-left:5px"
+                      ></i>
+                    </p>
+                  </template>
+                </el-popover>
+              </div>
+            </div>
+          </template>
         </el-table-column>
         </el-table-column>
 
 
-        <el-table-column label="销售合计" align="center" min-width="105px">
-          <template slot-scope="scope">{{ unit2TenThousand(scope.row.monthSaleAmount,isTenThound) }}</template>
+       <template v-if="costField">
+         <el-table-column label="当月成本" align="center" min-width="120px">
+          <template slot-scope="scope">
+            <div style="display:flex;justify-content:center;align-items:center"  v-if="costField">
+              {{
+              unit2TenThousand(Number(addition(Number(addition(scope.row.zy_cost, scope.row.qd_cost)).toFixed(2),scope.row.post_fee)).toFixed(2), isTenThound) }}
+              <el-popover placement="right" :width="200" trigger="click">
+                <div class="table-size">
+                  <p>直营/自营: {{ unit2TenThousand(scope.row.zy_cost, isTenThound) }}</p>
+                  <p>渠道: {{ unit2TenThousand(scope.row.qd_cost, isTenThound) }}</p>
+                  <p>物流费用: {{ unit2TenThousand(scope.row.post_fee, isTenThound) }}</p>
+                </div>
+                <template #reference>
+                  <p style="text-align: center;">
+                    <i
+                      class="el-icon-warning-outline trigger-hover"
+                      style="font-size:16px;cursor:pointer;margin-left:5px"
+                    ></i>
+                  </p>
+                </template>
+              </el-popover>
+            </div>
+
+            <p v-else>***</p>
+          </template>
         </el-table-column>
         </el-table-column>
 
 
-        <el-table-column label="当月成本(已减退货)" align="center" min-width="105px">
-          <template slot-scope="scope">{{ unit2TenThousand(scope.row.monthCost,isTenThound) }}</template>
+        <el-table-column align="center" label="当月毛利" min-width="120px">
+          <template slot-scope="scope">
+            <div style="display:flex;justify-content:center;align-items:center" v-if="costField">
+              {{unit2TenThousand(Number(subtraction(Number(addition(scope.row.zy_gross, scope.row.qd_gross)).toFixed(2),scope.row.post_fee)).toFixed(2), isTenThound)}}
+              <el-popover placement="right" :width="200" trigger="click">
+                <div class="table-size">
+                  <p>直营/自营: {{ unit2TenThousand(scope.row.zy_gross, isTenThound) }}</p>
+                  <p>支付渠道: {{ unit2TenThousand(scope.row.qd_gross, isTenThound) }}</p>
+                </div>
+                <template #reference>
+                  <p style="text-align: center;">
+                    <i class="el-icon-warning-outline trigger-hover" style="font-size:16px;cursor:pointer;margin-left:5px"></i>
+                  </p>
+                </template>
+              </el-popover>
+            </div>
+
+            <p v-else>***</p>
+          </template>
         </el-table-column>
         </el-table-column>
+       </template>
       </el-table>
       </el-table>
     </el-row>
     </el-row>
 
 
@@ -135,11 +195,18 @@ export default {
   mounted() {
   mounted() {
     this.isEmpty = this.companies.length === 0;
     this.isEmpty = this.companies.length === 0;
     if (this.isEmpty) return;
     if (this.isEmpty) return;
+
     this.cp_companies = this.companies.map(item => ({
     this.cp_companies = this.companies.map(item => ({
       ...item,
       ...item,
       label:
       label:
         mapCompany[item.label] === "万宇"
         mapCompany[item.label] === "万宇"
           ? `平台公司: 万宇`
           ? `平台公司: 万宇`
+          : mapCompany[item.label] === "泰文创"
+          ? `平台公司: 泰文创`
+          : mapCompany[item.label] === "预订单E企购"
+          ? `预订单E企购`
+          : mapCompany[item.label] === "结算单E企购"
+          ? `结算单E企购`
           : `业务公司: ${mapCompany[item.label]}`
           : `业务公司: ${mapCompany[item.label]}`
     }));
     }));
 
 
@@ -149,15 +216,24 @@ export default {
       "业务公司: 泓源",
       "业务公司: 泓源",
       "业务公司: 普润",
       "业务公司: 普润",
       "业务公司: 锦兴",
       "业务公司: 锦兴",
-      "业务公司: 知事"
+      "业务公司: 知事",
+      "平台公司: 泰文创",
+      '预订单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.companyNo = this.cp_companies[0].value;
+    this.cp_companies = list.map(item =>this.cp_companies.find(cp_item => cp_item.label === item));
+
+    if(this.hasCompose()){
+      this.cp_companies.unshift({ value: '', label: '万宇 + 预算单E企购' })
+    }
+
     this.companyNo = this.cp_companies[0].value;
     this.companyNo = this.cp_companies[0].value;
+
     this.daytime = this.transformTime();
     this.daytime = this.transformTime();
+    this.requestData();
   },
   },
   watch: {
   watch: {
     daytime: {
     daytime: {
@@ -168,21 +244,31 @@ export default {
   },
   },
   methods: {
   methods: {
     addition,
     addition,
+    subtraction,
     unit2TenThousand,
     unit2TenThousand,
+    hasCompose(){
+      const hasWANYU = this.cp_companies.findIndex(({value}) => value === 'GS2203161855277894')
+      const hasTwo = this.cp_companies.findIndex(({value}) => value === 'GS2404151642335170')
+      return hasWANYU !== -1 && hasTwo !== -1
+    },
     setCellClassName({ column, row }) {
     setCellClassName({ column, row }) {
       const { label } = column;
       const { label } = column;
 
 
-      if(!label) return;
-
       let base = "";
       let base = "";
-      if (row.depart.indexOf("万宇") !== -1) base += "font-bold "
+
+      if (row.depart.indexOf("泰文创") !== -1) {
+        base += "font-bold ";
+      }
 
 
       if (label === "当月营收目标") {
       if (label === "当月营收目标") {
         base += "bg__success";
         base += "bg__success";
         return base;
         return base;
       }
       }
 
 
-      if ((label.indexOf("营业") !== -1 || label.indexOf("营收") !== -1) && label !== "当日营业收入") {
+      if (
+        (label.indexOf("营业") !== -1 || label.indexOf("营收") !== -1) &&
+        label !== "当日营业收入"
+      ) {
         base += "bg__success_1";
         base += "bg__success_1";
         return base;
         return base;
       }
       }
@@ -242,7 +328,7 @@ export default {
     },
     },
     /* 表格合并列和行 */
     /* 表格合并列和行 */
     spanMethod({ rowIndex, columnIndex }) {
     spanMethod({ rowIndex, columnIndex }) {
-      if (columnIndex === 0 || columnIndex === 3 || columnIndex === 4 || columnIndex === 5) {
+      if (columnIndex === 0) {
         const _row = this.flitterData(this.list).one[rowIndex];
         const _row = this.flitterData(this.list).one[rowIndex];
         const _col = _row > 0 ? 1 : 0;
         const _col = _row > 0 ? 1 : 0;
         return { rowspan: _row, colspan: _col };
         return { rowspan: _row, colspan: _col };
@@ -257,8 +343,7 @@ export default {
           spanOneArr.push(1);
           spanOneArr.push(1);
         } else {
         } else {
           //注意这里的quarterly是表格绑定的字段,根据自己的需求来改
           //注意这里的quarterly是表格绑定的字段,根据自己的需求来改
-          if (
-            (item.depart === arr[index - 1].depart)) {
+          if (item.company === arr[index - 1].company) {
             //第一列需合并相同内容的判断条件
             //第一列需合并相同内容的判断条件
             spanOneArr[concatOne] += 1;
             spanOneArr[concatOne] += 1;
             spanOneArr.push(0);
             spanOneArr.push(0);
@@ -273,76 +358,188 @@ export default {
     },
     },
     async requestData() {
     async requestData() {
       this.loading = true;
       this.loading = true;
+      this.list = [];
 
 
-      const res = await asyncRequest.departmentEveryDay({
-        daytime: this.daytime,
-        companyNo: this.companyNo
-      });
 
 
+      let res = {}
+      // 预算单 + 万宇
+      if(this.companyNo === ''){
+        res = await asyncRequest.departmentEveryDay({ daytime: this.daytime,  companyNo: 'GS2203161855277894' })
+        const two = await asyncRequest.departmentEveryDay({ daytime: this.daytime,  companyNo: 'GS2404151642335170' }) 
+
+        const { data: data1 } = res
+        const { data: data2 } = two
+
+
+
+        const newData = []
+        data1.forEach(item => {
+          const twoItem = data2.find(({depart}) => depart === item.depart)
+          const keys = Object.keys(item)
+          const newItem = keys.reduce((prev,current) => ({
+            ...prev,
+            [current]: current === 'depart' ? item.depart : current === 'total_tips' ? item.total_tips : Number(addition(item[current],twoItem[current])).toFixed(2)
+          }),{})
+          newData.push(newItem)
+        })
+
+        
+        res.data = newData
+      }else {
+        res = await asyncRequest.departmentEveryDay({ daytime: this.daytime, companyNo: this.companyNo  });
+      }
 
 
 
 
       if (res.code === 0 && res.data && res.data.length > 0) {
       if (res.code === 0 && res.data && res.data.length > 0) {
-        let list = res.data;
+        // 非万宇 营业目标重取
+        // if (this.companyNo !== "GS2203161855277894") {
+        //   const r = await asyncRequest.companyEveryMonth({ daytime: this.daytime, companyNo: this.companyNo });
+        //   const { total_tips, companyName } = r.data[0] || {};
+        //   res.data.forEach(item => {
+        //     const index = companyName.indexOf(item.depart);
+        //     item.total_tips = (index === -1 && !(item.depart === "普润" && this.companyNo === "GS2304031312553746")) ? '0.00' : total_tips;
+        //   })
+        // }
+
+        let list = (res.data || []).map(
+          ({
+            depart,
+            msale_total,
+            mth_total,
+            sale_total,
+            th_total,
+            total_tips,
+            mzy_sale_total,
+            mchannel_sale_total,
+            channel_cost_total,
+            zy_cost_total,
+            mzy_cost_total,
+            mchannel_cost_total,
+            mpost_fee: post_fee
+          }) => ({
+              depart,
+              total_tips,
+              mzy_sale_total,
+              mchannel_sale_total,
+              channel_cost_total,
+              zy_cost_total,
+              mchannel_cost_total,
+              mzy_cost_total,
+              post_fee,
+              dayinfo: { sale_total, th_total },
+              monthinfo: { msale_total, mth_total }
+          }));
+
+        list = list.filter(item => Number(item.monthinfo.msale_total) !== 0 || Number(item.post_fee) !== 0);
+
+        this.total = list.reduce((prev, current) => {
+            const { total_tips = 0, day = 0, month = 0 } = current;
+            
+            return {
+              total_tips: addition(total_tips, prev.total_tips), month: addition(month, prev.month), day: addition(day, prev.day)
+            };
+          },
+          { total_tips: 0, month: 0, day: 0 }
+        );
+
+        let mapDepart = list.map(({ depart }) => depart);
+
+        list = mapDepart.map(d => list.find(({ depart }) => depart === d));
+
         const mapToDepartment = {
         const mapToDepartment = {
           百辰: "客服部@百辰",
           百辰: "客服部@百辰",
           泓源: "网络部@泓源",
           泓源: "网络部@泓源",
-          普润: "项目部@普润",
-          平台: "平台部@万宇"
+          普润: "	项目部@普润",
+          平台: "	平台部@泰文创"
         };
         };
 
 
-        list = list.filter(item => Number(item.msale_total) !== 0);
-        let mapList = ["平台", "百辰", "泓源", "普润"];
-        const cl = list.map(item => item.depart);
-        mapList = mapList.filter(item => cl.findIndex(i => i.indexOf(item)) !== -1);
-        list = mapList.map(item => list.find(i => i.depart.indexOf(item) !== -1));
-        list = list.filter(item => item)
-        list  = list.map(item => {
-          const depart = mapToDepartment[item.depart] || '--'
-          const monthSaleAmount = Number(subtraction(item.msale_total,item.mth_total)).toFixed(2)
-
-          const zy = {
+        const company = this.companies.find(
+          item => item.value === this.companyNo
+        );
+        this.list = list.map(
+          ({
             depart,
             depart,
-            type:'直营/自营',
-            monthSale:item.mzy_sale_total,
-            monthSaleNotReturn:item.msale_total,
-            monthReturn:item.mth_total,
-            monthSaleAmount,
-            monthCost:item.mzy_cost_total
-          };
-
-          const qd = {
-            depart,
-            type:'支付渠道',
-            monthSale:item.mchannel_sale_total,
-            monthSaleNotReturn:item.msale_total,
-            monthReturn:item.mth_total,
-            monthSaleAmount,
-            monthCost:item.mchannel_cost_total
-          };
-
-          return [zy, qd]
-        })
+            total_tips,
+            dayinfo,
+            monthinfo,
+            mchannel_sale_total,
+            mzy_sale_total,
+            mchannel_cost_total,
+            post_fee,
+            mzy_cost_total
+          }) => {
+            // mzy_sale_total = Number(addition(Number(multiplication(mzy_sale_total,0.05)).toFixed(2),mzy_sale_total)).toFixed(2);
+            // mchannel_sale_total = Number(addition(Number(multiplication(mchannel_sale_total,0.05)).toFixed(2),mchannel_sale_total)).toFixed(2);
+            /* 月净销售 = 月销售 - 月退货 **/
+            let monthNetSales = subtraction(
+              monthinfo.msale_total,
+              monthinfo.mth_total
+            );
+            // monthNetSales = Number(addition(Number(multiplication(monthNetSales,0.05)).toFixed(2),monthNetSales)).toFixed(2);
+
+            /* 月经销售完成率 = 月净销售 / 销售指标 **/
+            const monthProportion = multiplication(
+              division(monthNetSales, total_tips),
+              100
+            ).toFixed(2);
+
+
+            return {
+              total_tips, // 营收目标
+              zy_cost: mzy_cost_total, // 自营成本
+              qd_cost: mchannel_cost_total, // 渠道成本
+              post_fee: post_fee,
+              depart: mapToDepartment[depart],
+              company: company ? company.label : '--',
+              currentMonthPure: [
+                {
+                  zy: mzy_sale_total, 
+                  qd: mchannel_sale_total,
+                }
+              ], // 当月营业收入(净)
+              zy_gross: Number(
+                subtraction(mzy_sale_total, mzy_cost_total)
+              ).toFixed(2), // 自营毛利  = 自营营收 - 自营成本
+
+              qd_gross: Number(
+                subtraction(mchannel_sale_total, mchannel_cost_total)
+              ).toFixed(2), // 渠道毛利 = 渠道营收 - 渠道成本
+              
+              
+              dayinfo: {
+                ...dayinfo,
+                /** 日销售额 = 日销售额 - 日退货额 */ sale_total: subtraction(
+                  dayinfo.sale_total,
+                  dayinfo.th_total
+                )
+              },
+              /* 占比 =  (当前部门销售额 / 各部门总销售额) / 100 **/
+              proportion:
+                multiplication(
+                  division(monthinfo.msale_total, this.total.month) || 0,
+                  100
+                ) || 0,
+              monthinfo: { monthNetSales, monthProportion: monthProportion }
+            };
+          }
+        );
 
 
+        // const wanyuIndex = this.list.findIndex(item => item.depart.indexOf('万宇') !== -1);
+        // if(wanyuIndex !== -1){
+        //   const item = this.list.splice(wanyuIndex,1);
+        //   this.list.unshift(item[0]);
+        // }
 
 
-        const totalItem = list.reduce((prev,current) => ({
-          ...prev,
-          monthSaleNotReturn:Number(addition(prev.monthSaleNotReturn,current[0].monthSaleNotReturn)).toFixed(2),
-          monthCost:Number(addition(Number(addition(prev.monthCost,current[0].monthCost)).toFixed(2),current[1].monthCost)).toFixed(2)
-        }), {
-            depart:'合计',
-            type:'--',
-            monthSale:'--',
-            monthSaleNotReturn:0,
-            monthReturn:'--',
-            monthSaleAmount:'--',
-            monthCost:0
-        });
+        let l = [ "百辰", "泓源", "普润",'泰文创'];
+        const cl = this.list.map(item => item.depart);
 
 
-        console.log('🚀~',totalItem);
+        l = l.filter(item => {
+          return cl.findIndex(i => i.indexOf(item)) !== -1;
+        });
 
 
-        const list_copy = [];
-        list.forEach(item => Array.isArray(item) && item.forEach(i => list_copy.push(i)));
-        this.list = [...list_copy,totalItem];
+        this.list = l.map(item => {
+          return this.list.find(i => i.depart.indexOf(item) !== -1);
+        });
       } else {
       } else {
         this.list = [];
         this.list = [];
       }
       }

+ 3 - 0
src/components/newResultInfo/mapCompany.js

@@ -5,4 +5,7 @@ export const mapCompany = {
   "北京锦兴弘昌科技有限公司":"锦兴",
   "北京锦兴弘昌科技有限公司":"锦兴",
   "北京普润心堂商贸有限公司":"普润",
   "北京普润心堂商贸有限公司":"普润",
   "北京知事文化产业发展有限公司": "知事",
   "北京知事文化产业发展有限公司": "知事",
+  "北京泰文创供应链管理有限公司": "泰文创",
+  "北京元隆雅图文化传播股份有限公司": "预订单E企购",
+  "结算单E企购": "结算单E企购",
 }
 }

+ 1 - 1
src/pages/index.vue

@@ -20,7 +20,7 @@ export default {
         {label:'4.订单情况', link: '/?path=newReport'},
         {label:'4.订单情况', link: '/?path=newReport'},
         {label:'5.发货情况', link: '/?path=stock'},
         {label:'5.发货情况', link: '/?path=stock'},
         {label:'6.库存情况', link:'?path=newStock'},
         {label:'6.库存情况', link:'?path=newStock'},
-        // {label:'1.业绩报表(2023版)', link: '/?path=results'},
+        {label:'1.业绩报表(2023版)', link: '/?path=results'},
         {label: '测试', link: '/?path=newResultInfo'}
         {label: '测试', link: '/?path=newResultInfo'}
       ]
       ]
     }
     }

+ 8 - 8
src/pages/newResults.vue

@@ -1,12 +1,12 @@
 <template>
 <template>
-  <div class="new-results" v-loading="state.loading" style="min-height:300px">
+  <div class="new-results" v-loading="state.loading" style="min-height: 300px">
     <div v-if="!state.error && isShow">
     <div v-if="!state.error && isShow">
       <div
       <div
         style="
         style="
         color:red;
         color:red;
-        display:flex;
-        align-items:center;
-        justify-content:space-between;
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
         width:100%;
         width:100%;
         padding:5px 10px;
         padding:5px 10px;
         box-sizing:border-box;
         box-sizing:border-box;
@@ -39,14 +39,14 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import PeriodDatePicker from "../components/period-date-picker";
+import userRequest from "@/api/index"
 import UnusualState from "@/components/unusual/index.vue";
 import UnusualState from "@/components/unusual/index.vue";
 import ResultCompany from "@/components/newResults/company.vue"
 import ResultCompany from "@/components/newResults/company.vue"
+import PeriodDatePicker from "../components/period-date-picker"
 import ResultCompanyBu from "@/components/newResults/company-bu.vue"
 import ResultCompanyBu from "@/components/newResults/company-bu.vue"
 import ResultDepartment from "@/components/newResults/department.vue"
 import ResultDepartment from "@/components/newResults/department.vue"
 import ResultCompanyMonth from "@/components/newResults/company-month.vue"
 import ResultCompanyMonth from "@/components/newResults/company-month.vue"
-import { getOpenid, getParameterByName, removeOpenid, setOpenid } from "../utils/auth";
-import userRequest from "@/api/index";
+import { getOpenid, getParameterByName, removeOpenid, setOpenid } from "../utils/auth"
 
 
 export default {
 export default {
   name: "newReport",
   name: "newReport",
@@ -99,7 +99,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,
       //     "message": "获取成功",
       //     "message": "获取成功",

+ 40 - 40
src/pages/newResultsInfo.vue

@@ -1,12 +1,12 @@
 <template>
 <template>
-  <div class="new-results" v-loading="state.loading" style="min-height:300px">
-    <div v-if="!state.error && isShow && hasPermission">
+  <div class="new-results" v-loading="state.loading" style="min-height: 300px">
+    <div v-if="!state.error && isShow">
       <div
       <div
         style="
         style="
         color:red;
         color:red;
-        display:flex;
-        align-items:center;
-        justify-content:space-between;
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
         width:100%;
         width:100%;
         padding:5px 10px;
         padding:5px 10px;
         box-sizing:border-box;
         box-sizing:border-box;
@@ -26,17 +26,14 @@
 
 
       <div class="container">
       <div class="container">
         <result-company :companies="companies" :isTenThound="isTenThound" :costField="costField" />
         <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-department :companies="companies" :isTenThound="isTenThound" :costField="costField" />
-        <!-- <result-company-month :companies="companies" :isTenThound="isTenThound" :costField="costField" /> -->
+        <result-company-month :companies="companies" :isTenThound="isTenThound" :costField="costField" />
       </div>
       </div>
     </div>
     </div>
 
 
     <template v-else-if="!state.loading">
     <template v-else-if="!state.loading">
-      <div style="color:red;display:flex;justify-content:center;align-items:center;margin-top:10px">
-         <i class="el-icon-warning-outline" style="font-size:18px;margin-right:5px"></i>
-        该报表为信息部内部报表,暂不对外开放
-      </div>
-      <!-- <unusual-state :hasPermission="isShow" :message="state.message" path="newReport" /> -->
+      <unusual-state :hasPermission="isShow" :message="state.message" path="newReport" />
     </template>
     </template>
   </div>
   </div>
 </template>
 </template>
@@ -45,6 +42,7 @@
 import PeriodDatePicker from "../components/period-date-picker";
 import PeriodDatePicker from "../components/period-date-picker";
 import UnusualState from "@/components/unusual/index.vue";
 import UnusualState from "@/components/unusual/index.vue";
 import ResultCompany from "@/components/newResultInfo/company.vue"
 import ResultCompany from "@/components/newResultInfo/company.vue"
+import ResultCompanyBu from "@/components/newResultInfo/company-bu.vue"
 import ResultDepartment from "@/components/newResultInfo/department.vue"
 import ResultDepartment from "@/components/newResultInfo/department.vue"
 import ResultCompanyMonth from "@/components/newResultInfo/company-month.vue"
 import ResultCompanyMonth from "@/components/newResultInfo/company-month.vue"
 import { getOpenid, getParameterByName, removeOpenid, setOpenid } from "../utils/auth";
 import { getOpenid, getParameterByName, removeOpenid, setOpenid } from "../utils/auth";
@@ -57,7 +55,8 @@ export default {
     ResultCompany,
     ResultCompany,
     ResultDepartment,
     ResultDepartment,
     PeriodDatePicker,
     PeriodDatePicker,
-    ResultCompanyMonth
+    ResultCompanyMonth,
+    ResultCompanyBu
   },
   },
   data() {
   data() {
     return {
     return {
@@ -102,36 +101,37 @@ export default {
       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 = {
+  //         "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 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);
 
 
-      const permissions = ['1','2','3','17'];
-      this.hasPermission = permissions.includes(result.data.id);
+      console.log(this.hasPermission,result.data)
       this.companies = result.data.companyArr.reduce((prev, current) => {
       this.companies = result.data.companyArr.reduce((prev, current) => {
         return current.info.includes(6) || current.info.includes('6') ? [...prev, {
         return current.info.includes(6) || current.info.includes('6') ? [...prev, {
           value: current.companyNo,
           value: current.companyNo,

+ 40 - 41
src/pages/newStock.vue

@@ -171,47 +171,46 @@ 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 = {
-      //   "code": 0,
-      //   "message": "获取成功",
-      //   "data": {
-      //     "id": "1",
-      //     "openid": "oOpc26KiZFBKIm7SB8knFGvov1qg",
-      //     "mobile": "",
-      //     "gender": "0",
-      //     "nickname": "雪寒",
-      //     "avatar": "",
-      //     "subscribe_time": "2022-12-21 15:52:14",
-      //     "addr": "\/\/",
-      //     "status": "1",
-      //     "is_show": ["1", "2", "7"],
-      //     "companyArr": [{
-      //       "companyNo": "GS2302231125079621",
-      //       "companyName": "北京百辰荣达国际科贸有限公司",
-      //       "info": [1, 2]
-      //     }, {
-      //       "companyNo": "GS2302231323386950",
-      //       "companyName": "北京泓源广诚国际商贸有限公司",
-      //       "info": [1, 2]
-      //     }, {
-      //       "companyNo": "GS2304031312553746",
-      //       "companyName": "北京锦兴弘昌科技有限公司",
-      //       "info": [1, 2]
-      //     }, {
-      //       "companyNo": "GS2302231124114965",
-      //       "companyName": "北京普润心堂商贸有限公司",
-      //       "info": [1, 2]
-      //     }, {
-      //       "companyNo": "GS2203161855277894",
-      //       "companyName": "北京万宇恒通国际科贸有限公司",
-      //       "info": [1, 2]
-      //     }],
-      //     "addtime": "2023-04-10 18:11:07",
-      //     "updatetime": "2023-05-09 16:22:33"
-      //   }
-      // }
+      const result = await userRequest.userinfo({   ...( openid ? { openid } :  { code })  })
+      //  const result = {
+      //    "code": 0,
+      //    "message": "获取成功",
+      //    "data": {
+      //      "id": "1",
+      //      "openid": "oOpc26KiZFBKIm7SB8knFGvov1qg",
+      //      "mobile": "",
+      //      "gender": "0",
+      //      "nickname": "雪寒",
+      //      "avatar": "",
+      //      "subscribe_time": "2022-12-21 15:52:14",
+      //      "addr": "\/\/",
+      //      "status": "1",
+      //      "is_show": ["1", "2", "7"],
+      //      "companyArr": [{
+      //        "companyNo": "GS2302231125079621",
+      //        "companyName": "北京百辰荣达国际科贸有限公司",
+      //        "info": [1, 2]
+      //      }, {
+      //        "companyNo": "GS2302231323386950",
+      //        "companyName": "北京泓源广诚国际商贸有限公司",
+      //        "info": [1, 2]
+      //      }, {
+      //        "companyNo": "GS2304031312553746",
+      //        "companyName": "北京锦兴弘昌科技有限公司",
+      //        "info": [1, 2]
+      //      }, {
+      //        "companyNo": "GS2302231124114965",
+      //        "companyName": "北京普润心堂商贸有限公司",
+      //        "info": [1, 2]
+      //      }, {
+      //        "companyNo": "GS2203161855277894",
+      //        "companyName": "北京万宇恒通国际科贸有限公司",
+      //        "info": [1, 2]
+      //      }],
+      //      "addtime": "2023-04-10 18:11:07",
+      //      "updatetime": "2023-05-09 16:22:33"
+      //    }
+      //  }
 
 
       this.state.loading = false
       this.state.loading = false
       switch (Number(result.code)) {
       switch (Number(result.code)) {

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно