show balance_gold/cash
This commit is contained in:
@@ -6,6 +6,14 @@ export function usePrice(price: number, digit = true, unit = 'ریال') {
|
|||||||
return `${_price} ${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 {
|
export function useTowDecimal(num: string | number): string | number {
|
||||||
const temp = num.toString().match(/^-?\d+(?:\.\d{0,2})?/)
|
const temp = num.toString().match(/^-?\d+(?:\.\d{0,2})?/)
|
||||||
if (temp && temp.length > 0) return temp[0]
|
if (temp && temp.length > 0) return temp[0]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type {BaseTableColumn} from '@core/type/baseTable'
|
import type {BaseTableColumn} from '@core/type/baseTable'
|
||||||
import {toJalaliNoTime, toTime} from '@core/utils/useDataTime'
|
import {toJalaliNoTime, toTime} from '@core/utils/useDataTime'
|
||||||
import CustomTag from '@/components/CustomTag.vue'
|
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 BudgetSelect from '@/components/BudgetSelect.vue'
|
||||||
import { useStaticApiListsStore } from '@/store/staticApisStore'
|
import { useStaticApiListsStore } from '@/store/staticApisStore'
|
||||||
import type { FilterSelect } from '@/model/filterSelect'
|
import type { FilterSelect } from '@/model/filterSelect'
|
||||||
@@ -84,6 +84,40 @@ export const cols: BaseTableColumn[] = [
|
|||||||
key: 'customer.name',
|
key: 'customer.name',
|
||||||
type: 'Text'
|
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: 'مقدار طلا طی تراکنش (گرم)',
|
title: 'مقدار طلا طی تراکنش (گرم)',
|
||||||
dataIndex: 'gold',
|
dataIndex: 'gold',
|
||||||
|
|||||||
Reference in New Issue
Block a user