fix(tv): show board prices from tv_price instead of list price
The monitor uses the TV formula field so the catalog list price stays unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -249,6 +249,42 @@ export function isProductPriceInactive(product?: Product | null): boolean {
|
||||
return getProductBaseBuyPrice(product) <= 0
|
||||
}
|
||||
|
||||
function tvUnitPrice(product: Product): number {
|
||||
return Number(product.tv_price ?? 0)
|
||||
}
|
||||
|
||||
export function getTvProductBuyPrice(product?: Product | null): number {
|
||||
if (!product) {
|
||||
return 0
|
||||
}
|
||||
const unit = tvUnitPrice(product)
|
||||
if (unit > 0) {
|
||||
return unit + resolveProductCashFeeBuyRial(product, unit)
|
||||
}
|
||||
return getProductBuyPrice(product)
|
||||
}
|
||||
|
||||
export function getTvProductSellPrice(product?: Product | null): number {
|
||||
if (!product) {
|
||||
return 0
|
||||
}
|
||||
const unit = tvUnitPrice(product)
|
||||
if (unit > 0) {
|
||||
return unit - resolveProductCashFeeSellRial(product, unit)
|
||||
}
|
||||
return getProductSellPrice(product)
|
||||
}
|
||||
|
||||
export function isTvProductPriceInactive(product?: Product | null): boolean {
|
||||
if (!product) {
|
||||
return true
|
||||
}
|
||||
if (tvUnitPrice(product) > 0) {
|
||||
return false
|
||||
}
|
||||
return isProductPriceInactive(product)
|
||||
}
|
||||
|
||||
/**
|
||||
* نمایش محصول در فروشگاه — اولویت با `show` سرور.
|
||||
* آبشدهٔ قیمتاپ با مظنه زنده حتی اگر show هنوز false باشد.
|
||||
|
||||
Reference in New Issue
Block a user