fix(ui): 统一表格筛选分页和用量明细,升级 ESLint
This commit is contained in:
@@ -25,7 +25,6 @@ import {
|
||||
ConsoleListTable,
|
||||
} from '../../components/console/ConsolePrimitives';
|
||||
import ConsoleCollection from '../../components/console/ConsoleCollection';
|
||||
import { TableRowActions } from '../../components/common/table/TableToolbar';
|
||||
import { useIsMobile } from '../../hooks/common/useIsMobile';
|
||||
import { createCardProPagination } from '../../helpers/utils';
|
||||
import React, { useEffect, useState, useCallback } from 'react';
|
||||
@@ -40,7 +39,14 @@ import {
|
||||
Spin,
|
||||
Typography,
|
||||
} from '@/components/ui';
|
||||
import { Search } from 'lucide-react';
|
||||
import {
|
||||
Search,
|
||||
Eye as ActionEye,
|
||||
Check as ActionCheck,
|
||||
X as ActionX,
|
||||
Ban as ActionBan,
|
||||
RotateCw as ActionRotateCw,
|
||||
} from '@/components/common/icons/ActionIcons';
|
||||
import { API, showError, showSuccess } from '../../helpers';
|
||||
import {
|
||||
INVOICE_STATUS,
|
||||
@@ -307,53 +313,78 @@ const AdminInvoice = () => {
|
||||
{
|
||||
title: t('操作'),
|
||||
key: 'actions',
|
||||
width: 140,
|
||||
width: 200,
|
||||
fixed: 'right',
|
||||
render: (_, record) => (
|
||||
<TableRowActions
|
||||
items={[
|
||||
record.status === INVOICE_STATUS.PENDING && {
|
||||
key: 'approve',
|
||||
label: t('通过'),
|
||||
onClick: () => {
|
||||
setApproveId(record.id);
|
||||
setApproveVisible(true);
|
||||
},
|
||||
},
|
||||
record.status === INVOICE_STATUS.PENDING && {
|
||||
key: 'reject',
|
||||
label: t('拒绝'),
|
||||
danger: true,
|
||||
onClick: () => {
|
||||
setRejectId(record.id);
|
||||
setRejectVisible(true);
|
||||
},
|
||||
},
|
||||
record.status === INVOICE_STATUS.FAILED && {
|
||||
key: 'retry',
|
||||
label: t('重试'),
|
||||
onClick: () => handleRetry(record.id),
|
||||
},
|
||||
[
|
||||
INVOICE_STATUS.APPROVED,
|
||||
INVOICE_STATUS.INVOICING,
|
||||
INVOICE_STATUS.FAILED,
|
||||
].includes(record.status) && {
|
||||
key: 'cancel',
|
||||
label: t('取消'),
|
||||
danger: true,
|
||||
onClick: () => handleFailCancel(record.id),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<div className='flex items-center gap-1 flex-wrap'>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<ActionEye size={14} />}
|
||||
onClick={() => handleViewDetail(record.id)}
|
||||
>
|
||||
{t('详情')}
|
||||
</Button>
|
||||
</TableRowActions>
|
||||
/>
|
||||
{record.status === INVOICE_STATUS.PENDING && (
|
||||
<>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
type='primary'
|
||||
icon={<ActionCheck size={14} />}
|
||||
onClick={() => {
|
||||
setApproveId(record.id);
|
||||
setApproveVisible(true);
|
||||
}}
|
||||
>
|
||||
{t('通过')}
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
type='danger'
|
||||
icon={<ActionX size={14} />}
|
||||
onClick={() => {
|
||||
setRejectId(record.id);
|
||||
setRejectVisible(true);
|
||||
}}
|
||||
>
|
||||
{t('拒绝')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
{(record.status === INVOICE_STATUS.APPROVED ||
|
||||
record.status === INVOICE_STATUS.INVOICING) && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
type='danger'
|
||||
icon={<ActionBan size={14} />}
|
||||
onClick={() => handleFailCancel(record.id)}
|
||||
>
|
||||
{t('取消')}
|
||||
</Button>
|
||||
)}
|
||||
{record.status === INVOICE_STATUS.FAILED && (
|
||||
<>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<ActionRotateCw size={14} />}
|
||||
onClick={() => handleRetry(record.id)}
|
||||
>
|
||||
{t('重试')}
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
type='danger'
|
||||
icon={<ActionBan size={14} />}
|
||||
onClick={() => handleFailCancel(record.id)}
|
||||
>
|
||||
{t('取消')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
];
|
||||
@@ -374,7 +405,6 @@ const AdminInvoice = () => {
|
||||
placeholder={t('搜索抬头/税号/订单号/用户')}
|
||||
value={keyword}
|
||||
onChange={setKeyword}
|
||||
onEnterPress={handleSearch}
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
<ConsoleFilterField label={t('状态')} id='invoice-status'>
|
||||
@@ -576,10 +606,10 @@ const AdminInvoice = () => {
|
||||
}}
|
||||
/>
|
||||
</Text>
|
||||
<Table
|
||||
<ConsoleListTable
|
||||
dataSource={detailData.topup_list}
|
||||
rowKey='id'
|
||||
pagination={false}
|
||||
pagination={{ pageSize: 10 }}
|
||||
size='small'
|
||||
columns={[
|
||||
{ title: 'ID', dataIndex: 'id', width: 60 },
|
||||
|
||||
Reference in New Issue
Block a user