feat: 迭代
This commit is contained in:
@@ -21,6 +21,12 @@ import FinanceSettlements from '@/pages/finance/Settlements';
|
||||
import FinanceWithdrawals from '@/pages/finance/Withdrawals';
|
||||
import FinanceEarnings from '@/pages/finance/Earnings';
|
||||
import FinanceServiceFees from '@/pages/finance/ServiceFees';
|
||||
import FinanceDashboard from '@/pages/finance/Dashboard';
|
||||
import FinanceAccounts from '@/pages/finance/Accounts';
|
||||
import PlatformWallet from '@/pages/finance/PlatformWallet';
|
||||
import PlatformTransactions from '@/pages/finance/PlatformTransactions';
|
||||
import PlatformWithdrawals from '@/pages/finance/PlatformWithdrawals';
|
||||
import BankCards from '@/pages/finance/BankCards';
|
||||
import InviteManage from '@/pages/InviteManage';
|
||||
import ReviewManage from '@/pages/ReviewManage';
|
||||
|
||||
@@ -47,7 +53,13 @@ const App: React.FC = () => (
|
||||
<Route path="orders/:id" element={<OrderDetail />} />
|
||||
<Route path="order-statistics" element={<OrderStatistics />} />
|
||||
<Route path="finance">
|
||||
<Route index element={<Navigate to="/finance/settlements" replace />} />
|
||||
<Route index element={<Navigate to="/finance/dashboard" replace />} />
|
||||
<Route path="dashboard" element={<FinanceDashboard />} />
|
||||
<Route path="accounts" element={<FinanceAccounts />} />
|
||||
<Route path="platform-wallet" element={<PlatformWallet />} />
|
||||
<Route path="platform-transactions" element={<PlatformTransactions />} />
|
||||
<Route path="platform-withdrawals" element={<PlatformWithdrawals />} />
|
||||
<Route path="bank-cards" element={<BankCards />} />
|
||||
<Route path="settlements" element={<FinanceSettlements />} />
|
||||
<Route path="withdrawals" element={<FinanceWithdrawals />} />
|
||||
<Route path="earnings" element={<FinanceEarnings />} />
|
||||
|
||||
@@ -51,6 +51,22 @@ export function getPlatformWithdrawals(params: any) {
|
||||
return request.get('/api/admin/finance/withdrawals/platform', { params });
|
||||
}
|
||||
|
||||
export function createPlatformWithdrawal(data: any) {
|
||||
return request.post('/api/admin/finance/withdrawals/platform', data);
|
||||
}
|
||||
|
||||
export function approvePlatformWithdrawal(id: number) {
|
||||
return request.put(`/api/admin/finance/withdrawals/${id}/approve?type=platform`);
|
||||
}
|
||||
|
||||
export function rejectPlatformWithdrawal(id: number, reason: string) {
|
||||
return request.put(`/api/admin/finance/withdrawals/${id}/reject?type=platform`, { rejectReason: reason });
|
||||
}
|
||||
|
||||
export function confirmPlatformWithdrawal(id: number, transactionNo: string) {
|
||||
return request.put(`/api/admin/finance/withdrawals/${id}/confirm?type=platform`, { paymentNo: transactionNo });
|
||||
}
|
||||
|
||||
export function approveUserWithdrawal(id: number) {
|
||||
return request.put(`/api/admin/finance/withdrawals/users/${id}/approve`);
|
||||
}
|
||||
@@ -75,6 +91,27 @@ export function confirmMerchantWithdrawal(id: number, transactionNo: string) {
|
||||
return request.put(`/api/admin/finance/withdrawals/merchants/${id}/confirm`, { paymentNo: transactionNo });
|
||||
}
|
||||
|
||||
// 平台银行卡管理
|
||||
export function getBankCards(params: any) {
|
||||
return request.get('/api/admin/finance/bank-cards', { params });
|
||||
}
|
||||
|
||||
export function getBankCardById(id: number) {
|
||||
return request.get(`/api/admin/finance/bank-cards/${id}`);
|
||||
}
|
||||
|
||||
export function createBankCard(data: any) {
|
||||
return request.post('/api/admin/finance/bank-cards', data);
|
||||
}
|
||||
|
||||
export function updateBankCard(id: number, data: any) {
|
||||
return request.put(`/api/admin/finance/bank-cards/${id}`, data);
|
||||
}
|
||||
|
||||
export function deleteBankCard(id: number) {
|
||||
return request.delete(`/api/admin/finance/bank-cards/${id}`);
|
||||
}
|
||||
|
||||
// 结算管理
|
||||
export function getSettlements(params: any) {
|
||||
return request.get('/api/admin/finance/settlements', { params });
|
||||
@@ -92,6 +129,14 @@ export function generateSettlement(merchantId: number, data: { startDate: string
|
||||
return request.post(`/api/admin/finance/settlements/generate/${merchantId}`, data);
|
||||
}
|
||||
|
||||
export function executeWeeklySettlement() {
|
||||
return request.post('/api/admin/finance/settlements/execute-weekly');
|
||||
}
|
||||
|
||||
export function previewWeeklySettlement() {
|
||||
return request.get('/api/admin/finance/settlements/preview-weekly');
|
||||
}
|
||||
|
||||
// 对账管理
|
||||
export function getReconciliations(params: any) {
|
||||
return request.get('/api/admin/finance/reconciliations', { params });
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
StarOutlined,
|
||||
BarChartOutlined,
|
||||
TagOutlined,
|
||||
CreditCardOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { useAuthStore } from '@/store/auth';
|
||||
|
||||
@@ -38,10 +39,15 @@ const menuItems = [
|
||||
icon: <WalletOutlined />,
|
||||
label: '财务管理',
|
||||
children: [
|
||||
{ key: '/finance/settlements', icon: <AuditOutlined />, label: '对账审核' },
|
||||
{ key: '/finance/dashboard', icon: <DashboardOutlined />, label: '财务总览' },
|
||||
{ key: '/finance/platform-wallet', icon: <WalletOutlined />, label: '平台钱包' },
|
||||
{ key: '/finance/platform-transactions', icon: <UnorderedListOutlined />, label: '交易记录' },
|
||||
{ key: '/finance/bank-cards', icon: <CreditCardOutlined />, label: '银行卡管理' },
|
||||
{ key: '/finance/accounts', icon: <TeamOutlined />, label: '账户管理' },
|
||||
{ key: '/finance/settlements', icon: <AuditOutlined />, label: '结算管理' },
|
||||
{ key: '/finance/withdrawals', icon: <PayCircleOutlined />, label: '提现审核' },
|
||||
{ key: '/finance/earnings', icon: <FundOutlined />, label: '平台收益' },
|
||||
{ key: '/finance/service-fees', icon: <DollarOutlined />, label: '服务费管理' },
|
||||
{ key: '/finance/earnings', icon: <FundOutlined />, label: '收益分析' },
|
||||
{ key: '/finance/service-fees', icon: <DollarOutlined />, label: '服务费统计' },
|
||||
],
|
||||
},
|
||||
{ key: '/invite', icon: <TrophyOutlined />, label: '邀请返现' },
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
UnorderedListOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import ReactECharts from 'echarts-for-react';
|
||||
import { getPlatformStatistics } from '@/api/admin';
|
||||
import { getPlatformStatistics, getOrderTrend } from '@/api/admin';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const { RangePicker } = DatePicker;
|
||||
@@ -20,6 +20,8 @@ const Dashboard: React.FC = () => {
|
||||
userCount: 0,
|
||||
todayOrders: 0,
|
||||
platformBalance: 0,
|
||||
merchantTotalBalance: 0,
|
||||
userTotalBalance: 0,
|
||||
todayIncome: 0,
|
||||
});
|
||||
const [dateRange, setDateRange] = useState<[dayjs.Dayjs, dayjs.Dayjs]>([
|
||||
@@ -38,17 +40,15 @@ const Dashboard: React.FC = () => {
|
||||
const res: any = await getPlatformStatistics();
|
||||
setStats(res.data || {});
|
||||
|
||||
// 模拟趋势数据(实际应该从后端获取)
|
||||
const dates = [];
|
||||
const orders = [];
|
||||
const income = [];
|
||||
// 获取趋势数据
|
||||
const startDate = dateRange[0].format('YYYY-MM-DD');
|
||||
const endDate = dateRange[1].format('YYYY-MM-DD');
|
||||
const trendRes: any = await getOrderTrend({ startDate, endDate });
|
||||
|
||||
for (let i = 6; i >= 0; i--) {
|
||||
const date = dayjs().subtract(i, 'day').format('MM-DD');
|
||||
dates.push(date);
|
||||
orders.push(Math.floor(Math.random() * 50) + 20);
|
||||
income.push((Math.random() * 5000 + 2000).toFixed(2));
|
||||
}
|
||||
const trendList = trendRes.data || [];
|
||||
const dates = trendList.map((item: any) => dayjs(item.date).format('MM-DD'));
|
||||
const income = trendList.map((item: any) => Number(item.income || 0).toFixed(2));
|
||||
const orders = trendList.map((item: any) => item.orderCount || 0);
|
||||
|
||||
setTrendData({ dates, orders, income });
|
||||
} catch (error) {
|
||||
@@ -67,7 +67,7 @@ const Dashboard: React.FC = () => {
|
||||
}, 5 * 60 * 1000);
|
||||
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
}, [dateRange]);
|
||||
|
||||
// 订单趋势图表配置
|
||||
const orderTrendOption = {
|
||||
@@ -212,10 +212,10 @@ const Dashboard: React.FC = () => {
|
||||
</Row>
|
||||
|
||||
<Row gutter={[24, 24]} style={{ marginTop: 24 }}>
|
||||
<Col span={12}>
|
||||
<Col span={8}>
|
||||
<Card>
|
||||
<Statistic
|
||||
title="平台账户余额"
|
||||
title="平台钱包余额"
|
||||
value={stats.platformBalance}
|
||||
prefix={<DollarOutlined />}
|
||||
suffix="元"
|
||||
@@ -223,7 +223,7 @@ const Dashboard: React.FC = () => {
|
||||
/>
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Col span={8}>
|
||||
<Card>
|
||||
<Statistic
|
||||
title="商家账户总余额"
|
||||
@@ -234,6 +234,17 @@ const Dashboard: React.FC = () => {
|
||||
/>
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<Card>
|
||||
<Statistic
|
||||
title="用户账户总余额"
|
||||
value={stats.userTotalBalance || 0}
|
||||
prefix={<DollarOutlined />}
|
||||
suffix="元"
|
||||
precision={2}
|
||||
/>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<Row gutter={[24, 24]} style={{ marginTop: 24 }}>
|
||||
|
||||
@@ -0,0 +1,297 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Card, Table, Button, Space, Modal, Form, Input, message, Tag, Switch } from 'antd';
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons';
|
||||
import { getBankCards, createBankCard, updateBankCard, deleteBankCard } from '@/api/finance';
|
||||
import type { ColumnsType } from 'antd/es/table';
|
||||
import { formatDateTime } from '@rent/shared-utils';
|
||||
import { useTableData } from '@/hooks/useTableData';
|
||||
import { useModal } from '@/hooks/useModal';
|
||||
|
||||
interface BankCard {
|
||||
id: number;
|
||||
cardName: string;
|
||||
bankName: string;
|
||||
bankAccount: string;
|
||||
accountName: string;
|
||||
isDefault: boolean;
|
||||
status: 'active' | 'inactive';
|
||||
remark?: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
const BankCards: React.FC = () => {
|
||||
const [form] = Form.useForm();
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
const createModal = useModal();
|
||||
const editModal = useModal<BankCard>();
|
||||
|
||||
const {
|
||||
data: bankCards,
|
||||
loading,
|
||||
total,
|
||||
page,
|
||||
pageSize,
|
||||
setPage,
|
||||
setPageSize,
|
||||
refresh,
|
||||
} = useTableData<BankCard>({
|
||||
fetchFn: async (params) => {
|
||||
const res = await getBankCards(params);
|
||||
return {
|
||||
list: res.data.items || res.data,
|
||||
total: res.data.total || res.data.length,
|
||||
page: params.page || 1,
|
||||
pageSize: params.pageSize || 20,
|
||||
totalPages: Math.ceil((res.data.total || res.data.length) / (params.pageSize || 20)),
|
||||
};
|
||||
},
|
||||
initialParams: { pageSize: 20 },
|
||||
});
|
||||
|
||||
const handleCreate = () => {
|
||||
form.resetFields();
|
||||
createModal.open();
|
||||
};
|
||||
|
||||
const handleEdit = (record: BankCard) => {
|
||||
form.setFieldsValue({
|
||||
cardName: record.cardName,
|
||||
bankName: record.bankName,
|
||||
bankAccount: record.bankAccount,
|
||||
accountName: record.accountName,
|
||||
isDefault: record.isDefault,
|
||||
remark: record.remark,
|
||||
});
|
||||
editModal.open(record);
|
||||
};
|
||||
|
||||
const handleDelete = (record: BankCard) => {
|
||||
Modal.confirm({
|
||||
title: '确认删除',
|
||||
content: `确定要删除银行卡"${record.cardName}"吗?`,
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
okButtonProps: { danger: true },
|
||||
onOk: async () => {
|
||||
try {
|
||||
await deleteBankCard(record.id);
|
||||
message.success('删除成功');
|
||||
refresh();
|
||||
} catch (error: any) {
|
||||
message.error(error.response?.data?.message || '删除失败');
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const handleSubmit = async (values: any) => {
|
||||
setSubmitting(true);
|
||||
try {
|
||||
if (editModal.data) {
|
||||
await updateBankCard(editModal.data.id, values);
|
||||
message.success('更新成功');
|
||||
editModal.close();
|
||||
} else {
|
||||
await createBankCard(values);
|
||||
message.success('添加成功');
|
||||
createModal.close();
|
||||
}
|
||||
form.resetFields();
|
||||
refresh();
|
||||
} catch (error: any) {
|
||||
message.error(error.response?.data?.message || '操作失败');
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
}
|
||||
};
|
||||
|
||||
const columns: ColumnsType<BankCard> = [
|
||||
{
|
||||
title: '卡片名称',
|
||||
dataIndex: 'cardName',
|
||||
key: 'cardName',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '开户银行',
|
||||
dataIndex: 'bankName',
|
||||
key: 'bankName',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '银行账号',
|
||||
dataIndex: 'bankAccount',
|
||||
key: 'bankAccount',
|
||||
width: 200,
|
||||
render: (account: string) => {
|
||||
const masked = account.replace(/(\d{4})\d+(\d{4})/, '$1****$2');
|
||||
return masked;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '账户名称',
|
||||
dataIndex: 'accountName',
|
||||
key: 'accountName',
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
title: '默认卡',
|
||||
dataIndex: 'isDefault',
|
||||
key: 'isDefault',
|
||||
width: 100,
|
||||
render: (isDefault: boolean) => (
|
||||
<Tag color={isDefault ? 'green' : 'default'}>{isDefault ? '是' : '否'}</Tag>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
width: 100,
|
||||
render: (status: string) => (
|
||||
<Tag color={status === 'active' ? 'green' : 'red'}>
|
||||
{status === 'active' ? '启用' : '停用'}
|
||||
</Tag>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'remark',
|
||||
key: 'remark',
|
||||
width: 200,
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createdAt',
|
||||
key: 'createdAt',
|
||||
width: 180,
|
||||
render: (date: string) => formatDateTime(date),
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 150,
|
||||
fixed: 'right',
|
||||
render: (_, record: BankCard) => (
|
||||
<Space>
|
||||
<Button type="link" size="small" icon={<EditOutlined />} onClick={() => handleEdit(record)}>
|
||||
编辑
|
||||
</Button>
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
danger
|
||||
icon={<DeleteOutlined />}
|
||||
onClick={() => handleDelete(record)}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2 style={{ marginBottom: 24 }}>平台银行卡管理</h2>
|
||||
|
||||
<Card>
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<Button type="primary" icon={<PlusOutlined />} onClick={handleCreate}>
|
||||
添加银行卡
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={bankCards}
|
||||
rowKey="id"
|
||||
loading={loading}
|
||||
scroll={{ x: 1400 }}
|
||||
pagination={{
|
||||
current: page,
|
||||
pageSize,
|
||||
total,
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
showTotal: (total) => `共 ${total} 条`,
|
||||
onChange: setPage,
|
||||
onShowSizeChange: (_, size) => setPageSize(size),
|
||||
}}
|
||||
/>
|
||||
</Card>
|
||||
|
||||
<Modal
|
||||
title={editModal.data ? '编辑银行卡' : '添加银行卡'}
|
||||
open={createModal.visible || editModal.visible}
|
||||
onCancel={() => {
|
||||
createModal.close();
|
||||
editModal.close();
|
||||
form.resetFields();
|
||||
}}
|
||||
footer={null}
|
||||
width={600}
|
||||
>
|
||||
<Form form={form} layout="vertical" onFinish={handleSubmit}>
|
||||
<Form.Item
|
||||
name="cardName"
|
||||
label="卡片名称"
|
||||
rules={[{ required: true, message: '请输入卡片名称' }]}
|
||||
>
|
||||
<Input placeholder="例如:主账户、备用账户" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="bankName"
|
||||
label="开户银行"
|
||||
rules={[{ required: true, message: '请输入开户银行' }]}
|
||||
>
|
||||
<Input placeholder="例如:中国工商银行" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="bankAccount"
|
||||
label="银行账号"
|
||||
rules={[
|
||||
{ required: true, message: '请输入银行账号' },
|
||||
{ pattern: /^\d{16,19}$/, message: '请输入正确的银行账号(16-19位数字)' },
|
||||
]}
|
||||
>
|
||||
<Input placeholder="请输入银行账号" maxLength={19} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="accountName"
|
||||
label="账户名称"
|
||||
rules={[{ required: true, message: '请输入账户名称' }]}
|
||||
>
|
||||
<Input placeholder="请输入账户名称" />
|
||||
</Form.Item>
|
||||
<Form.Item name="isDefault" label="设为默认" valuePropName="checked">
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
<Form.Item name="remark" label="备注">
|
||||
<Input.TextArea rows={3} placeholder="请输入备注信息(选填)" />
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Space style={{ width: '100%', justifyContent: 'flex-end' }}>
|
||||
<Button
|
||||
onClick={() => {
|
||||
createModal.close();
|
||||
editModal.close();
|
||||
form.resetFields();
|
||||
}}
|
||||
>
|
||||
取消
|
||||
</Button>
|
||||
<Button type="primary" htmlType="submit" loading={submitting}>
|
||||
{editModal.data ? '更新' : '添加'}
|
||||
</Button>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default BankCards;
|
||||
@@ -108,6 +108,21 @@ const FinanceDashboard: React.FC = () => {
|
||||
|
||||
{overview && (
|
||||
<>
|
||||
{/* 平台总账户余额 - 突出显示 */}
|
||||
<Card style={{ marginBottom: 24, background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)' }}>
|
||||
<Statistic
|
||||
title={<span style={{ color: '#fff', fontSize: 16 }}>平台总账户余额</span>}
|
||||
value={Number(overview.platformBalance || 0) + Number(overview.totalMerchantBalance || 0) + Number(overview.totalUserBalance || 0)}
|
||||
prefix={<WalletOutlined style={{ color: '#fff' }} />}
|
||||
suffix={<span style={{ color: '#fff' }}>元</span>}
|
||||
precision={2}
|
||||
valueStyle={{ color: '#fff', fontSize: 36, fontWeight: 'bold' }}
|
||||
/>
|
||||
<div style={{ color: 'rgba(255,255,255,0.8)', fontSize: 12, marginTop: 8 }}>
|
||||
平台内所有未提现的资金总额(包含平台钱包、商家账户、用户账户)
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Row gutter={24} style={{ marginBottom: 24 }}>
|
||||
<Col span={6}>
|
||||
<Card>
|
||||
|
||||
@@ -0,0 +1,292 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Card, Table, Form, Input, Button, Space, DatePicker, Select, Tag, Descriptions, Modal } from 'antd';
|
||||
import { SearchOutlined, ReloadOutlined, EyeOutlined } from '@ant-design/icons';
|
||||
import { getPlatformTransactions } from '@/api/finance';
|
||||
import type { ColumnsType } from 'antd/es/table';
|
||||
import { formatMoney, formatDateTime } from '@rent/shared-utils';
|
||||
import { useTableData } from '@/hooks/useTableData';
|
||||
import { useModal } from '@/hooks/useModal';
|
||||
|
||||
const { RangePicker } = DatePicker;
|
||||
|
||||
interface PlatformTransaction {
|
||||
id: number;
|
||||
transaction_no: string;
|
||||
account_id: number;
|
||||
direction: 'income' | 'expense';
|
||||
amount: number;
|
||||
balance_before: number;
|
||||
balance_after: number;
|
||||
transaction_type: string;
|
||||
business_type: string;
|
||||
business_id: number;
|
||||
business_no: string;
|
||||
related_account_type?: string;
|
||||
related_account_id?: number;
|
||||
remark: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
const PlatformTransactions: React.FC = () => {
|
||||
const [form] = Form.useForm();
|
||||
const detailModal = useModal<PlatformTransaction>();
|
||||
|
||||
const {
|
||||
data: transactions,
|
||||
loading,
|
||||
total,
|
||||
page,
|
||||
pageSize,
|
||||
setPage,
|
||||
setPageSize,
|
||||
refresh,
|
||||
} = useTableData<PlatformTransaction>({
|
||||
fetchFn: async (params) => {
|
||||
const res = await getPlatformTransactions(params);
|
||||
return {
|
||||
list: res.data.items,
|
||||
total: res.data.total,
|
||||
page: params.page || 1,
|
||||
pageSize: params.pageSize || 20,
|
||||
totalPages: Math.ceil(res.data.total / (params.pageSize || 20)),
|
||||
};
|
||||
},
|
||||
initialParams: { pageSize: 20 },
|
||||
});
|
||||
|
||||
const handleSearch = () => {
|
||||
const values = form.getFieldsValue();
|
||||
const params: any = { page: 1 };
|
||||
|
||||
if (values.transactionNo) params.transactionNo = values.transactionNo;
|
||||
if (values.direction) params.direction = values.direction;
|
||||
if (values.transactionType) params.transactionType = values.transactionType;
|
||||
if (values.businessType) params.businessType = values.businessType;
|
||||
if (values.dateRange && values.dateRange.length === 2) {
|
||||
params.startDate = values.dateRange[0].format('YYYY-MM-DD');
|
||||
params.endDate = values.dateRange[1].format('YYYY-MM-DD');
|
||||
}
|
||||
|
||||
refresh(params);
|
||||
};
|
||||
|
||||
const handleReset = () => {
|
||||
form.resetFields();
|
||||
refresh({ page: 1 });
|
||||
};
|
||||
|
||||
const handleViewDetail = (record: PlatformTransaction) => {
|
||||
detailModal.open(record);
|
||||
};
|
||||
|
||||
const columns: ColumnsType<PlatformTransaction> = [
|
||||
{
|
||||
title: '交易流水号',
|
||||
dataIndex: 'transaction_no',
|
||||
key: 'transaction_no',
|
||||
width: 180,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
title: '交易时间',
|
||||
dataIndex: 'created_at',
|
||||
key: 'created_at',
|
||||
width: 180,
|
||||
render: (date: string) => formatDateTime(date),
|
||||
},
|
||||
{
|
||||
title: '交易方向',
|
||||
dataIndex: 'direction',
|
||||
key: 'direction',
|
||||
width: 100,
|
||||
render: (direction: string) => {
|
||||
const config = {
|
||||
income: { text: '收入', color: 'green' },
|
||||
expense: { text: '支出', color: 'red' },
|
||||
};
|
||||
const item = config[direction as keyof typeof config] || { text: direction, color: 'default' };
|
||||
return <Tag color={item.color}>{item.text}</Tag>;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '交易类型',
|
||||
dataIndex: 'transaction_type',
|
||||
key: 'transaction_type',
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
title: '业务类型',
|
||||
dataIndex: 'business_type',
|
||||
key: 'business_type',
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
title: '业务单号',
|
||||
dataIndex: 'business_no',
|
||||
key: 'business_no',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '交易金额',
|
||||
dataIndex: 'amount',
|
||||
key: 'amount',
|
||||
width: 120,
|
||||
render: (amount: number, record: PlatformTransaction) => (
|
||||
<span style={{ color: record.direction === 'income' ? '#52c41a' : '#ff4d4f', fontWeight: 'bold' }}>
|
||||
{record.direction === 'income' ? '+' : '-'}{formatMoney(amount, '')}
|
||||
</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '交易前余额',
|
||||
dataIndex: 'balance_before',
|
||||
key: 'balance_before',
|
||||
width: 120,
|
||||
render: (balance: number) => formatMoney(balance),
|
||||
},
|
||||
{
|
||||
title: '交易后余额',
|
||||
dataIndex: 'balance_after',
|
||||
key: 'balance_after',
|
||||
width: 120,
|
||||
render: (balance: number) => formatMoney(balance),
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'remark',
|
||||
key: 'remark',
|
||||
width: 200,
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 100,
|
||||
fixed: 'right',
|
||||
render: (_, record: PlatformTransaction) => (
|
||||
<Button type="link" size="small" icon={<EyeOutlined />} onClick={() => handleViewDetail(record)}>
|
||||
详情
|
||||
</Button>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2 style={{ marginBottom: 24 }}>平台交易记录</h2>
|
||||
|
||||
<Card>
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<Form form={form} layout="inline">
|
||||
<Form.Item name="transactionNo" label="流水号">
|
||||
<Input placeholder="请输入交易流水号" style={{ width: 180 }} />
|
||||
</Form.Item>
|
||||
<Form.Item name="direction" label="交易方向">
|
||||
<Select placeholder="请选择" style={{ width: 120 }} allowClear>
|
||||
<Select.Option value="income">收入</Select.Option>
|
||||
<Select.Option value="expense">支出</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item name="transactionType" label="交易类型">
|
||||
<Select placeholder="请选择" style={{ width: 150 }} allowClear>
|
||||
<Select.Option value="订单收入">订单收入</Select.Option>
|
||||
<Select.Option value="商家结算">商家结算</Select.Option>
|
||||
<Select.Option value="邀请返现">邀请返现</Select.Option>
|
||||
<Select.Option value="提现">提现</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item name="businessType" label="业务类型">
|
||||
<Select placeholder="请选择" style={{ width: 150 }} allowClear>
|
||||
<Select.Option value="order">订单</Select.Option>
|
||||
<Select.Option value="settlement">结算</Select.Option>
|
||||
<Select.Option value="invitation">邀请</Select.Option>
|
||||
<Select.Option value="withdraw">提现</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item name="dateRange" label="交易时间">
|
||||
<RangePicker style={{ width: 240 }} />
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Space>
|
||||
<Button type="primary" icon={<SearchOutlined />} onClick={handleSearch}>
|
||||
查询
|
||||
</Button>
|
||||
<Button icon={<ReloadOutlined />} onClick={handleReset}>
|
||||
重置
|
||||
</Button>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={transactions}
|
||||
rowKey="id"
|
||||
loading={loading}
|
||||
scroll={{ x: 1600 }}
|
||||
pagination={{
|
||||
current: page,
|
||||
pageSize,
|
||||
total,
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
showTotal: (total) => `共 ${total} 条`,
|
||||
onChange: setPage,
|
||||
onShowSizeChange: (_, size) => setPageSize(size),
|
||||
}}
|
||||
/>
|
||||
</Card>
|
||||
|
||||
<Modal
|
||||
title="交易详情"
|
||||
open={detailModal.visible}
|
||||
onCancel={detailModal.close}
|
||||
footer={null}
|
||||
width={700}
|
||||
>
|
||||
{detailModal.data && (
|
||||
<Descriptions column={1} bordered>
|
||||
<Descriptions.Item label="交易流水号">{detailModal.data.transaction_no}</Descriptions.Item>
|
||||
<Descriptions.Item label="账户ID">{detailModal.data.account_id}</Descriptions.Item>
|
||||
<Descriptions.Item label="交易方向">
|
||||
<Tag color={detailModal.data.direction === 'income' ? 'green' : 'red'}>
|
||||
{detailModal.data.direction === 'income' ? '收入' : '支出'}
|
||||
</Tag>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="交易金额">
|
||||
<span
|
||||
style={{
|
||||
fontSize: 18,
|
||||
fontWeight: 'bold',
|
||||
color: detailModal.data.direction === 'income' ? '#52c41a' : '#ff4d4f',
|
||||
}}
|
||||
>
|
||||
{detailModal.data.direction === 'income' ? '+' : '-'}
|
||||
{formatMoney(detailModal.data.amount)}
|
||||
</span>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="交易前余额">{formatMoney(detailModal.data.balance_before)}</Descriptions.Item>
|
||||
<Descriptions.Item label="交易后余额">{formatMoney(detailModal.data.balance_after)}</Descriptions.Item>
|
||||
<Descriptions.Item label="交易类型">{detailModal.data.transaction_type}</Descriptions.Item>
|
||||
<Descriptions.Item label="业务类型">{detailModal.data.business_type}</Descriptions.Item>
|
||||
<Descriptions.Item label="业务ID">{detailModal.data.business_id}</Descriptions.Item>
|
||||
<Descriptions.Item label="业务单号">{detailModal.data.business_no}</Descriptions.Item>
|
||||
{detailModal.data.related_account_type && (
|
||||
<>
|
||||
<Descriptions.Item label="关联账户类型">
|
||||
{detailModal.data.related_account_type === 'merchant' ? '商家' : '用户'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="关联账户ID">{detailModal.data.related_account_id}</Descriptions.Item>
|
||||
</>
|
||||
)}
|
||||
<Descriptions.Item label="备注">{detailModal.data.remark}</Descriptions.Item>
|
||||
<Descriptions.Item label="交易时间">{formatDateTime(detailModal.data.created_at)}</Descriptions.Item>
|
||||
</Descriptions>
|
||||
)}
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default PlatformTransactions;
|
||||
@@ -0,0 +1,373 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Card, Row, Col, Statistic, Descriptions, Button, Space, Modal, Form, InputNumber, Input, message, Select } from 'antd';
|
||||
import { WalletOutlined, ArrowUpOutlined, ArrowDownOutlined, DollarOutlined, ExportOutlined } from '@ant-design/icons';
|
||||
import { getPlatformAccounts, createPlatformWithdrawal, getBankCards } from '@/api/finance';
|
||||
import { formatMoney, formatDateTime } from '@rent/shared-utils';
|
||||
|
||||
interface PlatformAccount {
|
||||
id: number;
|
||||
account_name: string;
|
||||
balance: number;
|
||||
frozen_balance: number;
|
||||
total_income: number;
|
||||
total_expense: number;
|
||||
total_service_fee: number;
|
||||
status: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
interface BankCard {
|
||||
id: number;
|
||||
cardName: string;
|
||||
bankName: string;
|
||||
bankAccount: string;
|
||||
accountName: string;
|
||||
isDefault: boolean;
|
||||
status: string;
|
||||
}
|
||||
|
||||
const PlatformWallet: React.FC = () => {
|
||||
const [account, setAccount] = useState<PlatformAccount | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [withdrawModalVisible, setWithdrawModalVisible] = useState(false);
|
||||
const [bankCards, setBankCards] = useState<BankCard[]>([]);
|
||||
const [form] = Form.useForm();
|
||||
|
||||
useEffect(() => {
|
||||
fetchAccount();
|
||||
fetchBankCards();
|
||||
}, []);
|
||||
|
||||
const fetchAccount = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await getPlatformAccounts({});
|
||||
if (res.data && res.data.length > 0) {
|
||||
setAccount(res.data[0]);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取平台账户失败', error);
|
||||
message.error('获取平台账户失败');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const fetchBankCards = async () => {
|
||||
try {
|
||||
const res = await getBankCards({});
|
||||
const cards = res.data.items || res.data || [];
|
||||
setBankCards(cards.filter((card: BankCard) => card.status === 'active'));
|
||||
} catch (error) {
|
||||
console.error('获取银行卡列表失败', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleWithdraw = () => {
|
||||
if (bankCards.length === 0) {
|
||||
message.warning('请先添加银行卡');
|
||||
return;
|
||||
}
|
||||
const defaultCard = bankCards.find(card => card.isDefault);
|
||||
if (defaultCard) {
|
||||
form.setFieldsValue({
|
||||
bankCardId: defaultCard.id,
|
||||
bankAccount: defaultCard.bankAccount,
|
||||
bankName: defaultCard.bankName,
|
||||
});
|
||||
}
|
||||
setWithdrawModalVisible(true);
|
||||
};
|
||||
|
||||
const handleBankCardChange = (bankCardId: number) => {
|
||||
const selectedCard = bankCards.find(card => card.id === bankCardId);
|
||||
if (selectedCard) {
|
||||
form.setFieldsValue({
|
||||
bankAccount: selectedCard.bankAccount,
|
||||
bankName: selectedCard.bankName,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleWithdrawSubmit = async (values: any) => {
|
||||
try {
|
||||
await createPlatformWithdrawal({
|
||||
amount: values.amount,
|
||||
bankAccount: values.bankAccount,
|
||||
bankName: values.bankName,
|
||||
remark: values.remark,
|
||||
});
|
||||
message.success('提现申请已提交');
|
||||
setWithdrawModalVisible(false);
|
||||
form.resetFields();
|
||||
fetchAccount();
|
||||
} catch (error: any) {
|
||||
message.error(error.response?.data?.message || '提现申请失败');
|
||||
}
|
||||
};
|
||||
|
||||
// 可提现金额 = 钱包余额 - 冻结余额
|
||||
const withdrawableAmount = account ? Number(account.balance) - Number(account.frozen_balance) : 0;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2 style={{ marginBottom: 24 }}>平台钱包</h2>
|
||||
|
||||
{account && (
|
||||
<>
|
||||
<Row gutter={24} style={{ marginBottom: 24 }}>
|
||||
<Col span={6}>
|
||||
<Card>
|
||||
<Statistic
|
||||
title="钱包余额"
|
||||
value={account.balance}
|
||||
precision={2}
|
||||
prefix={<WalletOutlined />}
|
||||
suffix="元"
|
||||
valueStyle={{ color: '#1890ff', fontSize: 32 }}
|
||||
/>
|
||||
<div style={{ fontSize: 12, color: '#999', marginTop: 8 }}>
|
||||
平台可支配金额
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={6}>
|
||||
<Card>
|
||||
<Statistic
|
||||
title="可提现金额"
|
||||
value={withdrawableAmount}
|
||||
precision={2}
|
||||
prefix={<DollarOutlined />}
|
||||
suffix="元"
|
||||
valueStyle={{ color: '#52c41a', fontSize: 32 }}
|
||||
/>
|
||||
<div style={{ fontSize: 12, color: '#999', marginTop: 8 }}>
|
||||
钱包余额 - 冻结金额
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={6}>
|
||||
<Card>
|
||||
<Statistic
|
||||
title="冻结金额"
|
||||
value={account.frozen_balance}
|
||||
precision={2}
|
||||
suffix="元"
|
||||
valueStyle={{ color: '#faad14', fontSize: 32 }}
|
||||
/>
|
||||
<div style={{ fontSize: 12, color: '#999', marginTop: 8 }}>
|
||||
提现申请中
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={6}>
|
||||
<Card>
|
||||
<Statistic
|
||||
title="服务费收入"
|
||||
value={account.total_service_fee}
|
||||
precision={2}
|
||||
suffix="元"
|
||||
valueStyle={{ color: '#722ed1', fontSize: 32 }}
|
||||
/>
|
||||
<div style={{ fontSize: 12, color: '#999', marginTop: 8 }}>
|
||||
累计服务费
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<Row gutter={24} style={{ marginBottom: 24 }}>
|
||||
<Col span={8}>
|
||||
<Card>
|
||||
<Statistic
|
||||
title="账户总收入"
|
||||
value={account.total_income}
|
||||
precision={2}
|
||||
prefix={<ArrowUpOutlined />}
|
||||
suffix="元"
|
||||
valueStyle={{ color: '#52c41a', fontSize: 24 }}
|
||||
/>
|
||||
<div style={{ fontSize: 12, color: '#999', marginTop: 8 }}>
|
||||
所有订单支付总额
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<Card>
|
||||
<Statistic
|
||||
title="账户总支出"
|
||||
value={account.total_expense}
|
||||
precision={2}
|
||||
prefix={<ArrowDownOutlined />}
|
||||
suffix="元"
|
||||
valueStyle={{ color: '#ff4d4f', fontSize: 24 }}
|
||||
/>
|
||||
<div style={{ fontSize: 12, color: '#999', marginTop: 8 }}>
|
||||
商家结算 + 邀请返现
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<Card>
|
||||
<Statistic
|
||||
title="其他收入"
|
||||
value={0}
|
||||
precision={2}
|
||||
suffix="元"
|
||||
valueStyle={{ color: '#13c2c2', fontSize: 24 }}
|
||||
/>
|
||||
<div style={{ fontSize: 12, color: '#999', marginTop: 8 }}>
|
||||
广告费、会员费等
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<Card title="钱包详情" loading={loading}>
|
||||
<Descriptions column={2} bordered>
|
||||
<Descriptions.Item label="账户名称">{account.account_name}</Descriptions.Item>
|
||||
<Descriptions.Item label="账户ID">{account.id}</Descriptions.Item>
|
||||
<Descriptions.Item label="钱包余额">
|
||||
<span style={{ fontSize: 16, fontWeight: 'bold', color: '#1890ff' }}>
|
||||
{formatMoney(account.balance)}
|
||||
</span>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="可提现金额">
|
||||
<span style={{ fontSize: 16, fontWeight: 'bold', color: '#52c41a' }}>
|
||||
{formatMoney(withdrawableAmount)}
|
||||
</span>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="冻结金额">
|
||||
<span style={{ fontSize: 16, color: '#faad14' }}>
|
||||
{formatMoney(account.frozen_balance)}
|
||||
</span>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="账户状态">
|
||||
<span style={{ color: account.status === 'active' ? '#52c41a' : '#ff4d4f' }}>
|
||||
{account.status === 'active' ? '正常' : '冻结'}
|
||||
</span>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="服务费收入">
|
||||
<span style={{ color: '#722ed1', fontSize: 16, fontWeight: 'bold' }}>{formatMoney(account.total_service_fee)}</span>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="其他收入">
|
||||
<span style={{ color: '#13c2c2' }}>{formatMoney(0)}</span>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="账户总收入">
|
||||
<span style={{ color: '#52c41a' }}>{formatMoney(account.total_income)}</span>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="账户总支出">
|
||||
<span style={{ color: '#ff4d4f' }}>{formatMoney(account.total_expense)}</span>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="创建时间">{formatDateTime(account.created_at)}</Descriptions.Item>
|
||||
<Descriptions.Item label="更新时间">{formatDateTime(account.updated_at)}</Descriptions.Item>
|
||||
</Descriptions>
|
||||
|
||||
<div style={{ marginTop: 24, textAlign: 'right' }}>
|
||||
<Space>
|
||||
<Button type="primary" icon={<ExportOutlined />} onClick={handleWithdraw}>
|
||||
申请提现
|
||||
</Button>
|
||||
<Button onClick={fetchAccount}>刷新数据</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</Card>
|
||||
</>
|
||||
)}
|
||||
|
||||
<Modal
|
||||
title="平台钱包提现"
|
||||
open={withdrawModalVisible}
|
||||
onCancel={() => {
|
||||
setWithdrawModalVisible(false);
|
||||
form.resetFields();
|
||||
}}
|
||||
footer={null}
|
||||
width={500}
|
||||
>
|
||||
<Form form={form} layout="vertical" onFinish={handleWithdrawSubmit}>
|
||||
<Form.Item label="可提现金额">
|
||||
<div style={{ fontSize: 24, fontWeight: 'bold', color: '#52c41a' }}>
|
||||
{formatMoney(withdrawableAmount)}
|
||||
</div>
|
||||
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>
|
||||
钱包余额 - 冻结金额 = 可提现金额
|
||||
</div>
|
||||
<div style={{ fontSize: 12, color: '#999', marginTop: 4 }}>
|
||||
包含:服务费收入、其他收入,扣除:邀请返现等支出
|
||||
</div>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="bankCardId"
|
||||
label="选择银行卡"
|
||||
rules={[{ required: true, message: '请选择银行卡' }]}
|
||||
>
|
||||
<Select
|
||||
placeholder="请选择银行卡"
|
||||
onChange={handleBankCardChange}
|
||||
options={bankCards.map(card => ({
|
||||
label: `${card.cardName} - ${card.bankName} (${card.bankAccount.replace(/(\d{4})\d+(\d{4})/, '$1****$2')})`,
|
||||
value: card.id,
|
||||
}))}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="amount"
|
||||
label="提现金额"
|
||||
rules={[
|
||||
{ required: true, message: '请输入提现金额' },
|
||||
{
|
||||
validator: (_, value) => {
|
||||
if (value && value > withdrawableAmount) {
|
||||
return Promise.reject(`提现金额不能大于可提现金额(${withdrawableAmount.toFixed(2)}元)`);
|
||||
}
|
||||
if (value && value <= 0) {
|
||||
return Promise.reject('提现金额必须大于0');
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputNumber
|
||||
style={{ width: '100%' }}
|
||||
placeholder="请输入提现金额"
|
||||
min={0}
|
||||
max={withdrawableAmount}
|
||||
precision={2}
|
||||
addonAfter="元"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="bankAccount"
|
||||
label="收款账户"
|
||||
rules={[{ required: true, message: '请输入收款账户' }]}
|
||||
>
|
||||
<Input placeholder="请输入银行账号" disabled />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="bankName"
|
||||
label="开户银行"
|
||||
rules={[{ required: true, message: '请输入开户银行' }]}
|
||||
>
|
||||
<Input placeholder="请输入开户银行" disabled />
|
||||
</Form.Item>
|
||||
<Form.Item name="remark" label="备注">
|
||||
<Input.TextArea rows={3} placeholder="请输入备注信息(选填)" />
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Space style={{ width: '100%', justifyContent: 'flex-end' }}>
|
||||
<Button onClick={() => setWithdrawModalVisible(false)}>取消</Button>
|
||||
<Button type="primary" htmlType="submit">
|
||||
提交申请
|
||||
</Button>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default PlatformWallet;
|
||||
@@ -0,0 +1,403 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Card, Table, Form, Input, Button, Space, Select, Tag, Descriptions, Modal, message } from 'antd';
|
||||
import { SearchOutlined, ReloadOutlined, EyeOutlined, CheckOutlined, CloseOutlined } from '@ant-design/icons';
|
||||
import { getPlatformWithdrawals, approvePlatformWithdrawal, rejectPlatformWithdrawal, confirmPlatformWithdrawal } from '@/api/finance';
|
||||
import type { ColumnsType } from 'antd/es/table';
|
||||
import { formatMoney, formatDateTime } from '@rent/shared-utils';
|
||||
import { useTableData } from '@/hooks/useTableData';
|
||||
import { useModal } from '@/hooks/useModal';
|
||||
|
||||
interface PlatformWithdrawal {
|
||||
id: number;
|
||||
withdrawal_no: string;
|
||||
account_id: number;
|
||||
amount: number;
|
||||
bank_account: string;
|
||||
bank_name: string;
|
||||
account_name: string;
|
||||
status: 'pending' | 'approved' | 'rejected' | 'paid' | 'failed';
|
||||
remark?: string;
|
||||
reject_reason?: string;
|
||||
reviewer_id?: number;
|
||||
reviewed_at?: string;
|
||||
payment_no?: string;
|
||||
paid_at?: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
const statusConfig = {
|
||||
pending: { text: '待审核', color: 'orange' },
|
||||
approved: { text: '已审核', color: 'blue' },
|
||||
rejected: { text: '已拒绝', color: 'red' },
|
||||
paid: { text: '已打款', color: 'green' },
|
||||
failed: { text: '打款失败', color: 'red' },
|
||||
};
|
||||
|
||||
const PlatformWithdrawals: React.FC = () => {
|
||||
const [form] = Form.useForm();
|
||||
const [rejectForm] = Form.useForm();
|
||||
const [confirmForm] = Form.useForm();
|
||||
const detailModal = useModal<PlatformWithdrawal>();
|
||||
const rejectModal = useModal<PlatformWithdrawal>();
|
||||
const confirmModal = useModal<PlatformWithdrawal>();
|
||||
|
||||
const {
|
||||
data: withdrawals,
|
||||
loading,
|
||||
total,
|
||||
page,
|
||||
pageSize,
|
||||
setPage,
|
||||
setPageSize,
|
||||
refresh,
|
||||
} = useTableData<PlatformWithdrawal>({
|
||||
fetchFn: async (params) => {
|
||||
const res = await getPlatformWithdrawals(params);
|
||||
return {
|
||||
list: res.data.items,
|
||||
total: res.data.total,
|
||||
page: params.page || 1,
|
||||
pageSize: params.pageSize || 20,
|
||||
totalPages: Math.ceil(res.data.total / (params.pageSize || 20)),
|
||||
};
|
||||
},
|
||||
initialParams: { pageSize: 20 },
|
||||
});
|
||||
|
||||
const handleSearch = () => {
|
||||
const values = form.getFieldsValue();
|
||||
refresh({ ...values, page: 1 });
|
||||
};
|
||||
|
||||
const handleReset = () => {
|
||||
form.resetFields();
|
||||
refresh({ page: 1 });
|
||||
};
|
||||
|
||||
const handleViewDetail = (record: PlatformWithdrawal) => {
|
||||
detailModal.open(record);
|
||||
};
|
||||
|
||||
const handleApprove = async (record: PlatformWithdrawal) => {
|
||||
Modal.confirm({
|
||||
title: '确认审核通过',
|
||||
content: `确定要审核通过提现申请 ${record.withdrawal_no} 吗?`,
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
try {
|
||||
await approvePlatformWithdrawal(record.id);
|
||||
message.success('审核通过成功');
|
||||
refresh();
|
||||
} catch (error: any) {
|
||||
message.error(error.response?.data?.message || '审核失败');
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const handleReject = (record: PlatformWithdrawal) => {
|
||||
rejectModal.open(record);
|
||||
};
|
||||
|
||||
const handleRejectSubmit = async (values: any) => {
|
||||
if (!rejectModal.data) return;
|
||||
try {
|
||||
await rejectPlatformWithdrawal(rejectModal.data.id, values.rejectReason);
|
||||
message.success('已拒绝提现申请');
|
||||
rejectModal.close();
|
||||
rejectForm.resetFields();
|
||||
refresh();
|
||||
} catch (error: any) {
|
||||
message.error(error.response?.data?.message || '操作失败');
|
||||
}
|
||||
};
|
||||
|
||||
const handleConfirm = (record: PlatformWithdrawal) => {
|
||||
confirmModal.open(record);
|
||||
};
|
||||
|
||||
const handleConfirmSubmit = async (values: any) => {
|
||||
if (!confirmModal.data) return;
|
||||
try {
|
||||
await confirmPlatformWithdrawal(confirmModal.data.id, values.paymentNo);
|
||||
message.success('打款确认成功');
|
||||
confirmModal.close();
|
||||
confirmForm.resetFields();
|
||||
refresh();
|
||||
} catch (error: any) {
|
||||
message.error(error.response?.data?.message || '操作失败');
|
||||
}
|
||||
};
|
||||
|
||||
const columns: ColumnsType<PlatformWithdrawal> = [
|
||||
{
|
||||
title: '提现单号',
|
||||
dataIndex: 'withdrawal_no',
|
||||
key: 'withdrawal_no',
|
||||
width: 180,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
title: '提现金额',
|
||||
dataIndex: 'amount',
|
||||
key: 'amount',
|
||||
width: 120,
|
||||
render: (amount: number) => (
|
||||
<span style={{ fontWeight: 'bold', color: '#ff4d4f' }}>{formatMoney(amount)}</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '收款账户',
|
||||
dataIndex: 'bank_account',
|
||||
key: 'bank_account',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '开户银行',
|
||||
dataIndex: 'bank_name',
|
||||
key: 'bank_name',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '账户名称',
|
||||
dataIndex: 'account_name',
|
||||
key: 'account_name',
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
width: 100,
|
||||
render: (status: string) => {
|
||||
const config = statusConfig[status as keyof typeof statusConfig] || { text: status, color: 'default' };
|
||||
return <Tag color={config.color}>{config.text}</Tag>;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '申请时间',
|
||||
dataIndex: 'created_at',
|
||||
key: 'created_at',
|
||||
width: 180,
|
||||
render: (date: string) => formatDateTime(date),
|
||||
},
|
||||
{
|
||||
title: '审核时间',
|
||||
dataIndex: 'reviewed_at',
|
||||
key: 'reviewed_at',
|
||||
width: 180,
|
||||
render: (date: string) => (date ? formatDateTime(date) : '-'),
|
||||
},
|
||||
{
|
||||
title: '打款时间',
|
||||
dataIndex: 'paid_at',
|
||||
key: 'paid_at',
|
||||
width: 180,
|
||||
render: (date: string) => (date ? formatDateTime(date) : '-'),
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 200,
|
||||
fixed: 'right',
|
||||
render: (_, record: PlatformWithdrawal) => (
|
||||
<Space>
|
||||
<Button type="link" size="small" icon={<EyeOutlined />} onClick={() => handleViewDetail(record)}>
|
||||
详情
|
||||
</Button>
|
||||
{record.status === 'pending' && (
|
||||
<>
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
icon={<CheckOutlined />}
|
||||
onClick={() => handleApprove(record)}
|
||||
style={{ color: '#52c41a' }}
|
||||
>
|
||||
通过
|
||||
</Button>
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
icon={<CloseOutlined />}
|
||||
onClick={() => handleReject(record)}
|
||||
danger
|
||||
>
|
||||
拒绝
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
{record.status === 'approved' && (
|
||||
<Button type="link" size="small" onClick={() => handleConfirm(record)}>
|
||||
确认打款
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2 style={{ marginBottom: 24 }}>平台服务费提现管理</h2>
|
||||
|
||||
<Card>
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<Form form={form} layout="inline">
|
||||
<Form.Item name="withdrawalNo" label="提现单号">
|
||||
<Input placeholder="请输入提现单号" style={{ width: 180 }} />
|
||||
</Form.Item>
|
||||
<Form.Item name="status" label="状态">
|
||||
<Select placeholder="请选择" style={{ width: 120 }} allowClear>
|
||||
<Select.Option value="pending">待审核</Select.Option>
|
||||
<Select.Option value="approved">已审核</Select.Option>
|
||||
<Select.Option value="rejected">已拒绝</Select.Option>
|
||||
<Select.Option value="paid">已打款</Select.Option>
|
||||
<Select.Option value="failed">打款失败</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Space>
|
||||
<Button type="primary" icon={<SearchOutlined />} onClick={handleSearch}>
|
||||
查询
|
||||
</Button>
|
||||
<Button icon={<ReloadOutlined />} onClick={handleReset}>
|
||||
重置
|
||||
</Button>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={withdrawals}
|
||||
rowKey="id"
|
||||
loading={loading}
|
||||
scroll={{ x: 1600 }}
|
||||
pagination={{
|
||||
current: page,
|
||||
pageSize,
|
||||
total,
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
showTotal: (total) => `共 ${total} 条`,
|
||||
onChange: setPage,
|
||||
onShowSizeChange: (_, size) => setPageSize(size),
|
||||
}}
|
||||
/>
|
||||
</Card>
|
||||
|
||||
<Modal
|
||||
title="提现详情"
|
||||
open={detailModal.visible}
|
||||
onCancel={detailModal.close}
|
||||
footer={null}
|
||||
width={700}
|
||||
>
|
||||
{detailModal.data && (
|
||||
<Descriptions column={1} bordered>
|
||||
<Descriptions.Item label="提现单号">{detailModal.data.withdrawal_no}</Descriptions.Item>
|
||||
<Descriptions.Item label="提现金额">
|
||||
<span style={{ fontSize: 18, fontWeight: 'bold', color: '#ff4d4f' }}>
|
||||
{formatMoney(detailModal.data.amount)}
|
||||
</span>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="收款账户">{detailModal.data.bank_account}</Descriptions.Item>
|
||||
<Descriptions.Item label="开户银行">{detailModal.data.bank_name}</Descriptions.Item>
|
||||
<Descriptions.Item label="账户名称">{detailModal.data.account_name}</Descriptions.Item>
|
||||
<Descriptions.Item label="状态">
|
||||
<Tag color={statusConfig[detailModal.data.status].color}>
|
||||
{statusConfig[detailModal.data.status].text}
|
||||
</Tag>
|
||||
</Descriptions.Item>
|
||||
{detailModal.data.remark && (
|
||||
<Descriptions.Item label="备注">{detailModal.data.remark}</Descriptions.Item>
|
||||
)}
|
||||
{detailModal.data.reject_reason && (
|
||||
<Descriptions.Item label="拒绝原因">
|
||||
<span style={{ color: '#ff4d4f' }}>{detailModal.data.reject_reason}</span>
|
||||
</Descriptions.Item>
|
||||
)}
|
||||
{detailModal.data.payment_no && (
|
||||
<Descriptions.Item label="打款流水号">{detailModal.data.payment_no}</Descriptions.Item>
|
||||
)}
|
||||
<Descriptions.Item label="申请时间">{formatDateTime(detailModal.data.created_at)}</Descriptions.Item>
|
||||
{detailModal.data.reviewed_at && (
|
||||
<Descriptions.Item label="审核时间">{formatDateTime(detailModal.data.reviewed_at)}</Descriptions.Item>
|
||||
)}
|
||||
{detailModal.data.paid_at && (
|
||||
<Descriptions.Item label="打款时间">{formatDateTime(detailModal.data.paid_at)}</Descriptions.Item>
|
||||
)}
|
||||
</Descriptions>
|
||||
)}
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title="拒绝提现申请"
|
||||
open={rejectModal.visible}
|
||||
onCancel={() => {
|
||||
rejectModal.close();
|
||||
rejectForm.resetFields();
|
||||
}}
|
||||
footer={null}
|
||||
width={500}
|
||||
>
|
||||
<Form form={rejectForm} layout="vertical" onFinish={handleRejectSubmit}>
|
||||
<Form.Item
|
||||
name="rejectReason"
|
||||
label="拒绝原因"
|
||||
rules={[{ required: true, message: '请输入拒绝原因' }]}
|
||||
>
|
||||
<Input.TextArea rows={4} placeholder="请输入拒绝原因" />
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Space style={{ width: '100%', justifyContent: 'flex-end' }}>
|
||||
<Button onClick={() => rejectModal.close()}>取消</Button>
|
||||
<Button type="primary" danger htmlType="submit">
|
||||
确认拒绝
|
||||
</Button>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title="确认打款"
|
||||
open={confirmModal.visible}
|
||||
onCancel={() => {
|
||||
confirmModal.close();
|
||||
confirmForm.resetFields();
|
||||
}}
|
||||
footer={null}
|
||||
width={500}
|
||||
>
|
||||
<Form form={confirmForm} layout="vertical" onFinish={handleConfirmSubmit}>
|
||||
<Form.Item label="提现金额">
|
||||
<div style={{ fontSize: 24, fontWeight: 'bold', color: '#ff4d4f' }}>
|
||||
{confirmModal.data && formatMoney(confirmModal.data.amount)}
|
||||
</div>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="paymentNo"
|
||||
label="打款流水号"
|
||||
rules={[{ required: true, message: '请输入打款流水号' }]}
|
||||
>
|
||||
<Input placeholder="请输入银行打款流水号" />
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Space style={{ width: '100%', justifyContent: 'flex-end' }}>
|
||||
<Button onClick={() => confirmModal.close()}>取消</Button>
|
||||
<Button type="primary" htmlType="submit">
|
||||
确认打款
|
||||
</Button>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default PlatformWithdrawals;
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Card, Table, Button, Space, Modal, Form, DatePicker, InputNumber, message, Descriptions } from 'antd';
|
||||
import { PlusOutlined, EyeOutlined } from '@ant-design/icons';
|
||||
import { getSettlements, getSettlementDetail, getSettlementItems, generateSettlement } from '@/api/finance';
|
||||
import { Card, Table, Button, Space, Modal, Form, DatePicker, InputNumber, message, Descriptions, Alert, Divider } from 'antd';
|
||||
import { PlusOutlined, EyeOutlined, ThunderboltOutlined } from '@ant-design/icons';
|
||||
import { getSettlements, getSettlementDetail, getSettlementItems, generateSettlement, executeWeeklySettlement, previewWeeklySettlement } from '@/api/finance';
|
||||
import type { ColumnsType } from 'antd/es/table';
|
||||
import type { Settlement } from '@rent/shared-types';
|
||||
import { formatMoney, formatDateTime } from '@rent/shared-utils';
|
||||
@@ -25,9 +25,29 @@ interface PlatformSettlement extends Settlement {
|
||||
merchantName: string;
|
||||
}
|
||||
|
||||
interface WeeklySettlementPreview {
|
||||
periodStart: string;
|
||||
periodEnd: string;
|
||||
totalOrders: number;
|
||||
totalAmount: number;
|
||||
totalServiceFee: number;
|
||||
totalSettlementAmount: number;
|
||||
merchants: Array<{
|
||||
merchantId: number;
|
||||
merchantName: string;
|
||||
orderCount: number;
|
||||
orderAmount: number;
|
||||
serviceFee: number;
|
||||
settlementAmount: number;
|
||||
}>;
|
||||
}
|
||||
|
||||
const Settlements: React.FC = () => {
|
||||
const [form] = Form.useForm();
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
const [executing, setExecuting] = useState(false);
|
||||
const [previewData, setPreviewData] = useState<WeeklySettlementPreview | null>(null);
|
||||
const [previewLoading, setPreviewLoading] = useState(false);
|
||||
|
||||
const {
|
||||
data: settlements,
|
||||
@@ -55,6 +75,7 @@ const Settlements: React.FC = () => {
|
||||
const generateModal = useModal();
|
||||
const detailModal = useModal<PlatformSettlement>();
|
||||
const itemsModal = useModal<number>();
|
||||
const weeklyModal = useModal();
|
||||
const [items, setItems] = useState<SettlementItem[]>([]);
|
||||
const [itemsLoading, setItemsLoading] = useState(false);
|
||||
const [itemsPagination, setItemsPagination] = useState({ current: 1, pageSize: 10, total: 0 });
|
||||
@@ -95,6 +116,41 @@ const Settlements: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handlePreviewWeekly = async () => {
|
||||
setPreviewLoading(true);
|
||||
try {
|
||||
const res = await previewWeeklySettlement();
|
||||
setPreviewData(res.data);
|
||||
weeklyModal.open();
|
||||
} catch (error: any) {
|
||||
message.error(error.response?.data?.message || error.message || '获取预览数据失败');
|
||||
} finally {
|
||||
setPreviewLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleExecuteWeekly = async () => {
|
||||
Modal.confirm({
|
||||
title: '确认执行周结算',
|
||||
content: '确定要执行周结算吗?此操作将为所有商家生成上周的结算单并转账。',
|
||||
okText: '确认执行',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
setExecuting(true);
|
||||
try {
|
||||
await executeWeeklySettlement();
|
||||
message.success('周结算执行成功');
|
||||
weeklyModal.close();
|
||||
refresh();
|
||||
} catch (error: any) {
|
||||
message.error(error.response?.data?.message || error.message || '执行失败');
|
||||
} finally {
|
||||
setExecuting(false);
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const columns: ColumnsType<PlatformSettlement> = [
|
||||
{
|
||||
title: '结算ID',
|
||||
@@ -231,9 +287,19 @@ const Settlements: React.FC = () => {
|
||||
|
||||
<Card>
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<Button type="primary" icon={<PlusOutlined />} onClick={() => generateModal.open()}>
|
||||
生成结算单
|
||||
</Button>
|
||||
<Space>
|
||||
<Button type="primary" icon={<PlusOutlined />} onClick={() => generateModal.open()}>
|
||||
生成结算单
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<ThunderboltOutlined />}
|
||||
onClick={handlePreviewWeekly}
|
||||
loading={previewLoading}
|
||||
>
|
||||
执行周结算
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
|
||||
<Table
|
||||
@@ -352,6 +418,104 @@ const Settlements: React.FC = () => {
|
||||
}}
|
||||
/>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title="执行周结算"
|
||||
open={weeklyModal.visible}
|
||||
onCancel={weeklyModal.close}
|
||||
footer={null}
|
||||
width={900}
|
||||
>
|
||||
{previewData && (
|
||||
<>
|
||||
<Alert
|
||||
message="结算周期"
|
||||
description={`${previewData.periodStart} ~ ${previewData.periodEnd}`}
|
||||
type="info"
|
||||
showIcon
|
||||
style={{ marginBottom: 16 }}
|
||||
/>
|
||||
|
||||
<Descriptions column={2} bordered style={{ marginBottom: 16 }}>
|
||||
<Descriptions.Item label="订单总数">{previewData.totalOrders} 笔</Descriptions.Item>
|
||||
<Descriptions.Item label="订单总额">{formatMoney(previewData.totalAmount)}</Descriptions.Item>
|
||||
<Descriptions.Item label="服务费总额">
|
||||
<span style={{ color: '#52c41a' }}>{formatMoney(previewData.totalServiceFee)}</span>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="结算总额">
|
||||
<span style={{ fontWeight: 'bold' }}>{formatMoney(previewData.totalSettlementAmount)}</span>
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
|
||||
<Divider>商家结算明细</Divider>
|
||||
|
||||
{previewData.merchants.length === 0 ? (
|
||||
<Alert message="没有需要结算的订单" type="warning" showIcon />
|
||||
) : (
|
||||
<>
|
||||
<Table
|
||||
dataSource={previewData.merchants}
|
||||
rowKey="merchantId"
|
||||
pagination={false}
|
||||
size="small"
|
||||
columns={[
|
||||
{
|
||||
title: '商家ID',
|
||||
dataIndex: 'merchantId',
|
||||
key: 'merchantId',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '商家名称',
|
||||
dataIndex: 'merchantName',
|
||||
key: 'merchantName',
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
title: '订单数',
|
||||
dataIndex: 'orderCount',
|
||||
key: 'orderCount',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '订单总额',
|
||||
dataIndex: 'orderAmount',
|
||||
key: 'orderAmount',
|
||||
width: 120,
|
||||
render: (amount: number) => formatMoney(amount),
|
||||
},
|
||||
{
|
||||
title: '服务费',
|
||||
dataIndex: 'serviceFee',
|
||||
key: 'serviceFee',
|
||||
width: 120,
|
||||
render: (fee: number) => <span style={{ color: '#52c41a' }}>{formatMoney(fee)}</span>,
|
||||
},
|
||||
{
|
||||
title: '结算金额',
|
||||
dataIndex: 'settlementAmount',
|
||||
key: 'settlementAmount',
|
||||
width: 120,
|
||||
render: (amount: number) => (
|
||||
<span style={{ fontWeight: 'bold' }}>{formatMoney(amount)}</span>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
<div style={{ marginTop: 16, textAlign: 'right' }}>
|
||||
<Space>
|
||||
<Button onClick={weeklyModal.close}>取消</Button>
|
||||
<Button type="primary" onClick={handleExecuteWeekly} loading={executing}>
|
||||
确认执行结算
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user