fix price

This commit is contained in:
2026-06-11 16:30:08 +03:30
parent 4404b4cb92
commit 366157e026
3 changed files with 14 additions and 3 deletions
+8 -2
View File
@@ -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)
}