merge: 同步 origin/ui-optimization(d224d5b6),保留 weiyuan 功能与 Semi 迁移
- 冲突以 weiyuan 功能(小程序登录、i18n 文案)为准,并保留远端 lint 重构与依赖收敛 - 删除 weiyuan 已移除、远端仅做 lint 修正的 3 个图片相关文件 - 适配远端零警告 ESLint:Monitoring/Subscription 改用 useEffectEvent,EditChannelModal 注明 t 依赖 - effect-events 单测补充 react-i18next mock - 对合并后仍不符合 Prettier 的文件做纯格式化
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 i18next from 'i18next';
|
||||
@@ -162,83 +156,80 @@ 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]
|
||||
? t(PLAN_TYPE_MAP[record.plan_type])
|
||||
: record.plan_type}{' '}
|
||||
· {TIER_MAP[record.tier] ? t(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]
|
||||
? t(PLAN_TYPE_MAP[record.plan_type])
|
||||
: record.plan_type}{' '}
|
||||
· {TIER_MAP[record.tier] ? t(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 t('{{days}} 天', { days });
|
||||
},
|
||||
{
|
||||
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 t('{{days}} 天', { days });
|
||||
},
|
||||
},
|
||||
{
|
||||
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