接单员与财务管理
This commit is contained in:
@@ -0,0 +1,155 @@
|
||||
import { Tag, Typography } from 'antd';
|
||||
import React from 'react';
|
||||
import XinTable from '@/components/XinTable';
|
||||
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings';
|
||||
import type IDepositPayment from '@/domain/iDepositPayment';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import dayjs from 'dayjs';
|
||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
|
||||
const { Title, Text } = Typography;
|
||||
dayjs.extend(relativeTime);
|
||||
|
||||
const Table: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const columns: XinTableColumn<IDepositPayment>[] = [
|
||||
{
|
||||
title: t('finance.deposit_payment.id'),
|
||||
dataIndex: 'id',
|
||||
hideInForm: true,
|
||||
sorter: true,
|
||||
align: 'center',
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit_payment.payment_no'),
|
||||
dataIndex: 'payment_no',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit_payment.deposit_id'),
|
||||
dataIndex: 'deposit_id',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit_payment.user_id'),
|
||||
dataIndex: 'user_id',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit_payment.payment_transaction_id'),
|
||||
dataIndex: 'payment_transaction_id',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit_payment.amount'),
|
||||
dataIndex: 'amount',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit_payment.pay_type'),
|
||||
dataIndex: 'pay_type',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit_payment.status'),
|
||||
dataIndex: 'status',
|
||||
valueType: 'radioButton',
|
||||
fieldProps: {
|
||||
options: [
|
||||
{ value: 0, label: t('finance.deposit_payment.status.0') },
|
||||
{ value: 1, label: t('finance.deposit_payment.status.1') },
|
||||
{ value: 2, label: t('finance.deposit_payment.status.2') },
|
||||
],
|
||||
},
|
||||
render: (value: number) => {
|
||||
if (value === 1) return <Tag color="success">{t('finance.deposit_payment.status.1')}</Tag>;
|
||||
if (value === 2) return <Tag color="warning">{t('finance.deposit_payment.status.2')}</Tag>;
|
||||
return <Tag color="default">{t('finance.deposit_payment.status.0')}</Tag>;
|
||||
},
|
||||
filters: [
|
||||
{ text: t('finance.deposit_payment.status.0'), value: 0 },
|
||||
{ text: t('finance.deposit_payment.status.1'), value: 1 },
|
||||
{ text: t('finance.deposit_payment.status.2'), value: 2 },
|
||||
],
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit_payment.paid_at'),
|
||||
dataIndex: 'paid_at',
|
||||
hideInForm: true,
|
||||
hideInSearch: true,
|
||||
align: 'center',
|
||||
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit_payment.refund_at'),
|
||||
dataIndex: 'refund_at',
|
||||
hideInForm: true,
|
||||
hideInSearch: true,
|
||||
align: 'center',
|
||||
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit_payment.created_at'),
|
||||
hideInForm: true,
|
||||
hideInSearch: true,
|
||||
dataIndex: 'created_at',
|
||||
align: 'center',
|
||||
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit_payment.updated_at'),
|
||||
hideInForm: true,
|
||||
hideInSearch: true,
|
||||
dataIndex: 'updated_at',
|
||||
align: 'center',
|
||||
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||
},
|
||||
];
|
||||
|
||||
const tableProps: XinTableProps<IDepositPayment> = {
|
||||
api: '/runner/deposit-payment',
|
||||
columns,
|
||||
rowKey: 'id',
|
||||
accessName: 'runner.deposit_payment',
|
||||
addShow: false,
|
||||
editShow: false,
|
||||
formProps: {
|
||||
grid: true,
|
||||
colProps: { span: 12 },
|
||||
rowProps: { gutter: [30, 0] },
|
||||
layout: 'vertical',
|
||||
},
|
||||
modalProps: {
|
||||
width: 800,
|
||||
},
|
||||
cardProps: {
|
||||
variant: 'borderless',
|
||||
},
|
||||
pagination: {
|
||||
size: 'small',
|
||||
style: { marginBottom: 0 },
|
||||
},
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="mb-5">
|
||||
<Title level={3}>{t('finance.deposit_payment.page.title')}</Title>
|
||||
<Text type="secondary">{t('finance.deposit_payment.page.description')}</Text>
|
||||
</div>
|
||||
<XinTable<IDepositPayment> {...tableProps} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Table;
|
||||
@@ -0,0 +1,158 @@
|
||||
import { Tag, Typography } from 'antd';
|
||||
import React from 'react';
|
||||
import XinTable from '@/components/XinTable';
|
||||
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings';
|
||||
import type IRunnerDeposit from '@/domain/iRunnerDeposit';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import dayjs from 'dayjs';
|
||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
|
||||
const { Title, Text } = Typography;
|
||||
dayjs.extend(relativeTime);
|
||||
|
||||
const Table: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const columns: XinTableColumn<IRunnerDeposit>[] = [
|
||||
{
|
||||
title: t('finance.deposit.id'),
|
||||
dataIndex: 'id',
|
||||
hideInForm: true,
|
||||
sorter: true,
|
||||
align: 'center',
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit.deposit_no'),
|
||||
dataIndex: 'deposit_no',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit.worker_id'),
|
||||
dataIndex: 'worker_id',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit.user_id'),
|
||||
dataIndex: 'user_id',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit.amount'),
|
||||
dataIndex: 'amount',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit.status'),
|
||||
dataIndex: 'status',
|
||||
valueType: 'radioButton',
|
||||
fieldProps: {
|
||||
options: [
|
||||
{ value: 0, label: t('finance.deposit.status.0') },
|
||||
{ value: 1, label: t('finance.deposit.status.1') },
|
||||
{ value: 2, label: t('finance.deposit.status.2') },
|
||||
{ value: 3, label: t('finance.deposit.status.3') },
|
||||
],
|
||||
},
|
||||
render: (value: number) => {
|
||||
if (value === 1) return <Tag color="success">{t('finance.deposit.status.1')}</Tag>;
|
||||
if (value === 2) return <Tag color="warning">{t('finance.deposit.status.2')}</Tag>;
|
||||
if (value === 3) return <Tag color="error">{t('finance.deposit.status.3')}</Tag>;
|
||||
return <Tag color="default">{t('finance.deposit.status.0')}</Tag>;
|
||||
},
|
||||
filters: [
|
||||
{ text: t('finance.deposit.status.0'), value: 0 },
|
||||
{ text: t('finance.deposit.status.1'), value: 1 },
|
||||
{ text: t('finance.deposit.status.2'), value: 2 },
|
||||
{ text: t('finance.deposit.status.3'), value: 3 },
|
||||
],
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit.deduct_reason'),
|
||||
dataIndex: 'deduct_reason',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit.paid_at'),
|
||||
dataIndex: 'paid_at',
|
||||
hideInForm: true,
|
||||
hideInSearch: true,
|
||||
align: 'center',
|
||||
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit.refund_at'),
|
||||
dataIndex: 'refund_at',
|
||||
hideInForm: true,
|
||||
hideInSearch: true,
|
||||
align: 'center',
|
||||
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit.deducted_at'),
|
||||
dataIndex: 'deducted_at',
|
||||
hideInForm: true,
|
||||
hideInSearch: true,
|
||||
align: 'center',
|
||||
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit.created_at'),
|
||||
hideInForm: true,
|
||||
hideInSearch: true,
|
||||
dataIndex: 'created_at',
|
||||
align: 'center',
|
||||
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||
},
|
||||
{
|
||||
title: t('finance.deposit.updated_at'),
|
||||
hideInForm: true,
|
||||
hideInSearch: true,
|
||||
dataIndex: 'updated_at',
|
||||
align: 'center',
|
||||
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||
},
|
||||
];
|
||||
|
||||
const tableProps: XinTableProps<IRunnerDeposit> = {
|
||||
api: '/runner/deposit',
|
||||
columns,
|
||||
rowKey: 'id',
|
||||
accessName: 'runner.deposit',
|
||||
formProps: {
|
||||
grid: true,
|
||||
colProps: { span: 12 },
|
||||
rowProps: { gutter: [30, 0] },
|
||||
layout: 'vertical',
|
||||
},
|
||||
modalProps: {
|
||||
width: 800,
|
||||
},
|
||||
cardProps: {
|
||||
variant: 'borderless',
|
||||
},
|
||||
pagination: {
|
||||
size: 'small',
|
||||
style: { marginBottom: 0 },
|
||||
},
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="mb-5">
|
||||
<Title level={3}>{t('finance.deposit.page.title')}</Title>
|
||||
<Text type="secondary">{t('finance.deposit.page.description')}</Text>
|
||||
</div>
|
||||
<XinTable<IRunnerDeposit> {...tableProps} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Table;
|
||||
@@ -0,0 +1,155 @@
|
||||
import { Tag, Typography } from 'antd';
|
||||
import React from 'react';
|
||||
import XinTable from '@/components/XinTable';
|
||||
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings';
|
||||
import type ITaskPayment from '@/domain/iTaskPayment';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import dayjs from 'dayjs';
|
||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
|
||||
const { Title, Text } = Typography;
|
||||
dayjs.extend(relativeTime);
|
||||
|
||||
const Table: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const columns: XinTableColumn<ITaskPayment>[] = [
|
||||
{
|
||||
title: t('finance.task_payment.id'),
|
||||
dataIndex: 'id',
|
||||
hideInForm: true,
|
||||
sorter: true,
|
||||
align: 'center',
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: t('finance.task_payment.payment_no'),
|
||||
dataIndex: 'payment_no',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.task_payment.order_id'),
|
||||
dataIndex: 'order_id',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.task_payment.user_id'),
|
||||
dataIndex: 'user_id',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.task_payment.payment_transaction_id'),
|
||||
dataIndex: 'payment_transaction_id',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: t('finance.task_payment.amount'),
|
||||
dataIndex: 'amount',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.task_payment.pay_type'),
|
||||
dataIndex: 'pay_type',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.task_payment.status'),
|
||||
dataIndex: 'status',
|
||||
valueType: 'radioButton',
|
||||
fieldProps: {
|
||||
options: [
|
||||
{ value: 0, label: t('finance.task_payment.status.0') },
|
||||
{ value: 1, label: t('finance.task_payment.status.1') },
|
||||
{ value: 2, label: t('finance.task_payment.status.2') },
|
||||
],
|
||||
},
|
||||
render: (value: number) => {
|
||||
if (value === 1) return <Tag color="success">{t('finance.task_payment.status.1')}</Tag>;
|
||||
if (value === 2) return <Tag color="warning">{t('finance.task_payment.status.2')}</Tag>;
|
||||
return <Tag color="default">{t('finance.task_payment.status.0')}</Tag>;
|
||||
},
|
||||
filters: [
|
||||
{ text: t('finance.task_payment.status.0'), value: 0 },
|
||||
{ text: t('finance.task_payment.status.1'), value: 1 },
|
||||
{ text: t('finance.task_payment.status.2'), value: 2 },
|
||||
],
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.task_payment.paid_at'),
|
||||
dataIndex: 'paid_at',
|
||||
hideInForm: true,
|
||||
hideInSearch: true,
|
||||
align: 'center',
|
||||
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||
},
|
||||
{
|
||||
title: t('finance.task_payment.refund_at'),
|
||||
dataIndex: 'refund_at',
|
||||
hideInForm: true,
|
||||
hideInSearch: true,
|
||||
align: 'center',
|
||||
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||
},
|
||||
{
|
||||
title: t('finance.task_payment.created_at'),
|
||||
hideInForm: true,
|
||||
hideInSearch: true,
|
||||
dataIndex: 'created_at',
|
||||
align: 'center',
|
||||
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||
},
|
||||
{
|
||||
title: t('finance.task_payment.updated_at'),
|
||||
hideInForm: true,
|
||||
hideInSearch: true,
|
||||
dataIndex: 'updated_at',
|
||||
align: 'center',
|
||||
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||
},
|
||||
];
|
||||
|
||||
const tableProps: XinTableProps<ITaskPayment> = {
|
||||
api: '/task/payment',
|
||||
columns,
|
||||
rowKey: 'id',
|
||||
accessName: 'task.payment',
|
||||
addShow: false,
|
||||
editShow: false,
|
||||
formProps: {
|
||||
grid: true,
|
||||
colProps: { span: 12 },
|
||||
rowProps: { gutter: [30, 0] },
|
||||
layout: 'vertical',
|
||||
},
|
||||
modalProps: {
|
||||
width: 800,
|
||||
},
|
||||
cardProps: {
|
||||
variant: 'borderless',
|
||||
},
|
||||
pagination: {
|
||||
size: 'small',
|
||||
style: { marginBottom: 0 },
|
||||
},
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="mb-5">
|
||||
<Title level={3}>{t('finance.task_payment.page.title')}</Title>
|
||||
<Text type="secondary">{t('finance.task_payment.page.description')}</Text>
|
||||
</div>
|
||||
<XinTable<ITaskPayment> {...tableProps} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Table;
|
||||
@@ -0,0 +1,197 @@
|
||||
import { Tag, Typography } from 'antd';
|
||||
import React from 'react';
|
||||
import XinTable from '@/components/XinTable';
|
||||
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings';
|
||||
import type IPaymentTransaction from '@/domain/iPaymentTransaction';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import dayjs from 'dayjs';
|
||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
|
||||
const { Title, Text } = Typography;
|
||||
dayjs.extend(relativeTime);
|
||||
|
||||
const statusMap: Record<number, { color: string; text: string }> = {
|
||||
0: { color: 'processing', text: '待支付' },
|
||||
1: { color: 'success', text: '支付成功' },
|
||||
2: { color: 'error', text: '支付失败' },
|
||||
3: { color: 'warning', text: '已退款' },
|
||||
};
|
||||
|
||||
const Table: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const columns: XinTableColumn<IPaymentTransaction>[] = [
|
||||
{
|
||||
title: t('finance.transaction.id'),
|
||||
dataIndex: 'id',
|
||||
hideInForm: true,
|
||||
sorter: true,
|
||||
align: 'center',
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: t('finance.transaction.transaction_no'),
|
||||
dataIndex: 'transaction_no',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
width: 220,
|
||||
},
|
||||
{
|
||||
title: t('finance.transaction.out_trade_no'),
|
||||
dataIndex: 'out_trade_no',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
title: t('finance.transaction.pay_type'),
|
||||
dataIndex: 'pay_type',
|
||||
valueType: 'radioButton',
|
||||
fieldProps: {
|
||||
options: [
|
||||
{ value: 'wechat', label: t('finance.transaction.pay_type.wechat') },
|
||||
{ value: 'alipay', label: t('finance.transaction.pay_type.alipay') },
|
||||
],
|
||||
},
|
||||
render: (value: string) => (
|
||||
<Tag>{value === 'wechat' ? t('finance.transaction.pay_type.wechat') : t('finance.transaction.pay_type.alipay')}</Tag>
|
||||
),
|
||||
filters: [
|
||||
{ text: t('finance.transaction.pay_type.wechat'), value: 'wechat' },
|
||||
{ text: t('finance.transaction.pay_type.alipay'), value: 'alipay' },
|
||||
],
|
||||
align: 'center',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: t('finance.transaction.amount'),
|
||||
dataIndex: 'amount',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
render: (value: string) => `¥${value || '0.00'}`,
|
||||
},
|
||||
{
|
||||
title: t('finance.transaction.status'),
|
||||
dataIndex: 'status',
|
||||
valueType: 'radioButton',
|
||||
fieldProps: {
|
||||
options: [
|
||||
{ value: 0, label: '待支付' },
|
||||
{ value: 1, label: '支付成功' },
|
||||
{ value: 2, label: '支付失败' },
|
||||
{ value: 3, label: '已退款' },
|
||||
],
|
||||
},
|
||||
render: (value: number) => {
|
||||
const item = statusMap[value] || { color: 'default', text: '未知' };
|
||||
return <Tag color={item.color}>{item.text}</Tag>;
|
||||
},
|
||||
filters: [
|
||||
{ text: '待支付', value: 0 },
|
||||
{ text: '支付成功', value: 1 },
|
||||
{ text: '支付失败', value: 2 },
|
||||
{ text: '已退款', value: 3 },
|
||||
],
|
||||
align: 'center',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: t('finance.transaction.business_type'),
|
||||
dataIndex: 'business_type',
|
||||
valueType: 'radioButton',
|
||||
fieldProps: {
|
||||
options: [
|
||||
{ value: 'task', label: t('finance.transaction.business_type.task') },
|
||||
{ value: 'deposit', label: t('finance.transaction.business_type.deposit') },
|
||||
{ value: 'order', label: t('finance.transaction.business_type.order') },
|
||||
],
|
||||
},
|
||||
render: (value: string) => {
|
||||
const labels: Record<string, string> = {
|
||||
task: t('finance.transaction.business_type.task'),
|
||||
deposit: t('finance.transaction.business_type.deposit'),
|
||||
order: t('finance.transaction.business_type.order'),
|
||||
};
|
||||
return <Tag>{labels[value] || value}</Tag>;
|
||||
},
|
||||
filters: [
|
||||
{ text: t('finance.transaction.business_type.task'), value: 'task' },
|
||||
{ text: t('finance.transaction.business_type.deposit'), value: 'deposit' },
|
||||
{ text: t('finance.transaction.business_type.order'), value: 'order' },
|
||||
],
|
||||
align: 'center',
|
||||
width: 110,
|
||||
},
|
||||
{
|
||||
title: t('finance.transaction.business_id'),
|
||||
dataIndex: 'business_id',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
width: 90,
|
||||
},
|
||||
{
|
||||
title: t('finance.transaction.user_id'),
|
||||
dataIndex: 'user_id',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
width: 90,
|
||||
},
|
||||
{
|
||||
title: t('finance.transaction.paid_at'),
|
||||
dataIndex: 'paid_at',
|
||||
valueType: 'date',
|
||||
hideInSearch: true,
|
||||
align: 'center',
|
||||
width: 180,
|
||||
render: (value: string) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : '-'),
|
||||
},
|
||||
{
|
||||
title: t('finance.transaction.created_at'),
|
||||
hideInForm: true,
|
||||
hideInSearch: true,
|
||||
dataIndex: 'created_at',
|
||||
align: 'center',
|
||||
width: 160,
|
||||
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||
},
|
||||
];
|
||||
|
||||
const tableProps: XinTableProps<IPaymentTransaction> = {
|
||||
api: '/finance/payment-transaction',
|
||||
columns,
|
||||
rowKey: 'id',
|
||||
accessName: 'finance.transaction',
|
||||
addShow: false,
|
||||
editShow: false,
|
||||
scroll: { x: 1500 },
|
||||
formProps: {
|
||||
grid: true,
|
||||
colProps: { span: 12 },
|
||||
rowProps: { gutter: [30, 0] },
|
||||
layout: 'vertical',
|
||||
},
|
||||
modalProps: {
|
||||
width: 800,
|
||||
},
|
||||
cardProps: {
|
||||
variant: 'borderless',
|
||||
},
|
||||
pagination: {
|
||||
size: 'small',
|
||||
style: { marginBottom: 0 },
|
||||
},
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="mb-5">
|
||||
<Title level={3}>{t('finance.transaction.page.title')}</Title>
|
||||
<Text type="secondary">{t('finance.transaction.page.description')}</Text>
|
||||
</div>
|
||||
<XinTable<IPaymentTransaction> {...tableProps} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Table;
|
||||
@@ -0,0 +1,158 @@
|
||||
import { Tag, Typography } from 'antd';
|
||||
import React from 'react';
|
||||
import XinTable from '@/components/XinTable';
|
||||
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings';
|
||||
import type IRunnerWithdrawal from '@/domain/iRunnerWithdrawal';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import dayjs from 'dayjs';
|
||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
|
||||
const { Title, Text } = Typography;
|
||||
dayjs.extend(relativeTime);
|
||||
|
||||
const Table: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const columns: XinTableColumn<IRunnerWithdrawal>[] = [
|
||||
{
|
||||
title: t('finance.withdrawal.id'),
|
||||
dataIndex: 'id',
|
||||
hideInForm: true,
|
||||
sorter: true,
|
||||
align: 'center',
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: t('finance.withdrawal.withdraw_no'),
|
||||
dataIndex: 'withdraw_no',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.withdrawal.user_id'),
|
||||
dataIndex: 'user_id',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.withdrawal.worker_id'),
|
||||
dataIndex: 'worker_id',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.withdrawal.amount'),
|
||||
dataIndex: 'amount',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.withdrawal.fee'),
|
||||
dataIndex: 'fee',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.withdrawal.channel'),
|
||||
dataIndex: 'channel',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.withdrawal.account_info'),
|
||||
dataIndex: 'account_info',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: t('finance.withdrawal.status'),
|
||||
dataIndex: 'status',
|
||||
valueType: 'radioButton',
|
||||
fieldProps: {
|
||||
options: [
|
||||
{ value: 0, label: t('finance.withdrawal.status.0') },
|
||||
{ value: 1, label: t('finance.withdrawal.status.1') },
|
||||
{ value: 2, label: t('finance.withdrawal.status.2') },
|
||||
],
|
||||
},
|
||||
render: (value: number) => {
|
||||
if (value === 1) return <Tag color="success">{t('finance.withdrawal.status.1')}</Tag>;
|
||||
if (value === 2) return <Tag color="error">{t('finance.withdrawal.status.2')}</Tag>;
|
||||
return <Tag color="processing">{t('finance.withdrawal.status.0')}</Tag>;
|
||||
},
|
||||
filters: [
|
||||
{ text: t('finance.withdrawal.status.0'), value: 0 },
|
||||
{ text: t('finance.withdrawal.status.1'), value: 1 },
|
||||
{ text: t('finance.withdrawal.status.2'), value: 2 },
|
||||
],
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('finance.withdrawal.remark'),
|
||||
dataIndex: 'remark',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: t('finance.withdrawal.processed_at'),
|
||||
dataIndex: 'processed_at',
|
||||
hideInForm: true,
|
||||
hideInSearch: true,
|
||||
align: 'center',
|
||||
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||
},
|
||||
{
|
||||
title: t('finance.withdrawal.created_at'),
|
||||
hideInForm: true,
|
||||
hideInSearch: true,
|
||||
dataIndex: 'created_at',
|
||||
align: 'center',
|
||||
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||
},
|
||||
{
|
||||
title: t('finance.withdrawal.updated_at'),
|
||||
hideInForm: true,
|
||||
hideInSearch: true,
|
||||
dataIndex: 'updated_at',
|
||||
align: 'center',
|
||||
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
|
||||
},
|
||||
];
|
||||
|
||||
const tableProps: XinTableProps<IRunnerWithdrawal> = {
|
||||
api: '/runner/withdrawal',
|
||||
columns,
|
||||
rowKey: 'id',
|
||||
accessName: 'runner.withdrawal',
|
||||
formProps: {
|
||||
grid: true,
|
||||
colProps: { span: 12 },
|
||||
rowProps: { gutter: [30, 0] },
|
||||
layout: 'vertical',
|
||||
},
|
||||
modalProps: {
|
||||
width: 800,
|
||||
},
|
||||
cardProps: {
|
||||
variant: 'borderless',
|
||||
},
|
||||
pagination: {
|
||||
size: 'small',
|
||||
style: { marginBottom: 0 },
|
||||
},
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="mb-5">
|
||||
<Title level={3}>{t('finance.withdrawal.page.title')}</Title>
|
||||
<Text type="secondary">{t('finance.withdrawal.page.description')}</Text>
|
||||
</div>
|
||||
<XinTable<IRunnerWithdrawal> {...tableProps} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Table;
|
||||
Reference in New Issue
Block a user