Переглянути джерело

add: shopee product list

dev
powersir 1 рік тому
джерело
коміт
91a12544a4
6 змінених файлів з 1279 додано та 10 видалено
  1. +1052
    -0
      mock/shopeeProduct.json
  2. +1
    -0
      src/models/index.ts
  3. +32
    -0
      src/models/platform-product.data.ts
  4. +193
    -0
      src/pages/custom/platform-product/shopee/index.tsx
  5. +0
    -9
      src/pages/custom/platform-product/xiapi/index.tsx
  6. +1
    -1
      src/request/index.ts

+ 1052
- 0
mock/shopeeProduct.json
Різницю між файлами не показано, бо вона завелика
Переглянути файл


+ 1
- 0
src/models/index.ts Переглянути файл

@@ -5,6 +5,7 @@ export * from './position.data.ts'
export * from './department.data.ts'
export * from './tenant.data.ts'
export * from './template.data.ts'
export * from './platform-product.data.ts'

export interface ResponseDTO<T>{
code: number;


+ 32
- 0
src/models/platform-product.data.ts Переглянути файл

@@ -0,0 +1,32 @@


export interface ProductKeywordGpt {
dynamicTableName: string;
id: number;
idList: string[],
keyword: string;
keywordType: number;
lang: string;
spuCode: string;
tableName: string;
}

export interface ShpopeeProductVO {
catePubId: string;
catePubName: string;
id: number;
imgUrl: string;
isDelete: number;
isPublish: number;
itemId: number;
itemName: string;
originalPrice: number;
publishErrInfo: string;
publishTime: string;
requestId: string;
spuCode: string;
tbProductKeywordGpts: ProductKeywordGpt[];
tbSpuCodes: string[],
templateId: number;
templateName: string;
}

+ 193
- 0
src/pages/custom/platform-product/shopee/index.tsx Переглянути файл

@@ -0,0 +1,193 @@
import { Space, Table, Form, Button, Card, Input, TreeSelect, Image } from 'antd';
import type { ColumnsType } from 'antd/es/table';
import { t } from '@/utils/i18n';
import React, { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import {
ExclamationCircleFilled,
PlusOutlined,
CarryOutOutlined,
SearchOutlined,
UndoOutlined
} from '@ant-design/icons';
import { antdUtils } from '@/utils/antd';
import { ShpopeeProductVO } from '@/models';
import mockData from '../../../../../mock/shopeeProduct.json'

const treeData = [
{
value: 'parent 1',
title: 'parent 1',
icon: <CarryOutOutlined />,
children: [
{
value: 'parent 1-0',
title: 'parent 1-0',
icon: <CarryOutOutlined />,
children: [
{
value: 'leaf1',
title: 'leaf1',
icon: <CarryOutOutlined />,
},
{
value: 'leaf2',
title: 'leaf2',
icon: <CarryOutOutlined />,
},
],
},
{
value: 'parent 1-1',
title: 'parent 1-1',
icon: <CarryOutOutlined />,
children: [
{
value: 'sss',
title: 'sss',
icon: <CarryOutOutlined />,
},
],
},
],
},
];

export default () => {

const showDeleteConfirm = (item: ShpopeeProductVO) => {
antdUtils.modal?.confirm({
title: `确认删除编码为: ${item.spuCode} 的产品吗?`,
icon: <ExclamationCircleFilled />,
content: `请注意删除以后不可恢复!`,
okText: '删除',
okType: 'danger',
cancelText: '取消',
onOk() {
return new Promise((resolve, reject) => {
setTimeout(() => {
antdUtils.message?.open({
type: 'success',
content: '删除成功',
});
resolve(null)
}, 1000);

}).catch(() => antdUtils.message?.open({
type: 'error',
content: '操作失败',
}));
},
onCancel() {
},
});
};

const columns: ColumnsType<ShpopeeProductVO> = [
{
title: '缩略图',
dataIndex: 'imgUrl',
key: 'imgUrl',
render: (value: string) => (
<div className='flex justify-center'>
{value ? (
<Image src={value} className='w-[40px] h-[40px] flex items-center rounded-[5%]' />
) : null}
</div>
),
align: 'center',
width: 100,
},
{
title: '产品编码',
dataIndex: 'spuCode',
key: 'spuCode',
},
{
title: '产品名称',
dataIndex: 'itemName',
key: 'itemName',
},
{
title: '类目',
key: 'catePubName',
dataIndex: 'catePubName'
},
{
title: '成品spu',
dataIndex: 'spuCode',
key: 'spuCode',
},
{
title: '是否刊登',
dataIndex: 'isPublish',
key: 'isPublish',
},
{
title: '刊登时间',
key: 'publishTime',
dataIndex: 'publishTime'
},
{
title: t("QkOmYwne" /* 操作 */),
key: 'action',
render: (_, record) => (
<Space size="middle">
<a onClick={() => {
}}>编辑</a>
<a onClick={() => {
showDeleteConfirm(record)
}}>删除</a>
</Space>
),
},
];

const [searchFrom] = Form.useForm();
const navigate = useNavigate();


const [treeLine, setTreeLine] = useState(true);
const [showLeafIcon, setShowLeafIcon] = useState(false);
const [showIcon, setShowIcon] = useState<boolean>(false);

return (
<div>
<div>
<Card className='mt-[4px] dark:bg-[rgb(33,41,70)] bg-white roundle-lg px[12px]' bodyStyle={{ paddingTop: 4, paddingBottom: 4 }}>
<div className='flex justify-between content-center'>
<div className='flex justify-normal items-center'>
<Form layout='inline' form={searchFrom}>
<Form.Item name="name" label="所属类目">
<TreeSelect
treeDataSimpleMode
style={{ width: '100%' }}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
treeLine={treeLine && { showLeafIcon }}
treeData={treeData}
treeIcon={showIcon}
size='large'
placeholder="请选择类目"
/>
</Form.Item>
{/* <Form.Item className='w-[250px]' name="status" label="店铺">
<Input placeholder='请输入店铺名称' />
</Form.Item> */}
</Form>
<Space.Compact className="ml-5">
<Button type='primary' size='large' icon={<SearchOutlined />}> 搜索 </Button>
<Button type='primary' size='large' icon={<UndoOutlined />}> 重置 </Button>
</Space.Compact>
</div>
</div>
</Card>
<Card className='mt-[4px] dark:bg-[rgb(33,41,70)] bg-white roundle-lg px[12px]'>
<Table rowKey="id" scroll={{ x: true }} columns={columns} dataSource={mockData as ShpopeeProductVO[]} className='bg-transparent'
pagination={{ position: ['bottomRight'] }}
/>
</Card>
</div>
</div>
);
};


+ 0
- 9
src/pages/custom/platform-product/xiapi/index.tsx Переглянути файл

@@ -1,9 +0,0 @@
import { Empty } from 'antd';

const CustomMade = () => {
return (
<Empty />
);
};

export default CustomMade;

+ 1
- 1
src/request/index.ts Переглянути файл

@@ -137,6 +137,7 @@ class Request {
response: AxiosResponse<any, any>
): Promise<any> {
if (!response.config.url?.startsWith(refreshTokenUrl)) {
this.requestingCount -= 1;
if(response.data && response.data.code && response.data.code === 401) {
return new Promise((resolve) => {
this.requestQueue.unshift({resolve, config: response.config, type: 'response'});
@@ -146,7 +147,6 @@ class Request {
this.refreshToken();
});
} else {
this.requestingCount -= 1;
if (this.requestQueue.length) {
this.requestByQueue();
}


Завантаження…
Відмінити
Зберегти