佣金计算问题
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m23s

This commit is contained in:
Break
2026-06-02 16:19:42 +08:00
parent c5126c583b
commit 1b47fb8f32

View File

@@ -141,7 +141,14 @@ func (s *Service) CalculateCostDiffCommission(ctx context.Context, order *model.
return nil, errors.Wrap(errors.CodeDatabaseError, err, "获取销售店铺失败")
}
sellerProfit := order.TotalAmount - order.SellerCostPrice
// 卖家利润 = 实际收款 - 成本价,必须用 ActualPaidAmount 而非 TotalAmount
// TotalAmount 在 fix-order-price-semantics 后始终存零售价,代理自购时会错误产生佣金
var sellerProfit int64
if order.ActualPaidAmount != nil {
sellerProfit = *order.ActualPaidAmount - order.SellerCostPrice
} else {
sellerProfit = order.TotalAmount - order.SellerCostPrice
}
if sellerProfit > 0 {
records = append(records, &model.CommissionRecord{
BaseModel: model.BaseModel{