feat: 1.统一右侧抽屉关闭按钮布局 2.统一 UI 组件为 Ant Design 移除 radix-ui、floating-ui 组件 3. 修复 ESLint 文件格式错误的问题
This commit is contained in:
@@ -17,13 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, {
|
||||
useState,
|
||||
useEffect,
|
||||
useCallback,
|
||||
useRef,
|
||||
useMemo,
|
||||
} from 'react';
|
||||
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
||||
import { Empty as AntEmpty, Tag as AntTag } from 'antd';
|
||||
import { Modal, Table, Typography, Pagination, Toast } from '@/components/ui';
|
||||
import { API, renderQuota } from '../../helpers';
|
||||
@@ -161,81 +155,78 @@ export const MembershipHistoryContent = ({ visible, t, inline = false }) => {
|
||||
};
|
||||
|
||||
// 表格列定义(使用 useCallback 的格式化函数作为依赖)
|
||||
const columns = useMemo(
|
||||
() => [
|
||||
{
|
||||
title: t('方案名称'),
|
||||
dataIndex: 'plan_name',
|
||||
key: 'plan_name',
|
||||
width: 180,
|
||||
render: (text, record) => (
|
||||
<div>
|
||||
<Text>{text || '-'}</Text>
|
||||
<Text type='tertiary' size='small' className='block'>
|
||||
{PLAN_TYPE_MAP[record.plan_type] || record.plan_type} ·{' '}
|
||||
{TIER_MAP[record.tier] || record.tier}
|
||||
</Text>
|
||||
</div>
|
||||
),
|
||||
const columns = [
|
||||
{
|
||||
title: t('方案名称'),
|
||||
dataIndex: 'plan_name',
|
||||
key: 'plan_name',
|
||||
width: 180,
|
||||
render: (text, record) => (
|
||||
<div>
|
||||
<Text>{text || '-'}</Text>
|
||||
<Text type='tertiary' size='small' className='block'>
|
||||
{PLAN_TYPE_MAP[record.plan_type] || record.plan_type} ·{' '}
|
||||
{TIER_MAP[record.tier] || record.tier}
|
||||
</Text>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t('每日额度'),
|
||||
dataIndex: 'daily_quota',
|
||||
key: 'daily_quota',
|
||||
width: 120,
|
||||
render: (quota) => renderQuota(quota),
|
||||
},
|
||||
{
|
||||
title: t('天数'),
|
||||
key: 'duration_days',
|
||||
width: 80,
|
||||
align: 'center',
|
||||
render: (_, record) => {
|
||||
// duration_days 不在 UserMembership 模型中,需从 end_date - start_date 计算
|
||||
const days =
|
||||
record.end_date && record.start_date
|
||||
? Math.round((record.end_date - record.start_date) / 86400)
|
||||
: '-';
|
||||
return `${days} ${t('天')}`;
|
||||
},
|
||||
{
|
||||
title: t('每日额度'),
|
||||
dataIndex: 'daily_quota',
|
||||
key: 'daily_quota',
|
||||
width: 120,
|
||||
render: (quota) => renderQuota(quota),
|
||||
},
|
||||
{
|
||||
title: t('天数'),
|
||||
key: 'duration_days',
|
||||
width: 80,
|
||||
align: 'center',
|
||||
render: (_, record) => {
|
||||
// duration_days 不在 UserMembership 模型中,需从 end_date - start_date 计算
|
||||
const days =
|
||||
record.end_date && record.start_date
|
||||
? Math.round((record.end_date - record.start_date) / 86400)
|
||||
: '-';
|
||||
return `${days} ${t('天')}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: t('购买价格'),
|
||||
dataIndex: 'price_paid',
|
||||
key: 'price_paid',
|
||||
width: 100,
|
||||
render: (price) => `¥${price?.toFixed(2) || '0.00'}`,
|
||||
},
|
||||
{
|
||||
title: t('生效日期'),
|
||||
dataIndex: 'start_date',
|
||||
key: 'start_date',
|
||||
width: 110,
|
||||
render: (date) => formatDate(date),
|
||||
},
|
||||
{
|
||||
title: t('到期日期'),
|
||||
dataIndex: 'end_date',
|
||||
key: 'end_date',
|
||||
width: 110,
|
||||
render: (date) => formatDate(date),
|
||||
},
|
||||
{
|
||||
title: t('状态'),
|
||||
key: 'status',
|
||||
width: 100,
|
||||
render: (_, record) => renderStatusTag(record),
|
||||
},
|
||||
{
|
||||
title: t('购买时间'),
|
||||
dataIndex: 'created_at',
|
||||
key: 'created_at',
|
||||
width: 140,
|
||||
render: (time) => formatDateTime(time),
|
||||
},
|
||||
],
|
||||
[t, formatDate, formatDateTime],
|
||||
);
|
||||
},
|
||||
{
|
||||
title: t('购买价格'),
|
||||
dataIndex: 'price_paid',
|
||||
key: 'price_paid',
|
||||
width: 100,
|
||||
render: (price) => `¥${price?.toFixed(2) || '0.00'}`,
|
||||
},
|
||||
{
|
||||
title: t('生效日期'),
|
||||
dataIndex: 'start_date',
|
||||
key: 'start_date',
|
||||
width: 110,
|
||||
render: (date) => formatDate(date),
|
||||
},
|
||||
{
|
||||
title: t('到期日期'),
|
||||
dataIndex: 'end_date',
|
||||
key: 'end_date',
|
||||
width: 110,
|
||||
render: (date) => formatDate(date),
|
||||
},
|
||||
{
|
||||
title: t('状态'),
|
||||
key: 'status',
|
||||
width: 100,
|
||||
render: (_, record) => renderStatusTag(record),
|
||||
},
|
||||
{
|
||||
title: t('购买时间'),
|
||||
dataIndex: 'created_at',
|
||||
key: 'created_at',
|
||||
width: 140,
|
||||
render: (time) => formatDateTime(time),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div className={inline ? 'rc-member-history' : 'flex flex-col h-full'}>
|
||||
|
||||
Reference in New Issue
Block a user