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

This commit is contained in:
zhanjunhao
2026-11-09 21:45:37 +08:00
parent 54b3e0cc21
commit 5c0849e82b
242 changed files with 9242 additions and 5043 deletions
+63 -54
View File
@@ -16,6 +16,12 @@ 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 React, { useEffect, useState, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import {
@@ -29,7 +35,7 @@ import {
Spin,
Typography,
} from '@/components/ui';
import { Receipt, Search, Eye, Check, X, RotateCw, Ban } from 'lucide-react';
import { Search, Eye, Check, X, RotateCw, Ban } from 'lucide-react';
import { API, showError, showSuccess } from '../../helpers';
import {
INVOICE_STATUS,
@@ -53,6 +59,7 @@ const AdminInvoice = () => {
const [total, setTotal] = useState(0);
const [loading, setLoading] = useState(false);
const [page, setPage] = useState(1);
const [pageSize, setPageSize] = useState(20);
const [keyword, setKeyword] = useState('');
const [searchKeyword, setSearchKeyword] = useState('');
const [statusFilter, setStatusFilter] = useState('');
@@ -77,20 +84,22 @@ const AdminInvoice = () => {
const fetchInvoices = useCallback(async () => {
setLoading(true);
try {
const params = { p: page, page_size: 20 };
const params = { p: page, page_size: pageSize };
if (searchKeyword) params.keyword = searchKeyword;
if (statusFilter) params.status = statusFilter;
const res = await API.get('/api/invoice/list', { params });
if (res.data.success) {
setInvoices(res.data.data?.items || []);
setTotal(res.data.data?.total || 0);
} else {
showError(res.data.message || t('查询失败'));
}
} catch (err) {
showError(err.message);
} finally {
setLoading(false);
}
}, [page, searchKeyword, statusFilter]);
}, [page, pageSize, searchKeyword, statusFilter]);
useEffect(() => {
fetchInvoices();
@@ -359,61 +368,61 @@ const AdminInvoice = () => {
];
return (
<div className='mt-[60px] p-4 sm:p-6'>
<div className='console-content'>
{/* 筛选区:标题与筛选项同行 */}
<div className='flex flex-wrap items-center gap-2 mb-4'>
<div className='flex items-center gap-1.5 mr-2 flex-shrink-0'>
<Receipt size={18} className='text-amber-500' />
<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 }}
/>
<Select
placeholder={t('状态')}
value={statusFilter || undefined}
onChange={handleStatusFilterChange}
style={{ width: 120 }}
allowClear
optionList={[
{ label: t('待审核'), value: '1' },
{ label: t('审核通过'), value: '2' },
{ label: t('已拒绝'), value: '3' },
{ label: t('开票中'), value: '4' },
{ label: t('已开票'), value: '5' },
{ label: t('已取消'), value: '6' },
{ label: t('开票失败'), value: '7' },
]}
/>
<ConsoleSearchActions onSearch={handleSearch} loading={loading} />
</div>
<Input
prefix={<Search size={14} />}
placeholder={t('搜索抬头/税号/订单号/用户')}
value={keyword}
onChange={setKeyword}
onEnterPress={handleSearch}
style={{ width: 240 }}
/>
<Select
placeholder={t('状态')}
value={statusFilter || undefined}
onChange={handleStatusFilterChange}
style={{ width: 120 }}
allowClear
optionList={[
{ label: t('待审核'), value: '1' },
{ label: t('审核通过'), value: '2' },
{ label: t('已拒绝'), value: '3' },
{ label: t('开票中'), value: '4' },
{ label: t('已开票'), value: '5' },
{ label: t('已取消'), value: '6' },
{ label: t('开票失败'), value: '7' },
]}
/>
<Button theme='solid' type='primary' onClick={handleSearch}>
{t('搜索')}
</Button>
</div>
</ConsoleSearchBar>
{/* 表格 */}
<Table
columns={columns}
dataSource={invoices}
loading={loading}
rowKey='id'
pagination={{
currentPage: page,
total,
pageSize: 20,
onPageChange: setPage,
showTotal: true,
}}
scroll={{ x: 1100 }}
size='small'
empty={t('暂无发票数据')}
/>
<ConsoleCard>
<Table
columns={columns}
dataSource={invoices}
loading={loading}
rowKey='id'
pagination={{
currentPage: page,
total,
pageSize,
onPageChange: setPage,
onPageSizeChange: (size) => {
setPage(1);
setPageSize(size);
},
showTotal: true,
}}
scroll={{ x: 1100 }}
size='middle'
empty={t('暂无发票数据')}
/>
</ConsoleCard>
{/* 审核通过弹窗 */}
<Modal