commit
663c8b3824
@ -313,7 +313,7 @@ export const fenToYuan = (price: string | number): string => {
|
|||||||
*/
|
*/
|
||||||
export const calculateRelativeRate = (value?: number, reference?: number) => {
|
export const calculateRelativeRate = (value?: number, reference?: number) => {
|
||||||
// 防止除0
|
// 防止除0
|
||||||
if (!reference) return 0
|
if (!reference || reference == 0) return 0
|
||||||
|
|
||||||
return ((100 * ((value || 0) - reference)) / reference).toFixed(0)
|
return ((100 * ((value || 0) - reference)) / reference).toFixed(0)
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ const getOrderCountTrendComparison = async (
|
|||||||
dates.push(item.value.date)
|
dates.push(item.value.date)
|
||||||
if (series.length === 2) {
|
if (series.length === 2) {
|
||||||
series[0].data.push(fenToYuan(item?.value?.orderPayPrice || 0)) // 当前金额
|
series[0].data.push(fenToYuan(item?.value?.orderPayPrice || 0)) // 当前金额
|
||||||
series[1].data.push(fenToYuan(item?.value?.orderPayCount || 0)) // 当前数量
|
series[1].data.push(item?.value?.orderPayCount || 0) // 当前数量
|
||||||
} else {
|
} else {
|
||||||
series[0].data.push(fenToYuan(item?.reference?.orderPayPrice || 0)) // 对照金额
|
series[0].data.push(fenToYuan(item?.reference?.orderPayPrice || 0)) // 对照金额
|
||||||
series[1].data.push(fenToYuan(item?.value?.orderPayPrice || 0)) // 当前金额
|
series[1].data.push(fenToYuan(item?.value?.orderPayPrice || 0)) // 当前金额
|
||||||
|
Loading…
Reference in New Issue
Block a user