- 将OrderSku中没有用的StoreSubName暂时当成VendorActType来使用
- 美团外卖订单使用sku_benefit_detail来更准确的判断单品活动
This commit is contained in:
@@ -126,8 +126,8 @@ func (p *PurchaseHandler) partRefund2OrderDetailSkuList(orderID string, orderDet
|
||||
SkuName: skuName,
|
||||
// Weight: int(utils.Interface2Int64WithDefault(product["total_weight"], 0)) / number, // 退单这里的total_weight有BUG,这里的total_weight还是没有退单时的值
|
||||
VendorPrice: utils.MustInterface2Int64(product["product_price"]),
|
||||
SalePrice: getSkuSalePrice(product),
|
||||
}
|
||||
sku.SalePrice, sku.StoreSubName = getSkuSalePrice(product)
|
||||
if sku.Weight == 0 {
|
||||
sku.Weight = jxutils.FormatSkuWeight(specQuality, specUnit) // 订单信息里没有重量,只有名字里尝试找
|
||||
}
|
||||
@@ -212,9 +212,8 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
||||
SkuName: skuName,
|
||||
Weight: int(utils.Interface2Int64WithDefault(product["total_weight"], 0)) / productAmount,
|
||||
VendorPrice: utils.MustInterface2Int64(product["product_price"]),
|
||||
SalePrice: getSkuSalePrice(product),
|
||||
// PromotionType: int(utils.MustInterface2Int64(product["promotionType"])),
|
||||
}
|
||||
sku.SalePrice, sku.StoreSubName = getSkuSalePrice(product)
|
||||
if sku.Weight == 0 {
|
||||
sku.Weight = jxutils.FormatSkuWeight(specQuality, specUnit) // 订单信息里没有重量,只有名字里尝试找
|
||||
}
|
||||
@@ -227,16 +226,16 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
||||
return order
|
||||
}
|
||||
|
||||
func getSkuSalePrice(product map[string]interface{}) (salePrice int64) {
|
||||
func getSkuSalePrice(product map[string]interface{}) (salePrice int64, vendorActType string) {
|
||||
var product2 *ebaiapi.OrderProductInfo
|
||||
if err := utils.Map2StructByJson(product, &product2, true); err != nil {
|
||||
return utils.MustInterface2Int64(product["product_price"])
|
||||
return utils.MustInterface2Int64(product["product_price"]), ""
|
||||
}
|
||||
return int64(getSkuSalePrice2(product2))
|
||||
return getSkuSalePrice2(product2)
|
||||
}
|
||||
|
||||
func getSkuSalePrice2(product *ebaiapi.OrderProductInfo) (salePrice int) {
|
||||
salePrice = product.ProductPrice
|
||||
func getSkuSalePrice2(product *ebaiapi.OrderProductInfo) (salePrice int64, vendorActType string) {
|
||||
salePrice = int64(product.ProductPrice)
|
||||
if product.ProductSubsidy != nil {
|
||||
for _, v := range product.ProductSubsidy.DiscountDetail {
|
||||
if skuActTypeMap[v.Type] == 1 {
|
||||
@@ -244,11 +243,12 @@ func getSkuSalePrice2(product *ebaiapi.OrderProductInfo) (salePrice int) {
|
||||
if skuCount == 0 {
|
||||
skuCount = product.Number
|
||||
}
|
||||
salePrice -= int(math.Round(float64(v.BaiduRate+v.ShopRate) / float64(skuCount))) // 饿百同一SKU的优惠与非优惠没有拆开,平均摊销处理
|
||||
salePrice -= int64(math.Round(float64(v.BaiduRate+v.ShopRate) / float64(skuCount))) // 饿百同一SKU的优惠与非优惠没有拆开,平均摊销处理
|
||||
vendorActType = v.Type
|
||||
}
|
||||
}
|
||||
}
|
||||
return salePrice
|
||||
return salePrice, vendorActType
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) AcceptOrRefuseOrder(order *model.GoodsOrder, isAcceptIt bool, userName string) (err error) {
|
||||
|
||||
Reference in New Issue
Block a user