feat: 添加订阅管理功能,新增路由和视图组件;更新路由映射和类型定义

This commit is contained in:
2025-12-23 18:48:49 +07:00
parent 0f2f806593
commit 84d35d0689
8 changed files with 117 additions and 0 deletions

View File

@@ -0,0 +1,95 @@
<script lang="ts" setup>
import { useTemplateRef } from 'vue';
import { useDateFormat } from '@vueuse/core';
import { client, safeClient } from '@/service/api';
import type { TableBaseColumns, TableFetchData, TableInst } from '@/components/table';
import { RwaSubscribeStatusEnum } from '@/enum';
const tableInst = useTemplateRef<TableInst>('tableInst');
const fetchData: TableFetchData = ({ pagination, filter }) => {
return safeClient(() =>
client.api.admin.rwa.subscription.orders.get({
query: {
...pagination,
...filter
}
})
);
};
const columns: TableBaseColumns = [
{
key: 'selection',
title: '序号',
type: 'selection',
width: 60
},
{
title: '用户ID',
key: 'userId'
},
{
title: '产品名称',
key: 'product.name'
},
{
title: '申购数量',
key: 'quantity',
render: (row: any) => {
return Number(row.quantity).toFixed(2);
}
},
{
title: '单价',
key: 'unitPrice',
render: (row: any) => {
return Number(row.unitPrice).toFixed(2);
}
},
{
title: '总价',
key: 'totalAmount',
render: (row: any) => {
return Number(row.totalAmount).toFixed(2);
}
},
{
title: '申购时间',
key: 'createdAt',
render: (row: any) => {
return useDateFormat(new Date(row.createdAt), 'YYYY-MM-DD HH:mm:ss').value;
}
},
{
title: '状态',
key: 'status',
render: (row: any) => {
return RwaSubscribeStatusEnum[row.status as keyof typeof RwaSubscribeStatusEnum];
}
},
{
title: '操作',
fixed: 'right',
key: 'operation',
width: 200,
operations: (row: any) => []
}
];
</script>
<template>
<TableBase
ref="tableInst"
show-header-operation
:header-operations="{
add: false,
refresh: true,
columns: true
}"
:columns="columns"
:fetch-data="fetchData"
/>
</template>
<style lang="css" scoped></style>