刷新结算价newearningprice也要刷

This commit is contained in:
苏尹岚
2020-05-15 13:37:08 +08:00
parent 774aa3d58c
commit 39ba090f88

View File

@@ -784,7 +784,20 @@ func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context,
}
}
jxutils.RefreshOrderSkuRelated(order)
num, err := dao.UpdateEntity(db, order, "EarningPrice")
storeID := 0
if order.StoreID == 0 {
storeID = order.JxStoreID
} else {
storeID = order.StoreID
}
store, _ := dao.GetStoreDetail(db, storeID, order.VendorID)
payPercentage := store.PayPercentage
if payPercentage <= 50 {
order.NewEarningPrice = order.TotalShopMoney * int64((100 - payPercentage/2)) / 100
} else {
order.NewEarningPrice = order.EarningPrice
}
num, err := dao.UpdateEntity(db, order, "EarningPrice", "NewEarningPrice")
if err != nil {
return nil, err
}