重构套餐管理页面 & 修复支付弹窗无法打开问题 & 修复用户中心展示问题

This commit is contained in:
2025-12-16 14:10:50 +08:00
parent 363fd39298
commit 427502489e
9 changed files with 446 additions and 645 deletions

View File

@@ -1,8 +1,8 @@
'use client'
import {Dialog, DialogClose, DialogContent, DialogFooter, DialogHeader, DialogTitle} from '@/components/ui/dialog'
import {Button} from '@/components/ui/button'
import balance from './_assets/balance.svg'
import Image from 'next/image'
import imgBalance from './_assets/balance.svg'
import {useState} from 'react'
import {useProfileStore} from '@/components/stores/profile'
import {Alert, AlertTitle} from '@/components/ui/alert'
@@ -105,11 +105,11 @@ export default function Pay(props: PayProps) {
}
}
const balanceEnough = balance >= Number(props.amount)
const balanceEnough = props.method == 'balance' && props.balance >= Number(props.amount)
return (
<>
<Button className="mt-4 h-12" onClick={onOpen}>
<div className="mt-4">
<Button className="w-full h-12" onClick={onOpen}>
</Button>
@@ -119,7 +119,7 @@ export default function Pay(props: PayProps) {
<DialogContent>
<DialogHeader>
<DialogTitle className="flex gap-2 items-center">
<Image src={balance} alt="余额" width={20} height={20}/>
<Image src={imgBalance} alt="余额" width={20} height={20}/>
<span></span>
</DialogTitle>
</DialogHeader>
@@ -129,7 +129,7 @@ export default function Pay(props: PayProps) {
<div className="flex justify-between items-center">
<span className="text-weak text-sm"></span>
<span className="text-lg">
{balance}
{props.balance}
</span>
</div>
<div className="flex justify-between items-center">
@@ -142,7 +142,7 @@ export default function Pay(props: PayProps) {
<div className="flex justify-between items-center">
<span className="text-weak text-sm"></span>
<span className={`text-lg ${balanceEnough ? 'text-done' : 'text-fail'}`}>
{(balance - Number(props.amount)).toFixed(2)}
{(props.balance - Number(props.amount)).toFixed(2)}
</span>
</div>
</div>
@@ -190,6 +190,6 @@ export default function Pay(props: PayProps) {
}}
/>
)}
</>
</div>
)
}

View File

@@ -16,7 +16,7 @@ export default function UserCenter(props: {
const refreshProfile = useProfileStore(store => store.refreshProfile)
const isAdminPage = pathname.startsWith('/admin') // 判断是否在后台页面
const displayedName = !isAdminPage
const displayedName = isAdminPage
? props.profile.username || props.profile.phone.substring(0, 3) + '****' + props.profile.phone.substring(7) || '用户'
: '进入控制台'