校园商户

This commit is contained in:
liu
2026-06-17 09:13:49 +08:00
parent 86be1c230e
commit 254823e308
50 changed files with 2186 additions and 40 deletions
+121
View File
@@ -0,0 +1,121 @@
import { Tag, Typography } from 'antd';
import React from 'react';
import XinTable from '@/components/XinTable';
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings';
import type IMerchantCategory from '@/domain/iMerchantCategory';
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<IMerchantCategory>[] = [
{
title: t('merchant.category.id'),
dataIndex: 'id',
hideInForm: true,
sorter: true,
align: 'center',
width: 80,
},
{
title: t('merchant.category.name'),
dataIndex: 'name',
valueType: 'text',
align: 'center',
required: true,
rules: [{ required: true, message: t('merchant.category.name.required') }],
},
{
title: t('merchant.category.slug'),
dataIndex: 'slug',
valueType: 'text',
align: 'center',
required: true,
rules: [{ required: true, message: t('merchant.category.slug.required') }],
},
{
title: t('merchant.category.description'),
dataIndex: 'description',
valueType: 'text',
align: 'center',
hideInSearch: true,
},
{
title: t('merchant.category.sort'),
dataIndex: 'sort',
valueType: 'text',
align: 'center',
hideInSearch: true,
},
{
title: t('merchant.category.status'),
dataIndex: 'status',
valueType: 'radioButton',
fieldProps: {
options: [
{ value: 0, label: t('merchant.category.status.0') },
{ value: 1, label: t('merchant.category.status.1') },
],
},
render: (value: number) => {
return value === 1
? <Tag color="success">{t('merchant.category.status.1')}</Tag>
: <Tag color="error">{t('merchant.category.status.0')}</Tag>;
},
filters: [
{ text: t('merchant.category.status.0'), value: 0 },
{ text: t('merchant.category.status.1'), value: 1 },
],
align: 'center',
},
{
title: t('merchant.category.created_at'),
hideInForm: true,
hideInSearch: true,
dataIndex: 'created_at',
align: 'center',
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
},
{
title: t('merchant.category.updated_at'),
hideInForm: true,
hideInSearch: true,
dataIndex: 'updated_at',
align: 'center',
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
},
];
const tableProps: XinTableProps<IMerchantCategory> = {
api: '/merchant/category',
columns,
rowKey: 'id',
accessName: 'merchant.category',
formProps: {
grid: true,
colProps: { span: 12 },
rowProps: { gutter: [30, 0] },
layout: 'vertical',
},
modalProps: { width: 600 },
cardProps: { variant: 'borderless' },
pagination: { size: 'small', style: { marginBottom: 0 } },
};
return (
<>
<div className="mb-5">
<Title level={3}>{t('merchant.category.page.title')}</Title>
<Text type="secondary">{t('merchant.category.page.description')}</Text>
</div>
<XinTable<IMerchantCategory> {...tableProps} />
</>
);
};
export default Table;
+135
View File
@@ -0,0 +1,135 @@
import { Tag, Typography } from 'antd';
import React from 'react';
import XinTable from '@/components/XinTable';
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings';
import type IPrintTask from '@/domain/iPrintTask';
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<IPrintTask>[] = [
{
title: t('merchant.print-task.id'),
dataIndex: 'id',
hideInForm: true,
sorter: true,
align: 'center',
width: 80,
},
{
title: t('merchant.print-task.printer_id'),
dataIndex: 'printer_id',
valueType: 'text',
align: 'center',
},
{
title: t('merchant.print-task.order_id'),
dataIndex: 'order_id',
valueType: 'text',
align: 'center',
hideInSearch: true,
},
{
title: t('merchant.print-task.content'),
dataIndex: 'content',
valueType: 'text',
hideInTable: true,
hideInSearch: true,
},
{
title: t('merchant.print-task.copies'),
dataIndex: 'copies',
valueType: 'text',
align: 'center',
hideInSearch: true,
},
{
title: t('merchant.print-task.status'),
dataIndex: 'status',
valueType: 'radioButton',
fieldProps: {
options: [
{ value: 0, label: t('merchant.print-task.status.0') },
{ value: 1, label: t('merchant.print-task.status.1') },
{ value: 2, label: t('merchant.print-task.status.2') },
{ value: 3, label: t('merchant.print-task.status.3') },
],
},
render: (value: number) => {
const colorMap: Record<number, string> = { 0: 'default', 1: 'processing', 2: 'success', 3: 'error' };
const labelMap: Record<number, string> = {
0: t('merchant.print-task.status.0'), 1: t('merchant.print-task.status.1'),
2: t('merchant.print-task.status.2'), 3: t('merchant.print-task.status.3'),
};
return <Tag color={colorMap[value] || 'default'}>{labelMap[value] || '-'}</Tag>;
},
filters: [
{ text: t('merchant.print-task.status.0'), value: 0 },
{ text: t('merchant.print-task.status.1'), value: 1 },
{ text: t('merchant.print-task.status.2'), value: 2 },
{ text: t('merchant.print-task.status.3'), value: 3 },
],
align: 'center',
},
{
title: t('merchant.print-task.error_msg'),
dataIndex: 'error_msg',
valueType: 'text',
hideInSearch: true,
align: 'center',
},
{
title: t('merchant.print-task.printed_at'),
dataIndex: 'printed_at',
hideInForm: true,
hideInSearch: true,
align: 'center',
render: (value: string) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : '-'),
},
{
title: t('merchant.print-task.created_at'),
hideInForm: true,
hideInSearch: true,
dataIndex: 'created_at',
align: 'center',
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
},
];
const tableProps: XinTableProps<IPrintTask> = {
api: '/merchant/print-task',
columns,
rowKey: 'id',
accessName: 'merchant.print-task',
createShow: false,
editShow: false,
scroll: { x: 1200 },
formProps: {
grid: true,
colProps: { span: 12 },
rowProps: { gutter: [30, 0] },
layout: 'vertical',
},
modalProps: { width: 600 },
cardProps: { variant: 'borderless' },
pagination: { size: 'small', style: { marginBottom: 0 } },
};
return (
<>
<div className="mb-5">
<Title level={3}>{t('merchant.print-task.page.title')}</Title>
<Text type="secondary">{t('merchant.print-task.page.description')}</Text>
</div>
<XinTable<IPrintTask> {...tableProps} />
</>
);
};
export default Table;
+139
View File
@@ -0,0 +1,139 @@
import { Tag, Typography } from 'antd';
import React from 'react';
import XinTable from '@/components/XinTable';
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings';
import type IPrinter from '@/domain/iPrinter';
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<IPrinter>[] = [
{
title: t('merchant.printer.id'),
dataIndex: 'id',
hideInForm: true,
sorter: true,
align: 'center',
width: 80,
},
{
title: t('merchant.printer.name'),
dataIndex: 'name',
valueType: 'text',
align: 'center',
required: true,
rules: [{ required: true, message: t('merchant.printer.name.required') }],
},
{
title: t('merchant.printer.merchant_id'),
dataIndex: 'merchant_id',
valueType: 'text',
align: 'center',
required: true,
},
{
title: t('merchant.printer.brand'),
dataIndex: 'brand',
valueType: 'text',
align: 'center',
hideInSearch: true,
},
{
title: t('merchant.printer.model'),
dataIndex: 'model',
valueType: 'text',
align: 'center',
hideInSearch: true,
},
{
title: t('merchant.printer.device_no'),
dataIndex: 'device_no',
valueType: 'text',
align: 'center',
hideInSearch: true,
},
{
title: t('merchant.printer.secret_key'),
dataIndex: 'secret_key',
valueType: 'password',
hideInTable: true,
hideInSearch: true,
},
{
title: t('merchant.printer.status'),
dataIndex: 'status',
valueType: 'radioButton',
fieldProps: {
options: [
{ value: 0, label: t('merchant.printer.status.0') },
{ value: 1, label: t('merchant.printer.status.1') },
{ value: 2, label: t('merchant.printer.status.2') },
],
},
render: (value: number) => {
const colorMap: Record<number, string> = { 0: 'default', 1: 'success', 2: 'error' };
const labelMap: Record<number, string> = {
0: t('merchant.printer.status.0'), 1: t('merchant.printer.status.1'), 2: t('merchant.printer.status.2'),
};
return <Tag color={colorMap[value] || 'default'}>{labelMap[value] || '-'}</Tag>;
},
filters: [
{ text: t('merchant.printer.status.0'), value: 0 },
{ text: t('merchant.printer.status.1'), value: 1 },
{ text: t('merchant.printer.status.2'), value: 2 },
],
align: 'center',
},
{
title: t('merchant.printer.created_at'),
hideInForm: true,
hideInSearch: true,
dataIndex: 'created_at',
align: 'center',
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
},
{
title: t('merchant.printer.updated_at'),
hideInForm: true,
hideInSearch: true,
dataIndex: 'updated_at',
align: 'center',
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
},
];
const tableProps: XinTableProps<IPrinter> = {
api: '/merchant/printer',
columns,
rowKey: 'id',
accessName: 'merchant.printer',
scroll: { x: 1200 },
formProps: {
grid: true,
colProps: { span: 12 },
rowProps: { gutter: [30, 0] },
layout: 'vertical',
},
modalProps: { width: 700 },
cardProps: { variant: 'borderless' },
pagination: { size: 'small', style: { marginBottom: 0 } },
};
return (
<>
<div className="mb-5">
<Title level={3}>{t('merchant.printer.page.title')}</Title>
<Text type="secondary">{t('merchant.printer.page.description')}</Text>
</div>
<XinTable<IPrinter> {...tableProps} />
</>
);
};
export default Table;
@@ -0,0 +1,131 @@
import { Tag, Typography } from 'antd';
import React from 'react';
import XinTable from '@/components/XinTable';
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings';
import type IProductCategory from '@/domain/iProductCategory';
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<IProductCategory>[] = [
{
title: t('merchant.product-category.id'),
dataIndex: 'id',
hideInForm: true,
sorter: true,
align: 'center',
width: 80,
},
{
title: t('merchant.product-category.merchant_id'),
dataIndex: 'merchant_id',
valueType: 'text',
align: 'center',
required: true,
},
{
title: t('merchant.product-category.name'),
dataIndex: 'name',
valueType: 'text',
align: 'center',
required: true,
rules: [{ required: true, message: t('merchant.product-category.name.required') }],
},
{
title: t('merchant.product-category.slug'),
dataIndex: 'slug',
valueType: 'text',
align: 'center',
required: true,
rules: [{ required: true, message: t('merchant.product-category.slug.required') }],
},
{
title: t('merchant.product-category.parent_id'),
dataIndex: 'parent_id',
valueType: 'text',
align: 'center',
hideInSearch: true,
},
{
title: t('merchant.product-category.description'),
dataIndex: 'description',
valueType: 'text',
align: 'center',
hideInSearch: true,
},
{
title: t('merchant.product-category.sort'),
dataIndex: 'sort',
valueType: 'text',
align: 'center',
hideInSearch: true,
},
{
title: t('merchant.product-category.status'),
dataIndex: 'status',
valueType: 'radioButton',
fieldProps: {
options: [
{ value: 0, label: t('merchant.product-category.status.0') },
{ value: 1, label: t('merchant.product-category.status.1') },
],
},
render: (value: number) => {
return value === 1
? <Tag color="success">{t('merchant.product-category.status.1')}</Tag>
: <Tag color="error">{t('merchant.product-category.status.0')}</Tag>;
},
align: 'center',
},
{
title: t('merchant.product-category.created_at'),
hideInForm: true,
hideInSearch: true,
dataIndex: 'created_at',
align: 'center',
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
},
{
title: t('merchant.product-category.updated_at'),
hideInForm: true,
hideInSearch: true,
dataIndex: 'updated_at',
align: 'center',
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
},
];
const tableProps: XinTableProps<IProductCategory> = {
api: '/merchant/product-category',
columns,
rowKey: 'id',
accessName: 'merchant.product-category',
formProps: {
grid: true,
colProps: { span: 12 },
rowProps: { gutter: [30, 0] },
layout: 'vertical',
},
modalProps: { width: 600 },
cardProps: { variant: 'borderless' },
pagination: { size: 'small', style: { marginBottom: 0 } },
};
return (
<>
<div className="mb-5">
<Title level={3}>{t('merchant.product-category.page.title')}</Title>
<Text type="secondary">{t('merchant.product-category.page.description')}</Text>
</div>
<XinTable<IProductCategory> {...tableProps} />
</>
);
};
export default Table;
+180
View File
@@ -0,0 +1,180 @@
import { Tag, Typography } from 'antd';
import React from 'react';
import XinTable from '@/components/XinTable';
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings';
import type IMerchantProduct from '@/domain/iMerchantProduct';
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<IMerchantProduct>[] = [
{
title: t('merchant.product.id'),
dataIndex: 'id',
hideInForm: true,
sorter: true,
align: 'center',
width: 80,
},
{
title: t('merchant.product.name'),
dataIndex: 'name',
valueType: 'text',
align: 'center',
required: true,
rules: [{ required: true, message: t('merchant.product.name.required') }],
},
{
title: t('merchant.product.merchant_id'),
dataIndex: 'merchant_id',
valueType: 'text',
align: 'center',
required: true,
},
{
title: t('merchant.product.category_id'),
dataIndex: 'category_id',
valueType: 'text',
align: 'center',
},
{
title: t('merchant.product.price'),
dataIndex: 'price',
valueType: 'text',
align: 'center',
render: (value: number) => `¥${value || '0.00'}`,
},
{
title: t('merchant.product.original_price'),
dataIndex: 'original_price',
valueType: 'text',
align: 'center',
hideInSearch: true,
render: (value: number) => value ? `¥${value}` : '-',
},
{
title: t('merchant.product.stock'),
dataIndex: 'stock',
valueType: 'text',
align: 'center',
hideInSearch: true,
},
{
title: t('merchant.product.sales'),
dataIndex: 'sales',
hideInForm: true,
hideInSearch: true,
align: 'center',
},
{
title: t('merchant.product.unit'),
dataIndex: 'unit',
valueType: 'text',
align: 'center',
hideInSearch: true,
},
{
title: t('merchant.product.description'),
dataIndex: 'description',
valueType: 'text',
hideInTable: true,
hideInSearch: true,
},
{
title: t('merchant.product.status'),
dataIndex: 'status',
valueType: 'radioButton',
fieldProps: {
options: [
{ value: 0, label: t('merchant.product.status.0') },
{ value: 1, label: t('merchant.product.status.1') },
],
},
render: (value: number) => {
return value === 1
? <Tag color="success">{t('merchant.product.status.1')}</Tag>
: <Tag color="default">{t('merchant.product.status.0')}</Tag>;
},
filters: [
{ text: t('merchant.product.status.0'), value: 0 },
{ text: t('merchant.product.status.1'), value: 1 },
],
align: 'center',
},
{
title: t('merchant.product.is_recommend'),
dataIndex: 'is_recommend',
valueType: 'radioButton',
fieldProps: {
options: [
{ value: 0, label: t('merchant.product.is_recommend.0') },
{ value: 1, label: t('merchant.product.is_recommend.1') },
],
},
render: (value: number) => {
return value === 1
? <Tag color="orange">{t('merchant.product.is_recommend.1')}</Tag>
: <Tag>{t('merchant.product.is_recommend.0')}</Tag>;
},
align: 'center',
},
{
title: t('merchant.product.sort'),
dataIndex: 'sort',
valueType: 'text',
align: 'center',
hideInSearch: true,
},
{
title: t('merchant.product.created_at'),
hideInForm: true,
hideInSearch: true,
dataIndex: 'created_at',
align: 'center',
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
},
{
title: t('merchant.product.updated_at'),
hideInForm: true,
hideInSearch: true,
dataIndex: 'updated_at',
align: 'center',
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
},
];
const tableProps: XinTableProps<IMerchantProduct> = {
api: '/merchant/product',
columns,
rowKey: 'id',
accessName: 'merchant.product',
scroll: { x: 1600 },
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('merchant.product.page.title')}</Title>
<Text type="secondary">{t('merchant.product.page.description')}</Text>
</div>
<XinTable<IMerchantProduct> {...tableProps} />
</>
);
};
export default Table;
+165
View File
@@ -0,0 +1,165 @@
import { Tag, Typography } from 'antd';
import React from 'react';
import XinTable from '@/components/XinTable';
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings';
import type IMerchantStore from '@/domain/iMerchantStore';
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<IMerchantStore>[] = [
{
title: t('merchant.store.id'),
dataIndex: 'id',
hideInForm: true,
sorter: true,
align: 'center',
width: 80,
},
{
title: t('merchant.store.name'),
dataIndex: 'name',
valueType: 'text',
align: 'center',
required: true,
rules: [{ required: true, message: t('merchant.store.name.required') }],
},
{
title: t('merchant.store.user_id'),
dataIndex: 'user_id',
valueType: 'text',
align: 'center',
required: true,
hideInSearch: true,
},
{
title: t('merchant.store.category_id'),
dataIndex: 'category_id',
valueType: 'text',
align: 'center',
},
{
title: t('merchant.store.contact_name'),
dataIndex: 'contact_name',
valueType: 'text',
align: 'center',
hideInSearch: true,
},
{
title: t('merchant.store.contact_mobile'),
dataIndex: 'contact_mobile',
valueType: 'text',
align: 'center',
hideInSearch: true,
},
{
title: t('merchant.store.address'),
dataIndex: 'address',
valueType: 'text',
hideInTable: true,
hideInSearch: true,
},
{
title: t('merchant.store.description'),
dataIndex: 'description',
valueType: 'text',
hideInTable: true,
hideInSearch: true,
},
{
title: t('merchant.store.balance'),
dataIndex: 'balance',
hideInForm: true,
hideInSearch: true,
align: 'center',
render: (value: number) => `¥${value || '0.00'}`,
},
{
title: t('merchant.store.min_price'),
dataIndex: 'min_price',
valueType: 'text',
align: 'center',
hideInSearch: true,
render: (value: number) => `¥${value || '0.00'}`,
},
{
title: t('merchant.store.status'),
dataIndex: 'status',
valueType: 'radioButton',
fieldProps: {
options: [
{ value: 0, label: t('merchant.store.status.0') },
{ value: 1, label: t('merchant.store.status.1') },
{ value: 2, label: t('merchant.store.status.2') },
{ value: 3, label: t('merchant.store.status.3') },
],
},
render: (value: number) => {
const colorMap: Record<number, string> = { 0: 'processing', 1: 'success', 2: 'warning', 3: 'error' };
const labelMap: Record<number, string> = {
0: t('merchant.store.status.0'), 1: t('merchant.store.status.1'),
2: t('merchant.store.status.2'), 3: t('merchant.store.status.3'),
};
return <Tag color={colorMap[value] || 'default'}>{labelMap[value] || '-'}</Tag>;
},
filters: [
{ text: t('merchant.store.status.0'), value: 0 },
{ text: t('merchant.store.status.1'), value: 1 },
{ text: t('merchant.store.status.2'), value: 2 },
{ text: t('merchant.store.status.3'), value: 3 },
],
align: 'center',
},
{
title: t('merchant.store.created_at'),
hideInForm: true,
hideInSearch: true,
dataIndex: 'created_at',
align: 'center',
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
},
{
title: t('merchant.store.updated_at'),
hideInForm: true,
hideInSearch: true,
dataIndex: 'updated_at',
align: 'center',
render: (value: string) => (value ? dayjs(value).fromNow() : '-'),
},
];
const tableProps: XinTableProps<IMerchantStore> = {
api: '/merchant/store',
columns,
rowKey: 'id',
accessName: 'merchant.store',
scroll: { x: 1400 },
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('merchant.store.page.title')}</Title>
<Text type="secondary">{t('merchant.store.page.description')}</Text>
</div>
<XinTable<IMerchantStore> {...tableProps} />
</>
);
};
export default Table;