Skip to content

Commit

Permalink
Merge pull request #42 from JJBoy1995/fix-bug
Browse files Browse the repository at this point in the history
【修复】商城管理首页统计数据显示问题
  • Loading branch information
YunaiV authored May 11, 2024
2 parents 05e6c2c + 1cf286b commit 663c8b3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/mall/home/components/TradeTrendCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)) // 当前金额
Expand Down

0 comments on commit 663c8b3

Please sign in to comment.