feat: 添加认购页面及相关路由和国际化支持
This commit is contained in:
@@ -51,7 +51,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.2:9538/api/capp-eden-0.0.40.tgz",
|
"@riwa/api-types": "http://192.168.1.2:9538/api/capp-eden-0.0.41.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.2:9538/api/capp-eden-0.0.40.tgz
|
specifier: http://192.168.1.2:9538/api/capp-eden-0.0.41.tgz
|
||||||
version: '@capp/eden@http://192.168.1.2:9538/api/capp-eden-0.0.40.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: '@capp/eden@http://192.168.1.2:9538/api/capp-eden-0.0.41.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
|
||||||
@@ -496,9 +496,9 @@ packages:
|
|||||||
'@borewit/text-codec@0.1.1':
|
'@borewit/text-codec@0.1.1':
|
||||||
resolution: {integrity: sha512-5L/uBxmjaCIX5h8Z+uu+kA9BQLkc/Wl06UGR5ajNRxu+/XjonB5i8JpgFMrPj3LXTCPA0pv8yxUvbUi+QthGGA==}
|
resolution: {integrity: sha512-5L/uBxmjaCIX5h8Z+uu+kA9BQLkc/Wl06UGR5ajNRxu+/XjonB5i8JpgFMrPj3LXTCPA0pv8yxUvbUi+QthGGA==}
|
||||||
|
|
||||||
'@capp/eden@http://192.168.1.2:9538/api/capp-eden-0.0.40.tgz':
|
'@capp/eden@http://192.168.1.2:9538/api/capp-eden-0.0.41.tgz':
|
||||||
resolution: {tarball: http://192.168.1.2:9538/api/capp-eden-0.0.40.tgz}
|
resolution: {tarball: http://192.168.1.2:9538/api/capp-eden-0.0.41.tgz}
|
||||||
version: 0.0.40
|
version: 0.0.41
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@elysiajs/eden': ^1.4.6
|
'@elysiajs/eden': ^1.4.6
|
||||||
|
|
||||||
@@ -4871,7 +4871,7 @@ snapshots:
|
|||||||
|
|
||||||
'@borewit/text-codec@0.1.1': {}
|
'@borewit/text-codec@0.1.1': {}
|
||||||
|
|
||||||
'@capp/eden@http://192.168.1.2:9538/api/capp-eden-0.0.40.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)))':
|
'@capp/eden@http://192.168.1.2:9538/api/capp-eden-0.0.41.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))
|
||||||
|
|
||||||
|
|||||||
@@ -236,7 +236,8 @@ const local: App.I18n.Schema = {
|
|||||||
kyc: 'KYC',
|
kyc: 'KYC',
|
||||||
check: 'CheckIn',
|
check: 'CheckIn',
|
||||||
referral: 'Referral',
|
referral: 'Referral',
|
||||||
deposit: 'Deposit'
|
deposit: 'Deposit',
|
||||||
|
subscription: 'Subscription'
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
login: {
|
login: {
|
||||||
|
|||||||
@@ -230,9 +230,10 @@ const local: App.I18n.Schema = {
|
|||||||
withdraw: '提现管理',
|
withdraw: '提现管理',
|
||||||
wallet: '钱包管理',
|
wallet: '钱包管理',
|
||||||
kyc: '实名管理',
|
kyc: '实名管理',
|
||||||
check: '签到管理',
|
check: '签到记录',
|
||||||
referral: '推广管理',
|
referral: '推广管理',
|
||||||
deposit: '充值管理'
|
deposit: '充值管理',
|
||||||
|
subscription: '认购记录'
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
login: {
|
login: {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export const views: Record<LastLevelRouteKey, RouteComponent | (() => Promise<Ro
|
|||||||
news: () => import("@/views/news/index.vue"),
|
news: () => import("@/views/news/index.vue"),
|
||||||
product: () => import("@/views/product/index.vue"),
|
product: () => import("@/views/product/index.vue"),
|
||||||
referral: () => import("@/views/referral/index.vue"),
|
referral: () => import("@/views/referral/index.vue"),
|
||||||
|
subscription: () => import("@/views/subscription/index.vue"),
|
||||||
user: () => import("@/views/user/index.vue"),
|
user: () => import("@/views/user/index.vue"),
|
||||||
wallet: () => import("@/views/wallet/index.vue"),
|
wallet: () => import("@/views/wallet/index.vue"),
|
||||||
withdraw: () => import("@/views/withdraw/index.vue"),
|
withdraw: () => import("@/views/withdraw/index.vue"),
|
||||||
|
|||||||
@@ -153,5 +153,15 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
i18nKey: 'route.withdraw',
|
i18nKey: 'route.withdraw',
|
||||||
order: 8
|
order: 8
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
name: 'subscription',
|
||||||
|
path: '/subscription',
|
||||||
|
component: 'layout.base$view.subscription',
|
||||||
|
meta: {
|
||||||
|
title: 'subscription',
|
||||||
|
i18nKey: 'route.subscription',
|
||||||
|
order: 9
|
||||||
|
}
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ const routeMap: RouteMap = {
|
|||||||
"news": "/news",
|
"news": "/news",
|
||||||
"product": "/product",
|
"product": "/product",
|
||||||
"referral": "/referral",
|
"referral": "/referral",
|
||||||
|
"subscription": "/subscription",
|
||||||
"user": "/user",
|
"user": "/user",
|
||||||
"wallet": "/wallet",
|
"wallet": "/wallet",
|
||||||
"withdraw": "/withdraw"
|
"withdraw": "/withdraw"
|
||||||
|
|||||||
3
src/typings/elegant-router.d.ts
vendored
3
src/typings/elegant-router.d.ts
vendored
@@ -28,6 +28,7 @@ declare module "@elegant-router/types" {
|
|||||||
"news": "/news";
|
"news": "/news";
|
||||||
"product": "/product";
|
"product": "/product";
|
||||||
"referral": "/referral";
|
"referral": "/referral";
|
||||||
|
"subscription": "/subscription";
|
||||||
"user": "/user";
|
"user": "/user";
|
||||||
"wallet": "/wallet";
|
"wallet": "/wallet";
|
||||||
"withdraw": "/withdraw";
|
"withdraw": "/withdraw";
|
||||||
@@ -73,6 +74,7 @@ declare module "@elegant-router/types" {
|
|||||||
| "news"
|
| "news"
|
||||||
| "product"
|
| "product"
|
||||||
| "referral"
|
| "referral"
|
||||||
|
| "subscription"
|
||||||
| "user"
|
| "user"
|
||||||
| "wallet"
|
| "wallet"
|
||||||
| "withdraw"
|
| "withdraw"
|
||||||
@@ -103,6 +105,7 @@ declare module "@elegant-router/types" {
|
|||||||
| "news"
|
| "news"
|
||||||
| "product"
|
| "product"
|
||||||
| "referral"
|
| "referral"
|
||||||
|
| "subscription"
|
||||||
| "user"
|
| "user"
|
||||||
| "wallet"
|
| "wallet"
|
||||||
| "withdraw"
|
| "withdraw"
|
||||||
|
|||||||
138
src/views/subscription/index.vue
Normal file
138
src/views/subscription/index.vue
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { useTemplateRef } from 'vue';
|
||||||
|
import { NSelect } from 'naive-ui';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import { client, safeClient } from '@/service/api';
|
||||||
|
import type { TableBaseColumns, TableFetchData, TableFilterColumns, TableInst } from '@/components/table';
|
||||||
|
import UserSelect from '@/components/common/user-select.vue';
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'DepositPage'
|
||||||
|
});
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
userId?: string;
|
||||||
|
productId?: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
enum DepositStatus {
|
||||||
|
pending = '确认中',
|
||||||
|
locked = '认购成功',
|
||||||
|
unlocked = '收益已发放',
|
||||||
|
cancelled = '已取消'
|
||||||
|
}
|
||||||
|
|
||||||
|
const tableInst = useTemplateRef<TableInst>('tableInst');
|
||||||
|
|
||||||
|
const fetchData: TableFetchData = ({ pagination, filter }) => {
|
||||||
|
return safeClient(() =>
|
||||||
|
client.api.admin.subscription.orders.get({
|
||||||
|
query: { userId: props.userId, productId: props.productId, ...pagination, ...filter }
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const columns: TableBaseColumns = [
|
||||||
|
{
|
||||||
|
key: 'product.name',
|
||||||
|
title: '产品名称',
|
||||||
|
fixed: 'left'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'user.name',
|
||||||
|
title: '认购用户'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'user.username',
|
||||||
|
title: '认购用户手机号'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'walletType.name',
|
||||||
|
title: '认购钱包'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'price',
|
||||||
|
title: '价格(元)',
|
||||||
|
render: (row: any) => {
|
||||||
|
return Number(row.price);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'maturityYield',
|
||||||
|
title: '到期收益(元)',
|
||||||
|
render: (row: any) => {
|
||||||
|
return Number(row.maturityYield);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'cycleDays',
|
||||||
|
title: '周期(天)'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'status',
|
||||||
|
title: '订阅状态',
|
||||||
|
render: (row: any) => {
|
||||||
|
return DepositStatus[row.status];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'createdAt',
|
||||||
|
title: '创建时间',
|
||||||
|
render: (row: any) => {
|
||||||
|
return dayjs(row.createdAt).format('YYYY-MM-DD HH:mm');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// {
|
||||||
|
// key: 'operations',
|
||||||
|
// title: '操作',
|
||||||
|
// width: 150,
|
||||||
|
// fixed: 'right',
|
||||||
|
// operations: (row: any) => []
|
||||||
|
// }
|
||||||
|
];
|
||||||
|
|
||||||
|
const filterColumns: TableFilterColumns = [
|
||||||
|
{
|
||||||
|
key: 'userId',
|
||||||
|
title: '用户',
|
||||||
|
component: UserSelect
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'productId',
|
||||||
|
title: '产品ID'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'status',
|
||||||
|
title: '状态',
|
||||||
|
component: NSelect,
|
||||||
|
componentProps: {
|
||||||
|
clearable: true,
|
||||||
|
options: [
|
||||||
|
{ label: '确认中', value: 'pending' },
|
||||||
|
{ label: '认购成功', value: 'locked' },
|
||||||
|
{ label: '收益已发放', value: 'unlocked' },
|
||||||
|
{ label: '已取消', value: 'cancelled' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<TableBase
|
||||||
|
ref="tableInst"
|
||||||
|
:fetch-data="fetchData"
|
||||||
|
:columns="columns"
|
||||||
|
:filter-columns="filterColumns"
|
||||||
|
:scroll-x="1500"
|
||||||
|
:show-header-operation="true"
|
||||||
|
:header-operations="{
|
||||||
|
add: false,
|
||||||
|
refresh: true,
|
||||||
|
columns: true
|
||||||
|
}"
|
||||||
|
v-bind="{ ...$attrs }"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="css" scoped></style>
|
||||||
Reference in New Issue
Block a user