订单earningprice活动另算over

This commit is contained in:
苏尹岚
2020-05-08 08:50:34 +08:00
parent 7223c6fa86
commit c593bea760

View File

@@ -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
}