@@ -16,6 +16,7 @@ export * from './category.data.ts' | |||||
export * from './material-classify.data.ts' | export * from './material-classify.data.ts' | ||||
export * from './goods-classify.data.ts' | export * from './goods-classify.data.ts' | ||||
export * from './goods-attr.data.ts' | export * from './goods-attr.data.ts' | ||||
export * from './shopee-product.data.ts' | |||||
export interface ResponseDTO<T>{ | export interface ResponseDTO<T>{ | ||||
code: number; | code: number; | ||||
@@ -1,32 +1,256 @@ | |||||
/** | |||||
* SHProductVO 虾皮商品 | |||||
*/ | |||||
export interface SHProductVO { | |||||
/** | |||||
* 品牌id(类目属性冗余过来,这个必填) | |||||
*/ | |||||
brandId: number; | |||||
/** | |||||
* 类目id | |||||
*/ | |||||
catePubId: string; | |||||
/** | |||||
* 类目名称 | |||||
*/ | |||||
catePubName: string; | |||||
/** | |||||
* 项目状况,可以是新的或二手的 | |||||
*/ | |||||
conditionVal?: string; | |||||
/** | |||||
* 创建时间 | |||||
*/ | |||||
createTime: Date; | |||||
/** | |||||
* 保证发货订单的天数 | |||||
*/ | |||||
daysToShip?: number; | |||||
/** | |||||
* 是否删除 0:未删除 1:删除 | |||||
*/ | |||||
deleted: boolean; | |||||
/** | |||||
* 描述-需要确认大小 | |||||
*/ | |||||
description: string; | |||||
/** | |||||
* description_type(正常,扩展)--- 不要了,白名单卖家字段关联,那个先不管 | |||||
*/ | |||||
descriptionType?: string; | |||||
/** | |||||
* 虾皮折扣活动ID | |||||
*/ | |||||
discountId?: number; | |||||
/** | |||||
* (仅适用于 BR 本地卖家)全球贸易项目代码。如果已上传,请通过get_item_base_info api 检查项目的gtin_code | |||||
*/ | |||||
gtinCode?: string; | |||||
/** | |||||
* 自增id | |||||
*/ | |||||
id: number; | |||||
/** | |||||
* 图片 | |||||
*/ | |||||
imgUrl: string; | |||||
/** | |||||
* 产品备货数量 | |||||
*/ | |||||
inventory?: number; | |||||
/** | |||||
* 商品是否为预购商品(0.否 1.是) | |||||
*/ | |||||
isPreOrder: number; | |||||
/** | |||||
* 是否已刊登到店铺1: 是, 2: 否 3.仍需手动重新刊登 | |||||
*/ | |||||
isPublish: string; | |||||
/** | |||||
* 此字段仅适用于印度尼西亚和马来西亚的本地卖家。使用此字段可确定产品是否为危险产品。0 表示非危险品,1 表示危险品。有关更多信息,请访问市场相应的卖家教育中心。) | |||||
*/ | |||||
itemDangerous?: string; | |||||
/** | |||||
* 产品id | |||||
*/ | |||||
itemId?: number; | |||||
/** | |||||
* 产品名称 | |||||
*/ | |||||
itemName: string; | |||||
/** | |||||
* 产品状态(UNLIST:下架状态; NORMAL:上架状态) | |||||
*/ | |||||
itemStatus?: string; | |||||
/** | |||||
* 产品价格 | |||||
*/ | |||||
originalPrice?: number; | |||||
/** | |||||
* 单价折扣 | |||||
*/ | |||||
priceDiscount?: number; | |||||
/** | |||||
* 刊登失败原因 | |||||
*/ | |||||
publishErrInfo?: string; | |||||
/** | |||||
* 刊登时间 | |||||
*/ | |||||
publishTime?: Date; | |||||
/** | |||||
* 用于错误跟踪的 API 请求的标识符 | |||||
*/ | |||||
requestId?: string; | |||||
/** | |||||
* 店铺id | |||||
*/ | |||||
shopId: number; | |||||
/** | |||||
* 尺码ID | |||||
*/ | |||||
sizeId?: number; | |||||
/** | |||||
* 产品spu编码 | |||||
*/ | |||||
spuCode: string; | |||||
/** | |||||
* 成品spuCode | |||||
*/ | |||||
tbSpuCodes: string[]; | |||||
/** | |||||
* 模版Id | |||||
*/ | |||||
templateId: number; | |||||
/** | |||||
* 模版名称 | |||||
*/ | |||||
templateName: string; | |||||
} | |||||
export interface SHProductPageReqVO extends PageParam { | |||||
/** | |||||
* 品牌id(类目属性冗余过来,这个必填) | |||||
*/ | |||||
brandId?: number; | |||||
/** | |||||
* 类目id | |||||
*/ | |||||
catePubId?: string; | |||||
/** | |||||
* 项目状况,可以是新的或二手的 | |||||
*/ | |||||
conditionVal?: string; | |||||
/** | |||||
* 创建时间 | |||||
*/ | |||||
createTime?: string[]; | |||||
/** | |||||
* 保证发货订单的天数 | |||||
*/ | |||||
daysToShip?: number; | |||||
/** | |||||
* 描述-需要确认大小 | |||||
*/ | |||||
description?: string; | |||||
/** | |||||
* description_type(正常,扩展)--- 不要了,白名单卖家字段关联,那个先不管 | |||||
*/ | |||||
descriptionType?: string; | |||||
/** | |||||
* 虾皮折扣活动ID | |||||
*/ | |||||
discountId?: number; | |||||
/** | |||||
* (仅适用于 BR 本地卖家)全球贸易项目代码。如果已上传,请通过get_item_base_info api 检查项目的gtin_code | |||||
*/ | |||||
gtinCode?: string; | |||||
/** | |||||
* 产品备货数量 | |||||
*/ | |||||
inventory?: number; | |||||
/** | |||||
* 商品是否为预购商品(0.否 1.是) | |||||
*/ | |||||
isPreOrder?: number; | |||||
/** | |||||
* 是否已刊登到店铺1: 是, 2: 否 3.仍需手动重新刊登 | |||||
*/ | |||||
isPublish?: string; | |||||
/** | |||||
* 此字段仅适用于印度尼西亚和马来西亚的本地卖家。使用此字段可确定产品是否为危险产品。0 表示非危险品,1 表示危险品。有关更多信息,请访问市场相应的卖家教育中心。) | |||||
*/ | |||||
itemDangerous?: string; | |||||
/** | |||||
* 产品id | |||||
*/ | |||||
itemId?: number; | |||||
/** | |||||
* 产品名称 | |||||
*/ | |||||
itemName?: string; | |||||
/** | |||||
* 产品状态(UNLIST:下架状态; NORMAL:上架状态) | |||||
*/ | |||||
itemStatus?: string; | |||||
/** | |||||
* 产品价格 | |||||
*/ | |||||
originalPrice?: number; | |||||
/** | |||||
* 单价折扣 | |||||
*/ | |||||
priceDiscount?: number; | |||||
/** | |||||
* 刊登失败原因 | |||||
*/ | |||||
publishErrInfo?: string; | |||||
/** | |||||
* 刊登时间 | |||||
*/ | |||||
publishTime?: string[]; | |||||
/** | |||||
* 用于错误跟踪的 API 请求的标识符 | |||||
*/ | |||||
requestId?: string; | |||||
/** | |||||
* 店铺id | |||||
*/ | |||||
shopId?: number; | |||||
/** | |||||
* 尺码ID | |||||
*/ | |||||
sizeId?: number; | |||||
/** | |||||
* 产品spu编码 | |||||
*/ | |||||
spuCode?: string; | |||||
/** | |||||
* 模版Id | |||||
*/ | |||||
templateId?: number; | |||||
} | |||||
export interface UpdateSHProductNameReqVO { | |||||
id: number; | |||||
spuCode: string; | |||||
gpts: ProductKeywordGpt[]; | |||||
} | |||||
export interface ProductKeywordGpt { | export interface ProductKeywordGpt { | ||||
dynamicTableName: string; | |||||
id: number; | id: number; | ||||
idList: string[], | |||||
keyword: string; | keyword: string; | ||||
keywordType: number; | keywordType: number; | ||||
lang: string; | |||||
spuCode: string; | |||||
tableName: string; | |||||
} | } | ||||
export interface ShpopeeProductVO { | |||||
catePubId: string; | |||||
catePubName: string; | |||||
export interface UpdateSHProductPriceReqVO { | |||||
id: number; | id: number; | ||||
imgUrl: string; | |||||
isDelete: number; | |||||
isPublish: number; | |||||
itemId: number; | |||||
itemName: string; | |||||
originalPrice: number; | originalPrice: number; | ||||
publishErrInfo: string; | |||||
publishTime: string; | |||||
requestId: string; | |||||
spuCode: string; | |||||
tbProductKeywordGpts: ProductKeywordGpt[]; | |||||
tbSpuCodes: string[], | |||||
templateId: number; | |||||
templateName: string; | |||||
} | |||||
export interface UpdateSHProductDescReqVO { | |||||
id: number; | |||||
description: string; | |||||
} | } |
@@ -1,18 +1,17 @@ | |||||
import React, { useEffect, useState } from 'react'; | |||||
import { Space, Table, Form, Button, Card, Input, TreeSelect, Image } from 'antd'; | import { Space, Table, Form, Button, Card, Input, TreeSelect, Image } from 'antd'; | ||||
import type { ColumnsType } from 'antd/es/table'; | import type { ColumnsType } from 'antd/es/table'; | ||||
import { t } from '@/utils/i18n'; | import { t } from '@/utils/i18n'; | ||||
import React, { useState } from 'react'; | |||||
import { useNavigate } from 'react-router-dom'; | |||||
import { | import { | ||||
ExclamationCircleFilled, | |||||
PlusOutlined, | |||||
CarryOutOutlined, | CarryOutOutlined, | ||||
SearchOutlined, | SearchOutlined, | ||||
UndoOutlined | UndoOutlined | ||||
} from '@ant-design/icons'; | } from '@ant-design/icons'; | ||||
import { antdUtils } from '@/utils/antd'; | import { antdUtils } from '@/utils/antd'; | ||||
import { ShpopeeProductVO } from '@/models'; | |||||
import mockData from '../../../../../mock/shopeeProduct.json' | |||||
import { useSetState } from 'ahooks'; | |||||
import { SHProductVO, SHProductPageReqVO } from '@/models'; | |||||
import { useRequest } from '@/hooks/use-request'; | |||||
import shopeeProductService from '@/request/service/shopee-product'; | |||||
const treeData = [ | const treeData = [ | ||||
{ | { | ||||
@@ -55,35 +54,28 @@ const treeData = [ | |||||
export default () => { | 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); | |||||
const [dataSource, setDataSource] = useState<SHProductVO[]>([]); | |||||
const [searchFrom] = Form.useForm(); | |||||
const [searchState, setSearchState] = useSetState<SHProductPageReqVO>({}); | |||||
const [total, setTotal] = useState(0); | |||||
}).catch(() => antdUtils.message?.open({ | |||||
type: 'error', | |||||
content: '操作失败', | |||||
})); | |||||
}, | |||||
onCancel() { | |||||
}, | |||||
}); | |||||
}; | |||||
const { runAsync: getPageApi } = useRequest(shopeeProductService.pageApi, { manual: true }); | |||||
const { runAsync: batchUpdateNameApi } = useRequest(shopeeProductService.batchUpdateNameApi, { manual: true }); | |||||
const { runAsync: batchUpdateDescApi } = useRequest(shopeeProductService.batchUpdateDescApi, { manual: true }); | |||||
const { runAsync: batchUpdatePriceApi } = useRequest(shopeeProductService.batchUpdatePriceApi, { manual: true }); | |||||
const columns: ColumnsType<ShpopeeProductVO> = [ | |||||
const load = async () => { | |||||
searchFrom.setFieldValue("pageSize", searchState.pageSize); | |||||
searchFrom.setFieldValue("pageNo", searchState.pageNo); | |||||
//TODO: merge search params | |||||
const [error, { data }] = await getPageApi(searchFrom.getFieldsValue()); | |||||
if (!error) { | |||||
setDataSource(data.list); | |||||
setTotal(data.total); | |||||
} | |||||
} | |||||
const columns: ColumnsType<SHProductVO> = [ | |||||
{ | { | ||||
title: '缩略图', | title: '缩略图', | ||||
dataIndex: 'imgUrl', | dataIndex: 'imgUrl', | ||||
@@ -127,30 +119,17 @@ export default () => { | |||||
title: '刊登时间', | title: '刊登时间', | ||||
key: 'publishTime', | key: 'publishTime', | ||||
dataIndex: '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 [treeLine, setTreeLine] = useState(true); | ||||
const [showLeafIcon, setShowLeafIcon] = useState(false); | const [showLeafIcon, setShowLeafIcon] = useState(false); | ||||
const [showIcon, setShowIcon] = useState<boolean>(false); | const [showIcon, setShowIcon] = useState<boolean>(false); | ||||
useEffect(() => { | |||||
load(); | |||||
}, [searchFrom, searchState]); | |||||
return ( | return ( | ||||
<div> | <div> | ||||
<div> | <div> | ||||
@@ -182,8 +161,17 @@ export default () => { | |||||
</div> | </div> | ||||
</Card> | </Card> | ||||
<Card className='mt-[4px] dark:bg-[rgb(33,41,70)] bg-white roundle-lg px[12px]'> | <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'] }} | |||||
<Table rowKey="id" | |||||
scroll={{ x: true }} | |||||
columns={columns} | |||||
dataSource={dataSource} | |||||
className='bg-transparent' | |||||
pagination={{ | |||||
position: ['bottomRight'], | |||||
current: searchState.pageNo, | |||||
pageSize: searchState.pageSize, | |||||
total | |||||
}} | |||||
/> | /> | ||||
</Card> | </Card> | ||||
</div> | </div> | ||||
@@ -0,0 +1,33 @@ | |||||
import request from '@/request'; | |||||
import { | |||||
SHProductVO, | |||||
SHProductPageReqVO, | |||||
UpdateSHProductNameReqVO, | |||||
UpdateSHProductPriceReqVO, | |||||
UpdateSHProductDescReqVO, | |||||
PageData | |||||
} from '@/models'; | |||||
const BASE_URL = '/admin-api/shopee/product'; | |||||
export default { | |||||
pageApi: (params: SHProductPageReqVO) => { | |||||
return request.get<PageData<SHProductVO>>(`${BASE_URL}/page`, { params }); | |||||
}, | |||||
//批量修改标题 | |||||
batchUpdateNameApi: (data: UpdateSHProductNameReqVO[]) => { | |||||
return request.put(`${BASE_URL}/batchUpdateName`, data); | |||||
}, | |||||
//批量修改价格 | |||||
batchUpdatePriceApi: (data: UpdateSHProductPriceReqVO[]) => { | |||||
return request.put(`${BASE_URL}/batchUpdatePrice`, data); | |||||
}, | |||||
//批量修改描述 | |||||
batchUpdateDescApi: (data: UpdateSHProductDescReqVO[]) => { | |||||
return request.put(`${BASE_URL}/batchUpdateDesc`, data); | |||||
} | |||||
} |