feat(产品管理): 重构产品属性管理功能
新增统一属性管理页面,整合品牌、强度、口味等属性配置 删除原有的独立属性管理页面(Brand/Flavors/Strength) 在产品列表页新增产品组成管理功能 更新API接口以支持新的属性管理方式
This commit is contained in:
parent
1d9d8a19f9
commit
ef838123f3
|
|
@ -0,0 +1,243 @@
|
|||
import { UploadOutlined } from '@ant-design/icons';
|
||||
import { PageContainer } from '@ant-design/pro-components';
|
||||
import { request } from '@umijs/max';
|
||||
import { Button, Form, Input, Layout, Modal, Space, Table, Upload, message } from 'antd';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
const { Sider, Content } = Layout;
|
||||
|
||||
// 中文注释:限定允许管理的字典名称集合
|
||||
const allowedDictNames = new Set(['brand', 'strength', 'flavor', 'size', 'humidity']);
|
||||
|
||||
const AttributePage: React.FC = () => {
|
||||
// 中文注释:左侧字典列表状态
|
||||
const [dicts, setDicts] = useState<any[]>([]);
|
||||
const [loadingDicts, setLoadingDicts] = useState(false);
|
||||
const [searchText, setSearchText] = useState('');
|
||||
const [selectedDict, setSelectedDict] = useState<any>(null);
|
||||
|
||||
// 中文注释:右侧字典项状态
|
||||
const [dictItems, setDictItems] = useState<any[]>([]);
|
||||
const [loadingDictItems, setLoadingDictItems] = useState(false);
|
||||
|
||||
// 中文注释:字典项新增/编辑模态框控制
|
||||
const [isDictItemModalVisible, setIsDictItemModalVisible] = useState(false);
|
||||
const [editingDictItem, setEditingDictItem] = useState<any>(null);
|
||||
const [dictItemForm] = Form.useForm();
|
||||
|
||||
// 中文注释:获取字典列表,仅保留允许的名称
|
||||
const fetchDicts = async (title?: string) => {
|
||||
setLoadingDicts(true);
|
||||
try {
|
||||
const res = await request('/dict/list', { params: { title } });
|
||||
// 中文注释:条件判断,过滤只保留 allowedDictNames 中的字典
|
||||
const filtered = (res || []).filter((d: any) => allowedDictNames.has(d?.name));
|
||||
setDicts(filtered);
|
||||
} catch (error) {
|
||||
message.error('获取字典列表失败');
|
||||
}
|
||||
setLoadingDicts(false);
|
||||
};
|
||||
|
||||
// 中文注释:获取字典项列表
|
||||
const fetchDictItems = async (dictId?: number) => {
|
||||
setLoadingDictItems(true);
|
||||
try {
|
||||
const res = await request('/dict/items', { params: { dictId } });
|
||||
setDictItems(res || []);
|
||||
} catch (error) {
|
||||
message.error('获取字典项列表失败');
|
||||
}
|
||||
setLoadingDictItems(false);
|
||||
};
|
||||
|
||||
// 中文注释:组件挂载时初始化数据
|
||||
useEffect(() => {
|
||||
fetchDicts();
|
||||
fetchDictItems();
|
||||
}, []);
|
||||
|
||||
// 中文注释:当选择的字典发生变化时刷新右侧字典项
|
||||
useEffect(() => {
|
||||
fetchDictItems(selectedDict?.id);
|
||||
}, [selectedDict]);
|
||||
|
||||
// 中文注释:搜索触发过滤
|
||||
const handleSearch = (value: string) => {
|
||||
fetchDicts(value);
|
||||
};
|
||||
|
||||
// 中文注释:打开添加字典项模态框
|
||||
const handleAddDictItem = () => {
|
||||
setEditingDictItem(null);
|
||||
dictItemForm.resetFields();
|
||||
setIsDictItemModalVisible(true);
|
||||
};
|
||||
|
||||
// 中文注释:打开编辑字典项模态框
|
||||
const handleEditDictItem = (item: any) => {
|
||||
setEditingDictItem(item);
|
||||
dictItemForm.setFieldsValue(item);
|
||||
setIsDictItemModalVisible(true);
|
||||
};
|
||||
|
||||
// 中文注释:字典项表单提交(新增或编辑)
|
||||
const handleDictItemFormSubmit = async (values: any) => {
|
||||
try {
|
||||
if (editingDictItem) {
|
||||
// 中文注释:条件判断,存在编辑项则执行更新
|
||||
await request(`/dict/item/${editingDictItem.id}`, {
|
||||
method: 'PUT',
|
||||
data: values,
|
||||
});
|
||||
message.success('更新成功');
|
||||
} else {
|
||||
// 中文注释:否则执行新增,绑定到当前选择的字典
|
||||
await request('/dict/item', {
|
||||
method: 'POST',
|
||||
data: { ...values, dictId: selectedDict.id },
|
||||
});
|
||||
message.success('添加成功');
|
||||
}
|
||||
setIsDictItemModalVisible(false);
|
||||
fetchDictItems(selectedDict.id);
|
||||
} catch (error) {
|
||||
message.error(editingDictItem ? '更新失败' : '添加失败');
|
||||
}
|
||||
};
|
||||
|
||||
// 中文注释:删除字典项
|
||||
const handleDeleteDictItem = async (itemId: number) => {
|
||||
try {
|
||||
await request(`/dict/item/${itemId}`, { method: 'DELETE' });
|
||||
message.success('删除成功');
|
||||
fetchDictItems(selectedDict.id);
|
||||
} catch (error) {
|
||||
message.error('删除失败');
|
||||
}
|
||||
};
|
||||
|
||||
// 中文注释:左侧字典列表列定义(紧凑样式)
|
||||
const dictColumns = [
|
||||
{ title: '名称', dataIndex: 'name', key: 'name' },
|
||||
{ title: '标题', dataIndex: 'title', key: 'title' },
|
||||
];
|
||||
|
||||
// 中文注释:右侧字典项列表列定义(紧凑样式)
|
||||
const dictItemColumns = [
|
||||
{ title: '名称', dataIndex: 'name', key: 'name' },
|
||||
{ title: '标题', dataIndex: 'title', key: 'title' },
|
||||
{ title: '中文标题', dataIndex: 'titleCN', key: 'titleCN' },
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
render: (_: any, record: any) => (
|
||||
<Space size="small">
|
||||
<Button size="small" type="link" onClick={() => handleEditDictItem(record)}>编辑</Button>
|
||||
<Button size="small" type="link" danger onClick={() => handleDeleteDictItem(record.id)}>删除</Button>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<PageContainer>
|
||||
<Layout style={{ background: '#fff' }}>
|
||||
<Sider
|
||||
width={240}
|
||||
style={{ background: '#fff', padding: '8px', borderRight: '1px solid #f0f0f0' }}
|
||||
>
|
||||
<Space direction="vertical" style={{ width: '100%' }} size="small">
|
||||
<Input.Search
|
||||
placeholder="搜索字典"
|
||||
onSearch={handleSearch}
|
||||
onChange={(e) => setSearchText(e.target.value)}
|
||||
enterButton
|
||||
allowClear
|
||||
size="small"
|
||||
/>
|
||||
<Table
|
||||
dataSource={dicts}
|
||||
columns={dictColumns}
|
||||
rowKey="id"
|
||||
loading={loadingDicts}
|
||||
size="small"
|
||||
onRow={(record) => ({
|
||||
onClick: () => {
|
||||
// 中文注释:条件判断,重复点击同一行则取消选择
|
||||
if (selectedDict?.id === record.id) {
|
||||
setSelectedDict(null);
|
||||
} else {
|
||||
setSelectedDict(record);
|
||||
}
|
||||
},
|
||||
})}
|
||||
rowClassName={(record) => (selectedDict?.id === record.id ? 'ant-table-row-selected' : '')}
|
||||
pagination={false}
|
||||
/>
|
||||
</Space>
|
||||
</Sider>
|
||||
<Content style={{ padding: '8px' }}>
|
||||
<Space direction="vertical" style={{ width: '100%' }} size="small">
|
||||
<div style={{ width: '100%', display: 'flex', flexDirection: 'row', gap: '4px' }}>
|
||||
<Button type="primary" size="small" onClick={handleAddDictItem} disabled={!selectedDict}>添加字典项</Button>
|
||||
<Upload
|
||||
name="file"
|
||||
action={`/dict/item/import`}
|
||||
data={{ dictId: selectedDict?.id }}
|
||||
showUploadList={false}
|
||||
disabled={!selectedDict}
|
||||
onChange={(info) => {
|
||||
// 中文注释:条件判断,上传状态处理
|
||||
if (info.file.status === 'done') {
|
||||
message.success(`${info.file.name} 文件上传成功`);
|
||||
fetchDictItems(selectedDict.id);
|
||||
} else if (info.file.status === 'error') {
|
||||
message.error(`${info.file.name} 文件上传失败`);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Button size="small" icon={<UploadOutlined />} disabled={!selectedDict}>
|
||||
导入字典项
|
||||
</Button>
|
||||
</Upload>
|
||||
</div>
|
||||
<Table
|
||||
dataSource={dictItems}
|
||||
columns={dictItemColumns}
|
||||
rowKey="id"
|
||||
loading={loadingDictItems}
|
||||
size="small"
|
||||
/>
|
||||
</Space>
|
||||
</Content>
|
||||
</Layout>
|
||||
|
||||
<Modal
|
||||
title={editingDictItem ? '编辑字典项' : '添加字典项'}
|
||||
open={isDictItemModalVisible}
|
||||
onOk={() => dictItemForm.submit()}
|
||||
onCancel={() => setIsDictItemModalVisible(false)}
|
||||
destroyOnClose
|
||||
>
|
||||
<Form form={dictItemForm} layout="vertical" onFinish={handleDictItemFormSubmit}>
|
||||
<Form.Item label="名称" name="name" rules={[{ required: true, message: '请输入名称' }]}>
|
||||
<Input size="small" placeholder="名称 (e.g., zyn)" />
|
||||
</Form.Item>
|
||||
<Form.Item label="标题" name="title" rules={[{ required: true, message: '请输入标题' }]}>
|
||||
<Input size="small" placeholder="标题 (e.g., ZYN)" />
|
||||
</Form.Item>
|
||||
<Form.Item label="中文标题" name="titleCN">
|
||||
<Input size="small" placeholder="中文标题 (e.g., 品牌)" />
|
||||
</Form.Item>
|
||||
<Form.Item label="值 (可选)" name="value">
|
||||
<Input size="small" placeholder="值 (可选)" />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default AttributePage;
|
||||
|
||||
|
|
@ -1,208 +0,0 @@
|
|||
import {
|
||||
productcontrollerCreatebrand,
|
||||
productcontrollerDeletebrand,
|
||||
productcontrollerGetbrands,
|
||||
productcontrollerUpdatebrand,
|
||||
} from '@/servers/api/product';
|
||||
import { EditOutlined, PlusOutlined } from '@ant-design/icons';
|
||||
import {
|
||||
ActionType,
|
||||
DrawerForm,
|
||||
PageContainer,
|
||||
ProColumns,
|
||||
ProForm,
|
||||
ProFormText,
|
||||
ProTable,
|
||||
} from '@ant-design/pro-components';
|
||||
import { App, Button, Popconfirm } from 'antd';
|
||||
import { useRef } from 'react';
|
||||
|
||||
const List: React.FC = () => {
|
||||
const actionRef = useRef<ActionType>();
|
||||
const { message } = App.useApp();
|
||||
const columns: ProColumns<API.Brand>[] = [
|
||||
{
|
||||
title: '名称',
|
||||
dataIndex: 'name',
|
||||
tip: '名称是唯一的 key',
|
||||
formItemProps: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '名称为必填项',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '标识',
|
||||
dataIndex: 'unique_key',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '更新时间',
|
||||
dataIndex: 'updatedAt',
|
||||
valueType: 'dateTime',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createdAt',
|
||||
valueType: 'dateTime',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'option',
|
||||
valueType: 'option',
|
||||
render: (_, record) => (
|
||||
<>
|
||||
{/* <UpdateForm tableRef={actionRef} values={record} />
|
||||
<Divider type="vertical" /> */}
|
||||
<Popconfirm
|
||||
title="删除"
|
||||
description="确认删除?"
|
||||
onConfirm={async () => {
|
||||
try {
|
||||
const { success, message: errMsg } =
|
||||
await productcontrollerDeletebrand({ id: record.id });
|
||||
if (!success) {
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
actionRef.current?.reload();
|
||||
} catch (error: any) {
|
||||
message.error(error.message);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Button type="primary" danger>
|
||||
删除
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<PageContainer header={{ title: '品牌列表' }}>
|
||||
<ProTable<any>
|
||||
headerTitle="查询表格"
|
||||
actionRef={actionRef}
|
||||
rowKey="id"
|
||||
toolBarRender={() => [<CreateForm tableRef={actionRef} />]}
|
||||
request={async (params) => {
|
||||
const { data, success } = await productcontrollerGetbrands(params);
|
||||
return {
|
||||
total: data?.total || 0,
|
||||
data: data?.items || [],
|
||||
success,
|
||||
};
|
||||
}}
|
||||
columns={columns}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
const CreateForm: React.FC<{
|
||||
tableRef: React.MutableRefObject<ActionType | undefined>;
|
||||
}> = ({ tableRef }) => {
|
||||
const { message } = App.useApp();
|
||||
return (
|
||||
<DrawerForm<API.CreateBrandDTO>
|
||||
title="新建"
|
||||
trigger={
|
||||
<Button type="primary">
|
||||
<PlusOutlined />
|
||||
新建
|
||||
</Button>
|
||||
}
|
||||
autoFocusFirstInput
|
||||
drawerProps={{
|
||||
destroyOnHidden: true,
|
||||
}}
|
||||
onFinish={async (values) => {
|
||||
try {
|
||||
const { success, message: errMsg } =
|
||||
await productcontrollerCreatebrand(values);
|
||||
if (!success) {
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
tableRef.current?.reload();
|
||||
message.success('提交成功');
|
||||
return true;
|
||||
} catch (error: any) {
|
||||
message.error(error.message);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<ProFormText
|
||||
name="name"
|
||||
width="md"
|
||||
label="品牌名称"
|
||||
placeholder="请输入名称"
|
||||
rules={[{ required: true, message: '请输入名称' }]}
|
||||
/>
|
||||
<ProFormText
|
||||
name="unique_key"
|
||||
width="md"
|
||||
label="Key"
|
||||
placeholder="请输入Key"
|
||||
rules={[{ required: true, message: '请输入Key' }]}
|
||||
/>
|
||||
</DrawerForm>
|
||||
);
|
||||
};
|
||||
|
||||
const UpdateForm: React.FC<{
|
||||
tableRef: React.MutableRefObject<ActionType | undefined>;
|
||||
values: API.Brand;
|
||||
}> = ({ tableRef, values: initialValues }) => {
|
||||
const { message } = App.useApp();
|
||||
return (
|
||||
<DrawerForm<API.UpdateBrandDTO>
|
||||
title="编辑"
|
||||
initialValues={initialValues}
|
||||
trigger={
|
||||
<Button type="primary">
|
||||
<EditOutlined />
|
||||
编辑
|
||||
</Button>
|
||||
}
|
||||
autoFocusFirstInput
|
||||
drawerProps={{
|
||||
destroyOnHidden: true,
|
||||
}}
|
||||
onFinish={async (values) => {
|
||||
try {
|
||||
const { success, message: errMsg } =
|
||||
await productcontrollerUpdatebrand(
|
||||
{ id: initialValues.id },
|
||||
values,
|
||||
);
|
||||
if (!success) {
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
message.success('提交成功');
|
||||
tableRef.current?.reload();
|
||||
return true;
|
||||
} catch (error: any) {
|
||||
message.error(error.message);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
name="name"
|
||||
width="md"
|
||||
label="品牌名称"
|
||||
placeholder="请输入名称"
|
||||
rules={[{ required: true, message: '请输入名称' }]}
|
||||
/>
|
||||
</ProForm.Group>
|
||||
</DrawerForm>
|
||||
);
|
||||
};
|
||||
|
||||
export default List;
|
||||
|
|
@ -1,207 +0,0 @@
|
|||
import {
|
||||
productcontrollerCreateflavors,
|
||||
productcontrollerDeleteflavors,
|
||||
productcontrollerGetflavors,
|
||||
productcontrollerUpdateflavors,
|
||||
} from '@/servers/api/product';
|
||||
import { EditOutlined, PlusOutlined } from '@ant-design/icons';
|
||||
import {
|
||||
ActionType,
|
||||
DrawerForm,
|
||||
PageContainer,
|
||||
ProColumns,
|
||||
ProForm,
|
||||
ProFormText,
|
||||
ProTable,
|
||||
} from '@ant-design/pro-components';
|
||||
import { App, Button, Popconfirm } from 'antd';
|
||||
import { useRef } from 'react';
|
||||
|
||||
const List: React.FC = () => {
|
||||
const actionRef = useRef<ActionType>();
|
||||
const { message } = App.useApp();
|
||||
const columns: ProColumns<API.Category>[] = [
|
||||
{
|
||||
title: '名称',
|
||||
dataIndex: 'name',
|
||||
tip: '名称是唯一的 key',
|
||||
formItemProps: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '名称为必填项',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '显示名称',
|
||||
dataIndex: 'title',
|
||||
},
|
||||
{
|
||||
title: '更新时间',
|
||||
dataIndex: 'updatedAt',
|
||||
valueType: 'dateTime',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createdAt',
|
||||
valueType: 'dateTime',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'option',
|
||||
valueType: 'option',
|
||||
render: (_, record) => (
|
||||
<>
|
||||
{/* <UpdateForm tableRef={actionRef} values={record} />
|
||||
<Divider type="vertical" /> */}
|
||||
<Popconfirm
|
||||
title="删除"
|
||||
description="确认删除?"
|
||||
onConfirm={async () => {
|
||||
try {
|
||||
const { success, message: errMsg } =
|
||||
await productcontrollerDeleteflavors({ id: record.id });
|
||||
if (!success) {
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
actionRef.current?.reload();
|
||||
} catch (error: any) {
|
||||
message.error(error.message);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Button type="primary" danger>
|
||||
删除
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<PageContainer header={{ title: '口味列表' }}>
|
||||
<ProTable<API.Category>
|
||||
headerTitle="查询表格"
|
||||
actionRef={actionRef}
|
||||
rowKey="id"
|
||||
toolBarRender={() => [<CreateForm tableRef={actionRef} />]}
|
||||
request={async (params) => {
|
||||
const { data, success } = await productcontrollerGetflavors(params);
|
||||
return {
|
||||
total: data?.total || 0,
|
||||
data: data?.items || [],
|
||||
success,
|
||||
};
|
||||
}}
|
||||
columns={columns}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
const CreateForm: React.FC<{
|
||||
tableRef: React.MutableRefObject<ActionType | undefined>;
|
||||
}> = ({ tableRef }) => {
|
||||
const { message } = App.useApp();
|
||||
return (
|
||||
<DrawerForm<API.CreateCategoryDTO>
|
||||
title="新建"
|
||||
trigger={
|
||||
<Button type="primary">
|
||||
<PlusOutlined />
|
||||
新建
|
||||
</Button>
|
||||
}
|
||||
autoFocusFirstInput
|
||||
drawerProps={{
|
||||
destroyOnHidden: true,
|
||||
}}
|
||||
onFinish={async (values) => {
|
||||
try {
|
||||
const { success, message: errMsg } =
|
||||
await productcontrollerCreateflavors(values);
|
||||
if (!success) {
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
tableRef.current?.reload();
|
||||
message.success('提交成功');
|
||||
return true;
|
||||
} catch (error: any) {
|
||||
message.error(error.message);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<ProFormText
|
||||
name="name"
|
||||
width="md"
|
||||
label="口味名称"
|
||||
placeholder="请输入名称"
|
||||
rules={[{ required: true, message: '请输入名称' }]}
|
||||
/>
|
||||
<ProFormText
|
||||
name="unique_key"
|
||||
width="md"
|
||||
label="Key"
|
||||
placeholder="请输入Key"
|
||||
rules={[{ required: true, message: '请输入Key' }]}
|
||||
/>
|
||||
</DrawerForm>
|
||||
);
|
||||
};
|
||||
|
||||
const UpdateForm: React.FC<{
|
||||
tableRef: React.MutableRefObject<ActionType | undefined>;
|
||||
values: API.Category;
|
||||
}> = ({ tableRef, values: initialValues }) => {
|
||||
const { message } = App.useApp();
|
||||
return (
|
||||
<DrawerForm<API.UpdateCategoryDTO>
|
||||
title="编辑"
|
||||
initialValues={initialValues}
|
||||
trigger={
|
||||
<Button type="primary">
|
||||
<EditOutlined />
|
||||
编辑
|
||||
</Button>
|
||||
}
|
||||
autoFocusFirstInput
|
||||
drawerProps={{
|
||||
destroyOnHidden: true,
|
||||
}}
|
||||
onFinish={async (values) => {
|
||||
try {
|
||||
const { success, message: errMsg } =
|
||||
await productcontrollerUpdateflavors(
|
||||
{ id: initialValues.id },
|
||||
values,
|
||||
);
|
||||
if (!success) {
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
message.success('提交成功');
|
||||
tableRef.current?.reload();
|
||||
return true;
|
||||
} catch (error: any) {
|
||||
message.error(error.message);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
name="name"
|
||||
width="md"
|
||||
label="口味名称"
|
||||
placeholder="请输入名称"
|
||||
rules={[{ required: true, message: '请输入名称' }]}
|
||||
/>
|
||||
</ProForm.Group>
|
||||
</DrawerForm>
|
||||
);
|
||||
};
|
||||
|
||||
export default List;
|
||||
|
|
@ -1,12 +1,16 @@
|
|||
import {
|
||||
productcontrollerCreateproduct,
|
||||
productcontrollerDeleteproduct,
|
||||
productcontrollerGetbrandall,
|
||||
productcontrollerGetflavorsall,
|
||||
productcontrollerCompatbrandall,
|
||||
productcontrollerCompatflavorsall,
|
||||
productcontrollerGetproductlist,
|
||||
productcontrollerGetstrengthall,
|
||||
productcontrollerCompatstrengthall,
|
||||
productcontrollerUpdateproductnamecn,
|
||||
productcontrollerUpdateproduct,
|
||||
productcontrollerGetproductcomponents,
|
||||
productcontrollerSetproductcomponents,
|
||||
productcontrollerAutobindcomponents,
|
||||
productcontrollerGetattributeall,
|
||||
} from '@/servers/api/product';
|
||||
import { templatecontrollerRendertemplate } from '@/servers/api/template';
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
|
|
@ -17,6 +21,7 @@ import {
|
|||
ProColumns,
|
||||
ProForm,
|
||||
ProFormInstance,
|
||||
ProFormList,
|
||||
ProFormSelect,
|
||||
ProFormText,
|
||||
ProFormTextArea,
|
||||
|
|
@ -102,21 +107,21 @@ const List: React.FC = () => {
|
|||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '产品描述',
|
||||
title: '描述',
|
||||
dataIndex: 'description',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '产品品牌',
|
||||
dataIndex: 'brandName',
|
||||
title: '品牌',
|
||||
dataIndex: 'brand.name',
|
||||
},
|
||||
{
|
||||
title: '强度',
|
||||
dataIndex: 'strengthName',
|
||||
dataIndex: 'strength.name',
|
||||
},
|
||||
{
|
||||
title: '口味',
|
||||
dataIndex: 'flavorsName',
|
||||
dataIndex: 'flavors.name',
|
||||
},
|
||||
{
|
||||
title: '湿度',
|
||||
|
|
@ -306,8 +311,22 @@ const CreateForm: React.FC<{
|
|||
destroyOnHidden: true,
|
||||
}}
|
||||
onFinish={async (values) => {
|
||||
// 中文注释:将选择的字典项ID与干湿属性组装为后端需要的 attributes
|
||||
const payload: any = {
|
||||
name: values.name,
|
||||
description: values.description,
|
||||
sku: values.sku,
|
||||
price: values.price,
|
||||
promotionPrice: values.promotionPrice,
|
||||
attributes: [
|
||||
values.brandId ? { id: values.brandId } : null,
|
||||
values.strengthId ? { id: values.strengthId } : null,
|
||||
values.flavorsId ? { id: values.flavorsId } : null,
|
||||
values.humidity ? { dictName: 'humidity', name: values.humidity } : null,
|
||||
].filter(Boolean),
|
||||
};
|
||||
const { success, message: errMsg } =
|
||||
await productcontrollerCreateproduct(values);
|
||||
await productcontrollerCreateproduct(payload);
|
||||
if (success) {
|
||||
message.success('提交成功');
|
||||
tableRef.current?.reloadAndRest?.();
|
||||
|
|
@ -323,7 +342,7 @@ const CreateForm: React.FC<{
|
|||
label="产品品牌"
|
||||
placeholder="请选择产品品牌"
|
||||
request={async () => {
|
||||
const { data = [] } = await productcontrollerGetbrandall();
|
||||
const { data = [] } = await productcontrollerCompatbrandall();
|
||||
setBrandOptions(data);
|
||||
return data.map((item: DictItem) => ({
|
||||
label: item.name,
|
||||
|
|
@ -338,7 +357,7 @@ const CreateForm: React.FC<{
|
|||
label="强度"
|
||||
placeholder="请选择强度"
|
||||
request={async () => {
|
||||
const { data = [] } = await productcontrollerGetstrengthall();
|
||||
const { data = [] } = await productcontrollerCompatstrengthall();
|
||||
setStrengthOptions(data);
|
||||
return data.map((item: DictItem) => ({
|
||||
label: item.name,
|
||||
|
|
@ -353,7 +372,7 @@ const CreateForm: React.FC<{
|
|||
label="口味"
|
||||
placeholder="请选择口味"
|
||||
request={async () => {
|
||||
const { data = [] } = await productcontrollerGetflavorsall();
|
||||
const { data = [] } = await productcontrollerCompatflavorsall();
|
||||
setFlavorOptions(data);
|
||||
return data.map((item: DictItem) => ({
|
||||
label: item.name,
|
||||
|
|
@ -367,9 +386,9 @@ const CreateForm: React.FC<{
|
|||
width="lg"
|
||||
label="干湿"
|
||||
placeholder="请选择干湿"
|
||||
valueEnum={{
|
||||
dry: 'dry',
|
||||
moisture: 'moisture',
|
||||
request={async () => {
|
||||
const { data = [] } = await productcontrollerGetattributeall({ dictName: 'humidity' } as any);
|
||||
return (data || []).map((item: any) => ({ label: item.name, value: item.name }));
|
||||
}}
|
||||
rules={[{ required: true, message: '请选择干湿' }]}
|
||||
/>
|
||||
|
|
@ -432,11 +451,13 @@ const EditForm: React.FC<{
|
|||
const [brandOptions, setBrandOptions] = useState<DictItem[]>([]);
|
||||
const [strengthOptions, setStrengthOptions] = useState<DictItem[]>([]);
|
||||
const [flavorOptions, setFlavorOptions] = useState<DictItem[]>([]);
|
||||
const [humidityOptions, setHumidityOptions] = useState<{ label: string; value: string }[]>([]);
|
||||
const [components, setComponents] = useState<{ stockId: number; quantity: number }[]>([]);
|
||||
|
||||
const setInitialIds = () => {
|
||||
const brand = brandOptions.find((item) => item.title === record.brandName);
|
||||
const strength = strengthOptions.find((item) => item.title === record.strengthName);
|
||||
const flavor = flavorOptions.find((item) => item.title === record.flavorsName);
|
||||
const brand = brandOptions.find((item) => item.title === record.brand.name);
|
||||
const strength = strengthOptions.find((item) => item.title === record.strength.name);
|
||||
const flavor = flavorOptions.find((item) => item.title === record.flavors.name);
|
||||
formRef.current?.setFieldsValue({
|
||||
brandId: brand?.id,
|
||||
strengthId: strength?.id,
|
||||
|
|
@ -450,6 +471,21 @@ const EditForm: React.FC<{
|
|||
}
|
||||
}, [brandOptions, strengthOptions, flavorOptions]);
|
||||
|
||||
React.useEffect(() => {
|
||||
// 中文注释:加载干湿选项
|
||||
(async () => {
|
||||
const { data = [] } = await productcontrollerGetattributeall({ dictName: 'humidity' } as any);
|
||||
setHumidityOptions((data || []).map((i: any) => ({ label: i.name, value: i.name })));
|
||||
})();
|
||||
// 中文注释:加载当前产品的组成
|
||||
(async () => {
|
||||
const { data = [] } = await productcontrollerGetproductcomponents({ id: (record as any).id });
|
||||
const items = (data || []).map((c: any) => ({ stockId: c.stockId, quantity: c.quantity }));
|
||||
setComponents(items);
|
||||
formRef.current?.setFieldsValue({ components: items });
|
||||
})();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<DrawerForm<API.UpdateProductDTO>
|
||||
formRef={formRef}
|
||||
|
|
@ -462,13 +498,37 @@ const EditForm: React.FC<{
|
|||
humidity: record.humidity,
|
||||
price: (record as any).price,
|
||||
promotionPrice: (record as any).promotionPrice,
|
||||
components,
|
||||
}}
|
||||
onFinish={async (values) => {
|
||||
// 中文注释:组装 attributes(若选择了则发送)
|
||||
const attrs = [
|
||||
values.brandId ? { id: values.brandId } : null,
|
||||
values.strengthId ? { id: values.strengthId } : null,
|
||||
values.flavorsId ? { id: values.flavorsId } : null,
|
||||
values.humidity ? { dictName: 'humidity', name: values.humidity } : null,
|
||||
].filter(Boolean);
|
||||
const updatePayload: any = {
|
||||
name: values.name,
|
||||
sku: values.sku,
|
||||
description: values.description,
|
||||
price: values.price,
|
||||
promotionPrice: values.promotionPrice,
|
||||
...(attrs.length ? { attributes: attrs } : {}),
|
||||
};
|
||||
const { success, message: errMsg } = await productcontrollerUpdateproduct(
|
||||
{ id: record.id },
|
||||
values as any,
|
||||
{ id: (record as any).id },
|
||||
updatePayload,
|
||||
);
|
||||
if (success) {
|
||||
// 中文注释:同步更新组成(覆盖式)
|
||||
const items = (values as any)?.components || [];
|
||||
if (Array.isArray(items)) {
|
||||
const payloadItems = items
|
||||
.filter((i: any) => i && i.stockId && i.quantity && i.quantity > 0)
|
||||
.map((i: any) => ({ stockId: Number(i.stockId), quantity: Number(i.quantity) }));
|
||||
await productcontrollerSetproductcomponents({ id: (record as any).id }, { items: payloadItems });
|
||||
}
|
||||
message.success('更新成功');
|
||||
tableRef.current?.reloadAndRest?.();
|
||||
return true;
|
||||
|
|
@ -477,62 +537,7 @@ const EditForm: React.FC<{
|
|||
return false;
|
||||
}}
|
||||
>
|
||||
<ProFormSelect
|
||||
name="brandId"
|
||||
width="lg"
|
||||
label="产品品牌"
|
||||
placeholder="请选择产品品牌"
|
||||
request={async () => {
|
||||
const { data = [] } = await productcontrollerGetbrandall();
|
||||
setBrandOptions(data);
|
||||
return data.map((item: DictItem) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
}}
|
||||
rules={[{ required: true, message: '请选择产品品牌' }]}
|
||||
/>
|
||||
<ProFormSelect
|
||||
name="strengthId"
|
||||
width="lg"
|
||||
label="强度"
|
||||
placeholder="请选择强度"
|
||||
request={async () => {
|
||||
const { data = [] } = await productcontrollerGetstrengthall();
|
||||
setStrengthOptions(data);
|
||||
return data.map((item: DictItem) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
}}
|
||||
rules={[{ required: true, message: '请选择强度' }]}
|
||||
/>
|
||||
<ProFormSelect
|
||||
name="flavorsId"
|
||||
width="lg"
|
||||
label="口味"
|
||||
placeholder="请选择口味"
|
||||
request={async () => {
|
||||
const { data = [] } = await productcontrollerGetflavorsall();
|
||||
setFlavorOptions(data);
|
||||
return data.map((item: DictItem) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
}}
|
||||
rules={[{ required: true, message: '请选择口味' }]}
|
||||
/>
|
||||
<ProFormSelect
|
||||
name="humidity"
|
||||
width="lg"
|
||||
label="干湿"
|
||||
placeholder="请选择干湿"
|
||||
valueEnum={{
|
||||
dry: 'dry',
|
||||
moisture: 'moisture',
|
||||
}}
|
||||
rules={[{ required: true, message: '请选择干湿' }]}
|
||||
/>
|
||||
{/* 在这里列举attribute字段 */}
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
name="sku"
|
||||
|
|
@ -549,6 +554,46 @@ const EditForm: React.FC<{
|
|||
rules={[{ required: true, message: '请输入名称' }]}
|
||||
/>
|
||||
</ProForm.Group>
|
||||
<ProFormSelect
|
||||
name="brandId"
|
||||
width="lg"
|
||||
label="产品品牌"
|
||||
placeholder="请选择产品品牌"
|
||||
request={async () => {
|
||||
const { data = [] } = await productcontrollerCompatbrandall();
|
||||
setBrandOptions(data);
|
||||
return data.map((item: DictItem) => ({ label: item.name, value: item.id }));
|
||||
}}
|
||||
/>
|
||||
<ProFormSelect
|
||||
name="strengthId"
|
||||
width="lg"
|
||||
label="强度"
|
||||
placeholder="请选择强度"
|
||||
request={async () => {
|
||||
const { data = [] } = await productcontrollerCompatstrengthall();
|
||||
setStrengthOptions(data);
|
||||
return data.map((item: DictItem) => ({ label: item.name, value: item.id }));
|
||||
}}
|
||||
/>
|
||||
<ProFormSelect
|
||||
name="flavorsId"
|
||||
width="lg"
|
||||
label="口味"
|
||||
placeholder="请选择口味"
|
||||
request={async () => {
|
||||
const { data = [] } = await productcontrollerCompatflavorsall();
|
||||
setFlavorOptions(data);
|
||||
return data.map((item: DictItem) => ({ label: item.name, value: item.id }));
|
||||
}}
|
||||
/>
|
||||
<ProFormSelect
|
||||
name="humidity"
|
||||
width="lg"
|
||||
label="干湿"
|
||||
placeholder="请选择干湿"
|
||||
options={humidityOptions}
|
||||
/>
|
||||
<ProFormText
|
||||
name="price"
|
||||
label="价格"
|
||||
|
|
@ -569,6 +614,52 @@ const EditForm: React.FC<{
|
|||
label="产品描述"
|
||||
placeholder="请输入产品描述"
|
||||
/>
|
||||
|
||||
{/* 中文注释:编辑产品组成(库存ID + 数量) */}
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
name={['__helper']}
|
||||
hidden
|
||||
/>
|
||||
<Button
|
||||
onClick={async () => {
|
||||
await productcontrollerAutobindcomponents({ id: (record as any).id });
|
||||
const { data = [] } = await productcontrollerGetproductcomponents({ id: (record as any).id });
|
||||
const items = (data || []).map((c: any) => ({ stockId: c.stockId, quantity: c.quantity }));
|
||||
formRef.current?.setFieldsValue({ components: items });
|
||||
}}
|
||||
>
|
||||
自动绑定(同 SKU)
|
||||
</Button>
|
||||
</ProForm.Group>
|
||||
<ProFormList
|
||||
name="components"
|
||||
label="组成项"
|
||||
creatorButtonProps={{ position: 'bottom', creatorButtonText: '新增组成项' }}
|
||||
itemRender={({ listDom, action }) => (
|
||||
<div style={{ marginBottom: 8 }}>
|
||||
{listDom}
|
||||
{action}
|
||||
</div>
|
||||
)}
|
||||
>
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
name="stockId"
|
||||
label="库存ID"
|
||||
width="md"
|
||||
placeholder="请输入库存ID"
|
||||
rules={[{ required: true, message: '请输入库存ID' }]}
|
||||
/>
|
||||
<ProFormText
|
||||
name="quantity"
|
||||
label="数量"
|
||||
width="md"
|
||||
placeholder="请输入数量"
|
||||
rules={[{ required: true, message: '请输入数量' }]}
|
||||
/>
|
||||
</ProForm.Group>
|
||||
</ProFormList>
|
||||
</DrawerForm>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,206 +0,0 @@
|
|||
import {
|
||||
productcontrollerCreatestrength,
|
||||
productcontrollerDeletestrength,
|
||||
productcontrollerGetstrength,
|
||||
} from '@/servers/api/product';
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import {
|
||||
ActionType,
|
||||
DrawerForm,
|
||||
PageContainer,
|
||||
ProColumns,
|
||||
ProFormText,
|
||||
ProTable,
|
||||
} from '@ant-design/pro-components';
|
||||
import { App, Button, Popconfirm } from 'antd';
|
||||
import { useRef } from 'react';
|
||||
|
||||
const List: React.FC = () => {
|
||||
const actionRef = useRef<ActionType>();
|
||||
const { message } = App.useApp();
|
||||
const columns: ProColumns<API.Category>[] = [
|
||||
{
|
||||
title: '名称',
|
||||
dataIndex: 'name',
|
||||
tip: '名称是唯一的 key',
|
||||
formItemProps: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '名称为必填项',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '标识',
|
||||
dataIndex: 'unique_key',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '更新时间',
|
||||
dataIndex: 'updatedAt',
|
||||
valueType: 'dateTime',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createdAt',
|
||||
valueType: 'dateTime',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'option',
|
||||
valueType: 'option',
|
||||
render: (_, record) => (
|
||||
<>
|
||||
{/* <UpdateForm tableRef={actionRef} values={record} />
|
||||
<Divider type="vertical" /> */}
|
||||
<Popconfirm
|
||||
title="删除"
|
||||
description="确认删除?"
|
||||
onConfirm={async () => {
|
||||
try {
|
||||
const { success, message: errMsg } =
|
||||
await productcontrollerDeletestrength({ id: record.id });
|
||||
if (!success) {
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
actionRef.current?.reload();
|
||||
} catch (error: any) {
|
||||
message.error(error.message);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Button type="primary" danger>
|
||||
删除
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<PageContainer header={{ title: '强度列表' }}>
|
||||
<ProTable<API.Category>
|
||||
headerTitle="查询表格"
|
||||
actionRef={actionRef}
|
||||
rowKey="id"
|
||||
toolBarRender={() => [<CreateForm tableRef={actionRef} />]}
|
||||
request={async (params) => {
|
||||
const { data, success } = await productcontrollerGetstrength(params);
|
||||
return {
|
||||
total: data?.total || 0,
|
||||
data: data?.items || [],
|
||||
success,
|
||||
};
|
||||
}}
|
||||
columns={columns}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
const CreateForm: React.FC<{
|
||||
tableRef: React.MutableRefObject<ActionType | undefined>;
|
||||
}> = ({ tableRef }) => {
|
||||
const { message } = App.useApp();
|
||||
return (
|
||||
<DrawerForm<API.CreateCategoryDTO>
|
||||
title="新建"
|
||||
trigger={
|
||||
<Button type="primary">
|
||||
<PlusOutlined />
|
||||
新建
|
||||
</Button>
|
||||
}
|
||||
autoFocusFirstInput
|
||||
drawerProps={{
|
||||
destroyOnHidden: true,
|
||||
}}
|
||||
onFinish={async (values) => {
|
||||
try {
|
||||
const { success, message: errMsg } =
|
||||
await productcontrollerCreatestrength(values);
|
||||
if (!success) {
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
tableRef.current?.reload();
|
||||
message.success('提交成功');
|
||||
return true;
|
||||
} catch (error: any) {
|
||||
message.error(error.message);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<ProFormText
|
||||
name="name"
|
||||
width="md"
|
||||
label="强度名称"
|
||||
placeholder="请输入名称"
|
||||
rules={[{ required: true, message: '请输入名称' }]}
|
||||
/>
|
||||
<ProFormText
|
||||
name="unique_key"
|
||||
width="md"
|
||||
label="Key"
|
||||
placeholder="请输入Key"
|
||||
rules={[{ required: true, message: '请输入Key' }]}
|
||||
/>
|
||||
</DrawerForm>
|
||||
);
|
||||
};
|
||||
|
||||
// const UpdateForm: React.FC<{
|
||||
// tableRef: React.MutableRefObject<ActionType | undefined>;
|
||||
// values: API.Category;
|
||||
// }> = ({ tableRef, values: initialValues }) => {
|
||||
// const { message } = App.useApp();
|
||||
// return (
|
||||
// <DrawerForm<API.UpdateCategoryDTO>
|
||||
// title="编辑"
|
||||
// initialValues={initialValues}
|
||||
// trigger={
|
||||
// <Button type="primary">
|
||||
// <EditOutlined />
|
||||
// 编辑
|
||||
// </Button>
|
||||
// }
|
||||
// autoFocusFirstInput
|
||||
// drawerProps={{
|
||||
// destroyOnHidden: true,
|
||||
// }}
|
||||
// onFinish={async (values) => {
|
||||
// try {
|
||||
// const { success, message: errMsg } =
|
||||
// await productcontrollerUpdatestrength(
|
||||
// { id: initialValues.id },
|
||||
// values,
|
||||
// );
|
||||
// if (!success) {
|
||||
// throw new Error(errMsg);
|
||||
// }
|
||||
// message.success('提交成功');
|
||||
// tableRef.current?.reload();
|
||||
// return true;
|
||||
// } catch (error: any) {
|
||||
// message.error(error.message);
|
||||
// }
|
||||
// }}
|
||||
// >
|
||||
// <ProForm.Group>
|
||||
// <ProFormText
|
||||
// name="name"
|
||||
// width="md"
|
||||
// label="强度名称"
|
||||
// placeholder="请输入名称"
|
||||
// rules={[{ required: true, message: '请输入名称' }]}
|
||||
// />
|
||||
// </ProForm.Group>
|
||||
// </DrawerForm>
|
||||
// );
|
||||
// };
|
||||
|
||||
export default List;
|
||||
|
|
@ -50,46 +50,30 @@ export async function productcontrollerDeleteproduct(
|
|||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 POST /product/batchSetSku */
|
||||
export async function productcontrollerBatchsetsku(
|
||||
body: API.BatchSetSkuDTO,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.BooleanRes>('/product/batchSetSku', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 POST /product/brand */
|
||||
export async function productcontrollerCreatebrand(
|
||||
body: API.CreateBrandDTO,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.ProductBrandRes>('/product/brand', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 PUT /product/brand/${param0} */
|
||||
export async function productcontrollerUpdatebrand(
|
||||
/** 此处后端没有提供注释 GET /product/${param0}/components */
|
||||
export async function productcontrollerGetproductcomponents(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerUpdatebrandParams,
|
||||
body: API.UpdateBrandDTO,
|
||||
params: API.productcontrollerGetproductcomponentsParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { id: param0, ...queryParams } = params;
|
||||
return request<API.ProductBrandRes>(`/product/brand/${param0}`, {
|
||||
method: 'PUT',
|
||||
return request<any>(`/product/${param0}/components`, {
|
||||
method: 'GET',
|
||||
params: { ...queryParams },
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 POST /product/${param0}/components */
|
||||
export async function productcontrollerSetproductcomponents(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerSetproductcomponentsParams,
|
||||
body: API.SetProductComponentsDTO,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { id: param0, ...queryParams } = params;
|
||||
return request<any>(`/product/${param0}/components`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
|
|
@ -99,10 +83,147 @@ export async function productcontrollerUpdatebrand(
|
|||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 DELETE /product/brand/${param0} */
|
||||
export async function productcontrollerDeletebrand(
|
||||
/** 此处后端没有提供注释 POST /product/${param0}/components/auto */
|
||||
export async function productcontrollerAutobindcomponents(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerDeletebrandParams,
|
||||
params: API.productcontrollerAutobindcomponentsParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { id: param0, ...queryParams } = params;
|
||||
return request<any>(`/product/${param0}/components/auto`, {
|
||||
method: 'POST',
|
||||
params: { ...queryParams },
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 GET /product/attribute */
|
||||
export async function productcontrollerGetattributelist(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerGetattributelistParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<any>('/product/attribute', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
pageSize: undefined,
|
||||
...params['pageSize'],
|
||||
current: undefined,
|
||||
...params['current'],
|
||||
},
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 POST /product/attribute */
|
||||
export async function productcontrollerCreateattribute(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerCreateattributeParams,
|
||||
body: Record<string, any>,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<any>('/product/attribute', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 PUT /product/attribute/${param0} */
|
||||
export async function productcontrollerUpdateattribute(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerUpdateattributeParams,
|
||||
body: Record<string, any>,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { id: param0, ...queryParams } = params;
|
||||
return request<any>(`/product/attribute/${param0}`, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
params: {
|
||||
...queryParams,
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 DELETE /product/attribute/${param0} */
|
||||
export async function productcontrollerDeleteattribute(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerDeleteattributeParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { id: param0, ...queryParams } = params;
|
||||
return request<API.BooleanRes>(`/product/attribute/${param0}`, {
|
||||
method: 'DELETE',
|
||||
params: { ...queryParams },
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 GET /product/attributeAll */
|
||||
export async function productcontrollerGetattributeall(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerGetattributeallParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<any>('/product/attributeAll', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 POST /product/brand */
|
||||
export async function productcontrollerCompatcreatebrand(
|
||||
body: Record<string, any>,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<any>('/product/brand', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 PUT /product/brand/${param0} */
|
||||
export async function productcontrollerCompatupdatebrand(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerCompatupdatebrandParams,
|
||||
body: Record<string, any>,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { id: param0, ...queryParams } = params;
|
||||
return request<any>(`/product/brand/${param0}`, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
params: { ...queryParams },
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 DELETE /product/brand/${param0} */
|
||||
export async function productcontrollerCompatdeletebrand(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerCompatdeletebrandParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { id: param0, ...queryParams } = params;
|
||||
|
|
@ -114,7 +235,7 @@ export async function productcontrollerDeletebrand(
|
|||
}
|
||||
|
||||
/** 此处后端没有提供注释 GET /product/brandAll */
|
||||
export async function productcontrollerGetbrandall(options?: {
|
||||
export async function productcontrollerCompatbrandall(options?: {
|
||||
[key: string]: any;
|
||||
}) {
|
||||
return request<any>('/product/brandAll', {
|
||||
|
|
@ -124,44 +245,52 @@ export async function productcontrollerGetbrandall(options?: {
|
|||
}
|
||||
|
||||
/** 此处后端没有提供注释 GET /product/brands */
|
||||
export async function productcontrollerGetbrands(
|
||||
export async function productcontrollerCompatbrands(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerGetbrandsParams,
|
||||
params: API.productcontrollerCompatbrandsParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.ProductBrandListRes>('/product/brands', {
|
||||
return request<any>('/product/brands', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
pageSize: undefined,
|
||||
...params['pageSize'],
|
||||
current: undefined,
|
||||
...params['current'],
|
||||
},
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 GET /product/flavors */
|
||||
export async function productcontrollerGetflavors(
|
||||
export async function productcontrollerCompatflavors(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerGetflavorsParams,
|
||||
params: API.productcontrollerCompatflavorsParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<any>('/product/flavors', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
pageSize: undefined,
|
||||
...params['pageSize'],
|
||||
current: undefined,
|
||||
...params['current'],
|
||||
},
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 POST /product/flavors */
|
||||
export async function productcontrollerCreateflavors(
|
||||
body: API.CreateFlavorsDTO,
|
||||
export async function productcontrollerCompatcreateflavors(
|
||||
body: Record<string, any>,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<any>('/product/flavors', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
|
|
@ -169,17 +298,17 @@ export async function productcontrollerCreateflavors(
|
|||
}
|
||||
|
||||
/** 此处后端没有提供注释 PUT /product/flavors/${param0} */
|
||||
export async function productcontrollerUpdateflavors(
|
||||
export async function productcontrollerCompatupdateflavors(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerUpdateflavorsParams,
|
||||
body: API.UpdateFlavorsDTO,
|
||||
params: API.productcontrollerCompatupdateflavorsParams,
|
||||
body: Record<string, any>,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { id: param0, ...queryParams } = params;
|
||||
return request<any>(`/product/flavors/${param0}`, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
params: { ...queryParams },
|
||||
data: body,
|
||||
|
|
@ -188,9 +317,9 @@ export async function productcontrollerUpdateflavors(
|
|||
}
|
||||
|
||||
/** 此处后端没有提供注释 DELETE /product/flavors/${param0} */
|
||||
export async function productcontrollerDeleteflavors(
|
||||
export async function productcontrollerCompatdeleteflavors(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerDeleteflavorsParams,
|
||||
params: API.productcontrollerCompatdeleteflavorsParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { id: param0, ...queryParams } = params;
|
||||
|
|
@ -202,7 +331,7 @@ export async function productcontrollerDeleteflavors(
|
|||
}
|
||||
|
||||
/** 此处后端没有提供注释 GET /product/flavorsAll */
|
||||
export async function productcontrollerGetflavorsall(options?: {
|
||||
export async function productcontrollerCompatflavorsall(options?: {
|
||||
[key: string]: any;
|
||||
}) {
|
||||
return request<any>('/product/flavorsAll', {
|
||||
|
|
@ -241,6 +370,83 @@ export async function productcontrollerSearchproducts(
|
|||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 GET /product/size */
|
||||
export async function productcontrollerCompatsize(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerCompatsizeParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<any>('/product/size', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
pageSize: undefined,
|
||||
...params['pageSize'],
|
||||
current: undefined,
|
||||
...params['current'],
|
||||
},
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 POST /product/size */
|
||||
export async function productcontrollerCompatcreatesize(
|
||||
body: Record<string, any>,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<any>('/product/size', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 PUT /product/size/${param0} */
|
||||
export async function productcontrollerCompatupdatesize(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerCompatupdatesizeParams,
|
||||
body: Record<string, any>,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { id: param0, ...queryParams } = params;
|
||||
return request<any>(`/product/size/${param0}`, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
params: { ...queryParams },
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 DELETE /product/size/${param0} */
|
||||
export async function productcontrollerCompatdeletesize(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerCompatdeletesizeParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { id: param0, ...queryParams } = params;
|
||||
return request<API.BooleanRes>(`/product/size/${param0}`, {
|
||||
method: 'DELETE',
|
||||
params: { ...queryParams },
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 GET /product/sizeAll */
|
||||
export async function productcontrollerCompatsizeall(options?: {
|
||||
[key: string]: any;
|
||||
}) {
|
||||
return request<any>('/product/sizeAll', {
|
||||
method: 'GET',
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 GET /product/sku/${param0} */
|
||||
export async function productcontrollerProductbysku(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
|
|
@ -256,29 +462,33 @@ export async function productcontrollerProductbysku(
|
|||
}
|
||||
|
||||
/** 此处后端没有提供注释 GET /product/strength */
|
||||
export async function productcontrollerGetstrength(
|
||||
export async function productcontrollerCompatstrength(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerGetstrengthParams,
|
||||
params: API.productcontrollerCompatstrengthParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<any>('/product/strength', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
pageSize: undefined,
|
||||
...params['pageSize'],
|
||||
current: undefined,
|
||||
...params['current'],
|
||||
},
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 POST /product/strength */
|
||||
export async function productcontrollerCreatestrength(
|
||||
body: API.CreateStrengthDTO,
|
||||
export async function productcontrollerCompatcreatestrength(
|
||||
body: Record<string, any>,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<any>('/product/strength', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
|
|
@ -286,17 +496,17 @@ export async function productcontrollerCreatestrength(
|
|||
}
|
||||
|
||||
/** 此处后端没有提供注释 PUT /product/strength/${param0} */
|
||||
export async function productcontrollerUpdatestrength(
|
||||
export async function productcontrollerCompatupdatestrength(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerUpdatestrengthParams,
|
||||
body: API.UpdateStrengthDTO,
|
||||
params: API.productcontrollerCompatupdatestrengthParams,
|
||||
body: Record<string, any>,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { id: param0, ...queryParams } = params;
|
||||
return request<any>(`/product/strength/${param0}`, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
params: { ...queryParams },
|
||||
data: body,
|
||||
|
|
@ -305,9 +515,9 @@ export async function productcontrollerUpdatestrength(
|
|||
}
|
||||
|
||||
/** 此处后端没有提供注释 DELETE /product/strength/${param0} */
|
||||
export async function productcontrollerDeletestrength(
|
||||
export async function productcontrollerCompatdeletestrength(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.productcontrollerDeletestrengthParams,
|
||||
params: API.productcontrollerCompatdeletestrengthParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { id: param0, ...queryParams } = params;
|
||||
|
|
@ -319,7 +529,7 @@ export async function productcontrollerDeletestrength(
|
|||
}
|
||||
|
||||
/** 此处后端没有提供注释 GET /product/strengthAll */
|
||||
export async function productcontrollerGetstrengthall(options?: {
|
||||
export async function productcontrollerCompatstrengthall(options?: {
|
||||
[key: string]: any;
|
||||
}) {
|
||||
return request<any>('/product/strengthAll', {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,10 @@ declare namespace API {
|
|||
id?: number;
|
||||
/** 区域名称 */
|
||||
name?: string;
|
||||
/** 纬度 */
|
||||
latitude?: number;
|
||||
/** 经度 */
|
||||
longitude?: number;
|
||||
/** 创建时间 */
|
||||
createdAt: string;
|
||||
/** 更新时间 */
|
||||
|
|
@ -38,11 +42,6 @@ declare namespace API {
|
|||
id: number;
|
||||
};
|
||||
|
||||
type BatchSetSkuDTO = {
|
||||
/** sku 数据列表 */
|
||||
skus?: SkuItemDTO[];
|
||||
};
|
||||
|
||||
type BooleanRes = {
|
||||
/** 状态码 */
|
||||
code?: number;
|
||||
|
|
@ -54,40 +53,19 @@ declare namespace API {
|
|||
data?: boolean;
|
||||
};
|
||||
|
||||
type BrandPaginatedResponse = {
|
||||
/** 当前页码 */
|
||||
page?: number;
|
||||
/** 每页大小 */
|
||||
pageSize?: number;
|
||||
/** 总记录数 */
|
||||
total?: number;
|
||||
/** 数据列表 */
|
||||
items?: Dict[];
|
||||
};
|
||||
|
||||
type CreateAreaDTO = {
|
||||
/** 区域名称 */
|
||||
name?: string;
|
||||
};
|
||||
|
||||
type CreateBrandDTO = {
|
||||
/** 品牌名称 */
|
||||
title: string;
|
||||
/** 品牌唯一标识 */
|
||||
name: string;
|
||||
/** 纬度 */
|
||||
latitude?: number;
|
||||
/** 经度 */
|
||||
longitude?: number;
|
||||
};
|
||||
|
||||
type CreateDictDTO = {};
|
||||
|
||||
type CreateDictItemDTO = {};
|
||||
|
||||
type CreateFlavorsDTO = {
|
||||
/** 口味名称 */
|
||||
title: string;
|
||||
/** 口味唯一标识 */
|
||||
name: string;
|
||||
};
|
||||
|
||||
type CreateOrderNoteDTO = {
|
||||
orderId?: number;
|
||||
content?: string;
|
||||
|
|
@ -100,15 +78,12 @@ declare namespace API {
|
|||
description?: string;
|
||||
/** 产品 SKU */
|
||||
sku?: string;
|
||||
/** 品牌 ID */
|
||||
brandId?: number;
|
||||
/** 规格 ID */
|
||||
strengthId?: number;
|
||||
/** 口味 ID */
|
||||
flavorsId?: number;
|
||||
humidity?: string;
|
||||
/** 属性列表 */
|
||||
attributes?: any[];
|
||||
/** 价格 */
|
||||
price?: number;
|
||||
/** 促销价格 */
|
||||
promotionPrice?: number;
|
||||
};
|
||||
|
||||
type CreatePurchaseOrderDTO = {
|
||||
|
|
@ -128,13 +103,6 @@ declare namespace API {
|
|||
contactPhone?: string;
|
||||
};
|
||||
|
||||
type CreateStrengthDTO = {
|
||||
/** 规格名称 */
|
||||
title?: string;
|
||||
/** 规格唯一标识 */
|
||||
name: string;
|
||||
};
|
||||
|
||||
type CreateTemplateDTO = {
|
||||
/** 模板名称 */
|
||||
name: string;
|
||||
|
|
@ -182,8 +150,6 @@ declare namespace API {
|
|||
SignatureRequirementEnum?: any;
|
||||
};
|
||||
|
||||
type Dict = {};
|
||||
|
||||
type dictcontrollerDeletedictitemParams = {
|
||||
id: number;
|
||||
};
|
||||
|
|
@ -734,10 +700,14 @@ declare namespace API {
|
|||
sku?: string;
|
||||
/** 价格 */
|
||||
price?: number;
|
||||
/** 类型 */
|
||||
type?: string;
|
||||
/** 促销价格 */
|
||||
promotionPrice?: number;
|
||||
/** 库存 */
|
||||
stock?: number;
|
||||
/** 库存组成 */
|
||||
components?: ProductStockComponent[];
|
||||
/** 来源 */
|
||||
source?: number;
|
||||
/** 创建时间 */
|
||||
|
|
@ -746,33 +716,78 @@ declare namespace API {
|
|||
updatedAt: string;
|
||||
};
|
||||
|
||||
type ProductBrandListRes = {
|
||||
/** 状态码 */
|
||||
code?: number;
|
||||
/** 是否成功 */
|
||||
success?: boolean;
|
||||
/** 消息内容 */
|
||||
message?: string;
|
||||
/** 响应数据 */
|
||||
data?: BrandPaginatedResponse;
|
||||
type ProductComponentItemDTO = {
|
||||
/** 库存记录ID */
|
||||
stockId?: number;
|
||||
/** 组成数量 */
|
||||
quantity?: number;
|
||||
};
|
||||
|
||||
type ProductBrandRes = {
|
||||
/** 状态码 */
|
||||
code?: number;
|
||||
/** 是否成功 */
|
||||
success?: boolean;
|
||||
/** 消息内容 */
|
||||
message?: string;
|
||||
/** 响应数据 */
|
||||
data?: Dict;
|
||||
};
|
||||
|
||||
type productcontrollerDeletebrandParams = {
|
||||
type productcontrollerAutobindcomponentsParams = {
|
||||
id: number;
|
||||
};
|
||||
|
||||
type productcontrollerDeleteflavorsParams = {
|
||||
type productcontrollerCompatbrandsParams = {
|
||||
name?: string;
|
||||
pageSize?: Record<string, any>;
|
||||
current?: Record<string, any>;
|
||||
};
|
||||
|
||||
type productcontrollerCompatdeletebrandParams = {
|
||||
id: number;
|
||||
};
|
||||
|
||||
type productcontrollerCompatdeleteflavorsParams = {
|
||||
id: number;
|
||||
};
|
||||
|
||||
type productcontrollerCompatdeletesizeParams = {
|
||||
id: number;
|
||||
};
|
||||
|
||||
type productcontrollerCompatdeletestrengthParams = {
|
||||
id: number;
|
||||
};
|
||||
|
||||
type productcontrollerCompatflavorsParams = {
|
||||
name?: string;
|
||||
pageSize?: Record<string, any>;
|
||||
current?: Record<string, any>;
|
||||
};
|
||||
|
||||
type productcontrollerCompatsizeParams = {
|
||||
name?: string;
|
||||
pageSize?: Record<string, any>;
|
||||
current?: Record<string, any>;
|
||||
};
|
||||
|
||||
type productcontrollerCompatstrengthParams = {
|
||||
name?: string;
|
||||
pageSize?: Record<string, any>;
|
||||
current?: Record<string, any>;
|
||||
};
|
||||
|
||||
type productcontrollerCompatupdatebrandParams = {
|
||||
id: number;
|
||||
};
|
||||
|
||||
type productcontrollerCompatupdateflavorsParams = {
|
||||
id: number;
|
||||
};
|
||||
|
||||
type productcontrollerCompatupdatesizeParams = {
|
||||
id: number;
|
||||
};
|
||||
|
||||
type productcontrollerCompatupdatestrengthParams = {
|
||||
id: number;
|
||||
};
|
||||
|
||||
type productcontrollerCreateattributeParams = {
|
||||
dictName?: string;
|
||||
};
|
||||
|
||||
type productcontrollerDeleteattributeParams = {
|
||||
id: number;
|
||||
};
|
||||
|
||||
|
|
@ -780,28 +795,21 @@ declare namespace API {
|
|||
id: number;
|
||||
};
|
||||
|
||||
type productcontrollerDeletestrengthParams = {
|
||||
type productcontrollerGetattributeallParams = {
|
||||
dictName?: string;
|
||||
};
|
||||
|
||||
type productcontrollerGetattributelistParams = {
|
||||
name?: string;
|
||||
pageSize?: Record<string, any>;
|
||||
current?: Record<string, any>;
|
||||
dictName?: string;
|
||||
};
|
||||
|
||||
type productcontrollerGetproductcomponentsParams = {
|
||||
id: number;
|
||||
};
|
||||
|
||||
type productcontrollerGetbrandsParams = {
|
||||
/** 页码 */
|
||||
current?: number;
|
||||
/** 每页大小 */
|
||||
pageSize?: number;
|
||||
/** 关键字 */
|
||||
name?: string;
|
||||
};
|
||||
|
||||
type productcontrollerGetflavorsParams = {
|
||||
/** 页码 */
|
||||
current?: number;
|
||||
/** 每页大小 */
|
||||
pageSize?: number;
|
||||
/** 关键字 */
|
||||
name?: string;
|
||||
};
|
||||
|
||||
type productcontrollerGetproductlistParams = {
|
||||
/** 页码 */
|
||||
current?: number;
|
||||
|
|
@ -813,15 +821,6 @@ declare namespace API {
|
|||
brandId?: number;
|
||||
};
|
||||
|
||||
type productcontrollerGetstrengthParams = {
|
||||
/** 页码 */
|
||||
current?: number;
|
||||
/** 每页大小 */
|
||||
pageSize?: number;
|
||||
/** 关键字 */
|
||||
name?: string;
|
||||
};
|
||||
|
||||
type productcontrollerProductbyskuParams = {
|
||||
sku: string;
|
||||
};
|
||||
|
|
@ -830,11 +829,12 @@ declare namespace API {
|
|||
name?: string;
|
||||
};
|
||||
|
||||
type productcontrollerUpdatebrandParams = {
|
||||
type productcontrollerSetproductcomponentsParams = {
|
||||
id: number;
|
||||
};
|
||||
|
||||
type productcontrollerUpdateflavorsParams = {
|
||||
type productcontrollerUpdateattributeParams = {
|
||||
dictName?: string;
|
||||
id: number;
|
||||
};
|
||||
|
||||
|
|
@ -847,10 +847,6 @@ declare namespace API {
|
|||
id: number;
|
||||
};
|
||||
|
||||
type productcontrollerUpdatestrengthParams = {
|
||||
id: number;
|
||||
};
|
||||
|
||||
type ProductListRes = {
|
||||
/** 状态码 */
|
||||
code?: number;
|
||||
|
|
@ -895,6 +891,18 @@ declare namespace API {
|
|||
data?: Product[];
|
||||
};
|
||||
|
||||
type ProductStockComponent = {
|
||||
id?: number;
|
||||
productId?: number;
|
||||
stockId?: number;
|
||||
/** 组成数量 */
|
||||
quantity?: number;
|
||||
/** 创建时间 */
|
||||
createdAt?: string;
|
||||
/** 更新时间 */
|
||||
updatedAt?: string;
|
||||
};
|
||||
|
||||
type PurchaseOrderDTO = {
|
||||
id?: number;
|
||||
stockPointId?: number;
|
||||
|
|
@ -950,15 +958,6 @@ declare namespace API {
|
|||
name?: string;
|
||||
};
|
||||
|
||||
type QueryBrandDTO = {
|
||||
/** 页码 */
|
||||
current?: number;
|
||||
/** 每页大小 */
|
||||
pageSize?: number;
|
||||
/** 关键字 */
|
||||
name?: string;
|
||||
};
|
||||
|
||||
type QueryCustomerListDTO = {
|
||||
current?: string;
|
||||
pageSize?: string;
|
||||
|
|
@ -971,15 +970,6 @@ declare namespace API {
|
|||
customerId?: number;
|
||||
};
|
||||
|
||||
type QueryFlavorsDTO = {
|
||||
/** 页码 */
|
||||
current?: number;
|
||||
/** 每页大小 */
|
||||
pageSize?: number;
|
||||
/** 关键字 */
|
||||
name?: string;
|
||||
};
|
||||
|
||||
type QueryOrderDTO = {
|
||||
/** 页码 */
|
||||
current?: number;
|
||||
|
|
@ -1095,15 +1085,6 @@ declare namespace API {
|
|||
endDate?: string;
|
||||
};
|
||||
|
||||
type QueryStrengthDTO = {
|
||||
/** 页码 */
|
||||
current?: number;
|
||||
/** 每页大小 */
|
||||
pageSize?: number;
|
||||
/** 关键字 */
|
||||
name?: string;
|
||||
};
|
||||
|
||||
type QuerySubscriptionDTO = {
|
||||
/** 页码 */
|
||||
current?: number;
|
||||
|
|
@ -1198,6 +1179,11 @@ declare namespace API {
|
|||
constitution?: { sku?: string; quantity?: number }[];
|
||||
};
|
||||
|
||||
type SetProductComponentsDTO = {
|
||||
/** 组成项列表 */
|
||||
items?: ProductComponentItemDTO[];
|
||||
};
|
||||
|
||||
type ShipmentBookDTO = {
|
||||
sales?: OrderSale[];
|
||||
details?: ShippingDetailsDTO;
|
||||
|
|
@ -1273,7 +1259,7 @@ declare namespace API {
|
|||
/** 站点 rest 秘钥 */
|
||||
consumerSecret?: string;
|
||||
/** 站点名 */
|
||||
siteName?: string;
|
||||
name?: string;
|
||||
/** 平台类型 */
|
||||
type?: 'woocommerce' | 'shopyy';
|
||||
/** SKU 前缀 */
|
||||
|
|
@ -1292,13 +1278,6 @@ declare namespace API {
|
|||
id: string;
|
||||
};
|
||||
|
||||
type SkuItemDTO = {
|
||||
/** 产品 ID */
|
||||
productId?: number;
|
||||
/** sku 编码 */
|
||||
sku?: string;
|
||||
};
|
||||
|
||||
type statisticscontrollerGetinativeusersbymonthParams = {
|
||||
month?: string;
|
||||
};
|
||||
|
|
@ -1616,26 +1595,16 @@ declare namespace API {
|
|||
type UpdateAreaDTO = {
|
||||
/** 区域名称 */
|
||||
name?: string;
|
||||
};
|
||||
|
||||
type UpdateBrandDTO = {
|
||||
/** 品牌名称 */
|
||||
title?: string;
|
||||
/** 品牌唯一标识 */
|
||||
name?: string;
|
||||
/** 纬度 */
|
||||
latitude?: number;
|
||||
/** 经度 */
|
||||
longitude?: number;
|
||||
};
|
||||
|
||||
type UpdateDictDTO = {};
|
||||
|
||||
type UpdateDictItemDTO = {};
|
||||
|
||||
type UpdateFlavorsDTO = {
|
||||
/** 口味名称 */
|
||||
title?: string;
|
||||
/** 口味唯一标识 */
|
||||
name?: string;
|
||||
};
|
||||
|
||||
type UpdateProductDTO = {
|
||||
/** 产品名称 */
|
||||
name?: string;
|
||||
|
|
@ -1643,15 +1612,12 @@ declare namespace API {
|
|||
description?: string;
|
||||
/** 产品 SKU */
|
||||
sku?: string;
|
||||
/** 品牌 ID */
|
||||
brandId?: number;
|
||||
/** 规格 ID */
|
||||
strengthId?: number;
|
||||
/** 口味 ID */
|
||||
flavorsId?: number;
|
||||
humidity?: string;
|
||||
/** 价格 */
|
||||
price?: number;
|
||||
/** 促销价格 */
|
||||
promotionPrice?: number;
|
||||
/** 属性列表 */
|
||||
attributes?: any[];
|
||||
};
|
||||
|
||||
type UpdatePurchaseOrderDTO = {
|
||||
|
|
@ -1680,13 +1646,6 @@ declare namespace API {
|
|||
contactPhone?: string;
|
||||
};
|
||||
|
||||
type UpdateStrengthDTO = {
|
||||
/** 规格名称 */
|
||||
title?: string;
|
||||
/** 规格唯一标识 */
|
||||
name?: string;
|
||||
};
|
||||
|
||||
type UpdateTemplateDTO = {
|
||||
/** 模板名称 */
|
||||
name: string;
|
||||
|
|
@ -1720,6 +1679,10 @@ declare namespace API {
|
|||
on_sale?: boolean;
|
||||
};
|
||||
|
||||
type usercontrollerUpdateuserParams = {
|
||||
id?: number;
|
||||
};
|
||||
|
||||
type VariationDTO = {
|
||||
/** ID */
|
||||
id: number;
|
||||
|
|
|
|||
|
|
@ -72,3 +72,24 @@ export async function usercontrollerToggleactive(
|
|||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 POST /user/update/${param0} */
|
||||
export async function usercontrollerUpdateuser(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.usercontrollerUpdateuserParams,
|
||||
body: Record<string, any>,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { id: param0, ...queryParams } = params;
|
||||
return request<any>(`/user/update/${param0}`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
params: {
|
||||
...queryParams,
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue