fix price
This commit is contained in:
@@ -14,7 +14,10 @@ function applyPriceOffsetPercent(basePrice: number, offsetPercent?: number | nul
|
||||
/** قیمت خرید نمایشی محصول (همان مقداری که در لیست و اکشنشیت نشان داده میشود) */
|
||||
export function getProductBuyPrice(product: Product): number {
|
||||
if (isMeltedProductUsingAppPrice(product)) {
|
||||
const base = applyPriceOffsetPercent(getTradeBuyPrice(lastPrice.value), product.price_offset_percent)
|
||||
const tradeBuy = getTradeBuyPrice(lastPrice.value)
|
||||
const base = tradeBuy > 0
|
||||
? applyPriceOffsetPercent(tradeBuy, product.price_offset_percent)
|
||||
: (product.price ?? 0)
|
||||
return base + (product.cash_fee_buy ?? 0)
|
||||
}
|
||||
|
||||
@@ -36,7 +39,10 @@ export function getProductBuyPrice(product: Product): number {
|
||||
/** قیمت فروش نمایشی محصول آبشدهای */
|
||||
export function getProductSellPrice(product: Product): number {
|
||||
if (isMeltedProductUsingAppPrice(product)) {
|
||||
const base = applyPriceOffsetPercent(getTradeSellPrice(lastPrice.value), product.price_offset_percent)
|
||||
const tradeSell = getTradeSellPrice(lastPrice.value)
|
||||
const base = tradeSell > 0
|
||||
? applyPriceOffsetPercent(tradeSell, product.price_offset_percent)
|
||||
: (product.price ?? 0)
|
||||
return base - (product.cash_fee_sell ?? 0)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user