Pārlūkot izejas kodu

update: rename ShopeeTemplateVO to TemplateInfoVO, add:platform template api

dev
powersir pirms 1 gada
vecāks
revīzija
25f3979f6e
4 mainītis faili ar 404 papildinājumiem un 53 dzēšanām
  1. +1
    -1
      src/models/index.ts
  2. +318
    -7
      src/models/template.data.ts
  3. +50
    -45
      src/pages/custom/template/shopee/index.tsx
  4. +35
    -0
      src/request/service/platform-template.ts

+ 1
- 1
src/models/index.ts Parādīt failu

@@ -16,7 +16,7 @@ export * from './category.data.ts'
export * from './material-classify.data.ts'
export * from './goods-classify.data.ts'
export * from './goods-attr.data.ts'
export * from './shopee-product.data.ts'
export * from './platform-template.data.ts'

export interface ResponseDTO<T>{
code: number;


+ 318
- 7
src/models/template.data.ts Parādīt failu

@@ -1,4 +1,3 @@

//数据字典
export interface DataDictVO{
description: string;
@@ -16,13 +15,325 @@ export interface DataDictDetailVO {
}


export interface ShopeeTemplateVO {
/**
* TemplateInfoVO,模板数据
*/
export interface TemplateInfoVO {
/**
* 背景ids
*/
backgroupIds?: number[];
/**
* 类别
*/
catePubId: string;
/**
* 每天最大刊登量
*/
dayMaxPublishNumber?: number;
/**
* 模版id
*/
id: number;
categoryName: string;
createName: string;
createTime: string;
/**
* 图片信息
*/
imageInfo: TemplateImgVO[];
/**
* 物流渠道
*/
logistics: TemplateLogisticsVO[];
/**
* 素材组ids
*/
materialClassifyIds?: number[];
/**
* 店铺最大上架数量
*/
maxPrintCount: number;
/**
* 产品价格
*/
originalPrice: number;
/**
* 平台编码
*/
platformCode: string;
remark: string;
shopName: string;
/**
* 单价折扣
*/
priceDiscount?: number;
/**
* 变种比例
*/
proportion?: number;
/**
* 模板备注
*/
remark?: string;
/**
* 店铺id
*/
shopId: number;
/**
* 类目属性
*/
templateAttrs: TemplateAttrInfoVO[];
templateDimension: TemplateDimensionVO;
/**
* 模板名称编码
*/
templateName: string;
templateProduct: TemplateProductVO;
templateSkuSpace?: TemplateSkuSpaceVO;
/**
* 图片信息
*/
videoInfo: TemplateVideoVO[];
}

/**
* TemplateImgVO,模板图片信息
*/
export interface TemplateImgVO {
/**
* 图片id
*/
id?: number;
/**
* 图片Url信息
*/
url: string;
}

/**
* TemplateLogisticsVO,模板物流通道
*/
export interface TemplateLogisticsVO {
/**
* 是否为此项目启用通道(0.否 1.是)
*/
enabled: number;
/**
* 是否为买家支付运费(0.否 1.是)
*/
isFree?: number;
/**
* 频道的 ID
*/
logisticId: number;
/**
* 运费
*/
shippingFee?: number;
/**
* 大小 ID
*/
sizeId?: number;
}

/**
* TemplateAttrInfoVO,模板属性信息封装VO
*/
export interface TemplateAttrInfoVO {
templateAttr: TemplateAttrVO;
/**
* 模板属性值信息
*/
templateAttrVals: TemplateAttrValVO[];
}

/**
* TemplateAttrVO,模板属性信息
*/
export interface TemplateAttrVO {
/**
* 属性ID
*/
attrId: number;
/**
* 属性名称
*/
attrName: string;
}

/**
* TemplateAttrValVO,模板属性值信息
*/
export interface TemplateAttrValVO {
/**
* 属性值ID
*/
attrValId: number;
/**
* 属性值名称
*/
attrValName: string;
/**
* 价值单位(仅限定量属性)
*/
valueUnit?: string;
}

/**
* TemplateDimensionVO,模板包装尺寸
*/
export interface TemplateDimensionVO {
/**
* 包装高度,单位为厘米
*/
packageHeight: number;
/**
* 包装长度,单位为厘米
*/
packageLength: number;
/**
* 包装宽度,单位为厘米
*/
packageWidth: number;
/**
* 重量,单位为千克
*/
weight: number;
}

/**
* TemplateProductVO,模板产品信息
*/
export interface TemplateProductVO {
/**
* 品牌ID
*/
brandId?: number;
/**
* 品牌名称
*/
brandName?: string;
/**
* 项目的状况,可以是二手的或新的
*/
conditionVal?: string;
/**
* 保证发货数量
*/
daysToShip?: number;
/**
* 描述数据字典ID
*/
description: string;
/**
* 产品Id
*/
id: number;
/**
* 商品是否为预购商品(0.否 1.是)
*/
isPreOrder: number;
/**
* 产品名称数据字典ID
*/
itemName: string;
/**
* 产品状态
*/
itemStatus: string;
}

/**
* TemplateSkuSpaceVO,模板sku
*/
export interface TemplateSkuSpaceVO {
/**
* 销售数量
*/
inventory?: number;
/**
* 价格
*/
originalPrice?: number;
/**
* 尺码
*/
sizeId?: number;
/**
* 批发价格
*/
templateWholesale?: TemplateWholesaleVO[];
}

/**
* TemplateWholesaleVO,模板批发价格
*/
export interface TemplateWholesaleVO {
/**
* 此层的最大计数
*/
maxCount: number;
/**
* 此层的最小计数
*/
minCount: number;
/**
* 价格
*/
unitPrice: number;
}

/**
* TemplateVideoVO,模板视频信息
*/
export interface TemplateVideoVO {
/**
* 视频id
*/
id?: number;
/**
* 视频信息
*/
url: string;
}


//模板分页请求参数
export interface TemplateInfoPageReqVO extends PageParam {
/**
* 背景id(a,b,c)
*/
backgroupIds?: string;
/**
* 类目id
*/
catePubId?: string;
/**
* 创建时间
*/
createTime?: string[];
/**
* 素材id(a,b,c)
*/
materialClassifyIds?: string;
/**
* 最大上刊数量
*/
maxPrintCount?: number;
/**
* 平台编码
*/
platformCode?: string;
/**
* 变种比例
*/
proportion?: number;
/**
* 备注
*/
remark?: string;
/**
* 店铺id
*/
shopId?: number;
/**
* 模板名称
*/
templateName?: string;
}

+ 50
- 45
src/pages/custom/template/shopee/index.tsx Parādīt failu

@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react';
import { Space, Table, Form, Button, Card, Input, TreeSelect } 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,
@@ -11,7 +11,10 @@ import {
UndoOutlined
} from '@ant-design/icons';
import { antdUtils } from '@/utils/antd';
import { ShopeeTemplateVO } from '@/models';
import { useSetState } from 'ahooks';
import { useRequest } from '@/hooks/use-request';
import platformShopService from '@/request/service/platform-template';
import { TemplateInfoVO, TemplateInfoPageReqVO } from '@/models';

const treeData = [
{
@@ -53,42 +56,38 @@ const treeData = [
];

export default () => {
const data: ShopeeTemplateVO[] = [
{
"id": 78,
"platformCode": "Shopee",
"shopName": "Trista",
"categoryName": "T-Shirts",
"templateName": "T-SHIRT",
"remark": "1",
"createName": "admin",
"createTime": "2023-06-15 14:45:15"
},
{
"id": 77,
"platformCode": "Shopee",
"shopName": "Trista",
"categoryName": "T-Shirts",
"templateName": "T-SHIRT",
"remark": "1",
"createName": "admin",
"createTime": "2023-06-15 14:44:46"
},
{
"id": 76,
"platformCode": "Shopee",
"shopName": "Trista",
"categoryName": "T-Shirts",
"templateName": "T-SHIRT",
"remark": "",
"createName": "admin",
"createTime": "2023-06-15 14:42:24"

const [dataSource, setDataSource] = useState<TemplateInfoVO[]>([]);
const [total, setTotal] = useState(0);
const [searchFrom] = Form.useForm();
const [searchState, setSearchState] = useSetState<TemplateInfoPageReqVO>({
pageNo: 1,
pageSize: 10
});

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

//获取分页数据
const { runAsync: getPageApi } = useRequest(platformShopService.pageApi, { manual: true });
//删除数据
const { runAsync: deleteApi } = useRequest(platformShopService.deleteApi, { manual: true });

//加载数据
const load = async () => {
const [error, { code, data, msg }] = await getPageApi(searchState);
if (error || code !== 0) {
antdUtils.message?.open({ type: 'error', content: msg ?? '操作失败' })
} else {
setDataSource(data.list);
setTotal(data.total);
}
];
};

const showDeleteConfirm = (item: ShopeeTemplateVO) => {
const showDeleteConfirm = (item: TemplateInfoVO) => {
antdUtils.modal?.confirm({
title: `确认删除标题为: ${item.shopName} 的模板吗?`,
title: `确认删除标题为: ${item.templateName} 的模板吗?`,
icon: <ExclamationCircleFilled />,
content: `请注意删除以后不可恢复!`,
okText: '删除',
@@ -114,7 +113,7 @@ export default () => {
});
};

const columns: ColumnsType<ShopeeTemplateVO> = [
const columns: ColumnsType<TemplateInfoVO> = [
{
title: '店铺',
dataIndex: 'shopName',
@@ -162,13 +161,9 @@ export default () => {
},
];

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


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

return (
<div>
@@ -204,8 +199,18 @@ export default () => {
</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={data} 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>
</div>


+ 35
- 0
src/request/service/platform-template.ts Parādīt failu

@@ -0,0 +1,35 @@
import request from '@/request';
import {
TemplateInfoVO,
TemplateInfoPageReqVO,
PageData
} from '@/models';

const BASE_URL = '/admin-api/template/platform';

export default {
//获得模版分页
pageApi: (params: TemplateInfoPageReqVO) => {
return request.get<PageData<TemplateInfoVO>>(`${BASE_URL}/page`, { params });
},

//创建模版
createApi: (data: TemplateInfoVO) => {
return request.post(`${BASE_URL}`, data);
},

//修改模版
updateApi: (data: TemplateInfoVO) => {
return request.put(`${BASE_URL}`, data);
},
//获得模版
getApi: (id: number) => {
return request.get(`${BASE_URL}/get?id=${id}`);
},

//删除模版
deleteApi: (id: number) => {
return request.delete(`${BASE_URL}/delete?id=${id}`);
},
}

Notiek ielāde…
Atcelt
Saglabāt