Skip to content

Commit 15aa559

Browse files
committed
feat(upgrade): complete upgrade module
1 parent 127e0e8 commit 15aa559

File tree

9 files changed

+554
-79
lines changed

9 files changed

+554
-79
lines changed

src/App.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import AppContext from '@/hooks/app-context';
66
import Layout from '@/layout';
77
import Error from '@/layout/error';
88

9-
const WeixinPay = lazy(() => import('@/page/pay'));
10-
119
const ChatPage = lazy(() => import('@/page/chat'));
1210
const ChatHomePage = lazy(() => import('@/page/chat/home'));
1311
const ChatConversationPage = lazy(() => import('@/page/chat/conversation'));
@@ -27,6 +25,8 @@ const WechatAuthConfirmPage = lazy(
2725
const GoogleAuthConfirmPage = lazy(
2826
() => import('@/page/user/google/auth-confirm')
2927
);
28+
const UpgradePage = lazy(() => import('@/page/upgrade'));
29+
const PaymentPage = lazy(() => import('@/page/upgrade/payment'));
3030

3131
const SharePage = lazy(() => import('@/page/share'));
3232
const SharedResourcePage = lazy(() => import('@/page/shared-resource'));
@@ -82,12 +82,16 @@ const router = createBrowserRouter([
8282
element: <InvitePage />,
8383
},
8484
{
85-
path: 'invite/:namespace_id/:invitation_id',
86-
element: <InviteRedirectPage />,
85+
path: 'upgrade',
86+
element: <UpgradePage />,
8787
},
8888
{
89-
path: 'single/pay',
90-
element: <WeixinPay />,
89+
path: 'upgrade/payment',
90+
element: <PaymentPage />,
91+
},
92+
{
93+
path: 'invite/:namespace_id/:invitation_id',
94+
element: <InviteRedirectPage />,
9195
},
9296
{
9397
path: ':namespace_id',

src/interface.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,3 +280,38 @@ export interface FileInfo {
280280
post_url: string;
281281
post_fields: [string, string][];
282282
}
283+
284+
export enum OrderStatus {
285+
PENDING = 'pending',
286+
PAID = 'paid',
287+
CLOSED = 'closed',
288+
REFUNDED = 'refunded',
289+
}
290+
291+
export enum PaymentMethod {
292+
ALIPAY = 'alipay',
293+
WECHAT = 'wechat',
294+
}
295+
296+
export enum PaymentType {
297+
NATIVE = 'native',
298+
H5 = 'h5',
299+
JSAPI = 'jsapi',
300+
}
301+
302+
export interface Order extends IBase {
303+
id: string;
304+
order_no: string;
305+
user_id: string;
306+
product_id: string | null;
307+
amount: number;
308+
currency: string;
309+
status: OrderStatus;
310+
payment_method: PaymentMethod | null;
311+
payment_type: PaymentType | null;
312+
third_party_order_no: string | null;
313+
description: string;
314+
paid_at: string | null;
315+
closed_at: string | null;
316+
refunded_at: string | null;
317+
}

src/page/pay/index.tsx

Lines changed: 0 additions & 73 deletions
This file was deleted.

src/page/sidebar/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Sidebar, SidebarHeader, SidebarRail } from '@/components/ui/sidebar';
2+
import { UpgradeButton } from '@/page/upgrade/button';
23

34
import Content from './content';
45
import { FooterSidebar } from './footer';
@@ -31,6 +32,7 @@ export default function MainSidebar() {
3132
<SidebarHeader className="pt-[16px] gap-[10px] pr-0">
3233
<Switcher namespaceId={namespaceId} />
3334
<Header active={chatPage} onActiveKey={handleActiveKey} />
35+
<UpgradeButton />
3436
</SidebarHeader>
3537
<Content
3638
data={data}

src/page/upgrade/button.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { useNavigate } from 'react-router-dom';
2+
3+
import { Button } from '@/components/ui/button';
4+
5+
export function UpgradeButton() {
6+
const navigate = useNavigate();
7+
8+
return (
9+
<Button size="sm" onClick={() => navigate('/upgrade')}>
10+
升级帐户
11+
</Button>
12+
);
13+
}

src/page/upgrade/index.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { ArrowLeft } from 'lucide-react';
2+
import { useNavigate } from 'react-router-dom';
3+
4+
import { Button } from '@/components/ui/button';
5+
6+
import { Product } from './product';
7+
8+
export default function UpgradePage() {
9+
const navigate = useNavigate();
10+
11+
return (
12+
<div className="container mx-auto py-8 px-4">
13+
<div className="mb-6">
14+
<Button variant="outline" onClick={() => navigate(-1)}>
15+
<ArrowLeft className="h-4 w-4" />
16+
返回
17+
</Button>
18+
</div>
19+
<div className="mb-8">
20+
<h1 className="text-3xl font-bold mb-2">升级帐户</h1>
21+
<p className="text-muted-foreground">选择适合您的套餐,解锁更多功能</p>
22+
</div>
23+
<Product />
24+
</div>
25+
);
26+
}

0 commit comments

Comments
 (0)