fix some bug
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import type { Product } from '@/models/products'
|
||||
import { getTradeBuyPrice, lastPrice } from '@/utils/price'
|
||||
import { getTradeBuyPrice, getTradeSellPrice, lastPrice } from '@/utils/price'
|
||||
|
||||
/** قیمت خرید نمایشی محصول (همان مقداری که در لیست و اکشنشیت نشان داده میشود) */
|
||||
export function getProductBuyPrice(product: Product): number {
|
||||
if (product.group_type === 'آبشده') {
|
||||
return getTradeBuyPrice(lastPrice.value)
|
||||
return getTradeBuyPrice(lastPrice.value) + (product.cash_fee_buy ?? 0)
|
||||
}
|
||||
|
||||
if (['مس', 'نقره'].includes(product.group_type)) {
|
||||
@@ -18,6 +18,14 @@ export function getProductBuyPrice(product: Product): number {
|
||||
: basePrice
|
||||
}
|
||||
|
||||
/** قیمت فروش نمایشی آبشده — فقط cash_fee_sell محصول اختلاف ایجاد میکند */
|
||||
export function getProductSellPrice(product: Product): number {
|
||||
if (product.group_type === 'آبشده') {
|
||||
return getTradeSellPrice(lastPrice.value) - (product.cash_fee_sell ?? 0)
|
||||
}
|
||||
return getTradeSellPrice(lastPrice.value)
|
||||
}
|
||||
|
||||
export function isProductPriceInactive(product: Product): boolean {
|
||||
return getProductBuyPrice(product) <= 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user