|
@@ -0,0 +1,543 @@
|
|
|
+<template>
|
|
|
+ <div v-loading="loading">
|
|
|
+ <div class="search clear" style="align-items: center;">
|
|
|
+ <el-tooltip placement="top" width="50px" trigger="hover" content="平台公司">
|
|
|
+ <i
|
|
|
+ class="el-icon-warning-outline"
|
|
|
+ style="font-size:16px;cursor:pointer;;display:inline-block;padding-right: 5px"
|
|
|
+ ></i>
|
|
|
+ </el-tooltip>
|
|
|
+
|
|
|
+ <span style="font-size: 15px;">月度完成情况</span>
|
|
|
+
|
|
|
+ <div style="float:right">
|
|
|
+ <el-date-picker class="fr picker no-padding" v-model="daytime" style="width:95px" value-format="yyyy-MM-dd"
|
|
|
+ :editable="false" :disabled="isEmpty" :clearable="false" :size="'small'" format="yyyy-MM-dd" type="date"
|
|
|
+ align="right" placeholder="选择日期"
|
|
|
+ :picker-options="{ disabledDate(time) { 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"
|
|
|
+ row-key="companyNo"
|
|
|
+ default-expand-all
|
|
|
+ :load="load"
|
|
|
+ lazy
|
|
|
+ >
|
|
|
+
|
|
|
+ <el-table-column fixed="left" label="公司" prop="companyName" align="center" width="120px">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span v-if="scope.row.companyName.indexOf('元隆雅图') === -1">
|
|
|
+ {{ mapCompany[scope.row.companyName] || scope.row.companyName }}
|
|
|
+ </span>
|
|
|
+
|
|
|
+ <span v-else>
|
|
|
+ 预定单E企购
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+
|
|
|
+ <el-table-column label="当日营业收入" align="center" width="95px">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.companyName === '合计-元隆雅图' ? unit2TenThousand(calcAmount('sale_total'), isTenThound) : unit2TenThousand(scope.row.sale_total, isTenThound) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="营收目标" align="center" min-width="95px">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.companyName === '合计-元隆雅图' ? unit2TenThousand(calcAmount('total_tips'), isTenThound) : unit2TenThousand(scope.row.total_tips, isTenThound) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="营业收入(净)" align="center" min-width="115px">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div style="display:flex;justify-content:center" :style="`${scope.row.companyName === '合计-元隆雅图' ? '' :getCurrentValueStyle(scope.row.msale_total, scope.row.total_tips)}`">
|
|
|
+ {{
|
|
|
+ scope.row.companyName === '合计-元隆雅图'
|
|
|
+ ? unit2TenThousand(calcAmount('msale_total'), isTenThound)
|
|
|
+ : unit2TenThousand(scope.row.msale_total, isTenThound)
|
|
|
+ }}
|
|
|
+ <el-popover placement="right" :width="200" trigger="click">
|
|
|
+ <div class="table-size">
|
|
|
+ <p>直营/自营: {{
|
|
|
+ scope.row.companyName === '合计-元隆雅图'
|
|
|
+ ? unit2TenThousand(calcAmount('0.0.monthinfo.msale_total', true), isTenThound)
|
|
|
+ : unit2TenThousand(scope.row.info[0].monthinfo.msale_total, isTenThound)
|
|
|
+ }}</p>
|
|
|
+ <p>支付渠道: {{
|
|
|
+ scope.row.companyName === '合计-元隆雅图'
|
|
|
+ ? unit2TenThousand(calcAmount('0.1.monthinfo.msale_total', true), isTenThound)
|
|
|
+ : unit2TenThousand(scope.row.info[1].monthinfo.msale_total, isTenThound)
|
|
|
+ }}</p>
|
|
|
+ <p v-if="scope.row.companyName !== '预订单E企购' && scope.row.companyName !== '结算单E企购'">供应商端: {{
|
|
|
+ scope.row.companyName === '合计-元隆雅图'
|
|
|
+ ? unit2TenThousand(calcAmount('0.2.monthinfo.msale_total', true), isTenThound)
|
|
|
+ : unit2TenThousand(scope.row.info[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].monthinfo.mcost_total, isTenThound)
|
|
|
+ }}
|
|
|
+ </p>
|
|
|
+ <p>支付渠道:
|
|
|
+ {{
|
|
|
+ scope.row.companyName ==='合计-元隆雅图'
|
|
|
+ ? unit2TenThousand(calcAmount('0.1.monthinfo.mcost_total', true), isTenThound)
|
|
|
+ : unit2TenThousand(scope.row.info[1].monthinfo.mcost_total, isTenThound)
|
|
|
+ }}</p>
|
|
|
+ <p v-if="scope.row.companyName !== '预订单E企购' && scope.row.companyName !== '结算单E企购'">供应商端:
|
|
|
+ {{
|
|
|
+ scope.row.companyName === '合计-元隆雅图'
|
|
|
+ ? unit2TenThousand(calcAmount('0.2.monthinfo.mcost_total', true),isTenThound)
|
|
|
+ : unit2TenThousand(scope.row.info[2].monthinfo.mcost_total, isTenThound)
|
|
|
+ }}</p>
|
|
|
+ <p>物流费用:
|
|
|
+ {{
|
|
|
+ scope.row.companyName === '合计-元隆雅图'
|
|
|
+ ? unit2TenThousand(calcAmount('0.3.monthinfo.mcost_total', true), isTenThound)
|
|
|
+ : unit2TenThousand(scope.row.info[3].monthinfo.mcost_total, isTenThound)
|
|
|
+ }}
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <template #reference>
|
|
|
+ <i class="el-icon-warning-outline trigger-hover" style="font-size:16px;cursor:pointer;margin-left:5px"></i>
|
|
|
+ </template>
|
|
|
+ </el-popover>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <p v-else>***</p>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="实际毛利率" align="center" width="85px">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ costField
|
|
|
+ ? scope.row.companyName === '合计-元隆雅图' ? calcAmountRealRate() : unit2TenThousand(scope.row.gross_sale_completion_rate) + "%"
|
|
|
+ : '***'
|
|
|
+ }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </template>
|
|
|
+ </el-table>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <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 { amountData } from "./calc"
|
|
|
+import dayjs from "dayjs"
|
|
|
+
|
|
|
+export default {
|
|
|
+ props: ['companies', 'costField', 'isTenThound'],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ daytime: "",
|
|
|
+ loading: false,
|
|
|
+ tableData: [],
|
|
|
+ companyNo: "",
|
|
|
+ plat_cp_companies:[],
|
|
|
+ cp_companies: [],
|
|
|
+ isEmpty: false,
|
|
|
+ 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;
|
|
|
+
|
|
|
+ const mapLabel = {
|
|
|
+ '北京万宇恒通国际科贸有限公司': '平台公司: 万宇',
|
|
|
+ '北京泰文创供应链管理有限公司': '平台公司: 泰文创',
|
|
|
+ '北京元隆雅图文化传播股份有限公司': '预订单E企购',
|
|
|
+ }
|
|
|
+
|
|
|
+ this.cp_companies = this.cp_companies.map((item, index) => {
|
|
|
+ const label = mapLabel[item.label] || item.label
|
|
|
+ return ({ ...item, label })
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ let plat_list = ['所有平台公司','平台公司: 万宇', '平台公司: 泰文创', '预订单E企购', '结算单E企购']
|
|
|
+ const plat_cp_list = this.cp_companies.map((item) => item.label);
|
|
|
+ plat_list = plat_list.filter(item => plat_cp_list.includes(item));
|
|
|
+ this.plat_cp_companies = plat_list.map((item) => this.cp_companies.find((cp_item) => cp_item.label === item));
|
|
|
+
|
|
|
+ if(this.plat_cp_companies.length === 4){ this.plat_cp_companies = [{ value: "", label: "所有平台公司" }, ...this.plat_cp_companies] }
|
|
|
+
|
|
|
+ this.companyNo = this.plat_cp_companies[0].value;
|
|
|
+ this.daytime = this.transformTime();
|
|
|
+ this.requestData();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ calcAmountRealRate(){
|
|
|
+ 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.tableData.find(({companyName}) => companyName === '合计-元隆雅图')
|
|
|
+ if(!isInfo){
|
|
|
+ return sourceData.children.reduce((prev,current) => {
|
|
|
+ const value = Number(addition(prev,isNaN(current[prop]) ? 0 : current[prop]))
|
|
|
+ return value === 0 ? 0 : value.toFixed(2)
|
|
|
+ }, 0)
|
|
|
+ } else {
|
|
|
+ const [i1, i2,i3, i4] = prop.split('.')
|
|
|
+ return sourceData.children.reduce((prev,current) => {
|
|
|
+ const value = Number(addition(prev, isNaN(current.info[i1][i2][i3][i4]) ? 0 : current.info[i1][i2][i3][i4]))
|
|
|
+ return value === 0 ? 0 : value.toFixed(2)
|
|
|
+ }, 0)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ unit2TenThousand,
|
|
|
+ load(_1,_2,resolve){
|
|
|
+ const ylBusiness = this.tableData.find(({companyName}) => companyName.indexOf('元隆雅图') !== -1)
|
|
|
+ resolve(ylBusiness ? ylBusiness.children : [])
|
|
|
+ },
|
|
|
+ getCurrentRateStyle(current) {
|
|
|
+ const days = dayjs(this.daytime).daysInMonth();
|
|
|
+ const oneDay = Number(division(100, days)).toFixed(2);
|
|
|
+ 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) {
|
|
|
+ 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 getData({ isChildren } = { isChildren: false }){
|
|
|
+ this.loading = true;
|
|
|
+
|
|
|
+ const api = isChildren ? asyncRequest.platform : asyncRequest.companyEveryMonth
|
|
|
+ const res = await api({ daytime: this.daytime });
|
|
|
+ this.loading = false;
|
|
|
+ let sourceData = []
|
|
|
+
|
|
|
+ if ((isChildren ? res.code === 1 : res.code === 0) && res.data && res.data.length > 0) {
|
|
|
+ res.data.forEach(({
|
|
|
+ platform_name,
|
|
|
+ platform_id,
|
|
|
+ companyName,
|
|
|
+ companyNo ,
|
|
|
+ monthinfo = [],
|
|
|
+ dayinfo = [],
|
|
|
+ total_tips = 0,
|
|
|
+ cost_tips = 0
|
|
|
+ }) => {
|
|
|
+ const mapResponseType = { '1': '自营', '2': '渠道', '3': '供应商端' ,'4' : '物流费用'}
|
|
|
+ const types = Object.keys(mapResponseType)
|
|
|
+
|
|
|
+ let prev_sale_total = 0;
|
|
|
+ let prev_msale_total = 0;
|
|
|
+ let prev_cost_total = 0;
|
|
|
+ let prev_mcost_total = 0;
|
|
|
+
|
|
|
+ const item = types.map(type => {
|
|
|
+ let _monthinfo = (Array.isArray(monthinfo) ? monthinfo : [monthinfo]).find(month => String(month.type) === type)
|
|
|
+ let _dayinfo = (Array.isArray(dayinfo) ? dayinfo : [dayinfo]).find(day => String(day.type) === type)
|
|
|
+
|
|
|
+ const defaultMonthInfo = { mcgd_th_total : "0.00", mcgd_total:"0.00", msale_total: "0.00", mth_total: "0.00", type }
|
|
|
+ const defaultDayinfo = { "sale_total": "0.00", "th_total": "0.00", "type": "1", "cgd_total": "0.00", "cgd_th_total": "0.00" }
|
|
|
+
|
|
|
+ if(!_monthinfo) _monthinfo = defaultMonthInfo
|
|
|
+ if(!_dayinfo) _dayinfo = defaultDayinfo
|
|
|
+
|
|
|
+ // 映射接口的字段
|
|
|
+ if(isChildren && 'sum_sale_total' in _dayinfo){
|
|
|
+ _dayinfo = {
|
|
|
+ cgd_total: _dayinfo.sum_cgd_total,
|
|
|
+ sale_total: _dayinfo.sum_sale_total,
|
|
|
+ cgd_th_total: _dayinfo.sum_cgd_th_total,
|
|
|
+ th_total: _dayinfo.sum_th_total,
|
|
|
+ type
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 月营业收入 = 月销售额 - 月退货额 */
|
|
|
+ let msale_total = 0;
|
|
|
+ if(Number(type) !== 4){ msale_total = subtraction(_monthinfo.msale_total, _monthinfo.mth_total) || 0 }
|
|
|
+
|
|
|
+ /** 日营业收入 = 日销售额 - 日退货额 */
|
|
|
+ const sale_total = subtraction(_dayinfo.sale_total, _dayinfo.th_total) || 0;
|
|
|
+ /** 日成本 = 日采购额 - 日退货额 */
|
|
|
+ const cost_total = subtraction(_dayinfo.cgd_total, _dayinfo.cgd_th_total) || 0;
|
|
|
+ /** 月成本 = 月采购额 - 月退货额 */
|
|
|
+ let mcost_total = 0;
|
|
|
+
|
|
|
+ if(Number(type) !== 4){
|
|
|
+ mcost_total = subtraction(_monthinfo.mcgd_total, _monthinfo.mcgd_th_total) || 0;
|
|
|
+ }else{
|
|
|
+ mcost_total = Number(_monthinfo.mcgd_total || 0).toFixed(2);
|
|
|
+ }
|
|
|
+
|
|
|
+ prev_sale_total = Number(addition(prev_sale_total, sale_total)).toFixed(2);
|
|
|
+ prev_msale_total = Number(addition(prev_msale_total, msale_total)).toFixed(2);
|
|
|
+ prev_cost_total = Number(addition(prev_cost_total, cost_total)).toFixed(2);
|
|
|
+ prev_mcost_total = Number(addition(prev_mcost_total, mcost_total)).toFixed(2);
|
|
|
+
|
|
|
+ return {
|
|
|
+ type: mapResponseType[type],
|
|
|
+ dayinfo: { ..._dayinfo, sale_total },
|
|
|
+ monthinfo: { ...monthinfo, msale_total, mcost_total }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ const gross_completion = Number(subtraction(prev_msale_total, prev_mcost_total)).toFixed(2) //当月毛利完成 = 月营收 - 月成本
|
|
|
+
|
|
|
+
|
|
|
+ sourceData = [
|
|
|
+ ...sourceData,
|
|
|
+ {
|
|
|
+ companyNo: isChildren ? platform_id : companyNo,
|
|
|
+ companyName: isChildren ? platform_name : 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), // 本月毛利率 = 当月毛利完成 / 当月营业收入
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ sourceData = []
|
|
|
+ }
|
|
|
+
|
|
|
+ return sourceData
|
|
|
+ },
|
|
|
+ async requestData() {
|
|
|
+ let platformlist = await this.getData()
|
|
|
+
|
|
|
+ // 显示的公司列表
|
|
|
+ let displayedCompanylist = ["北京万宇恒通国际科贸有限公司", '北京泰文创供应链管理有限公司' ,"北京元隆雅图文化传播股份有限公司"];
|
|
|
+ let values = this.plat_cp_companies.map(({value}) => value)
|
|
|
+ const l = platformlist.map(item => item.companyName);
|
|
|
+ displayedCompanylist = displayedCompanylist.filter(item => l.includes(item));
|
|
|
+ platformlist = displayedCompanylist.map(item => platformlist.find(l => l.companyName === item));
|
|
|
+ platformlist = platformlist.filter(({ companyNo }) => values.includes(companyNo))
|
|
|
+ const composeCompanyIndex = platformlist.findIndex(({ companyNo }) => companyNo === 'GS2404151642335170')
|
|
|
+
|
|
|
+ if(composeCompanyIndex !== -1){
|
|
|
+ const children = (await this.getData({ isChildren: true })).filter(({companyName}) => companyName !== '结算单E企购')
|
|
|
+ const [composeCompany] = platformlist.splice(composeCompanyIndex, 1)
|
|
|
+ platformlist.unshift({ hasChildren: true, children ,...composeCompany })
|
|
|
+ }
|
|
|
+
|
|
|
+ this.tableData = platformlist
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</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>
|
|
|
+
|