From a2978a94e5108938b25908a7d8ec5c7b0d240459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 11 Mar 2021 14:42:12 +0800 Subject: [PATCH] aa --- business/jxcallback/orderman/order.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 7c9f3f7ae..9b73d1d89 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1934,8 +1934,8 @@ func UpdateOrderInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID int, func RefreshOrderSkuInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID, skuID int) (num int64, err error) { var ( - db = dao.GetDB() - shopPrice int64 + db = dao.GetDB() + shopPrice, earningPrice int64 ) order, err := partner.CurOrderManager.LoadOrder(vendorOrderID, vendorID) if order.EarningType != model.EarningTypeQuote { @@ -1947,8 +1947,11 @@ func RefreshOrderSkuInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID, return fmt.Errorf("未找到此门店商品!") } storeSku := storeSkus[0] + if v.ShopPrice == v.EarningPrice { + v.EarningPrice = int64(math.Round(float64(storeSku.Price) * float64(order.OrderPayPercentage) / 100)) + } v.ShopPrice = int64(storeSku.Price) - dao.UpdateEntity(db, v, "ShopPrice") + dao.UpdateEntity(db, v, "ShopPrice", "EarningPrice") return err } dao.Begin(db) @@ -1974,9 +1977,11 @@ func RefreshOrderSkuInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID, } for _, v := range order.Skus { shopPrice += v.ShopPrice * int64(v.Count) + earningPrice += v.EarningPrice * int64(v.Count) } order.ShopPrice = shopPrice - num, err = dao.UpdateEntity(db, order, "ShopPrice") + order.EarningPrice = earningPrice + num, err = dao.UpdateEntity(db, order, "ShopPrice", "EarningPrice") dao.Commit(db) return num, err }