Merge branch 'main' into feature/distribution-system
同步结账损耗全额归号主与后台时间线 AuthImage 修复。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -340,16 +340,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)
|
||||
|
||||
Reference in New Issue
Block a user