From c593bea760b865f84dc91449570ddb430b95808f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 8 May 2020 08:50:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95earningprice=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8=E5=8F=A6=E7=AE=97over?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 47 +++++++++++++-------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 693db069c..8b72d0fc2 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -382,30 +382,29 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao. globals.SugarLogger.Debugf("skuMultiCountMap", utils.Format4Output(skuMultiCountMap, false)) //TODO 重复购买有活动且结算价大于0的商品需要拆分,第一个商品按结算价,后面的商品按shopprice 或者 saleprice, 2020-05-06 //TODO 京东美团的订单,做活动的商品之前就会拆分出来,所以只做更新,饿百暂时不管, 2020-05-07 - // if order.VendorID == model.VendorIDJD || order.VendorID == model.VendorIDMTWM { - // for _, v := range orderSkus { - // if v.EarningPrice > 0 { - // if len(skuMultiCountMap[v.SkuID]) > 1 { - // var price = 0 - // for _, vv := range skuMultiCountMap[v.SkuID] { - // if int(vv.SalePrice) > price { - // price = int(vv.SalePrice) - // } - // } - // if price == int(v.SalePrice) { - // var earningPrice = 0 - // if v.ShopPrice < v.SalePrice { - // earningPrice = int(v.ShopPrice) * storePayPercentage / 100 - // } else { - // earningPrice = int(v.ShopPrice) * storePayPercentage / 100 - // } - // v.EarningPrice = int64(earningPrice) - // globals.SugarLogger.Debugf("TestearningPrice", earningPrice) - // } - // } - // } - // } - // } + if order.VendorID == model.VendorIDJD || order.VendorID == model.VendorIDMTWM { + for _, v := range orderSkus { + if v.EarningPrice > 0 { + if len(skuMultiCountMap[v.SkuID]) > 1 { + var price = 0 + for _, vv := range skuMultiCountMap[v.SkuID] { + if int(vv.SalePrice) > price { + price = int(vv.SalePrice) + } + } + if price == int(v.SalePrice) { + var earningPrice = 0 + if v.ShopPrice < v.SalePrice { + earningPrice = int(utils.Float64TwoInt64(math.Round(utils.Int2Float64(int(v.ShopPrice)) * utils.Int2Float64(storePayPercentage) / 100))) + } else { + earningPrice = int(utils.Float64TwoInt64(math.Round(utils.Int2Float64(int(v.SalePrice)) * utils.Int2Float64(storePayPercentage) / 100))) + } + v.EarningPrice = int64(earningPrice) + } + } + } + } + } } return nil }