From 1b47fb8f326bbd98b0176017180df27780c1071e Mon Sep 17 00:00:00 2001 From: Break Date: Tue, 2 Jun 2026 16:19:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=A3=E9=87=91=E8=AE=A1=E7=AE=97=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/service/commission_calculation/service.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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{