From 7034a37b62e260964b937dd07c43527c9565fb47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 4 Aug 2020 11:59:10 +0800 Subject: [PATCH] nenew_earning_perice --- business/jxcallback/orderman/order.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 147b140f9..4ef397fff 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -194,6 +194,21 @@ func (c *OrderManager) OnOrderStatusChanged(vendorOrgCode string, orderStatus *m } } } + //更新订单new_earning_price + if order.EarningType == model.EarningTypePoints { + waybill, _ := c.LoadWaybill(order.VendorWaybillID, order.WaybillVendorID) + store, _ := c.LoadStoreDetail(jxutils.GetSaleStoreIDFromOrder(order), order.VendorID) + if waybill == nil { + if order.NewEarningPrice == 0 || order.NewEarningPrice != order.TotalShopMoney*int64(100-store.PayPercentage)/int64(100) { + order.NewEarningPrice = order.TotalShopMoney * int64(100-store.PayPercentage) / int64(100) + } + } else { + if order.NewEarningPrice == 0 || order.NewEarningPrice != (order.TotalShopMoney-waybill.DesiredFee)*int64(100-store.PayPercentage)/int64(100) { + order.NewEarningPrice = (order.TotalShopMoney - waybill.DesiredFee) * int64(100-store.PayPercentage) / int64(100) + } + } + dao.UpdateEntity(db, order, "NewEarningPrice") + } } } if !isDuplicated {