feat: 参考原型图 ui优化提交 个人端-用户中心 相关的页面
This commit is contained in:
@@ -18,17 +18,9 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Modal, Typography, Skeleton } from '@douyinfe/semi-ui';
|
||||
import {
|
||||
CreditCard,
|
||||
Sparkles,
|
||||
Coins,
|
||||
BadgePercent,
|
||||
Wallet,
|
||||
Tag,
|
||||
CheckCircle2,
|
||||
Clock3,
|
||||
} from 'lucide-react';
|
||||
import { Tag as AntTag } from 'antd';
|
||||
import { Modal, Typography, Skeleton } from '@/components/ui';
|
||||
import { CreditCard, Clock3 } from 'lucide-react';
|
||||
import {
|
||||
AlipayBrandIcon,
|
||||
WechatBrandIcon,
|
||||
@@ -101,9 +93,10 @@ const PaymentConfirmModal = ({
|
||||
return <CreditCard size={size} className='text-brand' />;
|
||||
};
|
||||
|
||||
// 原型未定义此弹窗:Ant Design 默认弹窗 + 统一规范(语义文字/分隔线,无渐变、光晕与动效)
|
||||
return (
|
||||
<Modal
|
||||
title={null}
|
||||
title={t('充值确认')}
|
||||
visible={open}
|
||||
onOk={onlineTopUp}
|
||||
onCancel={handleCancel}
|
||||
@@ -115,186 +108,83 @@ const PaymentConfirmModal = ({
|
||||
okText={t('确认支付')}
|
||||
cancelText={t('取消')}
|
||||
className='payment-confirm-modal'
|
||||
bodyStyle={{ padding: 0 }}
|
||||
style={{ overflow: 'hidden' }}
|
||||
>
|
||||
{/* 自定义头部 */}
|
||||
<div className='relative overflow-hidden'>
|
||||
{/* 背景渐变 */}
|
||||
<div className='absolute inset-0 bg-gradient-to-br from-brand-from via-brand-via to-brand-to' />
|
||||
|
||||
{/* 装饰圆形 */}
|
||||
<div className='absolute top-0 right-0 w-32 h-32 bg-white/10 rounded-full -mr-16 -mt-16 blur-2xl' />
|
||||
<div className='absolute bottom-0 left-0 w-24 h-24 bg-black/10 rounded-full -ml-12 -mb-12 blur-xl' />
|
||||
|
||||
{/* 头部内容 */}
|
||||
<div className='relative px-6 py-5'>
|
||||
<div className='flex items-center gap-3'>
|
||||
<div className='relative'>
|
||||
<div className='absolute -inset-1 bg-white/30 rounded-xl blur-sm' />
|
||||
<div className='relative w-12 h-12 rounded-xl bg-white/20 backdrop-blur-sm flex items-center justify-center border border-white/30'>
|
||||
<CreditCard size={24} className='text-white' />
|
||||
</div>
|
||||
<Sparkles
|
||||
size={14}
|
||||
className='absolute -top-1 -right-1 text-amber-300'
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<h3 className='text-white font-bold text-lg'>{t('充值确认')}</h3>
|
||||
<p className='text-white/70 text-sm'>{t('请确认您的充值信息')}</p>
|
||||
</div>
|
||||
</div>
|
||||
<Text type='tertiary' size='small'>
|
||||
{t('请确认您的充值信息')}
|
||||
</Text>
|
||||
<dl className='payment-confirm-rows'>
|
||||
<div>
|
||||
<dt>{t('获得额度')}</dt>
|
||||
<dd>{renderQuotaWithAmount(topUpCount)}</dd>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 主内容区域 */}
|
||||
<div className='p-5 space-y-4'>
|
||||
{/* 充值金额卡片 */}
|
||||
<div className='relative group'>
|
||||
<div className='absolute -inset-0.5 bg-gradient-to-r from-brand-from/30 to-brand-to/30 rounded-2xl blur-sm opacity-0 group-hover:opacity-100 transition-opacity' />
|
||||
<div className='relative bg-gradient-to-br from-slate-50 to-slate-100 dark:from-neutral-800 dark:to-neutral-900 rounded-xl p-4 border border-slate-200/50 dark:border-neutral-700/50'>
|
||||
{/* 充值金额 */}
|
||||
<div className='flex items-center justify-between mb-3 pb-3 border-b border-slate-200 dark:border-neutral-700'>
|
||||
<div className='flex items-center gap-2'>
|
||||
<div className='w-8 h-8 rounded-lg bg-gradient-to-br from-amber-400 to-orange-500 flex items-center justify-center shadow-md shadow-amber-500/20'>
|
||||
<Coins size={16} className='text-white' />
|
||||
</div>
|
||||
<Text className='text-slate-600 dark:text-slate-300 font-medium'>
|
||||
{t('获得额度')}
|
||||
</Text>
|
||||
</div>
|
||||
<Text className='text-lg font-bold bg-clip-text text-transparent bg-gradient-to-r from-amber-600 to-orange-600 dark:from-amber-400 dark:to-orange-400'>
|
||||
{renderQuotaWithAmount(topUpCount)}
|
||||
</Text>
|
||||
</div>
|
||||
|
||||
{/* 实付金额 */}
|
||||
<div className='flex items-center justify-between'>
|
||||
<div className='flex items-center gap-2'>
|
||||
<div className='w-8 h-8 rounded-lg bg-gradient-to-br from-rose-400 to-red-500 flex items-center justify-center shadow-md shadow-rose-500/20'>
|
||||
<Wallet size={16} className='text-white' />
|
||||
</div>
|
||||
<Text className='text-slate-600 dark:text-slate-300 font-medium'>
|
||||
{t('实付金额')}
|
||||
</Text>
|
||||
</div>
|
||||
{amountLoading ? (
|
||||
<Skeleton.Title style={{ width: '80px', height: '24px' }} />
|
||||
) : (
|
||||
<div className='flex items-center gap-2'>
|
||||
<span className='text-2xl font-bold text-rose-500'>
|
||||
{renderAmount()}
|
||||
</span>
|
||||
{hasDiscount && (
|
||||
<span className='px-2 py-0.5 rounded-full bg-emerald-100 dark:bg-emerald-900/30 text-emerald-600 dark:text-emerald-400 text-xs font-bold'>
|
||||
{Math.round((1 - discountRate) * 100)}% OFF
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{t('实付金额')}</dt>
|
||||
<dd>
|
||||
{amountLoading ? (
|
||||
<Skeleton.Title style={{ width: '80px', height: '24px' }} />
|
||||
) : (
|
||||
<>
|
||||
<strong className='payment-confirm-amount'>
|
||||
{renderAmount()}
|
||||
</strong>
|
||||
{hasDiscount && (
|
||||
<AntTag bordered={false} color='success'>
|
||||
{Math.round((1 - discountRate) * 100)}% OFF
|
||||
</AntTag>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
{/* 折扣明细 */}
|
||||
{hasDiscount && !amountLoading && (
|
||||
<div className='relative overflow-hidden rounded-xl bg-gradient-to-r from-emerald-50 to-teal-50 dark:from-emerald-900/20 dark:to-teal-900/20 border border-emerald-200/50 dark:border-emerald-800/30 p-4'>
|
||||
{/* 装饰 */}
|
||||
<div className='absolute top-0 right-0 w-20 h-20 bg-emerald-400/10 rounded-full -mr-10 -mt-10 blur-xl' />
|
||||
|
||||
<div className='relative flex items-center gap-2 mb-3'>
|
||||
<div className='w-6 h-6 rounded-full bg-gradient-to-br from-emerald-400 to-teal-500 flex items-center justify-center'>
|
||||
<BadgePercent size={14} className='text-white' />
|
||||
</div>
|
||||
<Text className='text-emerald-700 dark:text-emerald-300 font-semibold text-sm'>
|
||||
{t('优惠明细')}
|
||||
</Text>
|
||||
</div>
|
||||
|
||||
<div className='relative space-y-2'>
|
||||
<div className='flex justify-between items-center'>
|
||||
<Text className='text-slate-500 dark:text-slate-400 text-sm'>
|
||||
{t('原价')}
|
||||
</Text>
|
||||
<Text delete className='text-slate-400 dark:text-slate-500'>
|
||||
<>
|
||||
<div>
|
||||
<dt>{t('原价')}</dt>
|
||||
<dd>
|
||||
<Text delete type='tertiary'>
|
||||
¥{originalAmount.toFixed(2)}
|
||||
</Text>
|
||||
</div>
|
||||
<div className='flex justify-between items-center'>
|
||||
<div className='flex items-center gap-1'>
|
||||
<Tag size={12} className='text-emerald-500' />
|
||||
<Text className='text-emerald-600 dark:text-emerald-400 text-sm'>
|
||||
{t('优惠减免')}
|
||||
</Text>
|
||||
</div>
|
||||
<Text className='text-emerald-600 dark:text-emerald-400 font-semibold'>
|
||||
- ¥{discountAmount.toFixed(2)}
|
||||
</Text>
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{t('优惠减免')}</dt>
|
||||
<dd className='payment-confirm-discount'>
|
||||
- ¥{discountAmount.toFixed(2)}
|
||||
</dd>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* 支付方式 */}
|
||||
<div className='relative group'>
|
||||
<div className='absolute -inset-0.5 bg-gradient-to-r from-blue-400/20 to-cyan-400/20 rounded-2xl blur-sm opacity-0 group-hover:opacity-100 transition-opacity' />
|
||||
<div className='relative flex items-center justify-between bg-slate-50 dark:bg-neutral-800/50 rounded-xl p-4 border border-slate-200/50 dark:border-neutral-700/50'>
|
||||
<div className='flex items-center gap-2'>
|
||||
<div className='w-8 h-8 rounded-lg bg-gradient-to-br from-blue-400 to-cyan-500 flex items-center justify-center shadow-md shadow-blue-500/20'>
|
||||
<CheckCircle2 size={16} className='text-white' />
|
||||
</div>
|
||||
<Text className='text-slate-600 dark:text-slate-300 font-medium'>
|
||||
{t('支付方式')}
|
||||
</Text>
|
||||
</div>
|
||||
<div className='flex items-center gap-2 px-3 py-1.5 rounded-lg bg-white dark:bg-neutral-700 shadow-sm border border-slate-200 dark:border-neutral-600'>
|
||||
{renderPayIcon(paymentInfo.type, 18)}
|
||||
<Text className='font-medium text-slate-700 dark:text-slate-200'>
|
||||
{paymentInfo.name}
|
||||
</Text>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{t('支付方式')}</dt>
|
||||
<dd className='payment-confirm-method'>
|
||||
{renderPayIcon(paymentInfo.type, 16)}
|
||||
{paymentInfo.name}
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
{payWay === 'paypal' && payPalQuote ? (
|
||||
<div className='space-y-3 border-t border-slate-200 pt-3 dark:border-neutral-700'>
|
||||
<div className='space-y-2'>
|
||||
<div className='flex items-center justify-between gap-4'>
|
||||
<Text type='tertiary' size='small'>
|
||||
{t('充值金额')}
|
||||
</Text>
|
||||
<Text strong>
|
||||
{formatPayPalAmount(payPalQuote.basePayAmount)}
|
||||
</Text>
|
||||
</div>
|
||||
<div className='flex items-center justify-between gap-4'>
|
||||
<Text type='tertiary' size='small'>
|
||||
{t('支付服务费')}
|
||||
</Text>
|
||||
<Text strong>
|
||||
{payPalQuote.feePayer === 'platform'
|
||||
? t('平台承担')
|
||||
: formatPayPalAmount(payPalQuote.serviceFee)}
|
||||
</Text>
|
||||
</div>
|
||||
<div className='flex items-center justify-between gap-4'>
|
||||
<Text type='tertiary' size='small'>
|
||||
{t('实际支付')}
|
||||
</Text>
|
||||
<Text strong>{formatPayPalAmount(payPalQuote.payAmount)}</Text>
|
||||
</div>
|
||||
<>
|
||||
<div>
|
||||
<dt>{t('充值金额')}</dt>
|
||||
<dd>{formatPayPalAmount(payPalQuote.basePayAmount)}</dd>
|
||||
</div>
|
||||
<div className='flex items-start justify-between gap-4'>
|
||||
<div>
|
||||
<Text className='block text-sm font-medium'>
|
||||
{t('汇率来源')}:{t(payPalQuote.exchangeRateSource)}
|
||||
</Text>
|
||||
<Text type='tertiary' size='small'>
|
||||
1 USD = {payPalQuote.exchangeRate} CNY
|
||||
</Text>
|
||||
</div>
|
||||
<div className='flex items-center gap-1'>
|
||||
<div>
|
||||
<dt>{t('支付服务费')}</dt>
|
||||
<dd>
|
||||
{payPalQuote.feePayer === 'platform'
|
||||
? t('平台承担')
|
||||
: formatPayPalAmount(payPalQuote.serviceFee)}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{t('实际支付')}</dt>
|
||||
<dd>{formatPayPalAmount(payPalQuote.payAmount)}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>
|
||||
{t('汇率来源')}:{t(payPalQuote.exchangeRateSource)}
|
||||
<br />1 USD = {payPalQuote.exchangeRate} CNY
|
||||
</dt>
|
||||
<dd className='payment-confirm-method'>
|
||||
<Clock3 size={14} />
|
||||
<Text
|
||||
type={payPalQuoteExpired ? 'danger' : 'tertiary'}
|
||||
@@ -304,19 +194,14 @@ const PaymentConfirmModal = ({
|
||||
? t('报价已过期,请重新获取')
|
||||
: `${t('报价剩余')} ${quoteRemaining}s`}
|
||||
</Text>
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
) : null}
|
||||
|
||||
{/* 底部提示 */}
|
||||
<div className='flex items-center justify-center gap-2 pt-2'>
|
||||
<div className='w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse' />
|
||||
<Text className='text-xs text-slate-400 dark:text-slate-500'>
|
||||
{t('点击确认后将跳转至支付页面')}
|
||||
</Text>
|
||||
</div>
|
||||
</div>
|
||||
</dl>
|
||||
<Text type='tertiary' size='small'>
|
||||
{t('点击确认后将跳转至支付页面')}
|
||||
</Text>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user