接单员与财务管理
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 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;
|
||||
Reference in New Issue
Block a user