From 1cf286b057555201674b1afd0638bda627f494bd Mon Sep 17 00:00:00 2001 From: JJBoy <291077997@qq.com> Date: Wed, 8 May 2024 21:12:24 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E5=A4=8D=E3=80=91=E5=95=86?= =?UTF-8?q?=E5=9F=8E=E7=AE=A1=E7=90=86=E9=A6=96=E9=A1=B5=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 78dd2fa38a2d040c1c97d70cababc4f9265ac705) --- src/utils/index.ts | 2 +- src/views/mall/home/components/TradeTrendCard.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/index.ts b/src/utils/index.ts index 2590bce8..2c2fbbd0 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -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) } diff --git a/src/views/mall/home/components/TradeTrendCard.vue b/src/views/mall/home/components/TradeTrendCard.vue index a8cab828..7930e212 100644 --- a/src/views/mall/home/components/TradeTrendCard.vue +++ b/src/views/mall/home/components/TradeTrendCard.vue @@ -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)) // 当前金额