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 }