- 美团与饿百的订单活动商品处理,饿百活动商品没有拆开,摊销处理

This commit is contained in:
gazebo
2019-06-12 09:32:34 +08:00
parent 7f939333df
commit 3fb6bba882
3 changed files with 10 additions and 5 deletions

View File

@@ -50,6 +50,11 @@ var (
fakeUserApplyCancel: model.OrderStatusApplyCancel,
fakeUserUndoApplyCancel: model.OrderStatusUndoApplyCancel,
}
skuActTypeMap = map[string]int{
ebaiapi.OrderSkuDiscountTypeZhe: 1,
ebaiapi.OrderSkuDiscountTypeReduce: 1,
}
)
func (p *PurchaseHandler) GetStatusFromVendorStatus(vendorStatus string) int {
@@ -233,8 +238,8 @@ func getSkuSalePrice2(product *ebaiapi.OrderProductInfo) (salePrice int) {
salePrice = product.ProductPrice
if product.ProductSubsidy != nil {
for _, v := range product.ProductSubsidy.DiscountDetail {
if v.Type == ebaiapi.OrderSkuDiscountTypeZhe {
salePrice -= v.BaiduRate + v.ShopRate
if skuActTypeMap[v.Type] == 1 {
salePrice -= (v.BaiduRate + v.ShopRate) / product.Number // 饿百同一SKU的优惠与非优惠没有拆开平均摊销处理
}
}
}

View File

@@ -186,7 +186,7 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
}
if ignoreSkuMap[sku.SkuID] == 0 && sku.Count == 1 {
for _, v := range extraList {
if skuActTypeMap[v.Type] == 1 && strings.Index(v.Remark, skuName) >= 0 {
if /*skuActTypeMap[v.Type] == 1 && */ strings.Index(v.Remark, skuName) >= 0 {
ignoreSkuMap[sku.SkuID] = 1
sku.SalePrice -= jxutils.StandardPrice2Int(v.ReduceFee)
}