fix bugs of UI

This commit is contained in:
2026-05-23 13:27:30 +03:30
parent a342ca7d53
commit 53b89306f5
5 changed files with 79 additions and 14 deletions
+23
View File
@@ -0,0 +1,23 @@
import type { Product } from '@/models/products'
import { lastPrice } from '@/utils/price'
/** قیمت خرید نمایشی محصول (همان مقداری که در لیست و اکشن‌شیت نشان داده می‌شود) */
export function getProductBuyPrice(product: Product): number {
if (product.group_type === 'آبشده') {
return lastPrice.value?.buy ?? 0
}
if (['مس', 'نقره'].includes(product.group_type)) {
const base = (product.price_profit ?? 0) + (product.price ?? 0)
return base + (product.cash_fee_buy ?? 0)
}
const basePrice = (product.price ?? 0) + (product.cash_fee_buy ?? 0)
return product.direct_price === 0
? basePrice * (product.amount ?? 0)
: basePrice
}
export function isProductPriceInactive(product: Product): boolean {
return getProductBuyPrice(product) <= 0
}