|
|
|
@ -113,7 +113,7 @@ func OrderProfit(od order.Information, tx *gorm.DB) error {
|
|
|
|
|
// 实体店产生批发收益给子公司
|
|
|
|
|
extraBase := decimal.Zero
|
|
|
|
|
for _, v := range ods {
|
|
|
|
|
extra := v.UnitPrice.Sub(v.PurchasePrice).Mul(decimal.NewFromFloat(0.2)).Round(2)
|
|
|
|
|
extra := v.PurchasePrice.Mul(decimal.NewFromFloat(1.03)).Round(2).Mul(decimal.NewFromFloat(0.2)).Round(2)
|
|
|
|
|
extraBase = extraBase.Add(extra.Mul(decimal.NewFromFloat(define.Coefficient)).Round(2).Mul(decimal.NewFromInt(int64(v.Quantity))))
|
|
|
|
|
}
|
|
|
|
|
if err := tx.Create(order.CreateProfit(u1.RootID, order.Sale, base, od.ID)).Error; err != nil {
|
|
|
|
|