show balance_gold/cash

This commit is contained in:
2025-12-30 11:12:13 +03:30
parent 9bf89cf938
commit 6fb5bb763b
2 changed files with 43 additions and 1 deletions
+8
View File
@@ -6,6 +6,14 @@ export function usePrice(price: number, digit = true, unit = 'ریال') {
return `${_price} ${unit}`
}
export function usePriceWithoutType(price?: number, digit = true, unit = 'ریال') {
let _price = price?.toString()
if (digit) {
_price = _price?.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
}
return `${_price}`
}
export function useTowDecimal(num: string | number): string | number {
const temp = num.toString().match(/^-?\d+(?:\.\d{0,2})?/)
if (temp && temp.length > 0) return temp[0]
@@ -1,7 +1,7 @@
import type {BaseTableColumn} from '@core/type/baseTable'
import {toJalaliNoTime, toTime} from '@core/utils/useDataTime'
import CustomTag from '@/components/CustomTag.vue'
import {usePrice} from '@core/utils/usePrice'
import { usePrice, usePriceWithoutType } from "@core/utils/usePrice";
/*import BudgetSelect from '@/components/BudgetSelect.vue'
import { useStaticApiListsStore } from '@/store/staticApisStore'
import type { FilterSelect } from '@/model/filterSelect'
@@ -84,6 +84,40 @@ export const cols: BaseTableColumn[] = [
key: 'customer.name',
type: 'Text'
},
{
title: 'موجودی طلایی بعد تراکنش (گرم)',
dataIndex: 'balance_gold',
key: 'balance_gold',
type: 'Number',
customRender: ({record}) => {
return record.balance_gold > 0 ? (
<div class="flex justify-center">
<div class={'font-bold px-6 text-green'}>{record?.balance_gold ?? '_'}</div>
</div>
) : (
<div class="flex justify-center">
<div class={'font-bold px-6 text-red'}>{record?.balance_gold ?? '_'}</div>
</div>
)
}
},
{
title: 'موجودی ریالی بعد تراکنش (ریال)',
dataIndex: 'balance_cash',
key: 'balance_cash',
type: 'Number',
customRender: ({record}) => {
return record?.balance_cash > 0 ? (
<div class="flex justify-center">
<div class={'font-bold px-6 text-green'}>{usePriceWithoutType(record?.balance_cash) ?? '_'}</div>
</div>
) : (
<div class="flex justify-center">
<div class={'font-bold px-6 text-red'}>{usePriceWithoutType(record?.balance_cash) ?? '_'}</div>
</div>
)
}
},
{
title: 'مقدار طلا طی تراکنش (گرم)',
dataIndex: 'gold',