This commit is contained in:
@@ -141,7 +141,14 @@ func (s *Service) CalculateCostDiffCommission(ctx context.Context, order *model.
|
|||||||
return nil, errors.Wrap(errors.CodeDatabaseError, err, "获取销售店铺失败")
|
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 {
|
if sellerProfit > 0 {
|
||||||
records = append(records, &model.CommissionRecord{
|
records = append(records, &model.CommissionRecord{
|
||||||
BaseModel: model.BaseModel{
|
BaseModel: model.BaseModel{
|
||||||
|
|||||||
Reference in New Issue
Block a user