feat: 参考原型图 ui优化提交 个人端-用户中心 相关的页面
This commit is contained in:
@@ -18,12 +18,15 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Typography } from '@douyinfe/semi-ui';
|
||||
import { getCurrencyConfig } from '../../helpers/render';
|
||||
import { renderQuota } from '../../helpers';
|
||||
import { Sparkles, Gift, Check } from 'lucide-react';
|
||||
import { Check } from 'lucide-react';
|
||||
|
||||
const { Text } = Typography;
|
||||
// 折扣角标:0.99 → 99折,0.9 → 9折(与原型一致的中文折扣写法)
|
||||
const formatDiscountRate = (discount) => {
|
||||
const rate = Math.round(discount * 100);
|
||||
return rate % 10 === 0 ? rate / 10 : rate;
|
||||
};
|
||||
|
||||
const AmountCard = ({
|
||||
preset,
|
||||
@@ -50,89 +53,62 @@ const AmountCard = ({
|
||||
|
||||
// 获取新版属性
|
||||
const badge = preset.badge;
|
||||
const badgeColor = preset.badgeColor || '#10b981';
|
||||
const badgeColor = preset.badgeColor;
|
||||
const bonus = preset.bonus;
|
||||
const label = preset.label;
|
||||
|
||||
return (
|
||||
<div
|
||||
<button
|
||||
type='button'
|
||||
onClick={onClick}
|
||||
className={`
|
||||
group relative cursor-pointer rounded-xl p-3 text-center transition-all duration-300
|
||||
${
|
||||
selected
|
||||
? 'bg-gradient-to-br from-blue-500 to-brand-to text-white shadow-xl shadow-blue-500/30 scale-[1.03]'
|
||||
: 'bg-white/80 dark:bg-neutral-900/60 backdrop-blur-md border border-white/70 dark:border-neutral-700/50 hover:border-blue-300 dark:hover:border-blue-600 hover:shadow-lg hover:shadow-blue-500/10 hover:scale-[1.02]'
|
||||
}
|
||||
`}
|
||||
aria-pressed={selected}
|
||||
className={`rc-amount ${selected ? 'selected' : ''}`}
|
||||
>
|
||||
{/* 选中指示器 */}
|
||||
{selected && (
|
||||
<div className='absolute top-2 right-2 w-5 h-5 bg-white rounded-full flex items-center justify-center shadow'>
|
||||
<Check size={12} className='text-blue-600' />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 角标:优先显示自定义badge,其次显示折扣 */}
|
||||
{badge ? (
|
||||
<div
|
||||
className='absolute -top-2 -right-2 px-2 py-0.5 rounded-full text-xs font-medium text-white shadow-lg flex items-center gap-1'
|
||||
style={{ backgroundColor: badgeColor }}
|
||||
<span
|
||||
className='rc-amount-badge'
|
||||
style={badgeColor ? { backgroundColor: badgeColor } : undefined}
|
||||
>
|
||||
<Sparkles size={10} />
|
||||
{badge}
|
||||
</div>
|
||||
</span>
|
||||
) : (
|
||||
hasDiscount && (
|
||||
<div className='absolute -top-2 -right-2 px-2 py-0.5 rounded-full text-xs font-medium bg-gradient-to-r from-emerald-500 to-teal-500 text-white shadow-lg'>
|
||||
<span className='rc-amount-badge'>
|
||||
{t('{{rate}}折', {
|
||||
rate: (discount * 10).toFixed(1),
|
||||
rate: formatDiscountRate(discount),
|
||||
percent: Math.round(100 - discount * 100),
|
||||
})}
|
||||
</div>
|
||||
</span>
|
||||
)
|
||||
)}
|
||||
|
||||
{/* 金额 - 优先使用label,新版档位显示人民币,旧版显示额度 */}
|
||||
<Text
|
||||
strong
|
||||
className={`text-lg block font-bold ${selected ? '!text-white' : 'bg-clip-text text-transparent bg-gradient-to-r from-blue-600 to-brand-to dark:from-blue-400 dark:to-brand-to'}`}
|
||||
>
|
||||
{label ||
|
||||
(isNewVersion ? `¥${preset.value}` : `${symbol}${preset.value}`)}
|
||||
</Text>
|
||||
<span className='rc-amount-value'>
|
||||
{label || (
|
||||
<>
|
||||
<small>{isNewVersion ? '¥' : symbol}</small>
|
||||
{Number(preset.value).toLocaleString('en-US')}
|
||||
</>
|
||||
)}
|
||||
</span>
|
||||
|
||||
{/* 实付 - 始终显示人民币金额 */}
|
||||
<Text
|
||||
size='small'
|
||||
className={`block mt-1 ${selected ? '!text-white/80' : 'text-gray-500 dark:text-gray-400'}`}
|
||||
>
|
||||
{t('实付')}{' '}
|
||||
<span className='font-semibold'>¥{discountedPrice.toFixed(2)}</span>
|
||||
</Text>
|
||||
<span className='rc-amount-pay'>
|
||||
{t('实付')} ¥
|
||||
{discountedPrice.toLocaleString('en-US', {
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2,
|
||||
})}
|
||||
</span>
|
||||
|
||||
{/* 赠送额度 */}
|
||||
{bonus > 0 && (
|
||||
<div
|
||||
className={`mt-1.5 pt-1.5 border-t ${selected ? 'border-white/20' : 'border-gray-100 dark:border-neutral-800'}`}
|
||||
>
|
||||
<div
|
||||
className={`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium ${
|
||||
selected
|
||||
? 'bg-white/20 text-white'
|
||||
: 'bg-gradient-to-r from-amber-100 to-orange-100 dark:from-amber-900/30 dark:to-orange-900/30 text-amber-600 dark:text-amber-400'
|
||||
}`}
|
||||
>
|
||||
<Gift size={10} />+{renderQuota(bonus)}
|
||||
</div>
|
||||
</div>
|
||||
<span className='rc-amount-bonus'>+{renderQuota(bonus)}</span>
|
||||
)}
|
||||
|
||||
{/* 悬停光效 */}
|
||||
{!selected && (
|
||||
<div className='absolute inset-0 rounded-xl bg-gradient-to-br from-blue-500/0 to-brand-to/0 group-hover:from-blue-500/5 group-hover:to-brand-to/5 transition-all pointer-events-none' />
|
||||
)}
|
||||
</div>
|
||||
{selected && <Check size={12} className='rc-amount-check' />}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -18,55 +18,27 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useState, useEffect, useMemo } from 'react';
|
||||
import { Empty as AntEmpty, Tag as AntTag } from 'antd';
|
||||
import {
|
||||
Card,
|
||||
Typography,
|
||||
Input,
|
||||
Table,
|
||||
Empty,
|
||||
Button,
|
||||
Modal,
|
||||
Toast,
|
||||
Pagination,
|
||||
} from '@douyinfe/semi-ui';
|
||||
import { IconSearch } from '@douyinfe/semi-icons';
|
||||
import {
|
||||
IllustrationNoResult,
|
||||
IllustrationNoResultDark,
|
||||
} from '../../components/common/illustrations';
|
||||
import {
|
||||
Receipt,
|
||||
Sparkles,
|
||||
Clock,
|
||||
CheckCircle,
|
||||
AlertCircle,
|
||||
XCircle,
|
||||
} from 'lucide-react';
|
||||
} from '@/components/ui';
|
||||
import { Search } from 'lucide-react';
|
||||
import { API, timestamp2string } from '../../helpers';
|
||||
import { isAdmin } from '../../helpers/utils';
|
||||
|
||||
const { Text, Title } = Typography;
|
||||
const { Text } = Typography;
|
||||
|
||||
// 状态映射
|
||||
const STATUS_CONFIG = {
|
||||
success: {
|
||||
type: 'success',
|
||||
key: '成功',
|
||||
icon: CheckCircle,
|
||||
color: 'text-emerald-500',
|
||||
},
|
||||
pending: {
|
||||
type: 'warning',
|
||||
key: '待支付',
|
||||
icon: Clock,
|
||||
color: 'text-amber-500',
|
||||
},
|
||||
expired: {
|
||||
type: 'danger',
|
||||
key: '已过期',
|
||||
icon: XCircle,
|
||||
color: 'text-red-500',
|
||||
},
|
||||
success: { color: 'success', key: '成功' },
|
||||
pending: { color: 'warning', key: '待支付' },
|
||||
expired: { color: undefined, key: '已过期' },
|
||||
};
|
||||
|
||||
const HistoryPanel = ({ t, refreshTrigger }) => {
|
||||
@@ -134,20 +106,16 @@ const HistoryPanel = ({ t, refreshTrigger }) => {
|
||||
});
|
||||
};
|
||||
|
||||
// 渲染状态徽章
|
||||
// 渲染状态标签
|
||||
const renderStatusBadge = (status) => {
|
||||
const config = STATUS_CONFIG[status] || {
|
||||
type: 'primary',
|
||||
color: 'processing',
|
||||
key: status,
|
||||
icon: AlertCircle,
|
||||
color: 'text-gray-500',
|
||||
};
|
||||
const IconComponent = config.icon;
|
||||
return (
|
||||
<span className={`flex items-center gap-1.5 ${config.color}`}>
|
||||
<IconComponent size={14} />
|
||||
<span className='text-xs font-medium'>{t(config.key)}</span>
|
||||
</span>
|
||||
<AntTag bordered={false} color={config.color}>
|
||||
{t(config.key)}
|
||||
</AntTag>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -162,24 +130,26 @@ const HistoryPanel = ({ t, refreshTrigger }) => {
|
||||
render: (text) => (
|
||||
<Text
|
||||
copyable={{ content: text }}
|
||||
size='small'
|
||||
className='font-mono'
|
||||
className='rc-history-mono'
|
||||
ellipsis={{ showTooltip: true }}
|
||||
style={{ maxWidth: 200 }}
|
||||
>
|
||||
{text || '-'}
|
||||
</Text>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t('支付'),
|
||||
title: t('支付金额'),
|
||||
dataIndex: 'money',
|
||||
key: 'money',
|
||||
width: 80,
|
||||
width: 160,
|
||||
render: (money) => (
|
||||
<Text type='danger' size='small'>
|
||||
¥{money?.toFixed(2)}
|
||||
</Text>
|
||||
<span className='rc-history-money'>
|
||||
¥
|
||||
{Number(money || 0).toLocaleString('en-US', {
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2,
|
||||
})}
|
||||
</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -194,11 +164,7 @@ const HistoryPanel = ({ t, refreshTrigger }) => {
|
||||
dataIndex: 'create_time',
|
||||
key: 'create_time',
|
||||
width: 100,
|
||||
render: (time) => (
|
||||
<Text size='small' type='tertiary'>
|
||||
{timestamp2string(time).slice(5, 16)}
|
||||
</Text>
|
||||
),
|
||||
render: (time) => timestamp2string(time).slice(0, 16),
|
||||
},
|
||||
];
|
||||
|
||||
@@ -227,130 +193,70 @@ const HistoryPanel = ({ t, refreshTrigger }) => {
|
||||
}, [t, userIsAdmin]);
|
||||
|
||||
return (
|
||||
<div className='relative'>
|
||||
{/* 外层发光效果 - 与 RechargePanel 对齐 */}
|
||||
<div className='absolute -inset-0.5 bg-gradient-to-br from-emerald-400/20 via-teal-400/20 to-cyan-400/20 rounded-[20px] blur-md opacity-60' />
|
||||
<div className='rc-history'>
|
||||
<div className='rc-history-search'>
|
||||
<Input
|
||||
placeholder={t('请输入订单号')}
|
||||
value={keyword}
|
||||
onChange={(value) => {
|
||||
setKeyword(value);
|
||||
setPage(1);
|
||||
}}
|
||||
showClear
|
||||
/>
|
||||
{/* 重置等同清空订单号;搜索按当前订单号重新加载当前页 */}
|
||||
<Button
|
||||
onClick={() => {
|
||||
setKeyword('');
|
||||
setPage(1);
|
||||
}}
|
||||
>
|
||||
{t('重置')}
|
||||
</Button>
|
||||
<Button
|
||||
type='primary'
|
||||
icon={<Search size={14} />}
|
||||
onClick={() => loadTopups(page, pageSize)}
|
||||
>
|
||||
{t('搜索')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<Card
|
||||
className='relative !rounded-2xl shadow-xl border border-white/60 dark:border-neutral-800/60 bg-white/70 dark:bg-neutral-900/70 backdrop-blur-xl overflow-hidden'
|
||||
style={{
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
maxHeight: 'calc(100vh - 160px)',
|
||||
}}
|
||||
bodyStyle={{
|
||||
flex: 1,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
minHeight: 0,
|
||||
overflow: 'hidden',
|
||||
}}
|
||||
>
|
||||
{/* 顶部装饰线 */}
|
||||
<div className='absolute top-0 left-0 right-0 h-1 bg-gradient-to-r from-emerald-500 via-teal-500 to-cyan-500' />
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={topups}
|
||||
loading={loading}
|
||||
rowKey='id'
|
||||
scroll={{ x: 'max-content' }}
|
||||
size='middle'
|
||||
pagination={false}
|
||||
className='rc-history-table'
|
||||
empty={
|
||||
<AntEmpty
|
||||
image={AntEmpty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={t('暂无充值记录')}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
{/* 背景装饰 */}
|
||||
<div className='absolute top-0 right-0 w-64 h-64 bg-gradient-to-br from-emerald-400/10 to-teal-400/10 rounded-full blur-3xl -mr-32 -mt-32 pointer-events-none' />
|
||||
<div className='absolute bottom-0 left-0 w-48 h-48 bg-gradient-to-br from-cyan-400/10 to-blue-400/10 rounded-full blur-3xl -ml-24 -mb-24 pointer-events-none' />
|
||||
|
||||
{/* 这层必须是 flex 列并参与父级伸缩:Card 的 bodyStyle 已经是
|
||||
flex-column + minHeight:0 + overflow:hidden,但中间隔着这个普通块级 div,
|
||||
下面表格区的 flex-1/min-h-0 与分页的 flex-shrink-0 就都不是 flex 项了——
|
||||
每页选 20/50 条时表格会顶破 maxHeight 被裁掉,分页控件跟着滚出可视区。 */}
|
||||
<div className='relative flex-1 min-h-0 flex flex-col'>
|
||||
{/* 头部 */}
|
||||
<div className='flex items-center justify-between mb-3 flex-shrink-0'>
|
||||
<div className='flex items-center gap-3'>
|
||||
<div className='relative'>
|
||||
<div className='absolute -inset-1 bg-gradient-to-br from-emerald-500/40 to-teal-500/40 rounded-xl blur-md' />
|
||||
<div className='relative w-10 h-10 rounded-xl bg-gradient-to-br from-emerald-500 to-teal-600 flex items-center justify-center shadow-lg shadow-emerald-500/30'>
|
||||
<Receipt size={20} className='text-white' />
|
||||
</div>
|
||||
<Sparkles
|
||||
size={12}
|
||||
className='absolute -top-1 -right-1 text-amber-400'
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Title
|
||||
heading={5}
|
||||
className='!mb-0 bg-clip-text text-transparent bg-gradient-to-r from-emerald-600 to-teal-600 dark:from-emerald-400 dark:to-teal-400'
|
||||
>
|
||||
{t('充值记录')}
|
||||
</Title>
|
||||
<Text type='tertiary' size='small'>
|
||||
{t('查看历史充值订单')}
|
||||
</Text>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 搜索框 */}
|
||||
<div className='mb-3 flex-shrink-0'>
|
||||
<div className='relative group'>
|
||||
<div className='absolute -inset-0.5 bg-gradient-to-r from-emerald-400/20 to-teal-400/20 rounded-xl blur-sm opacity-0 group-hover:opacity-100 transition-opacity' />
|
||||
<Input
|
||||
prefix={<IconSearch className='text-emerald-500' />}
|
||||
placeholder={t('搜索订单号')}
|
||||
value={keyword}
|
||||
onChange={(value) => {
|
||||
setKeyword(value);
|
||||
setPage(1);
|
||||
}}
|
||||
showClear
|
||||
className='!rounded-xl relative'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 表格区域 - 可滚动 */}
|
||||
<div className='flex-1 overflow-auto min-h-0 image-list-scroll rounded-xl bg-white/40 dark:bg-neutral-800/30 backdrop-blur-sm border border-white/60 dark:border-neutral-700/40'>
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={topups}
|
||||
loading={loading}
|
||||
rowKey='id'
|
||||
size='small'
|
||||
pagination={false}
|
||||
className='history-table'
|
||||
empty={
|
||||
<Empty
|
||||
image={
|
||||
<IllustrationNoResult style={{ width: 100, height: 100 }} />
|
||||
}
|
||||
darkModeImage={
|
||||
<IllustrationNoResultDark
|
||||
style={{ width: 100, height: 100 }}
|
||||
/>
|
||||
}
|
||||
description={t('暂无充值记录')}
|
||||
style={{ padding: 20 }}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* 分页器 - 固定在底部 */}
|
||||
{total > 0 && (
|
||||
<div className='flex-shrink-0 pt-3 border-t border-gray-100 dark:border-gray-700 mt-3'>
|
||||
<Pagination
|
||||
total={total}
|
||||
currentPage={page}
|
||||
pageSize={pageSize}
|
||||
showSizeChanger
|
||||
pageSizeOpts={[10, 20, 50]}
|
||||
onPageChange={(p) => setPage(p)}
|
||||
onPageSizeChange={(size) => {
|
||||
setPageSize(size);
|
||||
setPage(1);
|
||||
}}
|
||||
showTotal
|
||||
style={{ justifyContent: 'flex-end' }}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{total > 0 && (
|
||||
<div className='rc-history-pagination'>
|
||||
<Pagination
|
||||
total={total}
|
||||
currentPage={page}
|
||||
pageSize={pageSize}
|
||||
showSizeChanger
|
||||
pageSizeOpts={[10, 20, 50]}
|
||||
onPageChange={(p) => setPage(p)}
|
||||
onPageSizeChange={(size) => {
|
||||
setPageSize(size);
|
||||
setPage(1);
|
||||
}}
|
||||
size='small'
|
||||
showTotal={(count) => t('共 {{total}} 条', { total: count })}
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -18,26 +18,17 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useEffect, useState, useContext } from 'react';
|
||||
import { Segmented } from 'antd';
|
||||
import {
|
||||
Typography,
|
||||
Button,
|
||||
Tag,
|
||||
Modal,
|
||||
Spin,
|
||||
Empty,
|
||||
Banner,
|
||||
} from '@douyinfe/semi-ui';
|
||||
import {
|
||||
Crown,
|
||||
Sparkles,
|
||||
Zap,
|
||||
Calendar,
|
||||
Check,
|
||||
Clock,
|
||||
Shield,
|
||||
Star,
|
||||
FileText,
|
||||
} from 'lucide-react';
|
||||
Progress,
|
||||
} from '@/components/ui';
|
||||
import { ArrowUpRight, Crown, Zap, Check, Clock } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { UserContext } from '../../context/User';
|
||||
import { API, showError, showSuccess, renderQuota } from '../../helpers';
|
||||
@@ -45,45 +36,11 @@ import MembershipHistoryModal from '../../components/membership/MembershipHistor
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
// 方案类型图标和颜色映射
|
||||
// 方案时长(原型分段固定展示周卡/月卡/季卡)
|
||||
const planTypeConfig = {
|
||||
weekly: {
|
||||
label: '周卡',
|
||||
color: 'var(--brand-gradient-from)',
|
||||
gradient: 'from-brand-from to-brand',
|
||||
icon: Clock,
|
||||
btnGradient:
|
||||
'linear-gradient(135deg, var(--brand-gradient-from), var(--brand-primary))',
|
||||
},
|
||||
monthly: {
|
||||
label: '月卡',
|
||||
color: 'var(--brand-gradient-to)',
|
||||
gradient: 'from-brand-from to-brand-to',
|
||||
icon: Calendar,
|
||||
btnGradient:
|
||||
'linear-gradient(135deg, var(--brand-gradient-to), var(--brand-primary-hover))',
|
||||
},
|
||||
quarterly: {
|
||||
label: '季卡',
|
||||
color: 'var(--brand-primary-hover)',
|
||||
gradient: 'from-brand-deep to-brand',
|
||||
icon: Crown,
|
||||
btnGradient:
|
||||
'linear-gradient(135deg, var(--brand-primary-hover), var(--brand-primary))',
|
||||
},
|
||||
};
|
||||
|
||||
const tierConfig = {
|
||||
lite: {
|
||||
label: '轻度版',
|
||||
color: 'var(--brand-primary)',
|
||||
desc: '适合偶尔使用',
|
||||
},
|
||||
pro: {
|
||||
label: '重度版',
|
||||
color: 'var(--brand-primary-hover)',
|
||||
desc: '高频使用首选',
|
||||
},
|
||||
weekly: { label: '周卡' },
|
||||
monthly: { label: '月卡' },
|
||||
quarterly: { label: '季卡' },
|
||||
};
|
||||
|
||||
const MembershipPanel = () => {
|
||||
@@ -332,359 +289,216 @@ const MembershipPanel = () => {
|
||||
return new Date(timestamp * 1000).toLocaleDateString('zh-CN');
|
||||
};
|
||||
|
||||
// 原型展示固定的周卡/月卡/季卡三个时长,没有方案的时长显示“待补充”空态
|
||||
const periodKeys = [
|
||||
...Object.keys(planTypeConfig),
|
||||
...typeKeys.filter((type) => !planTypeConfig[type]),
|
||||
];
|
||||
const currentPeriod = periodKeys.includes(activeType)
|
||||
? activeType
|
||||
: periodKeys[0];
|
||||
const periodPlans = plansByType[currentPeriod] || [];
|
||||
|
||||
return (
|
||||
<div className='space-y-4'>
|
||||
{/* 当前会员状态卡片 */}
|
||||
<div className='rc-membership'>
|
||||
{/* 当前会员状态 */}
|
||||
{!infoLoading && membershipInfo?.has_membership && (
|
||||
<div
|
||||
className='relative overflow-hidden rounded-2xl p-5 text-white shadow-2xl'
|
||||
style={{
|
||||
background:
|
||||
'linear-gradient(135deg, color-mix(in srgb, var(--brand-primary-hover) 35%, #0b1020) 0%, color-mix(in srgb, var(--brand-primary-hover) 55%, #161029) 30%, color-mix(in srgb, var(--brand-gradient-to) 70%, #211038) 60%, var(--brand-primary-hover) 100%)',
|
||||
}}
|
||||
>
|
||||
{/* 背景装饰 */}
|
||||
<div className='absolute top-0 right-0 w-64 h-64 bg-brand/15 rounded-full blur-3xl' />
|
||||
<div className='absolute -bottom-16 -left-16 w-48 h-48 bg-brand-from/10 rounded-full blur-3xl' />
|
||||
<div className='absolute top-1/2 right-1/4 w-24 h-24 bg-brand-from/10 rounded-full blur-2xl' />
|
||||
|
||||
<div className='relative'>
|
||||
<div className='flex items-center justify-between mb-3.5'>
|
||||
<div className='flex items-center gap-2.5'>
|
||||
<div className='w-8 h-8 rounded-lg bg-gradient-to-br from-yellow-400 to-amber-500 flex items-center justify-center shadow-lg shadow-amber-500/30'>
|
||||
<Crown size={18} className='text-white' />
|
||||
</div>
|
||||
<span className='text-white font-semibold text-base tracking-wide'>
|
||||
{t('当前会员')}
|
||||
</span>
|
||||
</div>
|
||||
<div className='flex items-center gap-2'>
|
||||
<span className='inline-flex items-center px-2.5 py-1 rounded-md text-xs font-medium bg-white/15 text-white backdrop-blur-sm border border-white/20'>
|
||||
{membershipInfo.plan_name}
|
||||
</span>
|
||||
<button
|
||||
onClick={() => setHistoryModalVisible(true)}
|
||||
className='inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium bg-white/10 text-white/90 backdrop-blur-sm border border-white/15 hover:bg-white/20 transition-all duration-200'
|
||||
>
|
||||
<FileText size={12} />
|
||||
{t('查看记录')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='grid grid-cols-2 gap-3 mb-3.5'>
|
||||
<div className='p-3 rounded-xl bg-white/10 backdrop-blur-sm border border-white/10'>
|
||||
<span className='text-white/70 text-xs block mb-1'>
|
||||
{t('今日剩余额度')}
|
||||
</span>
|
||||
<span
|
||||
className='text-white font-bold text-xl block'
|
||||
style={{ textShadow: '0 1px 2px rgba(0,0,0,0.2)' }}
|
||||
>
|
||||
{renderQuota(membershipInfo.membership_quota)}
|
||||
</span>
|
||||
</div>
|
||||
<div className='p-3 rounded-xl bg-white/10 backdrop-blur-sm border border-white/10'>
|
||||
<span className='text-white/70 text-xs block mb-1'>
|
||||
{t('每日额度')}
|
||||
</span>
|
||||
<span
|
||||
className='text-white font-bold text-xl block'
|
||||
style={{ textShadow: '0 1px 2px rgba(0,0,0,0.2)' }}
|
||||
>
|
||||
{renderQuota(membershipInfo.daily_quota)}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 额度使用进度 */}
|
||||
{membershipInfo.daily_quota > 0 && (
|
||||
<div className='mb-3'>
|
||||
<div className='flex justify-between text-xs text-white/60 mb-1.5'>
|
||||
<span>{t('今日用量')}</span>
|
||||
<span>
|
||||
{Math.round(
|
||||
(membershipInfo.membership_quota /
|
||||
membershipInfo.daily_quota) *
|
||||
100,
|
||||
)}
|
||||
%
|
||||
</span>
|
||||
</div>
|
||||
<div className='w-full h-2 bg-white/10 rounded-full overflow-hidden'>
|
||||
<div
|
||||
className='h-full rounded-full transition-all duration-500'
|
||||
style={{
|
||||
width: `${Math.round((membershipInfo.membership_quota / membershipInfo.daily_quota) * 100)}%`,
|
||||
background:
|
||||
'linear-gradient(90deg, var(--brand-gradient-from), var(--brand-gradient-via), var(--brand-gradient-to))',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className='flex items-center justify-between text-white/70 text-xs'>
|
||||
<span className='flex items-center gap-1.5'>
|
||||
<Calendar size={12} />
|
||||
{t('到期日')}: {formatDate(membershipInfo.end_date)}
|
||||
</span>
|
||||
<span className='flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-white/10'>
|
||||
<Clock size={12} />
|
||||
{t('剩余')} {membershipInfo.remaining_days} {t('天')}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* 已续费提示 */}
|
||||
{membershipInfo.has_future_membership && (
|
||||
<div className='mt-3 pt-2.5 border-t border-white/15'>
|
||||
<div className='flex items-center gap-2 px-3 py-2 rounded-lg bg-emerald-500/15 border border-emerald-400/20'>
|
||||
<Check size={14} className='text-emerald-300 flex-shrink-0' />
|
||||
<span className='text-white text-xs'>
|
||||
{t('已续费')}:{membershipInfo.future_plan_name},
|
||||
{formatDate(membershipInfo.future_start_date)} ~{' '}
|
||||
{formatDate(membershipInfo.future_end_date)} {t('生效')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 描述提示 */}
|
||||
{description && (
|
||||
<Banner type='info' description={description} closeIcon={null} />
|
||||
)}
|
||||
|
||||
{/* 查看购买历史按钮 - 当没有会员时也显示 */}
|
||||
{!membershipInfo?.has_membership && (
|
||||
<div className='flex justify-end -mt-1'>
|
||||
<Button
|
||||
theme='borderless'
|
||||
icon={<FileText size={16} />}
|
||||
onClick={() => setHistoryModalVisible(true)}
|
||||
className='text-gray-600 dark:text-gray-400 hover:text-brand-deep dark:hover:text-brand-from'
|
||||
>
|
||||
{t('查看购买记录')}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 方案类型切换 */}
|
||||
{typeKeys.length > 1 && (
|
||||
<div className='flex items-center gap-1.5 p-1.5 bg-gray-100/80 dark:bg-neutral-800/80 rounded-2xl backdrop-blur-sm border border-gray-200/50 dark:border-neutral-700/50'>
|
||||
{typeKeys.map((type) => {
|
||||
const config = planTypeConfig[type] || {
|
||||
label: type,
|
||||
gradient: 'from-gray-500 to-gray-600',
|
||||
};
|
||||
const TypeIcon = config.icon || Clock;
|
||||
const isActive = activeType === type;
|
||||
return (
|
||||
<div className='rc-member-status'>
|
||||
<div className='rc-member-status-head'>
|
||||
<strong>{t('当前会员')}</strong>
|
||||
<span>
|
||||
<Tag color='blue' size='small'>
|
||||
{membershipInfo.plan_name}
|
||||
</Tag>{' '}
|
||||
<button
|
||||
key={type}
|
||||
onClick={() => setActiveType(type)}
|
||||
className={`
|
||||
flex-1 flex items-center justify-center gap-2 py-2.5 px-4 rounded-xl text-sm font-semibold transition-all duration-300
|
||||
${
|
||||
isActive
|
||||
? `bg-gradient-to-r ${config.gradient} text-white shadow-lg transform scale-[1.02]`
|
||||
: 'text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-white/60 dark:hover:bg-neutral-700/60'
|
||||
}
|
||||
`}
|
||||
type='button'
|
||||
className='rc-section-link'
|
||||
onClick={() => setHistoryModalVisible(true)}
|
||||
>
|
||||
<TypeIcon size={16} />
|
||||
{config.label}
|
||||
{t('查看记录')}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</span>
|
||||
</div>
|
||||
<div className='rc-member-status-grid'>
|
||||
<div>
|
||||
<span className='rc-label'>{t('今日剩余额度')}</span>
|
||||
<strong>{renderQuota(membershipInfo.membership_quota)}</strong>
|
||||
</div>
|
||||
<div>
|
||||
<span className='rc-label'>{t('每日额度')}</span>
|
||||
<strong>{renderQuota(membershipInfo.daily_quota)}</strong>
|
||||
</div>
|
||||
</div>
|
||||
{membershipInfo.daily_quota > 0 && (
|
||||
<Progress
|
||||
percent={Math.round(
|
||||
(membershipInfo.membership_quota / membershipInfo.daily_quota) *
|
||||
100,
|
||||
)}
|
||||
showInfo
|
||||
size='small'
|
||||
aria-label={t('今日用量')}
|
||||
/>
|
||||
)}
|
||||
<div className='rc-member-status-meta'>
|
||||
<span>
|
||||
{t('到期日')}: {formatDate(membershipInfo.end_date)}
|
||||
</span>
|
||||
<span>
|
||||
{t('剩余')} {membershipInfo.remaining_days} {t('天')}
|
||||
</span>
|
||||
</div>
|
||||
{/* 已续费提示 */}
|
||||
{membershipInfo.has_future_membership && (
|
||||
<Banner
|
||||
type='success'
|
||||
closeIcon={null}
|
||||
description={
|
||||
t('已续费') +
|
||||
':' +
|
||||
membershipInfo.future_plan_name +
|
||||
',' +
|
||||
formatDate(membershipInfo.future_start_date) +
|
||||
' ~ ' +
|
||||
formatDate(membershipInfo.future_end_date) +
|
||||
' ' +
|
||||
t('生效')
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 方案卡片列表 */}
|
||||
<div className='grid grid-cols-1 sm:grid-cols-2 gap-4'>
|
||||
{(plansByType[activeType] || []).map((plan) => {
|
||||
const typeConf = planTypeConfig[plan.plan_type] || {};
|
||||
const tierConf = tierConfig[plan.tier] || {};
|
||||
const isSelected = selectedPlan?.id === plan.id;
|
||||
const isRecommend = plan.badge || plan.is_recommend;
|
||||
|
||||
return (
|
||||
<div
|
||||
key={plan.id}
|
||||
onClick={() => handlePlanClick(plan)}
|
||||
className={`
|
||||
group relative cursor-pointer rounded-2xl transition-all duration-300 overflow-hidden
|
||||
${
|
||||
isSelected
|
||||
? 'ring-2 ring-brand shadow-xl shadow-brand/20 scale-[1.02]'
|
||||
: 'hover:shadow-xl hover:shadow-gray-200/50 dark:hover:shadow-neutral-900/50 hover:-translate-y-1'
|
||||
}
|
||||
${
|
||||
isRecommend
|
||||
? 'bg-gradient-to-br from-white to-brand-to/50 dark:from-neutral-900 dark:to-brand-to/30 border-2 border-brand/20 dark:border-brand-deep/50'
|
||||
: 'bg-white dark:bg-neutral-900 border border-gray-200/80 dark:border-neutral-700/80'
|
||||
}
|
||||
`}
|
||||
>
|
||||
{/* 推荐角标 */}
|
||||
{plan.badge && (
|
||||
<div
|
||||
className='absolute top-0 right-0 px-3 py-1.5 rounded-bl-2xl text-xs font-bold text-white shadow-lg flex items-center gap-1'
|
||||
style={{
|
||||
background: plan.badge_color
|
||||
? `linear-gradient(135deg, ${plan.badge_color}, ${plan.badge_color}dd)`
|
||||
: 'linear-gradient(135deg, var(--brand-primary), var(--brand-gradient-to))',
|
||||
}}
|
||||
>
|
||||
<Star size={10} className='fill-current' />
|
||||
{plan.badge}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className='p-4'>
|
||||
{/* 方案头部 */}
|
||||
<div className='flex items-center gap-3 mb-3'>
|
||||
<div
|
||||
className={`w-10 h-10 rounded-xl bg-gradient-to-br ${typeConf.gradient || 'from-gray-500 to-gray-600'} flex items-center justify-center shadow-lg`}
|
||||
>
|
||||
<Zap size={18} className='text-white' />
|
||||
</div>
|
||||
<div>
|
||||
<Text strong className='text-base block leading-tight'>
|
||||
{plan.name}
|
||||
</Text>
|
||||
<Text className='text-xs text-gray-400 mt-0.5 block'>
|
||||
{plan.duration_days}
|
||||
{t('天')} · {tierConf.label}
|
||||
</Text>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 价格 */}
|
||||
<div className='mb-3'>
|
||||
<span className='text-sm font-medium text-gray-400 mr-0.5'>
|
||||
¥
|
||||
</span>
|
||||
<span
|
||||
className='text-4xl font-extrabold tracking-tight'
|
||||
style={{ color: typeConf.color || 'var(--brand-primary)' }}
|
||||
>
|
||||
{plan.price}
|
||||
</span>
|
||||
<span className='text-sm text-gray-400 ml-1 font-medium'>
|
||||
/{typeConf.label}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* 每日额度 - 高亮区域 */}
|
||||
<div className='flex items-center gap-2 mb-3 py-2 px-3 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-100 dark:border-emerald-800/30'>
|
||||
<Sparkles
|
||||
size={15}
|
||||
className='text-emerald-500 flex-shrink-0'
|
||||
/>
|
||||
<span className='text-sm text-gray-600 dark:text-gray-300'>
|
||||
{t('每日到账')}{' '}
|
||||
<strong className='text-emerald-600 dark:text-emerald-400'>
|
||||
{renderQuota(plan.daily_quota)}
|
||||
</strong>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* 描述 */}
|
||||
{plan.description && (
|
||||
<Text className='text-xs text-gray-400 block mb-2'>
|
||||
{plan.description}
|
||||
</Text>
|
||||
)}
|
||||
|
||||
{/* 功能点 */}
|
||||
<div className='space-y-1.5 mb-3.5'>
|
||||
<div className='flex items-center gap-2.5 text-xs text-gray-500 dark:text-gray-400'>
|
||||
<div className='w-4 h-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center flex-shrink-0'>
|
||||
<Check
|
||||
size={10}
|
||||
className='text-green-600 dark:text-green-400'
|
||||
/>
|
||||
</div>
|
||||
<span>{t('每日自动重置额度')}</span>
|
||||
</div>
|
||||
<div className='flex items-center gap-2.5 text-xs text-gray-500 dark:text-gray-400'>
|
||||
<div className='w-4 h-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center flex-shrink-0'>
|
||||
<Check
|
||||
size={10}
|
||||
className='text-green-600 dark:text-green-400'
|
||||
/>
|
||||
</div>
|
||||
<span>{t('会员额度优先消耗')}</span>
|
||||
</div>
|
||||
<div className='flex items-center gap-2.5 text-xs text-gray-500 dark:text-gray-400'>
|
||||
<div className='w-4 h-4 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center flex-shrink-0'>
|
||||
<Shield
|
||||
size={10}
|
||||
className='text-blue-600 dark:text-blue-400'
|
||||
/>
|
||||
</div>
|
||||
<span>{t('用完自动切换账户余额')}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 立即订阅/升级/续费按钮 */}
|
||||
{(() => {
|
||||
const isCurrentPlan = isCurrentPlanCheck(plan);
|
||||
const canUpgrade = canUpgradeCheck(plan);
|
||||
const isDowngrade = isDowngradeCheck(plan);
|
||||
const hasFuture = hasFutureForPlan(plan);
|
||||
// 按钮文案和样式 - 跟随卡片类型色调
|
||||
let btnText = t('立即订阅');
|
||||
let btnBg =
|
||||
typeConf.btnGradient ||
|
||||
'linear-gradient(135deg, var(--brand-primary), var(--brand-primary-hover))';
|
||||
let subText = '';
|
||||
if (isCurrentPlan) {
|
||||
btnText = hasFuture ? t('再次续费') : t('续费');
|
||||
} else if (canUpgrade) {
|
||||
btnText = t('立即升级');
|
||||
subText = t('立即生效,补差价');
|
||||
} else if (isDowngrade) {
|
||||
subText = t('到期后生效');
|
||||
} else if (membershipInfo?.has_membership) {
|
||||
subText = t('到期后生效');
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
<button
|
||||
className='w-full py-2.5 rounded-xl text-white text-sm font-semibold shadow-lg hover:shadow-xl transition-all duration-300 hover:opacity-90 active:scale-[0.98]'
|
||||
style={{
|
||||
background: btnBg,
|
||||
}}
|
||||
>
|
||||
{btnText}
|
||||
</button>
|
||||
{subText && (
|
||||
<span className='text-xs text-gray-400 text-center block mt-1.5'>
|
||||
{subText}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})()}
|
||||
</div>
|
||||
|
||||
{/* 悬停光效 */}
|
||||
<div className='absolute inset-0 rounded-2xl bg-gradient-to-br from-brand-from/0 to-brand-to/0 group-hover:from-brand-from/[0.03] group-hover:to-brand-to/[0.06] transition-all duration-500 pointer-events-none' />
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
{/* 方案时长切换 */}
|
||||
<div className='rc-segmented rc-member-type'>
|
||||
<Segmented
|
||||
value={currentPeriod}
|
||||
onChange={setActiveType}
|
||||
options={periodKeys.map((type) => ({
|
||||
value: type,
|
||||
label: t(planTypeConfig[type]?.label || type),
|
||||
}))}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{plans.length === 0 && (
|
||||
<Empty
|
||||
title={t('暂无可用方案')}
|
||||
description={t('管理员尚未配置会员方案')}
|
||||
/>
|
||||
)}
|
||||
<section className='rc-section'>
|
||||
<div className='rc-section-head'>
|
||||
<div>
|
||||
<h3>{t('选择适合你的会员')}</h3>
|
||||
<p className='rc-section-desc'>
|
||||
{description ||
|
||||
t(
|
||||
'会员额度每日重置,优先消耗;用完后切换账户余额,不自动续费。',
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
type='button'
|
||||
className='rc-section-link'
|
||||
onClick={() => setHistoryModalVisible(true)}
|
||||
>
|
||||
{t('购买记录')}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{plans.length === 0 ? (
|
||||
<div className='rc-plan-empty'>
|
||||
<Empty
|
||||
title={t('暂无可用方案')}
|
||||
description={t('管理员尚未配置会员方案')}
|
||||
/>
|
||||
</div>
|
||||
) : periodPlans.length === 0 ? (
|
||||
<div className='rc-plan-empty'>
|
||||
<Clock size={18} />
|
||||
<strong>
|
||||
{t(planTypeConfig[currentPeriod]?.label || currentPeriod)}
|
||||
{t('套餐')}
|
||||
</strong>
|
||||
<span>{t('价格与权益待补充')}</span>
|
||||
</div>
|
||||
) : (
|
||||
<div className='rc-plan-grid'>
|
||||
{periodPlans.map((plan) => {
|
||||
const isSelected = selectedPlan?.id === plan.id;
|
||||
const isCurrentPlan = isCurrentPlanCheck(plan);
|
||||
const canUpgrade = canUpgradeCheck(plan);
|
||||
const isDowngrade = isDowngradeCheck(plan);
|
||||
const hasFuture = hasFutureForPlan(plan);
|
||||
// 按钮文案沿用原有续费/升级/到期生效判断
|
||||
let btnText = t('立即订阅');
|
||||
let subText = '';
|
||||
if (isCurrentPlan) {
|
||||
btnText = hasFuture ? t('再次续费') : t('续费');
|
||||
} else if (canUpgrade) {
|
||||
btnText = t('立即升级');
|
||||
subText = t('立即生效,补差价');
|
||||
} else if (isDowngrade) {
|
||||
subText = t('到期后生效');
|
||||
} else if (membershipInfo?.has_membership) {
|
||||
subText = t('到期后生效');
|
||||
}
|
||||
return (
|
||||
<button
|
||||
key={plan.id}
|
||||
type='button'
|
||||
onClick={() => handlePlanClick(plan)}
|
||||
aria-pressed={isSelected}
|
||||
className={`rc-plan ${isSelected ? 'selected' : ''}`}
|
||||
>
|
||||
{(plan.badge || plan.is_recommend) && (
|
||||
<span className='rc-plan-badge'>
|
||||
{plan.badge || t('推荐')}
|
||||
</span>
|
||||
)}
|
||||
<span className='rc-plan-name'>{plan.name}</span>
|
||||
<span className='rc-plan-price'>
|
||||
<small>¥</small>
|
||||
<strong>
|
||||
{Number(plan.price).toLocaleString('en-US')}
|
||||
</strong>
|
||||
<span>
|
||||
/ {plan.duration_days} {t('天')}
|
||||
</span>
|
||||
</span>
|
||||
<span className='rc-plan-quota'>
|
||||
<span>{t('每日额度')}</span>
|
||||
<strong>{renderQuota(plan.daily_quota)}</strong>
|
||||
</span>
|
||||
{plan.description && (
|
||||
<span className='rc-plan-desc'>{plan.description}</span>
|
||||
)}
|
||||
<ul className='rc-plan-features'>
|
||||
<li>
|
||||
<Check size={12} />
|
||||
{t('每日自动重置额度')}
|
||||
</li>
|
||||
<li>
|
||||
<Check size={12} />
|
||||
{t('会员额度优先消耗')}
|
||||
</li>
|
||||
<li>
|
||||
<Check size={12} />
|
||||
{t('额度用完转账户余额')}
|
||||
</li>
|
||||
</ul>
|
||||
<span className='rc-plan-foot'>
|
||||
<span>
|
||||
{btnText}
|
||||
{subText && <small>{subText}</small>}
|
||||
</span>
|
||||
{isSelected ? (
|
||||
<Check size={14} />
|
||||
) : (
|
||||
<ArrowUpRight size={14} />
|
||||
)}
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
|
||||
{/* 购买确认弹窗 */}
|
||||
<Modal
|
||||
@@ -714,7 +528,7 @@ const MembershipPanel = () => {
|
||||
>
|
||||
{selectedPlan && (
|
||||
<div className='space-y-4 py-2'>
|
||||
<div className='p-4 rounded-xl bg-gradient-to-r from-gray-50 to-gray-100 dark:from-neutral-800 dark:to-neutral-900'>
|
||||
<div className='p-4 rounded-lg'>
|
||||
<div className='flex justify-between items-center mb-2'>
|
||||
<Text strong className='text-lg'>
|
||||
{selectedPlan.name}
|
||||
@@ -893,7 +707,7 @@ const MembershipPanel = () => {
|
||||
{selectedPlan && upgradeInfo && (
|
||||
<div className='space-y-4 py-2'>
|
||||
{/* 升级对比 */}
|
||||
<div className='p-4 rounded-xl bg-gradient-to-r from-orange-50 to-amber-50 dark:from-orange-900/20 dark:to-amber-900/20'>
|
||||
<div className='p-4 rounded-lg'>
|
||||
<div className='flex items-center justify-between mb-3'>
|
||||
<div className='text-center flex-1'>
|
||||
<Text className='text-xs text-gray-400 block mb-1'>
|
||||
@@ -927,7 +741,7 @@ const MembershipPanel = () => {
|
||||
</div>
|
||||
|
||||
{/* 差价明细 */}
|
||||
<div className='p-4 rounded-xl bg-gradient-to-r from-gray-50 to-gray-100 dark:from-neutral-800 dark:to-neutral-900'>
|
||||
<div className='p-4 rounded-lg'>
|
||||
<div className='flex justify-between items-center mb-2'>
|
||||
<Text className='text-gray-500'>{t('剩余会员天数')}</Text>
|
||||
<Text strong>
|
||||
|
||||
@@ -18,47 +18,35 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import {
|
||||
Card,
|
||||
Typography,
|
||||
Button,
|
||||
Input,
|
||||
Spin,
|
||||
Tooltip,
|
||||
Skeleton,
|
||||
Banner,
|
||||
} from '@douyinfe/semi-ui';
|
||||
import { IconGift } from '@douyinfe/semi-icons';
|
||||
import {
|
||||
CreditCard,
|
||||
Wallet,
|
||||
Coins,
|
||||
Sparkles,
|
||||
TrendingUp,
|
||||
Gift,
|
||||
Zap,
|
||||
ExternalLink,
|
||||
Receipt,
|
||||
Headphones,
|
||||
} from 'lucide-react';
|
||||
import { Alert } from 'antd';
|
||||
import { Button, Spin, Tooltip } from '@/components/ui';
|
||||
import { Check } from 'lucide-react';
|
||||
import {
|
||||
AlipayBrandIcon,
|
||||
WechatBrandIcon,
|
||||
StripeBrandIcon,
|
||||
PayPalBrandIcon,
|
||||
} from '../../components/common/icons/BrandIcons';
|
||||
import { getCurrencyConfig } from '../../helpers/render';
|
||||
import AmountCard from './AmountCard';
|
||||
import { useMinimumLoadingTime } from '../../hooks/common/useMinimumLoadingTime';
|
||||
|
||||
const { Text, Title } = Typography;
|
||||
const formatCny = (value) =>
|
||||
`¥${Number(value || 0).toLocaleString('en-US', {
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2,
|
||||
})}`;
|
||||
|
||||
// 需要发票时的联系提示(原型:充值订单按钮下方)
|
||||
export const InvoiceNote = ({ t }) => (
|
||||
<p className='rc-invoice'>
|
||||
{t('需要发票?')}
|
||||
<span>{t('联系在线客服')}</span>
|
||||
</p>
|
||||
);
|
||||
|
||||
const RechargePanel = ({
|
||||
t,
|
||||
userState,
|
||||
renderQuota,
|
||||
renderQuotaWithAmount,
|
||||
statusLoading,
|
||||
balanceLoading,
|
||||
enableOnlineTopUp,
|
||||
enableWechatTopUp,
|
||||
enableAlipayTopUp,
|
||||
@@ -69,31 +57,20 @@ const RechargePanel = ({
|
||||
creemPreTopUp,
|
||||
presetAmounts,
|
||||
selectedPreset,
|
||||
selectedPresetObj,
|
||||
selectPresetAmount,
|
||||
formatLargeNumber,
|
||||
priceRatio,
|
||||
topUpCount,
|
||||
minTopUp,
|
||||
getAmount,
|
||||
setTopUpCount,
|
||||
setSelectedPreset,
|
||||
setSelectedPresetObj,
|
||||
renderAmount,
|
||||
amount,
|
||||
amountLoading,
|
||||
payMethods,
|
||||
preTopUp,
|
||||
paymentLoading,
|
||||
payWay,
|
||||
redemptionCode,
|
||||
setRedemptionCode,
|
||||
topUp,
|
||||
isSubmitting,
|
||||
topUpLink,
|
||||
openTopUpLink,
|
||||
payPalQuote,
|
||||
topupInfo,
|
||||
}) => {
|
||||
useMinimumLoadingTime(amountLoading);
|
||||
const showBalanceSkeleton = useMinimumLoadingTime(balanceLoading);
|
||||
|
||||
// Creem 使用独立产品选择;其余渠道共用金额和支付方式区块。
|
||||
const hasStandardOnlinePayment =
|
||||
@@ -104,440 +81,247 @@ const RechargePanel = ({
|
||||
enablePayPalTopUp;
|
||||
const hasAnyOnlinePayment = hasStandardOnlinePayment || enableCreemTopUp;
|
||||
|
||||
// 渲染支付方式图标
|
||||
const renderPayIcon = (type, color) => {
|
||||
if (type === 'alipay') {
|
||||
return <AlipayBrandIcon size={18} color='#1677FF' />;
|
||||
} else if (type === 'wxpay') {
|
||||
return <WechatBrandIcon size={18} color='#07C160' />;
|
||||
} else if (type === 'stripe') {
|
||||
return <StripeBrandIcon size={18} color='#635BFF' />;
|
||||
} else if (type === 'paypal') {
|
||||
return <PayPalBrandIcon size={18} />;
|
||||
} else {
|
||||
return (
|
||||
<CreditCard size={18} color={color || 'var(--semi-color-text-2)'} />
|
||||
);
|
||||
}
|
||||
// 与原逻辑一致的支付方式可用性判断
|
||||
const isMethodDisabled = (method) => {
|
||||
const minTopupVal = Number(method.min_topup) || 0;
|
||||
const isStripe = method.type === 'stripe';
|
||||
const isPayPal = method.type === 'paypal';
|
||||
const isWechat = method.type === 'wxpay';
|
||||
const isAlipay = method.type === 'alipay';
|
||||
return (
|
||||
(!enableOnlineTopUp &&
|
||||
!isStripe &&
|
||||
!isPayPal &&
|
||||
!isWechat &&
|
||||
!isAlipay) ||
|
||||
(!enableStripeTopUp && isStripe) ||
|
||||
(!enablePayPalTopUp && isPayPal) ||
|
||||
(!enableWechatTopUp && isWechat) ||
|
||||
(!enableAlipayTopUp && isAlipay) ||
|
||||
minTopupVal > Number(topUpCount || 0)
|
||||
);
|
||||
};
|
||||
|
||||
// 渲染支付方式图标(微信为原型中的绿色圆点)
|
||||
const renderPayIcon = (type) => {
|
||||
if (type === 'alipay') return <AlipayBrandIcon size={16} color='#1677FF' />;
|
||||
if (type === 'wxpay') return <i className='rc-pay-dot' />;
|
||||
if (type === 'stripe') return <StripeBrandIcon size={16} color='#635BFF' />;
|
||||
if (type === 'paypal') return <PayPalBrandIcon size={16} />;
|
||||
return null;
|
||||
};
|
||||
|
||||
// ---- 充值订单:仅由已选档位、金额与支付方式派生展示 ----
|
||||
const { symbol } = getCurrencyConfig();
|
||||
const preset = selectedPreset !== null ? selectedPresetObj : null;
|
||||
const discount =
|
||||
preset?.discount || topupInfo?.discount?.[preset?.value] || 1.0;
|
||||
const isNewVersion = preset?.id !== undefined;
|
||||
const originalPrice = preset
|
||||
? isNewVersion
|
||||
? preset.value
|
||||
: preset.value * priceRatio
|
||||
: 0;
|
||||
const arrivalText = preset
|
||||
? preset.label ||
|
||||
(isNewVersion
|
||||
? formatCny(preset.value)
|
||||
: `${symbol}${Number(preset.value).toLocaleString('en-US')}`)
|
||||
: '-';
|
||||
const selectedMethod = payMethods?.find((method) => method.type === payWay);
|
||||
const payPalQuoted = payWay === 'paypal' && payPalQuote;
|
||||
// 应付金额:人民币取已计算的 amount;PayPal 取已获取的美元报价(原型中币种符号为小字)
|
||||
const payable = !preset
|
||||
? null
|
||||
: payWay === 'paypal'
|
||||
? payPalQuoted
|
||||
? {
|
||||
symbol: '$',
|
||||
value: Number(payPalQuote.payAmount).toFixed(2),
|
||||
unit: 'USD',
|
||||
}
|
||||
: null
|
||||
: { symbol: '¥', value: formatCny(amount).slice(1) };
|
||||
const canPay =
|
||||
Boolean(preset) &&
|
||||
Boolean(selectedMethod) &&
|
||||
!isMethodDisabled(selectedMethod) &&
|
||||
Boolean(payable);
|
||||
|
||||
if (statusLoading) {
|
||||
return (
|
||||
<div className='rc-loading'>
|
||||
<Spin size='large' />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!hasAnyOnlinePayment) {
|
||||
return (
|
||||
<>
|
||||
<Alert
|
||||
type='info'
|
||||
showIcon
|
||||
message={t(
|
||||
'管理员未开启在线充值功能,请联系管理员开启或使用兑换码充值。',
|
||||
)}
|
||||
/>
|
||||
<InvoiceNote t={t} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='relative'>
|
||||
{/* 外层发光效果 */}
|
||||
<div className='absolute -inset-0.5 bg-gradient-to-br from-blue-400/20 via-brand-via/20 to-brand-to/20 rounded-[20px] blur-md opacity-60' />
|
||||
|
||||
<Card className='relative !rounded-2xl shadow-xl border border-white/60 dark:border-neutral-800/60 bg-white/70 dark:bg-neutral-900/70 backdrop-blur-xl h-full overflow-hidden'>
|
||||
{/* 顶部装饰线 */}
|
||||
<div className='absolute top-0 left-0 right-0 h-1 bg-gradient-to-r from-blue-500 via-brand-via to-brand-to' />
|
||||
|
||||
{/* 背景装饰 */}
|
||||
<div className='absolute top-0 right-0 w-64 h-64 bg-gradient-to-br from-blue-400/10 to-brand-to/10 rounded-full blur-3xl -mr-32 -mt-32 pointer-events-none' />
|
||||
<div className='absolute bottom-0 left-0 w-48 h-48 bg-gradient-to-br from-brand-from/10 to-brand-to/10 rounded-full blur-3xl -ml-24 -mb-24 pointer-events-none' />
|
||||
|
||||
<div className='relative'>
|
||||
{/* 头部:余额展示 */}
|
||||
<div className='flex items-center justify-between mb-4'>
|
||||
<div className='flex items-center gap-3'>
|
||||
<div className='relative'>
|
||||
<div className='absolute -inset-1 bg-gradient-to-br from-blue-500/40 to-brand-to/40 rounded-xl blur-md' />
|
||||
<div className='relative w-10 h-10 rounded-xl bg-gradient-to-br from-blue-500 to-brand-to flex items-center justify-center shadow-lg shadow-blue-500/30'>
|
||||
<CreditCard size={20} className='text-white' />
|
||||
</div>
|
||||
<Sparkles
|
||||
size={12}
|
||||
className='absolute -top-1 -right-1 text-amber-400'
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Title
|
||||
heading={5}
|
||||
className='!mb-0 bg-clip-text text-transparent bg-gradient-to-r from-blue-600 to-brand-to dark:from-blue-400 dark:to-brand-to'
|
||||
>
|
||||
{t('在线充值')}
|
||||
</Title>
|
||||
<Text type='tertiary' size='small'>
|
||||
{t('多种支付方式,安全便捷')}
|
||||
</Text>
|
||||
</div>
|
||||
</div>
|
||||
<>
|
||||
{hasStandardOnlinePayment && (
|
||||
<section className='rc-section'>
|
||||
<h3>{t('选择充值额度')}</h3>
|
||||
<p className='rc-section-desc'>
|
||||
{t('按需充值,余额可用于平台模型调用。')}
|
||||
</p>
|
||||
<div className='rc-amount-grid'>
|
||||
{presetAmounts.slice(0, 8).map((item, index) => (
|
||||
<AmountCard
|
||||
key={index}
|
||||
preset={item}
|
||||
selected={selectedPreset === item.value}
|
||||
onClick={() => selectPresetAmount(item)}
|
||||
topupInfo={topupInfo}
|
||||
priceRatio={priceRatio}
|
||||
t={t}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* 余额卡片 */}
|
||||
<div className='relative overflow-hidden bg-gradient-to-r from-blue-500 via-brand-via to-brand-to rounded-2xl p-4 mb-4 shadow-xl shadow-blue-500/20'>
|
||||
{/* 装饰元素 */}
|
||||
<div className='absolute top-0 right-0 w-32 h-32 bg-white/10 rounded-full -mr-8 -mt-8 blur-2xl' />
|
||||
<div className='absolute bottom-0 left-0 w-24 h-24 bg-black/10 rounded-full -ml-8 -mb-8 blur-xl' />
|
||||
<div className='rc-divider' />
|
||||
|
||||
<div className='relative z-10 flex items-center justify-between gap-4'>
|
||||
{/* 左侧:余额信息 */}
|
||||
<div className='flex items-center gap-3 min-w-0'>
|
||||
<div className='p-2 bg-white/20 rounded-xl backdrop-blur-md flex-shrink-0'>
|
||||
<Wallet size={18} className='text-white' />
|
||||
</div>
|
||||
<div className='min-w-0'>
|
||||
<Text className='!text-white/80 text-xs font-medium'>
|
||||
{t('当前余额')}
|
||||
</Text>
|
||||
<Skeleton
|
||||
loading={showBalanceSkeleton}
|
||||
placeholder={
|
||||
<Skeleton.Title
|
||||
style={{
|
||||
width: 100,
|
||||
height: 28,
|
||||
backgroundColor: 'rgba(255,255,255,0.2)',
|
||||
}}
|
||||
/>
|
||||
}
|
||||
<h3>{t('支付方式')}</h3>
|
||||
{payMethods && payMethods.length > 0 ? (
|
||||
<div className='rc-pay-methods'>
|
||||
{payMethods.map((method) => {
|
||||
const minTopupVal = Number(method.min_topup) || 0;
|
||||
const disabled = isMethodDisabled(method);
|
||||
const selected = payWay === method.type;
|
||||
const button = (
|
||||
<Button
|
||||
key={method.type}
|
||||
onClick={() => preTopUp(method.type)}
|
||||
disabled={disabled}
|
||||
loading={paymentLoading && selected}
|
||||
aria-pressed={selected}
|
||||
icon={renderPayIcon(method.type)}
|
||||
className={`rc-pay-method ${selected ? 'is-selected' : ''}`}
|
||||
>
|
||||
<Title
|
||||
heading={4}
|
||||
className='!text-white !mb-0 drop-shadow-sm truncate'
|
||||
{method.name}
|
||||
{selected && <Check size={14} />}
|
||||
</Button>
|
||||
);
|
||||
if (disabled && minTopupVal > Number(topUpCount || 0)) {
|
||||
return (
|
||||
<Tooltip
|
||||
key={method.type}
|
||||
content={
|
||||
t('此支付方式最低充值金额为') + ' ' + minTopupVal
|
||||
}
|
||||
>
|
||||
{renderQuota(userState?.user?.quota)}
|
||||
</Title>
|
||||
</Skeleton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 分隔线 */}
|
||||
<div className='w-px h-10 bg-white/20 flex-shrink-0' />
|
||||
|
||||
{/* 右侧:历史消耗 */}
|
||||
<div className='flex items-center gap-3 min-w-0'>
|
||||
<div className='p-2 bg-white/10 rounded-xl backdrop-blur-md flex-shrink-0'>
|
||||
<TrendingUp size={18} className='text-white/80' />
|
||||
</div>
|
||||
<div className='min-w-0'>
|
||||
<Text className='!text-white/60 text-xs'>
|
||||
{t('历史消耗')}
|
||||
</Text>
|
||||
<Text className='!text-white font-semibold text-sm block truncate'>
|
||||
{renderQuota(userState?.user?.used_quota)}
|
||||
</Text>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 开票服务公告 */}
|
||||
<div className='relative mb-4 overflow-hidden rounded-xl border border-amber-200/80 dark:border-amber-700/40 bg-amber-50/80 dark:bg-amber-950/20 backdrop-blur-sm'>
|
||||
{/* 左侧强调色条 */}
|
||||
<div className='absolute left-0 top-0 bottom-0 w-1 bg-gradient-to-b from-amber-400 to-orange-400' />
|
||||
<div className='flex items-center gap-3 pl-4 pr-4 py-3'>
|
||||
{/* 图标区 */}
|
||||
<div className='flex-shrink-0 w-9 h-9 rounded-xl bg-gradient-to-br from-amber-400 to-orange-500 flex items-center justify-center shadow-md shadow-amber-400/30'>
|
||||
<Receipt size={16} className='text-white' />
|
||||
</div>
|
||||
{/* 文字区 */}
|
||||
<div className='flex-1 min-w-0'>
|
||||
<div className='flex items-center gap-2 mb-0.5'>
|
||||
<span className='text-xs font-bold text-amber-700 dark:text-amber-400 tracking-wide uppercase'>
|
||||
{t('发票服务')}
|
||||
</span>
|
||||
<span className='text-[10px] px-1.5 py-0.5 rounded-full bg-amber-100 dark:bg-amber-900/50 text-amber-600 dark:text-amber-400 border border-amber-200 dark:border-amber-700/60 font-medium'>
|
||||
{t('温馨提示')}
|
||||
</span>
|
||||
</div>
|
||||
<Text
|
||||
size='small'
|
||||
className='!text-gray-600 dark:!text-gray-300 leading-relaxed'
|
||||
>
|
||||
{t('需要开发票的用户,请联系')}
|
||||
<span className='inline-flex items-center gap-1 font-semibold text-amber-700 dark:text-amber-400'>
|
||||
<Headphones size={12} />
|
||||
{t('在线客服')}
|
||||
</span>
|
||||
{t('进行申请处理')}
|
||||
</Text>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{statusLoading ? (
|
||||
<div className='py-12 flex flex-col items-center justify-center'>
|
||||
<Spin size='large' />
|
||||
<Text type='tertiary' className='mt-4'>
|
||||
{t('加载中...')}
|
||||
</Text>
|
||||
</div>
|
||||
) : hasAnyOnlinePayment ? (
|
||||
<div className='space-y-3.5'>
|
||||
{/* 充值金额选择 */}
|
||||
{hasStandardOnlinePayment && (
|
||||
<div className='relative group'>
|
||||
<div className='absolute -inset-0.5 bg-gradient-to-r from-emerald-400/20 to-teal-400/20 rounded-2xl blur-sm opacity-0 group-hover:opacity-100 transition-opacity' />
|
||||
<div className='relative bg-white/50 dark:bg-neutral-800/40 backdrop-blur-md rounded-xl p-3.5 border border-white/70 dark:border-neutral-700/50 shadow-sm'>
|
||||
<div className='flex items-center gap-2 mb-3'>
|
||||
<div className='p-1.5 bg-gradient-to-br from-emerald-500 to-teal-500 rounded-lg shadow-md shadow-emerald-500/20'>
|
||||
<Coins size={14} className='text-white' />
|
||||
</div>
|
||||
<Text strong className='text-gray-800 dark:text-gray-200'>
|
||||
{t('选择充值金额')}
|
||||
</Text>
|
||||
</div>
|
||||
<div className='grid grid-cols-2 sm:grid-cols-4 gap-2.5'>
|
||||
{presetAmounts.slice(0, 8).map((preset, index) => (
|
||||
<AmountCard
|
||||
key={index}
|
||||
preset={preset}
|
||||
selected={selectedPreset === preset.value}
|
||||
onClick={() => selectPresetAmount(preset)}
|
||||
topupInfo={topupInfo}
|
||||
priceRatio={priceRatio}
|
||||
t={t}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 支付方式 */}
|
||||
{hasStandardOnlinePayment && (
|
||||
<div className='relative group'>
|
||||
<div className='absolute -inset-0.5 bg-gradient-to-r from-brand-from/20 to-brand-to/20 rounded-2xl blur-sm opacity-0 group-hover:opacity-100 transition-opacity' />
|
||||
<div className='relative bg-white/50 dark:bg-neutral-800/40 backdrop-blur-md rounded-xl p-3.5 border border-white/70 dark:border-neutral-700/50 shadow-sm'>
|
||||
<div className='flex items-center gap-2 mb-3'>
|
||||
<div className='p-1.5 bg-gradient-to-br from-brand-from to-brand-to rounded-lg shadow-md shadow-brand/20'>
|
||||
<CreditCard size={14} className='text-white' />
|
||||
</div>
|
||||
<Text strong className='text-gray-800 dark:text-gray-200'>
|
||||
{t('支付方式')}
|
||||
</Text>
|
||||
</div>
|
||||
{payMethods && payMethods.length > 0 ? (
|
||||
<div className='flex flex-wrap gap-3'>
|
||||
{payMethods.map((method) => {
|
||||
const minTopupVal = Number(method.min_topup) || 0;
|
||||
const isStripe = method.type === 'stripe';
|
||||
const isPayPal = method.type === 'paypal';
|
||||
const isWechat = method.type === 'wxpay';
|
||||
const isAlipay = method.type === 'alipay';
|
||||
|
||||
const disabled =
|
||||
(!enableOnlineTopUp &&
|
||||
!isStripe &&
|
||||
!isPayPal &&
|
||||
!isWechat &&
|
||||
!isAlipay) ||
|
||||
(!enableStripeTopUp && isStripe) ||
|
||||
(!enablePayPalTopUp && isPayPal) ||
|
||||
(!enableWechatTopUp && isWechat) ||
|
||||
(!enableAlipayTopUp && isAlipay) ||
|
||||
minTopupVal > Number(topUpCount || 0);
|
||||
|
||||
const button = (
|
||||
<Button
|
||||
key={method.type}
|
||||
theme={payWay === method.type ? 'solid' : 'light'}
|
||||
type={
|
||||
payWay === method.type ? 'primary' : 'tertiary'
|
||||
}
|
||||
onClick={() => preTopUp(method.type)}
|
||||
disabled={disabled}
|
||||
loading={paymentLoading && payWay === method.type}
|
||||
icon={renderPayIcon(method.type, method.color)}
|
||||
className={`!rounded-xl !px-5 !py-2.5 !h-auto transition-all ${
|
||||
payWay === method.type
|
||||
? '!bg-gradient-to-r !from-brand-from !to-brand-to !shadow-lg !shadow-brand/30'
|
||||
: 'hover:!bg-brand/5 dark:hover:!bg-brand-deep/20 hover:!border-brand-from'
|
||||
}`}
|
||||
>
|
||||
{method.name}
|
||||
</Button>
|
||||
);
|
||||
|
||||
if (
|
||||
disabled &&
|
||||
minTopupVal > Number(topUpCount || 0)
|
||||
) {
|
||||
return (
|
||||
<Tooltip
|
||||
key={method.type}
|
||||
content={
|
||||
t('此支付方式最低充值金额为') +
|
||||
' ' +
|
||||
minTopupVal
|
||||
}
|
||||
>
|
||||
{button}
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
return button;
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
<div className='text-gray-500 text-sm p-4 bg-gray-100/50 dark:bg-gray-800/50 rounded-xl border border-dashed border-gray-300 dark:border-gray-600 flex items-center gap-2'>
|
||||
<Zap size={16} className='text-gray-400' />
|
||||
{t('暂无可用的支付方式,请联系管理员配置')}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Creem 充值 */}
|
||||
{enableCreemTopUp && creemProducts.length > 0 && (
|
||||
<div className='relative group'>
|
||||
<div className='absolute -inset-0.5 bg-gradient-to-r from-cyan-400/20 to-blue-400/20 rounded-2xl blur-sm opacity-0 group-hover:opacity-100 transition-opacity' />
|
||||
<div className='relative bg-white/50 dark:bg-neutral-800/40 backdrop-blur-md rounded-xl p-3.5 border border-white/70 dark:border-neutral-700/50 shadow-sm'>
|
||||
<div className='flex items-center gap-2 mb-3'>
|
||||
<div className='p-1.5 bg-gradient-to-br from-cyan-500 to-blue-500 rounded-lg shadow-md shadow-cyan-500/20'>
|
||||
<Zap size={14} className='text-white' />
|
||||
</div>
|
||||
<Text strong className='text-gray-800 dark:text-gray-200'>
|
||||
{t('Creem 充值')}
|
||||
</Text>
|
||||
</div>
|
||||
<div className='grid grid-cols-2 sm:grid-cols-3 gap-3'>
|
||||
{creemProducts.map((product, index) => (
|
||||
<div
|
||||
key={index}
|
||||
onClick={() => creemPreTopUp(product)}
|
||||
className='cursor-pointer rounded-xl p-4 bg-white dark:bg-neutral-900 border border-gray-200 dark:border-neutral-700 transition-all hover:shadow-lg hover:border-cyan-300 dark:hover:border-cyan-700 hover:scale-[1.02] text-center'
|
||||
>
|
||||
<Text
|
||||
strong
|
||||
className='block text-gray-800 dark:text-gray-200'
|
||||
>
|
||||
{product.name}
|
||||
</Text>
|
||||
<div className='text-xs text-gray-500 my-2'>
|
||||
{t('额度')}: {product.quota}
|
||||
</div>
|
||||
<Text className='text-lg font-bold bg-clip-text text-transparent bg-gradient-to-r from-cyan-600 to-blue-600'>
|
||||
{product.currency === 'EUR' ? '€' : '¥'}
|
||||
{product.price}
|
||||
</Text>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 分隔线 */}
|
||||
<div className='h-px bg-gradient-to-r from-transparent via-gray-200 dark:via-gray-700 to-transparent' />
|
||||
|
||||
{/* 兑换码充值 */}
|
||||
<div className='relative group'>
|
||||
<div className='absolute -inset-0.5 bg-gradient-to-r from-amber-400/20 to-orange-400/20 rounded-2xl blur-sm opacity-0 group-hover:opacity-100 transition-opacity' />
|
||||
<div className='relative bg-white/50 dark:bg-neutral-800/40 backdrop-blur-md rounded-xl p-3.5 border border-white/70 dark:border-neutral-700/50 shadow-sm'>
|
||||
<div className='flex items-center gap-2 mb-3'>
|
||||
<div className='p-1.5 bg-gradient-to-br from-amber-500 to-orange-500 rounded-lg shadow-md shadow-amber-500/20'>
|
||||
<Gift size={14} className='text-white' />
|
||||
</div>
|
||||
<Text strong className='text-gray-800 dark:text-gray-200'>
|
||||
{t('兑换码充值')}
|
||||
</Text>
|
||||
</div>
|
||||
<div className='flex gap-3'>
|
||||
<Input
|
||||
prefix={<IconGift className='text-amber-500' />}
|
||||
placeholder={t('请输入兑换码')}
|
||||
value={redemptionCode}
|
||||
onChange={(value) => setRedemptionCode(value)}
|
||||
showClear
|
||||
className='flex-1 !rounded-xl'
|
||||
style={{ flex: 1 }}
|
||||
/>
|
||||
<Button
|
||||
theme='solid'
|
||||
onClick={topUp}
|
||||
loading={isSubmitting}
|
||||
className='!bg-gradient-to-r !from-amber-500 !to-orange-500 !rounded-xl !px-6 !shadow-lg !shadow-amber-500/20 hover:!shadow-amber-500/30 transition-all'
|
||||
>
|
||||
{t('兑换')}
|
||||
</Button>
|
||||
</div>
|
||||
{topUpLink && (
|
||||
<div className='mt-2 flex items-center gap-1'>
|
||||
<Text type='tertiary' size='small'>
|
||||
{t('在找兑换码?')}
|
||||
</Text>
|
||||
<Text
|
||||
link
|
||||
onClick={openTopUpLink}
|
||||
className='cursor-pointer flex items-center gap-1 text-amber-600 hover:text-amber-700'
|
||||
>
|
||||
{t('购买兑换码')}
|
||||
<ExternalLink size={12} />
|
||||
</Text>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{button}
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
return button;
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
<div className='space-y-3.5'>
|
||||
{/* 提示信息 */}
|
||||
<Banner
|
||||
type='info'
|
||||
description={t(
|
||||
'管理员未开启在线充值功能,请联系管理员开启或使用兑换码充值。',
|
||||
)}
|
||||
className='!rounded-xl'
|
||||
closeIcon={null}
|
||||
/>
|
||||
|
||||
{/* 分隔线 */}
|
||||
<div className='h-px bg-gradient-to-r from-transparent via-gray-200 dark:via-gray-700 to-transparent' />
|
||||
|
||||
{/* 兑换码充值 */}
|
||||
<div className='relative group'>
|
||||
<div className='absolute -inset-0.5 bg-gradient-to-r from-amber-400/20 to-orange-400/20 rounded-2xl blur-sm opacity-0 group-hover:opacity-100 transition-opacity' />
|
||||
<div className='relative bg-white/50 dark:bg-neutral-800/40 backdrop-blur-md rounded-xl p-3.5 border border-white/70 dark:border-neutral-700/50 shadow-sm'>
|
||||
<div className='flex items-center gap-2 mb-3'>
|
||||
<div className='p-1.5 bg-gradient-to-br from-amber-500 to-orange-500 rounded-lg'>
|
||||
<Gift size={14} className='text-white' />
|
||||
</div>
|
||||
<Text strong className='text-gray-800 dark:text-gray-200'>
|
||||
{t('兑换码充值')}
|
||||
</Text>
|
||||
</div>
|
||||
<div className='flex gap-3'>
|
||||
<Input
|
||||
prefix={<IconGift className='text-amber-500' />}
|
||||
placeholder={t('请输入兑换码')}
|
||||
value={redemptionCode}
|
||||
onChange={(value) => setRedemptionCode(value)}
|
||||
showClear
|
||||
className='flex-1 !rounded-xl'
|
||||
style={{ flex: 1 }}
|
||||
/>
|
||||
<Button
|
||||
theme='solid'
|
||||
onClick={topUp}
|
||||
loading={isSubmitting}
|
||||
className='!bg-gradient-to-r !from-amber-500 !to-orange-500 !rounded-xl !px-6 !shadow-lg !shadow-amber-500/20 hover:!shadow-amber-500/30 transition-all'
|
||||
>
|
||||
{t('兑换')}
|
||||
</Button>
|
||||
</div>
|
||||
{topUpLink && (
|
||||
<div className='mt-2 flex items-center gap-1'>
|
||||
<Text type='tertiary' size='small'>
|
||||
{t('在找兑换码?')}
|
||||
</Text>
|
||||
<Text
|
||||
link
|
||||
onClick={openTopUpLink}
|
||||
className='cursor-pointer flex items-center gap-1 text-amber-600 hover:text-amber-700'
|
||||
>
|
||||
{t('购买兑换码')}
|
||||
<ExternalLink size={12} />
|
||||
</Text>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className='rc-pay-empty'>
|
||||
{t('暂无可用的支付方式,请联系管理员配置')}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
|
||||
{/* Creem 充值 */}
|
||||
{enableCreemTopUp && creemProducts.length > 0 && (
|
||||
<section className='rc-section rc-section-gap'>
|
||||
<h3>{t('Creem 充值')}</h3>
|
||||
<div className='rc-amount-grid'>
|
||||
{creemProducts.map((product, index) => (
|
||||
<button
|
||||
key={index}
|
||||
type='button'
|
||||
onClick={() => creemPreTopUp(product)}
|
||||
className='rc-amount'
|
||||
>
|
||||
<span className='rc-amount-value'>{product.name}</span>
|
||||
<span className='rc-amount-pay'>
|
||||
{t('额度')}: {product.quota}
|
||||
</span>
|
||||
<span className='rc-amount-bonus'>
|
||||
{product.currency === 'EUR' ? '€' : '¥'}
|
||||
{product.price}
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
|
||||
{hasStandardOnlinePayment && (
|
||||
<section className='rc-order'>
|
||||
<div className='rc-order-main'>
|
||||
<h3 className='rc-order-title'>{t('充值订单')}</h3>
|
||||
<dl className='rc-order-rows'>
|
||||
<div>
|
||||
<dt>{t('到账额度')}</dt>
|
||||
<dd>{arrivalText}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{t('优惠金额')}</dt>
|
||||
<dd>
|
||||
{preset ? formatCny(originalPrice * (1 - discount)) : '-'}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{t('支付方式')}</dt>
|
||||
<dd>{selectedMethod?.name || '-'}</dd>
|
||||
</div>
|
||||
{payPalQuoted && (
|
||||
<div>
|
||||
<dt>{t('支付服务费')}</dt>
|
||||
<dd>{`$${Number(payPalQuote.serviceFee).toFixed(2)} USD`}</dd>
|
||||
</div>
|
||||
)}
|
||||
</dl>
|
||||
</div>
|
||||
<div className='rc-order-side'>
|
||||
<span className='rc-label'>{t('应付金额')}</span>
|
||||
<strong className='rc-order-amount'>
|
||||
{payable ? (
|
||||
<>
|
||||
<small>{payable.symbol}</small>
|
||||
{payable.value}
|
||||
{payable.unit && (
|
||||
<small className='rc-order-unit'>{payable.unit}</small>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
'-'
|
||||
)}
|
||||
</strong>
|
||||
{/* 与点击支付方式相同:进入原有的预充值校验与确认弹窗 */}
|
||||
<Button
|
||||
type='primary'
|
||||
block
|
||||
disabled={!canPay}
|
||||
loading={paymentLoading}
|
||||
onClick={() => preTopUp(payWay)}
|
||||
>
|
||||
{t('立即充值')}
|
||||
</Button>
|
||||
<InvoiceNote t={t} />
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
}
|
||||
|
||||
.amount-card.selected {
|
||||
border-color: var(--semi-color-primary);
|
||||
background: rgba(var(--semi-blue-0), 0.05);
|
||||
border-color: var(--ui-color-primary);
|
||||
background: rgba(var(--ui-blue-0), 0.05);
|
||||
}
|
||||
|
||||
.amount-card .badge {
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
Col,
|
||||
Space,
|
||||
Typography,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { UserContext } from '../../context/User';
|
||||
import { API, showError, showSuccess, renderQuota } from '../../helpers';
|
||||
@@ -255,7 +255,7 @@ const RechargeV2 = () => {
|
||||
<div
|
||||
className='discount-info'
|
||||
style={{
|
||||
color: 'var(--semi-color-success)',
|
||||
color: 'var(--ui-color-success)',
|
||||
marginTop: 5,
|
||||
}}
|
||||
>
|
||||
@@ -300,7 +300,7 @@ const RechargeV2 = () => {
|
||||
<div>
|
||||
<Text type='secondary'>{t('实付:')}</Text>
|
||||
<Text
|
||||
style={{ fontSize: 24, color: 'var(--semi-color-danger)' }}
|
||||
style={{ fontSize: 24, color: 'var(--ui-color-danger)' }}
|
||||
strong
|
||||
>
|
||||
¥{payInfo.pay_money.toFixed(2)}
|
||||
@@ -313,7 +313,7 @@ const RechargeV2 = () => {
|
||||
{payInfo.save_money > 0 && (
|
||||
<div>
|
||||
<Text type='secondary'>{t('节省:')}</Text>
|
||||
<Text style={{ color: 'var(--semi-color-success)' }}>
|
||||
<Text style={{ color: 'var(--ui-color-success)' }}>
|
||||
¥{payInfo.save_money.toFixed(2)}
|
||||
</Text>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Button, Input, Skeleton } from '@/components/ui';
|
||||
import { ExternalLink } from 'lucide-react';
|
||||
import { useMinimumLoadingTime } from '../../hooks/common/useMinimumLoadingTime';
|
||||
|
||||
/**
|
||||
* 在线充值左栏“账户钱包”:余额、历史消耗与兑换码充值。
|
||||
* 兑换码输入、提交与购买链接沿用页面原有状态与处理函数,仅调整呈现位置。
|
||||
*/
|
||||
const WalletCard = ({
|
||||
t,
|
||||
userState,
|
||||
renderQuota,
|
||||
balanceLoading,
|
||||
redemptionCode,
|
||||
setRedemptionCode,
|
||||
topUp,
|
||||
isSubmitting,
|
||||
topUpLink,
|
||||
openTopUpLink,
|
||||
}) => {
|
||||
const showBalanceSkeleton = useMinimumLoadingTime(balanceLoading);
|
||||
|
||||
return (
|
||||
<aside className='rc-wallet'>
|
||||
<h2 className='rc-wallet-title'>{t('账户钱包')}</h2>
|
||||
|
||||
<div className='rc-wallet-block'>
|
||||
<span className='rc-label'>{t('可用余额')}</span>
|
||||
<Skeleton
|
||||
loading={showBalanceSkeleton}
|
||||
placeholder={<Skeleton.Title style={{ width: 100, height: 28 }} />}
|
||||
>
|
||||
<strong className='rc-wallet-balance'>
|
||||
{renderQuota(userState?.user?.quota)}
|
||||
</strong>
|
||||
</Skeleton>
|
||||
</div>
|
||||
|
||||
<div className='rc-wallet-block'>
|
||||
<span className='rc-label'>{t('历史消耗')}</span>
|
||||
<strong className='rc-wallet-used'>
|
||||
{renderQuota(userState?.user?.used_quota)}
|
||||
</strong>
|
||||
</div>
|
||||
|
||||
<div className='rc-wallet-redeem'>
|
||||
<h3>{t('兑换码充值')}</h3>
|
||||
<p>{t('使用已有兑换码补充余额')}</p>
|
||||
<Input
|
||||
placeholder={t('请输入兑换码')}
|
||||
value={redemptionCode}
|
||||
onChange={(value) => setRedemptionCode(value)}
|
||||
showClear
|
||||
/>
|
||||
<Button block onClick={topUp} loading={isSubmitting}>
|
||||
{t('兑换')}
|
||||
</Button>
|
||||
{topUpLink && (
|
||||
<div className='rc-wallet-link'>
|
||||
{t('在找兑换码?')}{' '}
|
||||
<button type='button' onClick={openTopUpLink}>
|
||||
{t('购买兑换码')} <ExternalLink size={12} />
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className='rc-wallet-foot'>
|
||||
<i aria-hidden='true' />
|
||||
{t('余额用于模型调用')}
|
||||
</div>
|
||||
</aside>
|
||||
);
|
||||
};
|
||||
|
||||
export default WalletCard;
|
||||
+99
-118
@@ -18,7 +18,9 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useEffect, useState, useContext } from 'react';
|
||||
import { Modal, Toast } from '@douyinfe/semi-ui';
|
||||
import { Segmented, Tabs } from 'antd';
|
||||
import { Modal, Toast } from '@/components/ui';
|
||||
import UserCenterPageHeader from '../../components/common/UserCenterPageHeader';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { UserContext } from '../../context/User';
|
||||
import { StatusContext } from '../../context/Status';
|
||||
@@ -35,6 +37,9 @@ import PageBackground from '../../components/common/PageBackground';
|
||||
import RechargePanel from './RechargePanel';
|
||||
import MembershipPanel from './MembershipPanel';
|
||||
import HistoryPanel from './HistoryPanel';
|
||||
import WalletCard from './WalletCard';
|
||||
import { MembershipHistoryContent } from '../../components/membership/MembershipHistoryModal';
|
||||
import './recharge.css';
|
||||
import PaymentConfirmModal from '../../components/topup/modals/PaymentConfirmModal';
|
||||
import WechatQRModal from '../../components/topup/modals/WechatQRModal';
|
||||
import {
|
||||
@@ -485,15 +490,15 @@ const Recharge = ({ embedded = false }) => {
|
||||
|
||||
if (!method.color) {
|
||||
if (method.type === 'alipay') {
|
||||
method.color = 'rgba(var(--semi-blue-5), 1)';
|
||||
method.color = 'rgba(var(--ui-blue-5), 1)';
|
||||
} else if (method.type === 'wxpay') {
|
||||
method.color = 'rgba(var(--semi-green-5), 1)';
|
||||
method.color = 'rgba(var(--ui-green-5), 1)';
|
||||
} else if (method.type === 'stripe') {
|
||||
method.color = 'rgba(var(--semi-purple-5), 1)';
|
||||
method.color = 'rgba(var(--ui-purple-5), 1)';
|
||||
} else if (method.type === 'paypal') {
|
||||
method.color = '#0070ba';
|
||||
} else {
|
||||
method.color = 'rgba(var(--semi-primary-5), 1)';
|
||||
method.color = 'rgba(var(--ui-primary-5), 1)';
|
||||
}
|
||||
}
|
||||
return method;
|
||||
@@ -674,11 +679,6 @@ const Recharge = ({ embedded = false }) => {
|
||||
}));
|
||||
};
|
||||
|
||||
// 格式化大数字
|
||||
const formatLargeNumber = (num) => {
|
||||
return num.toString();
|
||||
};
|
||||
|
||||
const renderAmount = () => {
|
||||
if (payWay === 'paypal') {
|
||||
return formatPayPalUSD(payPalQuote?.payAmount || amount);
|
||||
@@ -734,7 +734,7 @@ const Recharge = ({ embedded = false }) => {
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`relative w-full min-h-screen pt-[64px] ${embedded ? '' : 'bg-[var(--surface-bg-base)]'}`}
|
||||
className={`ui-recharge-page relative w-full min-h-screen pt-[64px] ${embedded ? '' : 'bg-[var(--surface-bg-base)]'}`}
|
||||
>
|
||||
{/* 统一页面背景层 —— 走 bg-glow-* 主题变量。
|
||||
* embedded(嵌入 UserCenter/topup)时由父 shell 提供背景,此处跳过避免双层叠加;
|
||||
@@ -805,116 +805,97 @@ const Recharge = ({ embedded = false }) => {
|
||||
/>
|
||||
|
||||
{/* 主内容区 */}
|
||||
<div className='relative z-10 max-w-7xl mx-auto px-4 sm:px-6 py-4'>
|
||||
{/* Tab 切换:充值 / 包月 */}
|
||||
<div className='flex items-center gap-1.5 mb-4 p-1 bg-white/60 dark:bg-neutral-800/60 rounded-2xl w-fit backdrop-blur-xl border border-white/50 dark:border-neutral-700/50 shadow-lg shadow-black/[0.03]'>
|
||||
<button
|
||||
onClick={() => setActiveTab('recharge')}
|
||||
className={`
|
||||
flex items-center gap-2 px-6 py-2 rounded-xl text-sm font-semibold transition-all duration-300
|
||||
${
|
||||
activeTab === 'recharge'
|
||||
? 'bg-white/90 dark:bg-neutral-700/90 text-blue-600 dark:text-blue-400 shadow-md backdrop-blur-sm'
|
||||
: 'text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-white/40 dark:hover:bg-neutral-700/40'
|
||||
}
|
||||
`}
|
||||
>
|
||||
<svg
|
||||
className='w-4 h-4'
|
||||
fill='none'
|
||||
viewBox='0 0 24 24'
|
||||
stroke='currentColor'
|
||||
>
|
||||
<path
|
||||
strokeLinecap='round'
|
||||
strokeLinejoin='round'
|
||||
strokeWidth={2}
|
||||
d='M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z'
|
||||
<div className='ui-recharge-content uc-page relative z-10 max-w-7xl mx-auto'>
|
||||
<UserCenterPageHeader
|
||||
title={t('在线充值')}
|
||||
subtitle={t('管理账户余额,让每一次模型调用从容开始。')}
|
||||
/>
|
||||
<div className='rc-layout'>
|
||||
<WalletCard
|
||||
t={t}
|
||||
userState={userState}
|
||||
renderQuota={renderQuota}
|
||||
balanceLoading={balanceLoading}
|
||||
redemptionCode={redemptionCode}
|
||||
setRedemptionCode={setRedemptionCode}
|
||||
topUp={topUp}
|
||||
isSubmitting={isSubmitting}
|
||||
topUpLink={topUpLink}
|
||||
openTopUpLink={openTopUpLink}
|
||||
/>
|
||||
|
||||
<section className='rc-main'>
|
||||
<div className='rc-main-head'>
|
||||
<div>
|
||||
<h2>{t('为下一次调用补充能量')}</h2>
|
||||
<p>{t('选择充值额度或会员方案,继续使用 WeyAI 服务')}</p>
|
||||
</div>
|
||||
{/* Tab 切换:充值 / 会员 */}
|
||||
<div className='rc-segmented'>
|
||||
<Segmented
|
||||
value={activeTab}
|
||||
onChange={setActiveTab}
|
||||
options={[
|
||||
{ value: 'recharge', label: t('余额充值') },
|
||||
{ value: 'membership', label: t('会员订阅') },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{activeTab === 'membership' ? (
|
||||
<MembershipPanel />
|
||||
) : (
|
||||
<RechargePanel
|
||||
t={t}
|
||||
statusLoading={statusLoading}
|
||||
enableOnlineTopUp={enableOnlineTopUp}
|
||||
enableWechatTopUp={enableWechatTopUp}
|
||||
enableAlipayTopUp={enableAlipayTopUp}
|
||||
enableStripeTopUp={enableStripeTopUp}
|
||||
enablePayPalTopUp={enablePayPalTopUp}
|
||||
enableCreemTopUp={enableCreemTopUp}
|
||||
creemProducts={creemProducts}
|
||||
creemPreTopUp={creemPreTopUp}
|
||||
presetAmounts={presetAmounts}
|
||||
selectedPreset={selectedPreset}
|
||||
selectedPresetObj={selectedPresetObj}
|
||||
selectPresetAmount={selectPresetAmount}
|
||||
priceRatio={priceRatio}
|
||||
topUpCount={topUpCount}
|
||||
amount={amount}
|
||||
amountLoading={amountLoading}
|
||||
payMethods={payMethods}
|
||||
preTopUp={preTopUp}
|
||||
paymentLoading={paymentLoading}
|
||||
payWay={payWay}
|
||||
payPalQuote={payPalQuote}
|
||||
topupInfo={topupInfo}
|
||||
/>
|
||||
</svg>
|
||||
{t('充值')}
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setActiveTab('membership')}
|
||||
className={`
|
||||
flex items-center gap-2 px-6 py-2 rounded-xl text-sm font-semibold transition-all duration-300
|
||||
${
|
||||
activeTab === 'membership'
|
||||
? 'bg-gradient-to-r from-brand-from to-brand-to text-white shadow-md shadow-brand/25'
|
||||
: 'text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-white/40 dark:hover:bg-neutral-700/40'
|
||||
}
|
||||
`}
|
||||
>
|
||||
<svg
|
||||
className='w-4 h-4'
|
||||
fill='none'
|
||||
viewBox='0 0 24 24'
|
||||
stroke='currentColor'
|
||||
>
|
||||
<path
|
||||
strokeLinecap='round'
|
||||
strokeLinejoin='round'
|
||||
strokeWidth={2}
|
||||
d='M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z'
|
||||
/>
|
||||
</svg>
|
||||
{t('包月')}
|
||||
</button>
|
||||
)}
|
||||
</section>
|
||||
</div>
|
||||
|
||||
{/* 左右分栏布局 - 使用 grid 确保等高和顶部对齐 */}
|
||||
<div className='grid grid-cols-1 lg:grid-cols-2 gap-5 lg:items-start'>
|
||||
{/* 左侧内容:根据 Tab 切换 */}
|
||||
{activeTab === 'membership' ? (
|
||||
<MembershipPanel />
|
||||
) : (
|
||||
<RechargePanel
|
||||
t={t}
|
||||
userState={userState}
|
||||
renderQuota={renderQuota}
|
||||
renderQuotaWithAmount={renderQuotaWithAmount}
|
||||
statusLoading={statusLoading}
|
||||
balanceLoading={balanceLoading}
|
||||
enableOnlineTopUp={enableOnlineTopUp}
|
||||
enableWechatTopUp={enableWechatTopUp}
|
||||
enableAlipayTopUp={enableAlipayTopUp}
|
||||
enableStripeTopUp={enableStripeTopUp}
|
||||
enablePayPalTopUp={enablePayPalTopUp}
|
||||
enableCreemTopUp={enableCreemTopUp}
|
||||
creemProducts={creemProducts}
|
||||
creemPreTopUp={creemPreTopUp}
|
||||
presetAmounts={presetAmounts}
|
||||
selectedPreset={selectedPreset}
|
||||
selectPresetAmount={selectPresetAmount}
|
||||
formatLargeNumber={formatLargeNumber}
|
||||
priceRatio={priceRatio}
|
||||
topUpCount={topUpCount}
|
||||
minTopUp={minTopUp}
|
||||
getAmount={getAmount}
|
||||
setTopUpCount={setTopUpCount}
|
||||
setSelectedPreset={setSelectedPreset}
|
||||
setSelectedPresetObj={setSelectedPresetObj}
|
||||
renderAmount={renderAmount}
|
||||
amountLoading={amountLoading}
|
||||
payMethods={payMethods}
|
||||
preTopUp={preTopUp}
|
||||
paymentLoading={paymentLoading}
|
||||
payWay={payWay}
|
||||
redemptionCode={redemptionCode}
|
||||
setRedemptionCode={setRedemptionCode}
|
||||
topUp={topUp}
|
||||
isSubmitting={isSubmitting}
|
||||
topUpLink={topUpLink}
|
||||
openTopUpLink={openTopUpLink}
|
||||
topupInfo={topupInfo}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* 右侧:充值记录 */}
|
||||
<div className='lg:sticky lg:top-4'>
|
||||
<HistoryPanel t={t} refreshTrigger={refreshHistory} />
|
||||
</div>
|
||||
</div>
|
||||
{/* 充值记录 / 会员购买记录:页签首次激活时才挂载,沿用各自原有加载逻辑 */}
|
||||
<section className='rc-records'>
|
||||
<Tabs
|
||||
defaultActiveKey='topup'
|
||||
items={[
|
||||
{
|
||||
key: 'topup',
|
||||
label: t('充值记录'),
|
||||
children: (
|
||||
<HistoryPanel t={t} refreshTrigger={refreshHistory} />
|
||||
),
|
||||
},
|
||||
{
|
||||
key: 'membership',
|
||||
label: t('会员购买记录'),
|
||||
children: <MembershipHistoryContent inline visible t={t} />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,879 @@
|
||||
/*
|
||||
* 在线充值(/user-center/topup)样式。
|
||||
* 浅色数值来自原型图.zip:在线充值1–6(1920 宽视口实测)。深色主题无原型:由既有主题变量与 token 推导。
|
||||
* 装饰(钱包卡渐变与右下圆环、订单卡暖色渐变)均为原型截图中的视觉,限定在本页作用域。
|
||||
*/
|
||||
.ui-recharge-page {
|
||||
--rc-border: #e4e9ee;
|
||||
--rc-border-inner: #e3e9f0;
|
||||
--rc-card-shadow: 0 6px 24px rgba(15, 23, 42, 0.025);
|
||||
--rc-text: #243244;
|
||||
--rc-label: #65768a;
|
||||
--rc-desc: #758397;
|
||||
--rc-amount: #a95b07;
|
||||
--rc-selected-border: #a95b07;
|
||||
--rc-selected-bg: #fffbf3;
|
||||
--rc-chip-selected-bg: #fff0d7;
|
||||
--rc-chip-selected-text: #914b05;
|
||||
--rc-badge-bg: #fce9c4;
|
||||
--rc-badge-text: #925104;
|
||||
--rc-wallet-bg: linear-gradient(
|
||||
180deg,
|
||||
#ffffff 0%,
|
||||
#fffaf1 70%,
|
||||
#f5fbf7 100%
|
||||
);
|
||||
--rc-wallet-line: linear-gradient(
|
||||
90deg,
|
||||
#edd9b1 0%,
|
||||
rgba(237, 217, 177, 0) 100%
|
||||
);
|
||||
--rc-wallet-ring: #f6f3e7;
|
||||
--rc-wallet-ring-outer: #f9f8f1;
|
||||
--rc-wallet-ring-inner: #f5fbf7;
|
||||
--rc-dot: #3d9a82;
|
||||
--rc-dot-ring: #e3f2ea;
|
||||
--rc-order-border: #ecd9b6;
|
||||
--rc-order-bg: linear-gradient(90deg, #fffaf2 0%, #ffffff 80%);
|
||||
--rc-seg-bg: #f4f6f9;
|
||||
--rc-period-bg: #f6f8fb;
|
||||
--rc-seg-border: #e2e7ed;
|
||||
--rc-quota-bg: #edf7f2;
|
||||
--rc-quota-text: #24634f;
|
||||
--rc-empty-bg: #f7f9fb;
|
||||
--rc-empty-border: #e3e9f0;
|
||||
}
|
||||
html.dark .ui-recharge-page {
|
||||
--rc-border: var(--border-subtle);
|
||||
--rc-border-inner: var(--border-subtle);
|
||||
--rc-card-shadow: none;
|
||||
--rc-text: var(--uc-heading);
|
||||
--rc-label: var(--text-secondary);
|
||||
--rc-desc: var(--text-secondary);
|
||||
--rc-amount: var(--ui-color-primary);
|
||||
--rc-selected-border: var(--ui-color-primary);
|
||||
--rc-selected-bg: color-mix(
|
||||
in srgb,
|
||||
var(--ui-color-primary) 10%,
|
||||
var(--surface-card)
|
||||
);
|
||||
--rc-chip-selected-bg: color-mix(
|
||||
in srgb,
|
||||
var(--ui-color-primary) 16%,
|
||||
var(--surface-card)
|
||||
);
|
||||
--rc-chip-selected-text: var(--ui-color-primary);
|
||||
--rc-badge-bg: color-mix(
|
||||
in srgb,
|
||||
var(--ui-color-primary) 22%,
|
||||
var(--surface-card)
|
||||
);
|
||||
--rc-badge-text: var(--ui-color-primary);
|
||||
--rc-wallet-bg: linear-gradient(
|
||||
180deg,
|
||||
var(--surface-card) 0%,
|
||||
color-mix(in srgb, var(--ui-color-primary) 5%, var(--surface-card)) 70%,
|
||||
color-mix(in srgb, var(--ui-color-success) 6%, var(--surface-card)) 100%
|
||||
);
|
||||
--rc-wallet-line: linear-gradient(
|
||||
90deg,
|
||||
color-mix(in srgb, var(--ui-color-primary) 40%, transparent) 0%,
|
||||
transparent 100%
|
||||
);
|
||||
--rc-wallet-ring: color-mix(
|
||||
in srgb,
|
||||
var(--ui-color-primary) 6%,
|
||||
var(--surface-card)
|
||||
);
|
||||
--rc-wallet-ring-outer: color-mix(
|
||||
in srgb,
|
||||
var(--ui-color-primary) 3%,
|
||||
var(--surface-card)
|
||||
);
|
||||
--rc-wallet-ring-inner: color-mix(
|
||||
in srgb,
|
||||
var(--ui-color-success) 6%,
|
||||
var(--surface-card)
|
||||
);
|
||||
--rc-dot: var(--ui-color-success);
|
||||
--rc-dot-ring: color-mix(
|
||||
in srgb,
|
||||
var(--ui-color-success) 20%,
|
||||
var(--surface-card)
|
||||
);
|
||||
--rc-order-border: color-mix(
|
||||
in srgb,
|
||||
var(--ui-color-primary) 30%,
|
||||
var(--surface-card)
|
||||
);
|
||||
--rc-order-bg: linear-gradient(
|
||||
90deg,
|
||||
color-mix(in srgb, var(--ui-color-primary) 7%, var(--surface-card)) 0%,
|
||||
var(--surface-card) 80%
|
||||
);
|
||||
--rc-seg-bg: var(--ui-color-fill-0);
|
||||
--rc-period-bg: var(--ui-color-fill-0);
|
||||
--rc-seg-border: var(--border-subtle);
|
||||
--rc-quota-bg: color-mix(
|
||||
in srgb,
|
||||
var(--ui-color-success) 12%,
|
||||
var(--surface-card)
|
||||
);
|
||||
--rc-quota-text: var(--ui-color-success);
|
||||
--rc-empty-bg: var(--ui-color-fill-0);
|
||||
--rc-empty-border: var(--border-subtle);
|
||||
}
|
||||
|
||||
|
||||
/* 三栏布局:钱包 230px + 主卡;记录卡在下方 */
|
||||
.rc-layout {
|
||||
display: grid;
|
||||
grid-template-columns: 230px minmax(0, 1fr);
|
||||
gap: 22px;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
/* 账户钱包 */
|
||||
.rc-wallet {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100%;
|
||||
padding: 30px 23px 25px;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--rc-border);
|
||||
border-radius: 10px;
|
||||
background: var(--rc-wallet-bg);
|
||||
box-shadow: var(--rc-card-shadow);
|
||||
}
|
||||
.rc-wallet::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: -78px;
|
||||
bottom: -78px;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
border-radius: 50%;
|
||||
background: radial-gradient(
|
||||
circle,
|
||||
var(--rc-wallet-ring-inner) 0 46%,
|
||||
var(--rc-wallet-ring) 46% 56%,
|
||||
var(--rc-wallet-ring-outer) 56% 70%,
|
||||
transparent 70%
|
||||
);
|
||||
pointer-events: none;
|
||||
}
|
||||
.rc-wallet > * {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
.rc-wallet-title {
|
||||
position: relative;
|
||||
margin: 0;
|
||||
padding-bottom: 21px;
|
||||
color: var(--rc-text);
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
line-height: 28px;
|
||||
}
|
||||
.rc-wallet-title::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: 1px;
|
||||
background: var(--rc-wallet-line);
|
||||
}
|
||||
.rc-wallet-block {
|
||||
padding: 23px 0 25px;
|
||||
border-bottom: 1px solid var(--rc-border-inner);
|
||||
}
|
||||
.rc-wallet-block + .rc-wallet-block {
|
||||
padding-bottom: 22px;
|
||||
}
|
||||
.rc-label {
|
||||
display: block;
|
||||
color: var(--rc-label);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.rc-wallet-balance {
|
||||
display: block;
|
||||
margin-top: 16px;
|
||||
color: var(--rc-amount);
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
line-height: 36px;
|
||||
}
|
||||
.rc-wallet-used {
|
||||
display: block;
|
||||
margin-top: 13px;
|
||||
color: var(--rc-text);
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
line-height: 28px;
|
||||
}
|
||||
.rc-wallet-redeem {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
padding-top: 23px;
|
||||
}
|
||||
.rc-wallet-redeem h3 {
|
||||
margin: 0;
|
||||
color: var(--rc-text);
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
line-height: 20px;
|
||||
}
|
||||
.rc-wallet-redeem p {
|
||||
margin: -4px 0 4px;
|
||||
color: var(--rc-label);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.rc-wallet-link {
|
||||
color: var(--rc-desc);
|
||||
font-size: 12px;
|
||||
}
|
||||
.rc-wallet-link button {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--ui-color-primary);
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
.rc-wallet-foot {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-top: auto;
|
||||
padding-top: 32px;
|
||||
color: var(--rc-desc);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.rc-wallet-foot i {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: var(--rc-dot);
|
||||
box-shadow: 0 0 0 3px var(--rc-dot-ring);
|
||||
}
|
||||
|
||||
/* 主卡 */
|
||||
.rc-main {
|
||||
min-width: 0;
|
||||
padding: 25px 29px 29px;
|
||||
border: 1px solid var(--rc-border);
|
||||
border-radius: 10px;
|
||||
background: var(--surface-card);
|
||||
box-shadow: var(--rc-card-shadow);
|
||||
}
|
||||
.rc-main-head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
padding-bottom: 24px;
|
||||
margin-bottom: 20px;
|
||||
border-bottom: 1px solid var(--rc-border);
|
||||
}
|
||||
.rc-main-head h2 {
|
||||
margin: 0;
|
||||
color: var(--rc-text);
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
line-height: 30px;
|
||||
}
|
||||
.rc-main-head p {
|
||||
margin: 8px 0 0;
|
||||
color: var(--rc-desc);
|
||||
font-size: 13px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.rc-segmented {
|
||||
display: inline-flex;
|
||||
padding: 7px;
|
||||
border: 1px solid var(--rc-seg-border);
|
||||
border-radius: 10px;
|
||||
background: var(--rc-seg-bg);
|
||||
}
|
||||
.rc-segmented .ant-segmented {
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
}
|
||||
.rc-segmented .ant-segmented-item-label {
|
||||
min-height: 38px;
|
||||
padding: 0 12px;
|
||||
color: var(--rc-desc);
|
||||
line-height: 38px;
|
||||
}
|
||||
.rc-segmented .ant-segmented-item-selected .ant-segmented-item-label {
|
||||
color: var(--ui-color-primary);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* 区块卡(选择充值额度/支付方式、选择会员) */
|
||||
.rc-section {
|
||||
padding: 20px;
|
||||
border: 1px solid var(--rc-border);
|
||||
border-radius: 10px;
|
||||
background: var(--surface-card);
|
||||
}
|
||||
.rc-section-head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
}
|
||||
.rc-section h3 {
|
||||
margin: 0;
|
||||
color: var(--rc-text);
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
line-height: 24px;
|
||||
}
|
||||
.rc-section-desc {
|
||||
margin: 11px 0 0;
|
||||
color: var(--rc-label);
|
||||
font-size: 13px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.rc-section-link {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--ui-color-primary);
|
||||
font: inherit;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.rc-divider {
|
||||
height: 1px;
|
||||
margin: 24px 0 23px;
|
||||
background: var(--rc-border-inner);
|
||||
}
|
||||
|
||||
/* 金额卡 */
|
||||
.rc-amount-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 12px 13px;
|
||||
margin-top: 24px;
|
||||
}
|
||||
.rc-amount {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
justify-content: flex-start;
|
||||
min-height: 97px;
|
||||
padding: 27px 10px 11px;
|
||||
border: 1px solid var(--rc-border-inner);
|
||||
border-radius: 8px;
|
||||
background: var(--surface-card);
|
||||
color: var(--rc-text);
|
||||
font: inherit;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
.rc-amount:hover {
|
||||
border-color: var(--ui-color-primary-hover);
|
||||
}
|
||||
.rc-amount.selected {
|
||||
border: 2px solid var(--rc-selected-border);
|
||||
background: var(--rc-selected-bg);
|
||||
padding: 26px 9px 10px;
|
||||
}
|
||||
.rc-amount:focus-visible {
|
||||
outline: 2px solid var(--ui-color-primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.rc-amount-value {
|
||||
display: inline-flex;
|
||||
align-items: baseline;
|
||||
gap: 4px;
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
line-height: 28px;
|
||||
}
|
||||
.rc-amount-value small {
|
||||
font-size: 12px;
|
||||
}
|
||||
.rc-amount-pay {
|
||||
margin-top: 8px;
|
||||
color: var(--rc-label);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.rc-amount-bonus {
|
||||
margin-top: 4px;
|
||||
color: var(--rc-amount);
|
||||
font-size: 12px;
|
||||
}
|
||||
.rc-amount-badge {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
height: 18px;
|
||||
padding: 0 7px;
|
||||
border-radius: 0 7px 0 8px;
|
||||
background: var(--rc-badge-bg);
|
||||
color: var(--rc-badge-text);
|
||||
font-size: 11px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.rc-amount-check {
|
||||
position: absolute;
|
||||
right: 6px;
|
||||
bottom: 6px;
|
||||
color: var(--rc-selected-border);
|
||||
}
|
||||
|
||||
/* 支付方式 */
|
||||
.rc-pay-methods {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
.rc-pay-method.ant-btn {
|
||||
min-width: 133px;
|
||||
height: 42px;
|
||||
padding: 0 16px;
|
||||
border-color: var(--rc-border-inner);
|
||||
border-radius: 8px;
|
||||
color: var(--rc-text);
|
||||
box-shadow: none;
|
||||
}
|
||||
.rc-pay-method.ant-btn.is-selected {
|
||||
border-color: var(--rc-selected-border);
|
||||
background: var(--rc-chip-selected-bg);
|
||||
color: var(--rc-chip-selected-text);
|
||||
font-weight: 700;
|
||||
}
|
||||
.rc-pay-dot {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: var(--ui-color-success);
|
||||
}
|
||||
.rc-pay-note {
|
||||
margin: 14px 0 0;
|
||||
color: var(--rc-desc);
|
||||
font-size: 13px;
|
||||
}
|
||||
.rc-pay-empty {
|
||||
margin-top: 16px;
|
||||
padding: 16px;
|
||||
border: 1px dashed var(--rc-empty-border);
|
||||
border-radius: 8px;
|
||||
background: var(--rc-empty-bg);
|
||||
color: var(--rc-desc);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.rc-section-gap {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.rc-loading {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 64px 0;
|
||||
}
|
||||
|
||||
/* 充值订单 */
|
||||
.rc-order {
|
||||
display: flex;
|
||||
gap: 33px;
|
||||
margin-top: 20px;
|
||||
padding: 21px 20px 24px;
|
||||
border: 1px solid var(--rc-order-border);
|
||||
border-radius: 10px;
|
||||
background: var(--rc-order-bg);
|
||||
}
|
||||
.rc-order-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.rc-order-title {
|
||||
margin: 0;
|
||||
color: var(--rc-text);
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
line-height: 24px;
|
||||
}
|
||||
.rc-order-rows {
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
margin: 32px 0 0;
|
||||
}
|
||||
.rc-order-rows > div {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
}
|
||||
.rc-order-rows dt {
|
||||
color: var(--rc-label);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.rc-order-rows dd {
|
||||
margin: 0;
|
||||
color: var(--rc-text);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
line-height: 18px;
|
||||
}
|
||||
.rc-order-side {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
width: 240px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.rc-order-amount {
|
||||
margin: 16px 0 20px;
|
||||
color: var(--rc-amount);
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
line-height: 32px;
|
||||
}
|
||||
.rc-order-amount small {
|
||||
margin-right: 4px;
|
||||
font-size: 13px;
|
||||
}
|
||||
.rc-order-amount .rc-order-unit {
|
||||
margin: 0 0 0 4px;
|
||||
font-size: 11px;
|
||||
}
|
||||
.rc-order-side .ant-btn {
|
||||
height: 44px;
|
||||
border-radius: 8px;
|
||||
font-size: 15px;
|
||||
}
|
||||
.rc-invoice {
|
||||
align-self: center;
|
||||
margin: 12px 0 0;
|
||||
color: var(--rc-desc);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.rc-invoice span {
|
||||
margin-left: 6px;
|
||||
color: var(--ui-color-primary);
|
||||
}
|
||||
|
||||
/* 会员方案 */
|
||||
.rc-plan-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 18px;
|
||||
margin-top: 23px;
|
||||
}
|
||||
.rc-plan {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 20px;
|
||||
border: 1px solid var(--rc-border-inner);
|
||||
border-radius: 10px;
|
||||
background: var(--surface-card);
|
||||
color: var(--rc-text);
|
||||
font: inherit;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
.rc-plan:hover {
|
||||
border-color: var(--ui-color-primary-hover);
|
||||
}
|
||||
.rc-plan.selected {
|
||||
border: 2px solid var(--rc-selected-border);
|
||||
padding: 19px;
|
||||
background: var(--rc-selected-bg);
|
||||
}
|
||||
.rc-plan:focus-visible {
|
||||
outline: 2px solid var(--ui-color-primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.rc-plan-badge {
|
||||
position: absolute;
|
||||
top: -9px;
|
||||
right: 18px;
|
||||
padding: 0 6px;
|
||||
background: var(--surface-card);
|
||||
color: var(--rc-amount);
|
||||
font-size: 11px;
|
||||
line-height: 16px;
|
||||
}
|
||||
.rc-plan-name {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
line-height: 22px;
|
||||
}
|
||||
.rc-plan-price {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 4px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
.rc-plan-price small {
|
||||
align-self: flex-start;
|
||||
font-size: 14px;
|
||||
}
|
||||
.rc-plan-price strong {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
line-height: 34px;
|
||||
}
|
||||
.rc-plan-price span {
|
||||
color: var(--rc-label);
|
||||
font-size: 12px;
|
||||
}
|
||||
.rc-plan-quota {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 14px;
|
||||
padding: 7px 10px;
|
||||
border-radius: 6px;
|
||||
background: var(--rc-quota-bg);
|
||||
color: var(--rc-quota-text);
|
||||
font-size: 12px;
|
||||
}
|
||||
.rc-plan-quota strong {
|
||||
font-size: 14px;
|
||||
}
|
||||
.rc-plan-desc {
|
||||
margin: 12px 0 0;
|
||||
color: var(--rc-label);
|
||||
font-size: 12px;
|
||||
}
|
||||
.rc-plan-features {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
margin: 18px 0 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.rc-plan-features li {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
color: var(--rc-label);
|
||||
font-size: 12px;
|
||||
}
|
||||
.rc-plan-features svg {
|
||||
color: var(--ui-color-success);
|
||||
}
|
||||
.rc-plan-foot {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 20px;
|
||||
padding-top: 14px;
|
||||
border-top: 1px solid var(--rc-border-inner);
|
||||
color: var(--ui-color-primary);
|
||||
font-size: 13px;
|
||||
}
|
||||
.rc-plan-foot small {
|
||||
margin-left: 8px;
|
||||
color: var(--rc-desc);
|
||||
font-size: 12px;
|
||||
}
|
||||
.rc-plan-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 242px;
|
||||
margin-top: 23px;
|
||||
border: 1px dashed var(--rc-empty-border);
|
||||
border-radius: 10px;
|
||||
background: var(--rc-empty-bg);
|
||||
color: var(--rc-desc);
|
||||
font-size: 13px;
|
||||
}
|
||||
.rc-plan-empty strong {
|
||||
color: var(--rc-text);
|
||||
font-size: 14px;
|
||||
}
|
||||
.rc-member-status {
|
||||
margin-bottom: 20px;
|
||||
padding: 20px;
|
||||
border: 1px solid var(--rc-border);
|
||||
border-radius: 10px;
|
||||
background: var(--surface-card);
|
||||
}
|
||||
.rc-member-status-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
.rc-member-status-head strong {
|
||||
color: var(--rc-text);
|
||||
font-size: 16px;
|
||||
}
|
||||
.rc-member-status-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
.rc-member-status-grid > div {
|
||||
padding: 12px;
|
||||
border: 1px solid var(--rc-border-inner);
|
||||
border-radius: 8px;
|
||||
}
|
||||
.rc-member-status-grid strong {
|
||||
display: block;
|
||||
margin-top: 4px;
|
||||
color: var(--rc-amount);
|
||||
font-size: 20px;
|
||||
}
|
||||
.rc-member-status-meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-top: 12px;
|
||||
color: var(--rc-label);
|
||||
font-size: 12px;
|
||||
}
|
||||
/* 会员时长切换:原型为无边框浅底轨道,34px 选项 */
|
||||
.rc-segmented.rc-member-type {
|
||||
margin: -4px 0 18px;
|
||||
padding: 4px;
|
||||
border-color: transparent;
|
||||
background: var(--rc-period-bg);
|
||||
}
|
||||
.rc-member-type .ant-segmented-item-label {
|
||||
min-height: 34px;
|
||||
padding: 0 22px;
|
||||
line-height: 34px;
|
||||
}
|
||||
|
||||
/* 记录卡 */
|
||||
.rc-records {
|
||||
margin-top: 22px;
|
||||
padding: 10px 24px 24px;
|
||||
border: 1px solid var(--rc-border);
|
||||
border-radius: 10px;
|
||||
background: var(--surface-card);
|
||||
box-shadow: var(--rc-card-shadow);
|
||||
}
|
||||
.rc-records > .ant-tabs > .ant-tabs-nav {
|
||||
margin-bottom: 22px;
|
||||
}
|
||||
.rc-records .ant-tabs-tab + .ant-tabs-tab {
|
||||
margin-left: 32px;
|
||||
}
|
||||
.rc-history-search {
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
margin-bottom: 22px;
|
||||
}
|
||||
.rc-history-search .ant-input-affix-wrapper,
|
||||
.rc-history-search > .ant-input {
|
||||
width: 360px;
|
||||
max-width: 100%;
|
||||
}
|
||||
.rc-history-table .ant-tag {
|
||||
margin-inline-end: 0;
|
||||
}
|
||||
.rc-history-money {
|
||||
color: var(--rc-amount);
|
||||
font-weight: 600;
|
||||
}
|
||||
.rc-history-mono,
|
||||
.rc-history-mono .ant-typography {
|
||||
font-family: var(--ui-font-family-mono);
|
||||
font-size: 12px;
|
||||
}
|
||||
.rc-history-pagination {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 16px;
|
||||
}
|
||||
.rc-member-counts {
|
||||
display: flex;
|
||||
gap: 32px;
|
||||
margin-bottom: 22px;
|
||||
color: var(--rc-label);
|
||||
font-size: 13px;
|
||||
}
|
||||
.rc-member-counts strong {
|
||||
margin-left: 10px;
|
||||
color: var(--rc-amount);
|
||||
}
|
||||
|
||||
/* 窄屏:统一规范,纵向堆叠 */
|
||||
@media (max-width: 1100px) {
|
||||
.rc-layout {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
.rc-amount-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
@media (max-width: 768px) {
|
||||
.rc-main,
|
||||
.rc-records {
|
||||
padding: 16px;
|
||||
}
|
||||
.rc-main-head,
|
||||
.rc-order {
|
||||
flex-direction: column;
|
||||
}
|
||||
.rc-order-side {
|
||||
width: 100%;
|
||||
align-items: stretch;
|
||||
}
|
||||
.rc-plan-grid {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
.rc-history-search {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
|
||||
/* 充值确认弹窗(原型未定义):Ant Design 默认弹窗 + 统一规范的语义行列表 */
|
||||
.payment-confirm-rows {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
margin: 16px 0;
|
||||
padding: 16px 0;
|
||||
border-block: 1px solid var(--border-subtle);
|
||||
}
|
||||
.payment-confirm-rows > div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
}
|
||||
.payment-confirm-rows dt {
|
||||
color: var(--text-secondary);
|
||||
font-size: 13px;
|
||||
}
|
||||
.payment-confirm-rows dd {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin: 0;
|
||||
color: var(--text-primary);
|
||||
font-weight: 600;
|
||||
}
|
||||
.payment-confirm-amount {
|
||||
color: var(--ui-color-primary);
|
||||
font-size: 20px;
|
||||
}
|
||||
.payment-confirm-discount {
|
||||
color: var(--ui-color-success);
|
||||
}
|
||||
.payment-confirm-method .ant-typography {
|
||||
font-weight: 400;
|
||||
}
|
||||
Reference in New Issue
Block a user