import React from 'react'; import { Tag, Typography, Image } from 'antd'; import XinTable from '@/components/XinTable'; import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings.ts'; import type ICustomerLevel from '@/domain/iCustomerLevel.ts'; import { CUSTOMER_LEVEL_STATUS_MAP } from '@/domain/iCustomerLevel.ts'; const { Title, Text } = Typography; /** * 客户等级管理 */ const CustomerLevelPage: React.FC = () => { const columns: XinTableColumn[] = [ { title: 'ID', dataIndex: 'id', hideInForm: true, hideInSearch: true, width: 70, align: 'center', }, { title: '等级名称', dataIndex: 'name', valueType: 'text', required: true, align: 'center', rules: [{ required: true, message: '请输入等级名称' }], }, { title: '排序', dataIndex: 'sort', valueType: 'digit', hideInSearch: true, initialValue: 0, fieldProps: { min: 0 }, }, { title: '图片等级', dataIndex: 'icon_id', valueType: 'image', fieldProps: { action: '/customer/level/upload', mode: 'single', maxCount: 1, changeType: "id" }, render: (_, record: ICustomerLevel) => { const url = record.icon_url if (!url) return '-'; return ( ); }, align: 'center', hideInSearch: true, }, { title: '状态', dataIndex: 'status', valueType: 'radioButton', initialValue: 1, fieldProps: { options: [ { value: 1, label: '正常' }, { value: 0, label: '停用' }, ], }, render: (_, record) => { const item = CUSTOMER_LEVEL_STATUS_MAP[record.status ?? 1]; return {item?.text}; }, }, { title: '创建时间', dataIndex: 'updated_at', hideInForm: true, hideInSearch: true, align: 'center', }, { title: '创建时间', dataIndex: 'created_at', hideInForm: true, hideInSearch: true, align: 'center', }, ]; const tableProps: XinTableProps = { api: '/customer/level', columns, rowKey: 'id', accessName: 'customer.level', formProps: { grid: true, colProps: { span: 12 }, rowProps: { gutter: 20 }, layout: 'vertical', }, modalProps: { width: 640 }, }; return ( <>
客户等级 同一商品按客户等级显示不同单价,门店绑定等级后小程序端按对应价格展示。
{...tableProps} /> ); }; export default CustomerLevelPage;