2026-11-04 11:36:55 +03:30
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { computed } from 'vue';
|
2026-11-10 12:28:27 +03:30
|
|
|
import {
|
|
|
|
|
Flex as AFlex,
|
|
|
|
|
List as AList,
|
|
|
|
|
Table as ATable,
|
|
|
|
|
Typography,
|
|
|
|
|
} from 'ant-design-vue';
|
2026-11-04 11:36:55 +03:30
|
|
|
import type { TreasuryPartyBalanceDto } from '@mento/shared';
|
2026-11-17 16:07:13 +03:30
|
|
|
import TreasuryListPagination from '@/components/treasury/TreasuryListPagination.vue';
|
2026-11-04 11:36:55 +03:30
|
|
|
import { toman } from '@/views/treasury/treasury-format';
|
2026-11-17 16:07:13 +03:30
|
|
|
import { useTreasuryListPaging } from '@/views/treasury/useTreasuryListPaging';
|
2026-11-10 12:28:27 +03:30
|
|
|
import { useTreasuryMobile } from '@/views/treasury/useTreasuryMobile';
|
2026-11-04 11:36:55 +03:30
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
|
rows: TreasuryPartyBalanceDto[];
|
|
|
|
|
settledLabel: string;
|
|
|
|
|
}>();
|
|
|
|
|
|
2026-11-10 12:28:27 +03:30
|
|
|
const isMobile = useTreasuryMobile();
|
|
|
|
|
const { Text: ATypographyText } = Typography;
|
|
|
|
|
const AListItem = AList.Item;
|
|
|
|
|
|
2026-11-17 16:07:13 +03:30
|
|
|
const {
|
|
|
|
|
page,
|
|
|
|
|
pageSize,
|
|
|
|
|
pageSizeOptions,
|
|
|
|
|
total,
|
|
|
|
|
pagedRows,
|
|
|
|
|
onPageSizeChange,
|
|
|
|
|
showTotal,
|
|
|
|
|
} = useTreasuryListPaging(() => props.rows, 'treasury.party-balances');
|
|
|
|
|
|
2026-11-04 11:36:55 +03:30
|
|
|
const kindLabel: Record<string, string> = {
|
|
|
|
|
person: 'مشتری',
|
|
|
|
|
company: 'شرکت',
|
|
|
|
|
user: 'کاربر',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const columns = computed(() => [
|
|
|
|
|
{ title: 'طرف حساب', dataIndex: 'partyName', key: 'partyName' },
|
|
|
|
|
{
|
|
|
|
|
title: 'نوع',
|
|
|
|
|
key: 'partyKind',
|
|
|
|
|
customRender: ({ record }: { record: TreasuryPartyBalanceDto }) =>
|
|
|
|
|
(record.partyKind && kindLabel[record.partyKind]) || 'ثبت قبلی',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'مبلغ کل',
|
|
|
|
|
key: 'amount',
|
|
|
|
|
customRender: ({ record }: { record: TreasuryPartyBalanceDto }) => toman(record.amount),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: props.settledLabel,
|
|
|
|
|
key: 'settledAmount',
|
|
|
|
|
customRender: ({ record }: { record: TreasuryPartyBalanceDto }) => toman(record.settledAmount),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'مانده',
|
|
|
|
|
key: 'remaining',
|
|
|
|
|
customRender: ({ record }: { record: TreasuryPartyBalanceDto }) => toman(record.remaining),
|
|
|
|
|
},
|
|
|
|
|
]);
|
2026-11-10 12:28:27 +03:30
|
|
|
|
|
|
|
|
function kindOf(record: TreasuryPartyBalanceDto) {
|
|
|
|
|
return (record.partyKind && kindLabel[record.partyKind]) || 'ثبت قبلی';
|
|
|
|
|
}
|
2026-11-04 11:36:55 +03:30
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2026-11-10 12:28:27 +03:30
|
|
|
<a-list
|
|
|
|
|
v-if="isMobile"
|
2026-11-17 16:07:13 +03:30
|
|
|
:data-source="pagedRows"
|
2026-11-10 12:28:27 +03:30
|
|
|
:locale="{ emptyText: 'ماندهای نیست.' }"
|
|
|
|
|
>
|
|
|
|
|
<template #renderItem="{ item }">
|
|
|
|
|
<a-list-item>
|
|
|
|
|
<a-flex vertical :gap="4" style="width: 100%">
|
|
|
|
|
<a-flex justify="space-between" align="center" wrap="wrap" :gap="8">
|
|
|
|
|
<a-typography-text strong>{{ item.partyName }}</a-typography-text>
|
|
|
|
|
<a-typography-text type="secondary">{{ kindOf(item) }}</a-typography-text>
|
|
|
|
|
</a-flex>
|
|
|
|
|
<a-flex justify="space-between" align="center" :gap="8">
|
|
|
|
|
<a-typography-text type="secondary">مبلغ کل</a-typography-text>
|
|
|
|
|
<a-typography-text>{{ toman(item.amount) }}</a-typography-text>
|
|
|
|
|
</a-flex>
|
|
|
|
|
<a-flex justify="space-between" align="center" :gap="8">
|
|
|
|
|
<a-typography-text type="secondary">{{ settledLabel }}</a-typography-text>
|
|
|
|
|
<a-typography-text>{{ toman(item.settledAmount) }}</a-typography-text>
|
|
|
|
|
</a-flex>
|
|
|
|
|
<a-flex justify="space-between" align="center" :gap="8">
|
|
|
|
|
<a-typography-text type="secondary">مانده</a-typography-text>
|
|
|
|
|
<a-typography-text strong>{{ toman(item.remaining) }}</a-typography-text>
|
|
|
|
|
</a-flex>
|
|
|
|
|
</a-flex>
|
|
|
|
|
</a-list-item>
|
|
|
|
|
</template>
|
|
|
|
|
</a-list>
|
2026-11-04 11:36:55 +03:30
|
|
|
<a-table
|
2026-11-10 12:28:27 +03:30
|
|
|
v-else
|
2026-11-04 11:36:55 +03:30
|
|
|
:columns="columns"
|
2026-11-17 16:07:13 +03:30
|
|
|
:data-source="pagedRows"
|
2026-11-04 11:36:55 +03:30
|
|
|
:pagination="false"
|
|
|
|
|
row-key="key"
|
|
|
|
|
:locale="{ emptyText: 'ماندهای نیست.' }"
|
|
|
|
|
/>
|
2026-11-17 16:07:13 +03:30
|
|
|
<TreasuryListPagination
|
|
|
|
|
v-model:page="page"
|
|
|
|
|
:total="total"
|
|
|
|
|
:page-size="pageSize"
|
|
|
|
|
:page-size-options="pageSizeOptions"
|
|
|
|
|
:show-total="showTotal"
|
|
|
|
|
@update:page-size="onPageSizeChange"
|
|
|
|
|
/>
|
2026-11-04 11:36:55 +03:30
|
|
|
</template>
|