feat 计算打折时的折扣

This commit is contained in:
timerzz 2024-05-28 21:56:55 +08:00
parent 7957d28fe0
commit 53c6ee15ff

View File

@ -106,6 +106,9 @@ func (p *Product) CalRate() {
tmpPrice = discountPrice - 10
p.CNYPrice = tmpPrice*p.ExchangeRate + p.Freight
}
} else if p.Discount < 90 {
calculationProcess = append(calculationProcess, fmt.Sprintf("【打折扣】%.2f * %d%% * %.2f + %.2f = %.2f", p.USPrice, p.Discount, p.ExchangeRate, p.Freight, p.USPrice*float64(p.Discount)/100*p.ExchangeRate+p.Freight))
p.CNYPrice = p.USPrice*float64(p.Discount)/100*p.ExchangeRate + p.Freight
}
p.CalMark = strings.Join(calculationProcess, "\n")
if p.DWPrice > 0 {