feat: 添加账本功能,整合用户账本对话框,支持用户ID传递
This commit is contained in:
51
src/views/user/components/ledger.vue
Normal file
51
src/views/user/components/ledger.vue
Normal 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>
|
||||||
@@ -11,6 +11,7 @@ import Payment from './components/payment.vue';
|
|||||||
import Withdraw from './components/withdraw.vue';
|
import Withdraw from './components/withdraw.vue';
|
||||||
import Team from './components/team.vue';
|
import Team from './components/team.vue';
|
||||||
import Kyc from './components/kyc.vue';
|
import Kyc from './components/kyc.vue';
|
||||||
|
import Ledger from './components/ledger.vue';
|
||||||
|
|
||||||
const dialog = useDialog();
|
const dialog = useDialog();
|
||||||
|
|
||||||
@@ -151,6 +152,18 @@ const columns: TableBaseColumns = [
|
|||||||
content: () => h(Kyc, { userId: row.id })
|
content: () => h(Kyc, { userId: row.id })
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
contentText: '账本',
|
||||||
|
size: 'small',
|
||||||
|
onClick: () => {
|
||||||
|
dialog.create({
|
||||||
|
title: '账本',
|
||||||
|
showIcon: false,
|
||||||
|
style: { width: '1000px' },
|
||||||
|
content: () => h(Ledger, { userId: row.id })
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user