|
@@ -1,5 +1,6 @@
|
|
<template>
|
|
<template>
|
|
<div class="SalesReportRejectedNew">
|
|
<div class="SalesReportRejectedNew">
|
|
|
|
+ <div class="table-header">{{index}}.{{companyName || '--'}}</div>
|
|
<el-table
|
|
<el-table
|
|
:data="tableData"
|
|
:data="tableData"
|
|
v-loading="loading"
|
|
v-loading="loading"
|
|
@@ -7,29 +8,32 @@
|
|
:size="'mini'"
|
|
:size="'mini'"
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
>
|
|
>
|
|
- <el-table-column label="部门" prop="depart">
|
|
|
|
- <template slot-scope="scope">部门</template>
|
|
|
|
|
|
+ <el-table-column label="业绩类型" prop="depart" align="center">
|
|
|
|
+ <template slot-scope="scope">{{scope.row.field}}</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="本日销售净额" prop="depart">
|
|
|
|
- <template slot-scope="scope">本日净销售额</template>
|
|
|
|
|
|
+ <el-table-column label="本日销售净额" prop="pure_day_sale">
|
|
|
|
+ <template slot-scope="scope">{{unit2TenThousand(scope.row.pure_day_sale)}}</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="本日毛利率" prop="depart">
|
|
|
|
- <template slot-scope="scope">本日毛利率 = (本日净销售额 - 本日净采购额)</template>
|
|
|
|
|
|
+ <el-table-column label="本日毛利润" prop="pure_day_profit">
|
|
|
|
+ <template slot-scope="scope">{{unit2TenThousand(scope.row.pure_day_profit)}}</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="本月销售净额" prop="depart">
|
|
|
|
- <template slot-scope="scope">本月销售净额</template>
|
|
|
|
|
|
+ <el-table-column label="本日毛利率" prop="pure_month_interest_rate">
|
|
|
|
+ <template slot-scope="scope">{{Number(scope.row.pure_day_interest_rate || 0).toFixed(2) + '%'}}</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="本月销售指标" prop="depart">
|
|
|
|
- <template slot-scope="scope">本月销售指标</template>
|
|
|
|
|
|
+ <el-table-column label="本月销售净额" prop="pure_month_sale">
|
|
|
|
+ <template slot-scope="scope">{{unit2TenThousand(scope.row.pure_month_sale)}}</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="本月指标达成率" width="105px" prop="depart">
|
|
|
|
- <template slot-scope="scope">本月指标达成率 = (本月销售净额 / 本月销售指标) * 100</template>
|
|
|
|
|
|
+ <el-table-column label="本月销售指标" prop="total_tips">
|
|
|
|
+ <template slot-scope="scope">{{ unit2TenThousand(scope.row.total_tips) }}</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="本月毛利润" prop="depart">
|
|
|
|
- <template slot-scope="scope">本月毛利润 = (本月销售净额 - 本月采购净额)</template>
|
|
|
|
|
|
+ <el-table-column label="本月指标达成率" width="105px" prop="month_completion_rate">
|
|
|
|
+ <template slot-scope="scope">{{ scope.row.month_completion_rate === '--' ? '--' : Number(scope.row.month_completion_rate || 0).toFixed(2) + '%'}}</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="本月毛利率" prop="depart">
|
|
|
|
- <template slot-scope="scope">本月毛利率 = (本月毛利润 / 本月销售净额)</template>
|
|
|
|
|
|
+ <el-table-column label="本月毛利润" prop="pure_month_profit">
|
|
|
|
+ <template slot-scope="scope">{{unit2TenThousand(scope.row.pure_month_profit)}}</template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="本月毛利率" prop="pure_month_interest_rate">
|
|
|
|
+ <template slot-scope="scope">{{Number(scope.row.pure_month_interest_rate || 0).toFixed(2) + '%'}}</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
</div>
|
|
</div>
|
|
@@ -43,16 +47,17 @@ import {
|
|
getCompanyLabel,
|
|
getCompanyLabel,
|
|
multiplication,
|
|
multiplication,
|
|
subtraction,
|
|
subtraction,
|
|
- addition,
|
|
|
|
- division
|
|
|
|
|
|
+ division,
|
|
|
|
+ addition,
|
|
|
|
+ createTotalItem
|
|
} from "./_utils";
|
|
} from "./_utils";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "CompanyGrossMargin",
|
|
name: "CompanyGrossMargin",
|
|
- props: ["date"],
|
|
|
|
|
|
+ props: ["date","companyNo","index",'daytime'],
|
|
mixins: [setHeight],
|
|
mixins: [setHeight],
|
|
watch: {
|
|
watch: {
|
|
- date: function(val) {
|
|
|
|
|
|
+ daytime: function(val) {
|
|
this.dataTime = val;
|
|
this.dataTime = val;
|
|
if (val) {
|
|
if (val) {
|
|
this.searchList();
|
|
this.searchList();
|
|
@@ -63,7 +68,8 @@ export default {
|
|
return {
|
|
return {
|
|
loading: false,
|
|
loading: false,
|
|
maxHeight: "0",
|
|
maxHeight: "0",
|
|
- tableData: []
|
|
|
|
|
|
+ tableData: [],
|
|
|
|
+ companyName:"",
|
|
};
|
|
};
|
|
},
|
|
},
|
|
async created() {
|
|
async created() {
|
|
@@ -83,7 +89,145 @@ export default {
|
|
division,
|
|
division,
|
|
async searchList() {
|
|
async searchList() {
|
|
this.loading = true;
|
|
this.loading = true;
|
|
- this.tableData = [{depart:11}];
|
|
|
|
|
|
+ const result = await asyncRequest.companyEveryMonth({companyNo:this.companyNo,daytime:this.daytime})
|
|
|
|
+
|
|
|
|
+ console.log(result)
|
|
|
|
+ switch(Number(result.code)){
|
|
|
|
+ case 0:
|
|
|
|
+ this.companyName = result.data[0].companyName
|
|
|
|
+ const companies = ['百辰','普润','泓源']
|
|
|
|
+ const fields = ['自营','渠道','小计','供应商端','合计']
|
|
|
|
+
|
|
|
|
+ // 过滤三家公司数据
|
|
|
|
+ let tableData = (result.data || []).filter(({companyName}) => companies.some(company => companyName.indexOf(company) !== -1))
|
|
|
|
+ //合计三家公司的自营、渠道、供应商端数据
|
|
|
|
+ const total = tableData.reduce((prev,current) => ({
|
|
|
|
+ supplierSaleDay:addition(prev.supplierSaleDay,subtraction(current.dayinfo[2].sale_total,current.dayinfo[2].th_total)),
|
|
|
|
+ supplierSaleMonth:addition(prev.supplierSaleMonth,subtraction(current.monthinfo[2].msale_total,current.monthinfo[2].mth_total)),
|
|
|
|
+ supplierPurchDay:addition(prev.supplierPurchDay,subtraction(current.dayinfo[2].cgd_total,current.dayinfo[2].cgd_th_total)),
|
|
|
|
+ supplierPurchMonth:addition(prev.supplierPurchMonth,subtraction(current.monthinfo[2].mcgd_total,current.monthinfo[2].mcgd_th_total)),
|
|
|
|
+
|
|
|
|
+ selfOperatedSaleDay:addition(prev.selfOperatedSaleDay,subtraction(current.dayinfo[1].sale_total,current.dayinfo[1].th_total)),
|
|
|
|
+ selfOperatedSaleMonth:addition(prev.selfOperatedSaleMonth,subtraction(current.monthinfo[1].msale_total,current.monthinfo[1].mth_total)),
|
|
|
|
+ selfOperatedPurchDay:addition(prev.selfOperatedPurchDay,subtraction(current.dayinfo[1].cgd_total,current.dayinfo[1].cgd_th_total)),
|
|
|
|
+ selfOperatedPurchMonth:addition(prev.selfOperatedPurchMonth,subtraction(current.monthinfo[1].mcgd_total,current.monthinfo[1].mcgd_th_total)),
|
|
|
|
+
|
|
|
|
+ channelSaleDay:addition(prev.channelSaleDay,subtraction(current.dayinfo[0].sale_total,current.dayinfo[0].th_total)),
|
|
|
|
+ channelSaleMonth:addition(prev.channelSaleMonth,subtraction(current.monthinfo[0].msale_total,current.monthinfo[0].mth_total)),
|
|
|
|
+ channelPurchDay:addition(prev.channelPurchDay,subtraction(current.dayinfo[0].cgd_total,current.dayinfo[0].cgd_th_total)),
|
|
|
|
+ channelPurchMonth:addition(prev.channelPurchMonth,subtraction(current.monthinfo[0].mcgd_total,current.monthinfo[0].mcgd_th_total)),
|
|
|
|
+
|
|
|
|
+ totalTips:addition(prev.totalTips,current.total_tips)
|
|
|
|
+ }),{
|
|
|
|
+ supplierSaleDay:0,
|
|
|
|
+ supplierSaleMonth:0,
|
|
|
|
+ supplierPurchDay:0,
|
|
|
|
+ supplierPurchMonth:0,
|
|
|
|
+ selfOperatedSaleDay:0,
|
|
|
|
+ selfOperatedSaleMonth:0,
|
|
|
|
+ selfOperatedPurchDay:0,
|
|
|
|
+ selfOperatedPurchMonth:0,
|
|
|
|
+ channelSaleDay:0,
|
|
|
|
+ channelSaleMonth:0,
|
|
|
|
+ channelPurchDay:0,
|
|
|
|
+ channelPurchMonth:0,
|
|
|
|
+ totalTips:0
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ const mapFieldToTotalProperties = {
|
|
|
|
+ '供应商端':{
|
|
|
|
+ saleDay:'supplierSaleDay',
|
|
|
|
+ saleMonth:'supplierSaleMonth',
|
|
|
|
+ purchDay:'supplierPurchDay',
|
|
|
|
+ purchMonth:'supplierPurchMonth',
|
|
|
|
+ },
|
|
|
|
+ '自营':{
|
|
|
|
+ saleDay:'selfOperatedSaleDay',
|
|
|
|
+ saleMonth:'selfOperatedSaleMonth',
|
|
|
|
+ purchDay:'selfOperatedPurchDay',
|
|
|
|
+ purchMonth:'selfOperatedPurchMonth',
|
|
|
|
+ },
|
|
|
|
+ '渠道':{
|
|
|
|
+ saleDay:'channelSaleDay',
|
|
|
|
+ saleMonth:'channelSaleMonth',
|
|
|
|
+ purchDay:'channelPurchDay',
|
|
|
|
+ purchMonth:'channelPurchMonth'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ tableData = fields.map(field => {
|
|
|
|
+ const properties = mapFieldToTotalProperties[field]
|
|
|
|
+
|
|
|
|
+ if(!properties) {
|
|
|
|
+ return {
|
|
|
|
+ field,
|
|
|
|
+ total_tips:'--',
|
|
|
|
+ pure_day_sale:0,
|
|
|
|
+ pure_day_purch:0,
|
|
|
|
+ pure_day_profit:0,
|
|
|
|
+ pure_month_sale:0,
|
|
|
|
+ pure_month_purch:0,
|
|
|
|
+ month_completion_rate:'--',
|
|
|
|
+ pure_month_profit:0,
|
|
|
|
+ pure_month_interest_rate:0
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const pure_day_sale = total[properties.saleDay]
|
|
|
|
+ const pure_day_purch = total[properties.purchDay]
|
|
|
|
+ /* 本日毛利润 = (本日净销售额 - 本日净采购额) **/
|
|
|
|
+ const pure_day_profit = subtraction(pure_day_sale,pure_day_purch)
|
|
|
|
+ const pure_day_interest_rate = multiplication(division(pure_day_profit,pure_day_sale),100)
|
|
|
|
+ const pure_month_sale = total[properties.saleMonth]
|
|
|
|
+ const pure_month_purch = total[properties.purchMonth]
|
|
|
|
+ /* 本月毛利润 = (本月销售净额 - 本月采购净额) **/
|
|
|
|
+ const pure_month_profit = subtraction(pure_month_sale,pure_month_purch)
|
|
|
|
+ /* 本月毛利率 = (本月毛利润 / 本月销售净额) * 100**/
|
|
|
|
+ const pure_month_interest_rate = multiplication(division(pure_month_profit,pure_month_sale),100)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return {
|
|
|
|
+ field,
|
|
|
|
+ total_tips:'--',
|
|
|
|
+ pure_day_sale,
|
|
|
|
+ pure_day_purch,
|
|
|
|
+ pure_day_profit,
|
|
|
|
+ pure_month_sale,
|
|
|
|
+ pure_month_purch,
|
|
|
|
+ month_completion_rate:'--',
|
|
|
|
+ pure_month_profit,
|
|
|
|
+ pure_month_interest_rate,
|
|
|
|
+ pure_day_interest_rate
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ /* 小计 = 自营 + 渠道 **/
|
|
|
|
+ const totalItem = createTotalItem([tableData[0],tableData[1]])
|
|
|
|
+ totalItem.field = "小计"
|
|
|
|
+ totalItem.total_tips = "--"
|
|
|
|
+ totalItem.month_completion_rate = "--"
|
|
|
|
+ totalItem.pure_month_interest_rate = multiplication(division(totalItem.pure_month_profit,totalItem.pure_month_sale),100)
|
|
|
|
+ totalItem.pure_day_interest_rate = multiplication(division(totalItem.pure_day_profit,totalItem.pure_day_sale),100)
|
|
|
|
+
|
|
|
|
+ tableData[2] = totalItem
|
|
|
|
+
|
|
|
|
+ /* 合计 = 小计 + 供应商端 **/
|
|
|
|
+ const lastItem = createTotalItem([tableData[2],tableData[3]])
|
|
|
|
+ lastItem.field = "合计"
|
|
|
|
+ lastItem.total_tips = total.totalTips
|
|
|
|
+ lastItem.pure_month_interest_rate = multiplication(division(lastItem.pure_month_profit,lastItem.pure_month_sale),100)
|
|
|
|
+ /* 本月指标达成率 = (本月销售净额 / 本月销售指标) * 100 **/
|
|
|
|
+ lastItem.month_completion_rate = multiplication(division(lastItem.pure_month_sale,lastItem.total_tips),100)
|
|
|
|
+ lastItem.pure_day_interest_rate = multiplication(division(totalItem.pure_day_profit,totalItem.pure_day_sale),100)
|
|
|
|
+
|
|
|
|
+ tableData[4] = lastItem
|
|
|
|
+ this.tableData = tableData
|
|
|
|
+ break
|
|
|
|
+ default:
|
|
|
|
+ break
|
|
|
|
+ }
|
|
this.getHeight();
|
|
this.getHeight();
|
|
this.loading = false;
|
|
this.loading = false;
|
|
}
|
|
}
|
|
@@ -93,4 +237,3 @@ export default {
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
</style>
|
|
</style>
|
|
-
|
|
|