feat(checkout): 修复后置损耗结算全额归号主、支持角色隔离实时试算与全流程UI重构

- fix(pricing): 后置消耗/损耗金额 100% 划归号主收益,超出预收部分平台不抽成,避免被平台费吸收
- feat(checkout): 前端新增结账实时试算预览组件 (CheckoutTrialPreview + useCheckoutSimulator),角色隔离展示(仅见自身收入/退款,屏蔽平台服务费)
- refactor(admin): 重构交易全流程时间线 (ProcessTimeline.vue),将平铺挤压指标重构成4大分类仪表盘微型卡片矩阵,升级可视化业务状态流转徽章与阶段色彩主题
- style(admin): 优化支付与交接流水元信息网格布局,防止超宽屏下长单行拉伸
This commit is contained in:
yml2213
2026-09-13 10:19:33 +08:00
parent 7734f315ce
commit dff0577385
10 changed files with 1426 additions and 153 deletions
+14 -8
View File
@@ -336,16 +336,22 @@ func calculateCheckoutSettlement(order model.RentalOrder, consumableAmountCent i
}
}
// 消耗品按申报金额计价,允许超过预收;号主侧按预收消耗品占比线性外推
// 消耗品按申报金额计价,允许超过预收;号主侧按预收消耗品占比外推,超额及无预收损耗全额归号主
usedBuyerConsumablePriceCent := maxCent(consumableAmountCent, 0)
consumableUseRatio := 0.0
var usedOwnerConsumablePriceCent int64
if prepaidConsumablePriceCent > 0 {
consumableUseRatio = maxRatio(float64(usedBuyerConsumablePriceCent)/float64(prepaidConsumablePriceCent), 0)
}
usedOwnerConsumablePriceCent := int64(math.Round(float64(prepaidOwnerConsumablePriceCent) * consumableUseRatio))
if usedBuyerConsumablePriceCent <= prepaidConsumablePriceCent {
usedBuyerConsumablePriceCent = minCent(usedBuyerConsumablePriceCent, prepaidConsumablePriceCent)
usedOwnerConsumablePriceCent = minCent(usedOwnerConsumablePriceCent, prepaidOwnerConsumablePriceCent)
if usedBuyerConsumablePriceCent <= prepaidConsumablePriceCent {
consumableUseRatio := maxRatio(float64(usedBuyerConsumablePriceCent)/float64(prepaidConsumablePriceCent), 0)
usedOwnerConsumablePriceCent = int64(math.Round(float64(prepaidOwnerConsumablePriceCent) * consumableUseRatio))
usedOwnerConsumablePriceCent = minCent(usedOwnerConsumablePriceCent, prepaidOwnerConsumablePriceCent)
} else {
// 预收范围内按号主预收基准,超出预收部分作为后置损耗全额划归号主(平台不抽成)
excessCent := usedBuyerConsumablePriceCent - prepaidConsumablePriceCent
usedOwnerConsumablePriceCent = prepaidOwnerConsumablePriceCent + excessCent
}
} else {
// 原订单无预收消耗品,后置申报的消耗/损耗金额 100% 归号主,平台不抽成
usedOwnerConsumablePriceCent = usedBuyerConsumablePriceCent
}
pureCoinPlatformFeeCent := maxCent(usedBuyerCoinPriceCent-usedOwnerCoinPriceCent, 0)