aa
This commit is contained in:
@@ -1935,7 +1935,7 @@ func UpdateOrderInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID int,
|
|||||||
func RefreshOrderSkuInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID, skuID int) (num int64, err error) {
|
func RefreshOrderSkuInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID, skuID int) (num int64, err error) {
|
||||||
var (
|
var (
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
shopPrice int64
|
shopPrice, earningPrice int64
|
||||||
)
|
)
|
||||||
order, err := partner.CurOrderManager.LoadOrder(vendorOrderID, vendorID)
|
order, err := partner.CurOrderManager.LoadOrder(vendorOrderID, vendorID)
|
||||||
if order.EarningType != model.EarningTypeQuote {
|
if order.EarningType != model.EarningTypeQuote {
|
||||||
@@ -1947,8 +1947,11 @@ func RefreshOrderSkuInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID,
|
|||||||
return fmt.Errorf("未找到此门店商品!")
|
return fmt.Errorf("未找到此门店商品!")
|
||||||
}
|
}
|
||||||
storeSku := storeSkus[0]
|
storeSku := storeSkus[0]
|
||||||
|
if v.ShopPrice == v.EarningPrice {
|
||||||
|
v.EarningPrice = int64(math.Round(float64(storeSku.Price) * float64(order.OrderPayPercentage) / 100))
|
||||||
|
}
|
||||||
v.ShopPrice = int64(storeSku.Price)
|
v.ShopPrice = int64(storeSku.Price)
|
||||||
dao.UpdateEntity(db, v, "ShopPrice")
|
dao.UpdateEntity(db, v, "ShopPrice", "EarningPrice")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
dao.Begin(db)
|
dao.Begin(db)
|
||||||
@@ -1974,9 +1977,11 @@ func RefreshOrderSkuInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID,
|
|||||||
}
|
}
|
||||||
for _, v := range order.Skus {
|
for _, v := range order.Skus {
|
||||||
shopPrice += v.ShopPrice * int64(v.Count)
|
shopPrice += v.ShopPrice * int64(v.Count)
|
||||||
|
earningPrice += v.EarningPrice * int64(v.Count)
|
||||||
}
|
}
|
||||||
order.ShopPrice = shopPrice
|
order.ShopPrice = shopPrice
|
||||||
num, err = dao.UpdateEntity(db, order, "ShopPrice")
|
order.EarningPrice = earningPrice
|
||||||
|
num, err = dao.UpdateEntity(db, order, "ShopPrice", "EarningPrice")
|
||||||
dao.Commit(db)
|
dao.Commit(db)
|
||||||
return num, err
|
return num, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user