|
@@ -91,7 +91,7 @@
|
|
|
{{
|
|
|
isAmountProp(scope.row.companyName)
|
|
|
? calcAmountCompletionRate(scope.row.companyNo)
|
|
|
- : (String(scope.row.completion_rate) === 'NaN' || Math.abs(scope.row.completion_rate) === Infinity ? 0 : scope.row.completion_rate) + "%"
|
|
|
+ : isLineRete((String(scope.row.completion_rate) === 'NaN' || Math.abs(scope.row.completion_rate) === Infinity ? 0 : scope.row.completion_rate))
|
|
|
}}
|
|
|
</div>
|
|
|
</template>
|
|
@@ -124,7 +124,7 @@
|
|
|
<el-table-column label="毛利完成%" align="center" min-width="85px">
|
|
|
<template slot-scope="scope">
|
|
|
<div :style="isAmountProp(scope.row.companyName) ? '' : getCurrentRateStyle(scope.row.gross_completion_rate)">
|
|
|
- {{ isAmountProp(scope.row.companyName) ? calcAmountGrossCompletionRate(scope.row.companyNo) : scope.row.gross_completion_rate + '%' }}
|
|
|
+ {{ isAmountProp(scope.row.companyName) ? calcAmountGrossCompletionRate(scope.row.companyNo) : scope.row.gross_completion_rate === '-' ? '-' : scope.row.gross_completion_rate + '%' }}
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -230,13 +230,16 @@ export default {
|
|
|
this.requestData();
|
|
|
},
|
|
|
methods: {
|
|
|
+ isLineRete(value){
|
|
|
+ return value === '-' ? '-' : value + '%'
|
|
|
+ },
|
|
|
calcAmountRealRate(companyNo){
|
|
|
const msale_total = this.calcAmount('msale_total',companyNo)
|
|
|
const gross_completion = this.calcAmount('gross_completion',companyNo)
|
|
|
return Number(multiplication(Number(division(gross_completion, msale_total)).toFixed(2), 100)).toFixed(2) + '%'
|
|
|
},
|
|
|
calcAmountGrossCompletionRate(companyNo){
|
|
|
- if(companyNo === 'selfSupportOrderPR') return '-%'
|
|
|
+ if(companyNo === 'selfSupportOrderPR') return '-'
|
|
|
let cost_tips = ''
|
|
|
|
|
|
if(companyNo === 'selfSupportOrderAmount'){
|
|
@@ -319,8 +322,8 @@ export default {
|
|
|
return Number(currentTotalTip) > Number(current) ? 'color:red' : ''
|
|
|
},
|
|
|
handleData(data){
|
|
|
+ // console.log(JSON.parse(JSON.stringify(data.companyArr[0])))
|
|
|
let companyArr = []
|
|
|
-
|
|
|
data.companyArr.forEach(({
|
|
|
supplierName,
|
|
|
supplierNo,
|
|
@@ -328,8 +331,10 @@ export default {
|
|
|
monthinfo,
|
|
|
cost_tips = '-',
|
|
|
dayinfo,
|
|
|
- is_sup
|
|
|
+ is_sup = '-'
|
|
|
}) => {
|
|
|
+
|
|
|
+ total_tips = Number(total_tips) === 0 ? '-' : total_tips
|
|
|
const mapResponseType = { '1': '自营' }
|
|
|
const types = Object.keys(mapResponseType)
|
|
|
let prev_sale_total = 0;
|
|
@@ -338,12 +343,15 @@ export default {
|
|
|
let prev_mcost_total = 0;
|
|
|
|
|
|
const item = types.map(type => {
|
|
|
+
|
|
|
let _monthinfo = (Array.isArray(monthinfo) ? monthinfo : [monthinfo])[0]
|
|
|
- let _dayinfo = (Array.isArray(dayinfo) ? dayinfo : dayinfo)[0]
|
|
|
+ let _dayinfo = (Array.isArray(dayinfo) ? dayinfo : [dayinfo])[0]
|
|
|
const defaultMonthInfo = { mcgd_th_total : "0.00", mcgd_total:"0.00", msale_total: "0.00", mth_total: "0.00", type }
|
|
|
- const defaultDayinfo = { "sale_total": "0.00", "th_total": "0.00", "type": "1", "cgd_total": "0.00", "cgd_th_total": "0.00" }
|
|
|
+ const defaultDayinfo = { "sale_total": "0.00", "th_total": "0.00", "type": "1", "cgd_total": "0.00", "cgd_th_total": "0.00", type }
|
|
|
+
|
|
|
if(!_monthinfo) _monthinfo = defaultMonthInfo
|
|
|
if(!_dayinfo) _dayinfo = defaultDayinfo
|
|
|
+
|
|
|
/** 月营业收入 = 月销售额 - 月退货额 */
|
|
|
let msale_total = 0;
|
|
|
if('msale_th_total' in _monthinfo){ _monthinfo.mth_total = _monthinfo.msale_th_total }
|
|
@@ -351,7 +359,7 @@ export default {
|
|
|
msale_total = subtraction(_monthinfo.msale_total, _monthinfo.mth_total) || 0
|
|
|
// }
|
|
|
/** 日营业收入 = 日销售额 - 日退货额 */
|
|
|
- const sale_total = subtraction(_dayinfo.sale_total, _dayinfo.th_total) || 0;
|
|
|
+ const sale_total = subtraction(_dayinfo.sale_total, _dayinfo.sale_th_total) || 0;
|
|
|
/** 日成本 = 日采购额 - 日退货额 */
|
|
|
const cost_total = subtraction(_dayinfo.cgd_total, _dayinfo.cgd_th_total) || 0;
|
|
|
/** 月成本 = 月采购额 - 月退货额 */
|
|
@@ -375,6 +383,8 @@ export default {
|
|
|
|
|
|
const gross_completion = Number(subtraction(prev_msale_total, prev_mcost_total)).toFixed(2) //当月毛利完成 = 月营收 - 月成本
|
|
|
|
|
|
+
|
|
|
+
|
|
|
companyArr = [
|
|
|
...companyArr,
|
|
|
{
|
|
@@ -389,7 +399,7 @@ export default {
|
|
|
msale_total: prev_msale_total, // 当月营业收入
|
|
|
mcost_total: prev_mcost_total,// 当月成本总额
|
|
|
gross_completion, //当月毛利完成 = 月营收 - 月成本
|
|
|
- completion_rate: total_tips === '-' ? '-' : multiplication(division(prev_msale_total, total_tips), 100).toFixed(2), // 当月应收完成率
|
|
|
+ completion_rate: total_tips === '-' ? '-' : multiplication(Number(division(prev_msale_total, total_tips)).toFixed(2), 100).toFixed(2), // 当月应收完成率
|
|
|
gross_completion_rate: cost_tips === '-' ? '-' :Number(cost_tips) === 0 ? 0 : multiplication(division(gross_completion, cost_tips) || 0, 100).toFixed(2), // 当月毛利完成率
|
|
|
gross_sale_completion_rate: Number(multiplication(division(gross_completion, prev_msale_total) || 0, 100)).toFixed(2), // 本月毛利率 = 当月毛利完成 / 当月营业收入
|
|
|
}
|
|
@@ -467,8 +477,6 @@ export default {
|
|
|
this.loading = true;
|
|
|
this.tableData = [];
|
|
|
const res = await asyncRequest.supplier({ daytime: this.daytime });
|
|
|
- let sourceData = []
|
|
|
-
|
|
|
if (res.code === 1 && res.data) {
|
|
|
let { '2': selfSupport, '3': otherSupport } = JSON.parse(JSON.stringify(res.data))
|
|
|
selfSupport.companyArr = this.handleData(selfSupport)
|
|
@@ -477,8 +485,14 @@ export default {
|
|
|
this.otherSupport = otherSupport
|
|
|
this.selfSupport = selfSupport
|
|
|
|
|
|
+ let children = this.selfSupport.companyArr.filter(({companyNo}) => this.composeCompanies.includes(companyNo))
|
|
|
+
|
|
|
+ const companies = ['北京普润心堂商贸有限公司', '北京锦兴弘昌科技有限公司', '北京知事文化产业发展有限公司']
|
|
|
+ children = companies.map(companyName => {
|
|
|
+ return children.find(item => item.companyName === companyName)
|
|
|
+ })
|
|
|
+
|
|
|
|
|
|
- const children = this.selfSupport.companyArr.filter(({companyNo}) => this.composeCompanies.includes(companyNo))
|
|
|
this.selfSupport.companyArr = this.selfSupport.companyArr.filter(({companyNo}) => !this.composeCompanies.includes(companyNo))
|
|
|
|
|
|
this.selfSupport.companyArr = [
|