fix: 修复同步问题

This commit is contained in:
hzm
2026-03-17 14:10:17 +08:00
parent 7c48e94a5d
commit 0a97b80499
2 changed files with 13 additions and 33 deletions

View File

@@ -117,7 +117,8 @@ export default function GroupSummary({
hasHolding = true;
totalAsset += profit.amount;
if (profit.profitToday != null) {
totalProfitToday += Math.round(profit.profitToday * 100) / 100;
// 先累加原始当日收益,最后统一做一次四舍五入,避免逐笔四舍五入造成的总计误差
totalProfitToday += profit.profitToday;
hasAnyTodayData = true;
}
if (profit.profitTotal !== null) {
@@ -129,11 +130,14 @@ export default function GroupSummary({
}
});
// 将当日收益总和四舍五入到两位小数,和卡片展示保持一致
const roundedTotalProfitToday = Math.round(totalProfitToday * 100) / 100;
const returnRate = totalCost > 0 ? (totalHoldingReturn / totalCost) * 100 : 0;
return {
totalAsset,
totalProfitToday,
totalProfitToday: roundedTotalProfitToday,
totalHoldingReturn,
hasHolding,
returnRate,