fix(order) discount set default 1

This commit is contained in:
NoWay 2025-07-23 15:52:26 +08:00 committed by Leif Draven
parent f6ce7b2cd3
commit 1b78e04113

View File

@ -52,6 +52,9 @@ func (l *PreCreateOrderLogic) PreCreateOrder(req *types.PurchaseOrderRequest) (r
discount = getDiscount(dis, req.Quantity)
}
price := sub.UnitPrice * req.Quantity
if discount == 0 {
discount = 1
}
amount := int64(float64(price) * discount)
discountAmount := price - amount
var couponAmount int64