perf:客运-老客户:订单数占比、毛利占比值保留小数

main
ZJYHX 1 month ago
parent 488b33ae50
commit a9f45e334d

@ -90,7 +90,7 @@ const Customer_care_regular = () => {
title: '订单数占比', title: '订单数占比',
dataIndex: 'OrderRate', dataIndex: 'OrderRate',
key: 'OrderRate', key: 'OrderRate',
render: (text) => typeof text === 'number'?<span>{Math.round(text * 100)}%</span>:text, render: (text) => typeof text === 'number'?<span>{parseFloat((text * 100).toFixed(2))}%</span>:text,
}, },
{ {
title: '成行数', title: '成行数',
@ -112,7 +112,7 @@ const Customer_care_regular = () => {
title: '毛利占比', title: '毛利占比',
dataIndex: 'OrderMLRate', dataIndex: 'OrderMLRate',
key: 'OrderMLRate', key: 'OrderMLRate',
render: (text) => typeof text === 'number'?<span>{Math.round(text * 100)}%</span>:text, render: (text) => typeof text === 'number'?<span>{parseFloat((text * 100).toFixed(2))}%</span>:text,
}, },
{ {
title: '人数(含成人+儿童)', title: '人数(含成人+儿童)',

@ -2,7 +2,7 @@ import {makeAutoObservable, runInAction} from "mobx";
import { fetchJSON } from '../utils/request'; import { fetchJSON } from '../utils/request';
import * as config from "../config"; import * as config from "../config";
import { groupsMappedByKey, sitesMappedByCode, pivotBy } from './../libs/ht'; import { groupsMappedByKey, sitesMappedByCode, pivotBy } from './../libs/ht';
import { sortBy, show_vs_tag, formatPercent, groupBy, isEmpty, uniqWith } from "../utils/commons"; import { sortBy, show_vs_tag, formatPercent, groupBy, isEmpty, uniqWith, formatPercentToFloat } from "../utils/commons";
import moment from 'moment'; import moment from 'moment';
/** /**
@ -242,13 +242,13 @@ class CustomerStore {
SUCOrderNum: show_vs_tag(formatPercent((item1.SUCOrderNum-item2.SUCOrderNum)/(item2.SUCOrderNum===0?1:item2.SUCOrderNum)), SUCOrderNum: show_vs_tag(formatPercent((item1.SUCOrderNum-item2.SUCOrderNum)/(item2.SUCOrderNum===0?1:item2.SUCOrderNum)),
item1.SUCOrderNum-item2.SUCOrderNum,item1.SUCOrderNum,item2.SUCOrderNum), item1.SUCOrderNum-item2.SUCOrderNum,item1.SUCOrderNum,item2.SUCOrderNum),
OrderRate: show_vs_tag(formatPercent((item1.OrderRate-item2.OrderRate)/item2.OrderRate), OrderRate: show_vs_tag(formatPercent((item1.OrderRate-item2.OrderRate)/item2.OrderRate),
formatPercent(item1.OrderRate-item2.OrderRate),formatPercent(item1.OrderRate),formatPercent(item2.OrderRate)), formatPercentToFloat(item1.OrderRate-item2.OrderRate),formatPercentToFloat(item1.OrderRate),formatPercentToFloat(item2.OrderRate)),
SUCRate: show_vs_tag(formatPercent((item1.SUCRate-item2.SUCRate)/(item2.SUCRate===0?1:item2.SUCRate)), SUCRate: show_vs_tag(formatPercent((item1.SUCRate-item2.SUCRate)/(item2.SUCRate===0?1:item2.SUCRate)),
formatPercent(item1.SUCRate-item2.SUCRate),formatPercent(item1.SUCRate),formatPercent(item2.SUCRate)), formatPercent(item1.SUCRate-item2.SUCRate),formatPercent(item1.SUCRate),formatPercent(item2.SUCRate)),
ML: show_vs_tag(formatPercent((item1.ML-item2.ML)/(item2.ML===0?1:item2.ML)), ML: show_vs_tag(formatPercent((item1.ML-item2.ML)/(item2.ML===0?1:item2.ML)),
(item1.ML-item2.ML).toFixed(2),item1.ML,item2.ML), (item1.ML-item2.ML).toFixed(2),item1.ML,item2.ML),
OrderMLRate: show_vs_tag(formatPercent((item1.OrderMLRate-item2.OrderMLRate)/item2.OrderMLRate), OrderMLRate: show_vs_tag(formatPercent((item1.OrderMLRate-item2.OrderMLRate)/item2.OrderMLRate),
formatPercent(item1.OrderMLRate-item2.OrderMLRate),formatPercent(item1.OrderMLRate),formatPercent(item2.OrderMLRate)), formatPercentToFloat(item1.OrderMLRate-item2.OrderMLRate),formatPercentToFloat(item1.OrderMLRate),formatPercentToFloat(item2.OrderMLRate)),
PersonNum: show_vs_tag(formatPercent((item1.PersonNum-item2.PersonNum)/(item2.PersonNum===0?1:item2.PersonNum)), PersonNum: show_vs_tag(formatPercent((item1.PersonNum-item2.PersonNum)/(item2.PersonNum===0?1:item2.PersonNum)),
item1.PersonNum-item2.PersonNum,item1.PersonNum,item2.PersonNum), item1.PersonNum-item2.PersonNum,item1.PersonNum,item2.PersonNum),
}); });

@ -72,6 +72,10 @@ export function formatPercent(number) {
return Math.round(number * 100) + "%"; return Math.round(number * 100) + "%";
} }
export function formatPercentToFloat(number) {
return parseFloat((number * 100).toFixed(2)) + "%";
}
export function percentToDecimal(number) { export function percentToDecimal(number) {
return parseFloat(number) / 100; return parseFloat(number) / 100;
} }

Loading…
Cancel
Save