diff --git a/internal/service/commission_calculation/service.go b/internal/service/commission_calculation/service.go index 211250d..8f9c28e 100644 --- a/internal/service/commission_calculation/service.go +++ b/internal/service/commission_calculation/service.go @@ -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{