! GoodsOrder与OrderSku添加VendorPrice表示平台价,而SalePrice表示单品优惠之后的价格
This commit is contained in:
@@ -119,7 +119,8 @@ func (p *PurchaseHandler) partRefund2OrderDetailSkuList(orderID string, orderDet
|
||||
VendorSkuID: utils.Interface2String(product[ebaiapi.KeySkuID]),
|
||||
SkuName: skuName,
|
||||
// Weight: int(utils.Interface2Int64WithDefault(product["total_weight"], 0)) / number, // 退单这里的total_weight有BUG,这里的total_weight还是没有退单时的值
|
||||
SalePrice: utils.MustInterface2Int64(product["product_price"]),
|
||||
VendorPrice: utils.MustInterface2Int64(product["product_price"]),
|
||||
SalePrice: getSkuSalePrice(product),
|
||||
}
|
||||
if sku.Weight == 0 {
|
||||
sku.Weight = jxutils.FormatSkuWeight(specQuality, specUnit) // 订单信息里没有重量,只有名字里尝试找
|
||||
@@ -204,7 +205,8 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
||||
VendorSkuID: utils.Interface2String(product["baidu_product_id"]),
|
||||
SkuName: skuName,
|
||||
Weight: int(utils.Interface2Int64WithDefault(product["total_weight"], 0)) / productAmount,
|
||||
SalePrice: utils.MustInterface2Int64(product["product_price"]),
|
||||
VendorPrice: utils.MustInterface2Int64(product["product_price"]),
|
||||
SalePrice: getSkuSalePrice(product),
|
||||
// PromotionType: int(utils.MustInterface2Int64(product["promotionType"])),
|
||||
}
|
||||
if sku.Weight == 0 {
|
||||
@@ -219,6 +221,26 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
||||
return order
|
||||
}
|
||||
|
||||
func getSkuSalePrice(product map[string]interface{}) (salePrice int64) {
|
||||
var product2 *ebaiapi.OrderProductInfo
|
||||
if err := utils.Map2StructByJson(product, &product2, true); err != nil {
|
||||
return utils.MustInterface2Int64(product["product_price"])
|
||||
}
|
||||
return int64(getSkuSalePrice2(product2))
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
return salePrice
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) AcceptOrRefuseOrder(order *model.GoodsOrder, isAcceptIt bool, userName string) (err error) {
|
||||
globals.SugarLogger.Debugf("ebai AcceptOrRefuseOrder orderID:%s, isAcceptIt:%t", order.VendorOrderID, isAcceptIt)
|
||||
if isAcceptIt {
|
||||
|
||||
Reference in New Issue
Block a user