...
|
...
|
@@ -150,7 +150,7 @@ func (good *OrderGood) Compute() error { |
|
|
price := decimal.NewFromFloat(good.Price)
|
|
|
planamount := price.Mul(decimal.NewFromInt(int64(good.PlanGoodNumber))) //price*planGoodNumber
|
|
|
//price*useGoodNumber
|
|
|
planPartnerBonus := planamount.Mul(decimal.NewFromFloat(good.PartnerBonusPercent)) //price*planGoodNumber*PartnerBonusPercent
|
|
|
planPartnerBonus := planamount.Mul(decimal.NewFromFloat(good.PartnerBonusPercent)).Div(decimal.NewFromInt(100)) //price*planGoodNumber*PartnerBonusPercent
|
|
|
good.GoodCompute.PlanAmount, _ = planamount.Round(2).Float64()
|
|
|
good.GoodCompute.PlanPartnerBonus, _ = planPartnerBonus.Round(2).Float64()
|
|
|
if good.UseGoodNumber < 0 {
|
...
|
...
|
@@ -160,8 +160,8 @@ func (good *OrderGood) Compute() error { |
|
|
} else {
|
|
|
//计算调整后的货品总值
|
|
|
//计算调整后的合伙人分红
|
|
|
useamount := price.Mul(decimal.NewFromInt(int64(good.UseGoodNumber))) //price*useGoodNumber/price*useGoodNumber
|
|
|
usePartnerBonus := useamount.Mul(decimal.NewFromFloat(good.PartnerBonusPercent)) //price*useGoodNumber*PartnerBonusPercent
|
|
|
useamount := price.Mul(decimal.NewFromInt(int64(good.UseGoodNumber))) //price*useGoodNumber/price*useGoodNumber
|
|
|
usePartnerBonus := useamount.Mul(decimal.NewFromFloat(good.PartnerBonusPercent)).Div(decimal.NewFromInt(100)) //price*useGoodNumber*PartnerBonusPercent
|
|
|
good.GoodCompute.UsePartnerBonus, _ = usePartnerBonus.Round(2).Float64()
|
|
|
good.GoodCompute.UseAmount, _ = useamount.Round(2).Float64()
|
|
|
}
|
...
|
...
|
|