feat: 添加账本功能,整合用户账本对话框,支持用户ID传递

This commit is contained in:
2026-01-20 02:53:19 +07:00
parent 1dc8e32c5f
commit cd9848cd51
2 changed files with 64 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
<script lang="ts" setup>
import { useTemplateRef } from 'vue';
import { client, safeClient } from '@/service/api';
import type { TableBaseColumns, TableFetchData, TableInst } from '@/components/table';
defineOptions({
name: 'LedgerDialog'
});
const props = defineProps<{
userId: string;
}>();
const tableInst = useTemplateRef<TableInst>('tableInst');
const fetchData: TableFetchData = ({ pagination, filter }) => {
return safeClient(() =>
client.api.admin.ledger.entries.get({ query: { userId: props.userId, ...pagination, ...filter } })
);
};
const columns: TableBaseColumns = [
{
key: 'walletType.name',
title: '钱包类型'
},
{
key: 'amount',
title: '变动金额',
render: (row: any) => {
return Number(row.frozen);
}
},
{
key: 'memo',
title: '备注'
}
];
</script>
<template>
<TableBase
ref="tableInst"
:fetch-data="fetchData"
:columns="columns"
:scroll-x="800"
:show-header-operation="false"
/>
</template>
<style lang="css" scoped></style>

View File

@@ -11,6 +11,7 @@ import Payment from './components/payment.vue';
import Withdraw from './components/withdraw.vue';
import Team from './components/team.vue';
import Kyc from './components/kyc.vue';
import Ledger from './components/ledger.vue';
const dialog = useDialog();
@@ -151,6 +152,18 @@ const columns: TableBaseColumns = [
content: () => h(Kyc, { userId: row.id })
});
}
},
{
contentText: '账本',
size: 'small',
onClick: () => {
dialog.create({
title: '账本',
showIcon: false,
style: { width: '1000px' },
content: () => h(Ledger, { userId: row.id })
});
}
}
]
}