feat: 新增转账功能,包含转账视图及相关路由配置;更新 API 类型依赖至 0.0.64
This commit is contained in:
8
.github/copilot-instructions.md
vendored
8
.github/copilot-instructions.md
vendored
@@ -113,10 +113,10 @@ soybean-admin/
|
|||||||
|
|
||||||
### API 服务
|
### API 服务
|
||||||
|
|
||||||
- API 定义位于 `src/service/api/`
|
- API 定义位于 `src/service/api/client`
|
||||||
- 使用 `@sa/axios` 封装的请求实例
|
- API 全部使用safeClient实例 + client.api.admin 发送请求
|
||||||
- 请求配置在 `src/service/request/` 中
|
- 字段严格遵循每个rpc接口的类型定义
|
||||||
- 支持 TypeScript 类型定义
|
- 支持请求拦截、响应处理和错误处理
|
||||||
|
|
||||||
### 样式开发
|
### 样式开发
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
"@better-scroll/core": "2.5.1",
|
"@better-scroll/core": "2.5.1",
|
||||||
"@elysiajs/eden": "^1.4.5",
|
"@elysiajs/eden": "^1.4.5",
|
||||||
"@iconify/vue": "5.0.0",
|
"@iconify/vue": "5.0.0",
|
||||||
"@riwa/api-types": "http://192.168.1.27:9527/api/riwa-api-types-0.0.59.tgz",
|
"@riwa/api-types": "http://192.168.1.27:9527/api/riwa-api-types-0.0.64.tgz",
|
||||||
"@sa/axios": "workspace:*",
|
"@sa/axios": "workspace:*",
|
||||||
"@sa/color": "workspace:*",
|
"@sa/color": "workspace:*",
|
||||||
"@sa/hooks": "workspace:*",
|
"@sa/hooks": "workspace:*",
|
||||||
|
|||||||
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
@@ -18,8 +18,8 @@ importers:
|
|||||||
specifier: 5.0.0
|
specifier: 5.0.0
|
||||||
version: 5.0.0(vue@3.5.25(typescript@5.9.3))
|
version: 5.0.0(vue@3.5.25(typescript@5.9.3))
|
||||||
'@riwa/api-types':
|
'@riwa/api-types':
|
||||||
specifier: http://192.168.1.27:9527/api/riwa-api-types-0.0.59.tgz
|
specifier: http://192.168.1.27:9527/api/riwa-api-types-0.0.64.tgz
|
||||||
version: http://192.168.1.27:9527/api/riwa-api-types-0.0.59.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))
|
version: http://192.168.1.27:9527/api/riwa-api-types-0.0.64.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))
|
||||||
'@sa/axios':
|
'@sa/axios':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:packages/axios
|
version: link:packages/axios
|
||||||
@@ -1068,9 +1068,9 @@ packages:
|
|||||||
'@quansync/fs@0.1.6':
|
'@quansync/fs@0.1.6':
|
||||||
resolution: {integrity: sha512-zoA8SqQO11qH9H8FCBR7NIbowYARIPmBz3nKjgAaOUDi/xPAAu1uAgebtV7KXHTc6CDZJVRZ1u4wIGvY5CWYaw==}
|
resolution: {integrity: sha512-zoA8SqQO11qH9H8FCBR7NIbowYARIPmBz3nKjgAaOUDi/xPAAu1uAgebtV7KXHTc6CDZJVRZ1u4wIGvY5CWYaw==}
|
||||||
|
|
||||||
'@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.59.tgz':
|
'@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.64.tgz':
|
||||||
resolution: {tarball: http://192.168.1.27:9527/api/riwa-api-types-0.0.59.tgz}
|
resolution: {tarball: http://192.168.1.27:9527/api/riwa-api-types-0.0.64.tgz}
|
||||||
version: 0.0.59
|
version: 0.0.64
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@elysiajs/eden': ^1.4.5
|
'@elysiajs/eden': ^1.4.5
|
||||||
|
|
||||||
@@ -5057,7 +5057,7 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
quansync: 0.3.0
|
quansync: 0.3.0
|
||||||
|
|
||||||
'@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.59.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))':
|
'@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.64.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@elysiajs/eden': 1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3))
|
'@elysiajs/eden': 1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3))
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export const views: Record<LastLevelRouteKey, RouteComponent | (() => Promise<Ro
|
|||||||
rwa_product: () => import("@/views/rwa/product/index.vue"),
|
rwa_product: () => import("@/views/rwa/product/index.vue"),
|
||||||
rwa_producttype: () => import("@/views/rwa/productType/index.vue"),
|
rwa_producttype: () => import("@/views/rwa/productType/index.vue"),
|
||||||
rwa_subscribe: () => import("@/views/rwa/subscribe/index.vue"),
|
rwa_subscribe: () => import("@/views/rwa/subscribe/index.vue"),
|
||||||
|
transfer: () => import("@/views/transfer/index.vue"),
|
||||||
user_bank: () => import("@/views/user/bank/index.vue"),
|
user_bank: () => import("@/views/user/bank/index.vue"),
|
||||||
user_bankcard: () => import("@/views/user/bankcard/index.vue"),
|
user_bankcard: () => import("@/views/user/bankcard/index.vue"),
|
||||||
user_list: () => import("@/views/user/list/index.vue"),
|
user_list: () => import("@/views/user/list/index.vue"),
|
||||||
|
|||||||
@@ -214,5 +214,15 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
name: 'transfer',
|
||||||
|
path: '/transfer',
|
||||||
|
component: 'layout.base$view.transfer',
|
||||||
|
meta: {
|
||||||
|
title: 'transfer',
|
||||||
|
i18nKey: 'route.transfer',
|
||||||
|
order: 4
|
||||||
|
}
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ const routeMap: RouteMap = {
|
|||||||
"rwa_product": "/rwa/product",
|
"rwa_product": "/rwa/product",
|
||||||
"rwa_producttype": "/rwa/producttype",
|
"rwa_producttype": "/rwa/producttype",
|
||||||
"rwa_subscribe": "/rwa/subscribe",
|
"rwa_subscribe": "/rwa/subscribe",
|
||||||
|
"transfer": "/transfer",
|
||||||
"user": "/user",
|
"user": "/user",
|
||||||
"user_bank": "/user/bank",
|
"user_bank": "/user/bank",
|
||||||
"user_bankcard": "/user/bankcard",
|
"user_bankcard": "/user/bankcard",
|
||||||
|
|||||||
3
src/typings/elegant-router.d.ts
vendored
3
src/typings/elegant-router.d.ts
vendored
@@ -29,6 +29,7 @@ declare module "@elegant-router/types" {
|
|||||||
"rwa_product": "/rwa/product";
|
"rwa_product": "/rwa/product";
|
||||||
"rwa_producttype": "/rwa/producttype";
|
"rwa_producttype": "/rwa/producttype";
|
||||||
"rwa_subscribe": "/rwa/subscribe";
|
"rwa_subscribe": "/rwa/subscribe";
|
||||||
|
"transfer": "/transfer";
|
||||||
"user": "/user";
|
"user": "/user";
|
||||||
"user_bank": "/user/bank";
|
"user_bank": "/user/bank";
|
||||||
"user_bankcard": "/user/bankcard";
|
"user_bankcard": "/user/bankcard";
|
||||||
@@ -76,6 +77,7 @@ declare module "@elegant-router/types" {
|
|||||||
| "iframe-page"
|
| "iframe-page"
|
||||||
| "login"
|
| "login"
|
||||||
| "rwa"
|
| "rwa"
|
||||||
|
| "transfer"
|
||||||
| "user"
|
| "user"
|
||||||
| "withdraw"
|
| "withdraw"
|
||||||
>;
|
>;
|
||||||
@@ -104,6 +106,7 @@ declare module "@elegant-router/types" {
|
|||||||
| "rwa_product"
|
| "rwa_product"
|
||||||
| "rwa_producttype"
|
| "rwa_producttype"
|
||||||
| "rwa_subscribe"
|
| "rwa_subscribe"
|
||||||
|
| "transfer"
|
||||||
| "user_bank"
|
| "user_bank"
|
||||||
| "user_bankcard"
|
| "user_bankcard"
|
||||||
| "user_list"
|
| "user_list"
|
||||||
|
|||||||
141
src/views/transfer/index.vue
Normal file
141
src/views/transfer/index.vue
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { h, useTemplateRef } from 'vue';
|
||||||
|
import { useDateFormat } from '@vueuse/core';
|
||||||
|
import { NInput, NSelect, NTag } from 'naive-ui';
|
||||||
|
import { client, safeClient } from '@/service/api';
|
||||||
|
import type { TableBaseColumns, TableFetchData, TableFilterColumns, TableInst } from '@/components/table';
|
||||||
|
|
||||||
|
const tableInst = useTemplateRef<TableInst>('tableInst');
|
||||||
|
|
||||||
|
const fetchData: TableFetchData = ({ pagination, filter }) => {
|
||||||
|
return safeClient(() =>
|
||||||
|
client.api.admin.transfer.get({
|
||||||
|
query: {
|
||||||
|
...pagination,
|
||||||
|
...filter
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 状态枚举映射
|
||||||
|
const TransferStatusEnum = {
|
||||||
|
pending: '待完成',
|
||||||
|
completed: '已完成',
|
||||||
|
failed: '失败'
|
||||||
|
};
|
||||||
|
|
||||||
|
// 状态标签类型映射
|
||||||
|
const getStatusTagType = (status: string) => {
|
||||||
|
const typeMap: Record<string, 'warning' | 'success' | 'error'> = {
|
||||||
|
pending: 'warning',
|
||||||
|
completed: 'success',
|
||||||
|
failed: 'error'
|
||||||
|
};
|
||||||
|
return typeMap[status] || 'default';
|
||||||
|
};
|
||||||
|
|
||||||
|
const columns: TableBaseColumns = [
|
||||||
|
{
|
||||||
|
title: '订单ID',
|
||||||
|
key: 'id',
|
||||||
|
width: 180
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '订单号',
|
||||||
|
key: 'orderNo',
|
||||||
|
width: 200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '转出账户ID',
|
||||||
|
key: 'fromUserId',
|
||||||
|
width: 150
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '资产代码',
|
||||||
|
key: 'assetCode',
|
||||||
|
width: 120
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '金额',
|
||||||
|
key: 'amount',
|
||||||
|
width: 150,
|
||||||
|
render: row => {
|
||||||
|
return Number(row.amount).toFixed(2);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '手续费',
|
||||||
|
key: 'fee',
|
||||||
|
width: 120,
|
||||||
|
render: row => {
|
||||||
|
return Number(row.fee || 0).toFixed(2);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
key: 'status',
|
||||||
|
width: 120,
|
||||||
|
render: row => {
|
||||||
|
return h(
|
||||||
|
NTag,
|
||||||
|
{
|
||||||
|
type: getStatusTagType(row.status)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
default: () => TransferStatusEnum[row.status as keyof typeof TransferStatusEnum] || row.status
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
key: 'createdAt',
|
||||||
|
width: 180,
|
||||||
|
render: (row: any) => {
|
||||||
|
return useDateFormat(row.createdAt, 'YYYY-MM-DD HH:mm:ss').value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
const filterColumns: TableFilterColumns = [
|
||||||
|
{
|
||||||
|
title: '用户ID',
|
||||||
|
key: 'userId',
|
||||||
|
component: NInput,
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入用户ID',
|
||||||
|
clearable: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '资产代码',
|
||||||
|
key: 'assetCode',
|
||||||
|
component: NInput,
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入资产代码',
|
||||||
|
clearable: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
key: 'status',
|
||||||
|
component: NSelect,
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请选择状态',
|
||||||
|
clearable: true,
|
||||||
|
options: [
|
||||||
|
{ label: '待完成', value: 'pending' },
|
||||||
|
{ label: '已完成', value: 'completed' },
|
||||||
|
{ label: '失败', value: 'failed' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<TableBase ref="tableInst" :columns="columns" :filter-columns="filterColumns" :fetch-data="fetchData" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="css" scoped></style>
|
||||||
Reference in New Issue
Block a user