feat: 自行开发设计 ui样式优化 超管端-控制台 相关的页面

This commit is contained in:
zhanjunhao
2026-11-09 21:45:37 +08:00
parent 9fc5fd212d
commit 28e924e371
242 changed files with 9242 additions and 5043 deletions
+136 -128
View File
@@ -16,6 +16,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import {
ConsoleCard,
ConsoleSearchBar,
ConsoleSearchActions,
} from '../../components/console/ConsolePrimitives';
import { ConsolePageActions } from '../../components/console/ConsolePageContainer';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
@@ -52,8 +59,6 @@ import { isAdmin, showError, showSuccess } from '../../helpers';
import { renderQuota } from '../../helpers/render';
import QuotaInput from '../../components/common/ui/QuotaInput';
const PAGE_SIZE = 20;
const statusColorMap = {
active: 'green',
expired: 'grey',
@@ -125,6 +130,7 @@ const Subscription = () => {
const [total, setTotal] = useState(0);
const [loading, setLoading] = useState(false);
const [page, setPage] = useState(1);
const [pageSize, setPageSize] = useState(20);
// 过滤条件
const [keyword, setKeyword] = useState('');
@@ -172,7 +178,7 @@ const Subscription = () => {
const fetchList = useCallback(async () => {
setLoading(true);
try {
const params = { page, page_size: PAGE_SIZE };
const params = { page, page_size: pageSize };
if (appliedKeyword) params.keyword = appliedKeyword;
if (appliedUserId) params.user_id = appliedUserId;
if (planTypes.length) params.plan_types = planTypes.join(',');
@@ -215,6 +221,7 @@ const Subscription = () => {
}
}, [
page,
pageSize,
appliedKeyword,
appliedUserId,
planTypes,
@@ -489,116 +496,111 @@ const Subscription = () => {
}, [t, admin]);
return (
<div className='mt-[60px] p-4 sm:p-6'>
<div className='console-content'>
{/* 筛选区 */}
<div className='flex flex-wrap items-center gap-2 mb-3'>
<div className='flex items-center gap-1.5 mr-2 flex-shrink-0'>
<CreditCard size={18} className='text-brand' />
<span className='text-base font-bold text-gray-900 dark:text-white'>
{t('会员卡管理')}
</span>
<ConsoleSearchBar formProps={{ layout: 'inline' }}>
<div className='console-search-fields'>
<Input
prefix={<Search size={14} />}
placeholder={t('搜索用户名/昵称/订单号')}
value={keyword}
onChange={setKeyword}
onEnterPress={handleSearch}
style={{ width: 240 }}
/>
<InputNumber
placeholder={t('用户ID')}
value={userId}
onChange={setUserId}
min={0}
style={{ width: 110 }}
hideButtons
/>
<Select
placeholder={t('套餐类型')}
value={planTypes}
onChange={(v) => {
setPage(1);
setPlanTypes(v || []);
}}
multiple
maxTagCount={2}
style={{ width: 160 }}
optionList={[
{ label: t('周卡'), value: 'weekly' },
{ label: t('月卡'), value: 'monthly' },
{ label: t('季卡'), value: 'quarterly' },
]}
/>
<Select
placeholder={t('档位')}
value={tiers}
onChange={(v) => {
setPage(1);
setTiers(v || []);
}}
multiple
maxTagCount={2}
style={{ width: 140 }}
optionList={[
{ label: 'Lite', value: 'lite' },
{ label: 'Pro', value: 'pro' },
]}
/>
<Select
placeholder={t('状态')}
value={statuses}
onChange={(v) => {
setPage(1);
setStatuses(v || []);
}}
multiple
maxTagCount={2}
style={{ width: 180 }}
optionList={[
{ label: t('active'), value: 'active' },
{ label: t('expired'), value: 'expired' },
{ label: t('canceled'), value: 'canceled' },
{ label: t('banned'), value: 'banned' },
]}
/>
<DatePicker
type='dateRange'
value={endDateRange}
onChange={(d) => {
setPage(1);
setEndDateRange(d || null);
}}
placeholder={[t('到期开始'), t('到期结束')]}
style={{ width: 280 }}
density='compact'
/>
<ConsoleSearchActions
onReset={handleReset}
onSearch={handleSearch}
loading={loading}
/>
{admin && (
<ConsolePageActions>
<Button
theme='solid'
type='primary'
icon={<Plus size={14} />}
onClick={openCreate}
>
{t('新建会员')}
</Button>
<Button
type='tertiary'
icon={<CreditCard size={14} />}
onClick={() => navigate('/console/setting?tab=membership')}
>
{t('会员管理')}
</Button>
</ConsolePageActions>
)}
</div>
<Input
prefix={<Search size={14} />}
placeholder={t('搜索用户名/昵称/订单号')}
value={keyword}
onChange={setKeyword}
onEnterPress={handleSearch}
style={{ width: 240 }}
/>
<InputNumber
placeholder={t('用户ID')}
value={userId}
onChange={setUserId}
min={0}
style={{ width: 110 }}
hideButtons
/>
<Select
placeholder={t('套餐类型')}
value={planTypes}
onChange={(v) => {
setPage(1);
setPlanTypes(v || []);
}}
multiple
maxTagCount={2}
style={{ width: 160 }}
optionList={[
{ label: t('周卡'), value: 'weekly' },
{ label: t('月卡'), value: 'monthly' },
{ label: t('季卡'), value: 'quarterly' },
]}
/>
<Select
placeholder={t('档位')}
value={tiers}
onChange={(v) => {
setPage(1);
setTiers(v || []);
}}
multiple
maxTagCount={2}
style={{ width: 140 }}
optionList={[
{ label: 'Lite', value: 'lite' },
{ label: 'Pro', value: 'pro' },
]}
/>
<Select
placeholder={t('状态')}
value={statuses}
onChange={(v) => {
setPage(1);
setStatuses(v || []);
}}
multiple
maxTagCount={2}
style={{ width: 180 }}
optionList={[
{ label: t('active'), value: 'active' },
{ label: t('expired'), value: 'expired' },
{ label: t('canceled'), value: 'canceled' },
{ label: t('banned'), value: 'banned' },
]}
/>
<DatePicker
type='dateRange'
value={endDateRange}
onChange={(d) => {
setPage(1);
setEndDateRange(d || null);
}}
placeholder={[t('到期开始'), t('到期结束')]}
style={{ width: 280 }}
density='compact'
/>
<Button theme='solid' type='primary' onClick={handleSearch}>
{t('搜索')}
</Button>
<Button type='tertiary' onClick={handleReset}>
{t('重置')}
</Button>
{admin && (
<>
<Button
theme='solid'
type='primary'
icon={<Plus size={14} />}
onClick={openCreate}
>
{t('新建会员')}
</Button>
<Button
type='tertiary'
icon={<CreditCard size={14} />}
onClick={() => navigate('/console/setting?tab=membership')}
>
{t('会员管理')}
</Button>
</>
)}
</div>
</ConsoleSearchBar>
{/* 快捷筛选 */}
<div className='flex flex-wrap items-center gap-2 mb-4'>
@@ -630,23 +632,29 @@ const Subscription = () => {
</div>
{/* 表格 */}
<Table
columns={columns}
dataSource={list}
loading={loading}
rowKey='id'
pagination={{
currentPage: page,
total,
pageSize: PAGE_SIZE,
onPageChange: setPage,
showTotal: true,
showSizeChanger: false,
}}
scroll={{ x: 1300 }}
size='small'
empty={t('暂无订阅数据')}
/>
<ConsoleCard>
<Table
columns={columns}
dataSource={list}
loading={loading}
rowKey='id'
pagination={{
currentPage: page,
total,
pageSize,
onPageChange: setPage,
onPageSizeChange: (size) => {
setPage(1);
setPageSize(size);
},
showTotal: true,
showSizeChanger: false,
}}
scroll={{ x: 1300 }}
size='middle'
empty={t('暂无订阅数据')}
/>
</ConsoleCard>
{/* 封禁弹窗 */}
<BanModal