重构套餐管理页面 & 修复支付弹窗无法打开问题 & 修复用户中心展示问题
This commit is contained in:
@@ -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>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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) || '用户'
|
||||
: '进入控制台'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user