Merge pull request #42 from JJBoy1995/fix-bug

【修复】商城管理首页统计数据显示问题
This commit is contained in:
芋道源码 2024-05-11 23:25:05 +08:00 committed by GitHub
commit 663c8b3824
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -313,7 +313,7 @@ export const fenToYuan = (price: string | number): string => {
*/
export const calculateRelativeRate = (value?: number, reference?: number) => {
// 防止除0
if (!reference) return 0
if (!reference || reference == 0) return 0
return ((100 * ((value || 0) - reference)) / reference).toFixed(0)
}

View File

@ -186,7 +186,7 @@ const getOrderCountTrendComparison = async (
dates.push(item.value.date)
if (series.length === 2) {
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 {
series[0].data.push(fenToYuan(item?.reference?.orderPayPrice || 0)) //
series[1].data.push(fenToYuan(item?.value?.orderPayPrice || 0)) //