商品列表、分类管理、客户等级

This commit is contained in:
liu
2026-08-05 19:28:53 +08:00
parent dfa471bf22
commit 258df92e6c
36 changed files with 472 additions and 516 deletions
+12 -7
View File
@@ -1,11 +1,12 @@
import React, { useState } from 'react';
import React, {useEffect, useState} from 'react';
import {Button, Image, Tag, Typography} from 'antd';
import {NodeExpandOutlined} from '@ant-design/icons';
import XinTable from '@/components/XinTable';
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings.ts';
import type IProductCategory from '@/domain/iProductCategory.ts';
import type { IProductCategoryTree } from '@/domain/iProductCategory.ts';
import { CATEGORY_STATUS_MAP } from '@/domain/iProductCategory.ts';
import { getCategoryTable } from '@/api/product/category.ts';
import {getCategoryTable, getCategoryTree} from '@/api/product/category.ts';
const { Title, Text } = Typography;
@@ -34,7 +35,11 @@ function collectAllIds(nodes: IProductCategory[]): number[] {
const ProductCategoryPage: React.FC = () => {
const [expandedKeys, setExpandedKeys] = useState<number[]>([]);
const [allIds, setAllIds] = useState<number[]>([]);
const [categoryTree, setCategoryTree] = useState<IProductCategory[]>([]);
const [categoryTree, setCategoryTree] = useState<IProductCategoryTree[]>([]);
useEffect(() => {
getCategoryTree().then((res) => setCategoryTree(res.data.data ?? []));
}, []);
const columns: XinTableColumn<IProductCategory>[] = [
{
@@ -63,6 +68,7 @@ const ProductCategoryPage: React.FC = () => {
dataIndex: 'sort',
valueType: 'digit',
hideInSearch: true,
initialValue: 0,
fieldProps: { min: 0 },
align: 'center',
},
@@ -86,7 +92,7 @@ const ProductCategoryPage: React.FC = () => {
},
{
title: '分类图标',
dataIndex: 'icon',
dataIndex: 'icon_id',
valueType: 'image',
fieldProps: {
action: '/product/category/upload',
@@ -100,8 +106,8 @@ const ProductCategoryPage: React.FC = () => {
return (
<Image
src={url}
width={60}
height={60}
width={32}
height={32}
style={{ objectFit: 'cover', borderRadius: 4 }}
/>
);
@@ -134,7 +140,6 @@ const ProductCategoryPage: React.FC = () => {
handleRequest: async () => {
const res = await getCategoryTable();
const tree = res.data.data ?? [];
setCategoryTree(tree);
setAllIds(collectAllIds(tree));
return { data: tree, total: tree.length };
},