Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
admin
Commits
e604c922
提交
e604c922
authored
7月 28, 2023
作者:
龚洪江
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
功能:商品新增,商品编辑(联调完成)
上级
d500c2d9
显示空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
331 行增加
和
30 行删除
+331
-30
categoryManage.ts
src/api/interface/categoryManage.ts
+5
-1
goodsType.ts
src/api/interface/goodsType.ts
+2
-0
categoryManage.ts
src/api/modules/categoryManage.ts
+5
-1
index.tsx
src/pages/categoryManage/categoryList/index.tsx
+86
-5
index.tsx
src/pages/customManage/customList/index.tsx
+1
-1
index.tsx
...oods/goodsAddOrEditOrDetail/components/baseInfo/index.tsx
+1
-0
index.tsx
...sAddOrEditOrDetail/components/skuAddOrEditModal/index.tsx
+2
-5
index.tsx
...Goods/goodsAddOrEditOrDetail/components/skuInfo/index.tsx
+12
-1
index.tsx
...ges/mallManage/mallGoods/goodsAddOrEditOrDetail/index.tsx
+8
-4
index.scss
src/pages/mallManage/mallGoods/goodsDetails/index.scss
+25
-0
index.tsx
src/pages/mallManage/mallGoods/goodsDetails/index.tsx
+176
-1
index.tsx
src/pages/mallManage/mallGoods/goodsList/index.tsx
+4
-9
router.tsx
src/router/router.tsx
+4
-2
没有找到文件。
src/api/interface/categoryManage.ts
浏览文件 @
e604c922
...
@@ -80,9 +80,10 @@ type categoryItemType = {
...
@@ -80,9 +80,10 @@ type categoryItemType = {
createTime
:
string
;
createTime
:
string
;
icon
:
string
;
icon
:
string
;
description
:
string
;
description
:
string
;
subDTOList
:
(
Omit
<
categoryItemType
,
'createTime'
|
'icon'
|
'subDTOList'
>
&
{
subDTOList
:
(
Omit
<
categoryItemType
,
'createTime'
|
'icon'
|
'subDTOList'
|
'sort'
>
&
{
categoryPrimaryId
:
number
;
categoryPrimaryId
:
number
;
})[];
})[];
sort
:
number
;
};
};
export
type
categoryListRespType
=
InterItemFunction
<
{
id
?:
number
},
categoryItemType
[]
>
;
export
type
categoryListRespType
=
InterItemFunction
<
{
id
?:
number
},
categoryItemType
[]
>
;
//分类管理-1级分类新增(新)
//分类管理-1级分类新增(新)
...
@@ -106,6 +107,9 @@ export type updatePrimaryCategoryType = InterFunction<
...
@@ -106,6 +107,9 @@ export type updatePrimaryCategoryType = InterFunction<
>
;
>
;
//分类管理-1级分类删除(新)
//分类管理-1级分类删除(新)
export
type
deletePrimaryCategoryType
=
InterFunction
<
{
id
:
number
},
any
>
;
export
type
deletePrimaryCategoryType
=
InterFunction
<
{
id
:
number
},
any
>
;
//分类管理-1级分类交换顺序(新)
export
type
exchangeType
=
InterFunction
<
{
id
:
number
;
sort
:
number
}[],
any
>
;
//分类管理-2级分类新增(新)
//分类管理-2级分类新增(新)
export
type
addSubCategoryType
=
InterFunction
<
export
type
addSubCategoryType
=
InterFunction
<
{
{
...
...
src/api/interface/goodsType.ts
浏览文件 @
e604c922
...
@@ -127,6 +127,7 @@ export type addMallGoodsType = InterFunction<
...
@@ -127,6 +127,7 @@ export type addMallGoodsType = InterFunction<
specValueImage
:
string
;
specValueImage
:
string
;
specValueName
:
string
;
specValueName
:
string
;
stock
?:
number
;
stock
?:
number
;
goodsSpecId
?:
number
;
}[];
}[];
id
:
any
;
id
:
any
;
mallGoodsId
:
number
;
mallGoodsId
:
number
;
...
@@ -164,6 +165,7 @@ export type editMallGoodsType = InterFunction<
...
@@ -164,6 +165,7 @@ export type editMallGoodsType = InterFunction<
specValueImage
:
string
;
specValueImage
:
string
;
specValueName
:
string
;
specValueName
:
string
;
stock
?:
number
;
stock
?:
number
;
goodsSpecId
:
number
;
}[];
}[];
id
:
any
;
id
:
any
;
mallGoodsId
:
number
;
mallGoodsId
:
number
;
...
...
src/api/modules/categoryManage.ts
浏览文件 @
e604c922
...
@@ -7,8 +7,10 @@ import {
...
@@ -7,8 +7,10 @@ import {
categoryListType
,
categoryListType
,
categoryRelevantType
,
categoryRelevantType
,
deletePrimaryCategoryType
,
deletePrimaryCategoryType
,
deleteSubCategoryType
,
directoryListType
,
directoryListType
,
directoryPageListType
,
directoryPageListType
,
exchangeType
,
updatePrimaryCategoryType
,
updatePrimaryCategoryType
,
updateSubCategoryType
,
updateSubCategoryType
,
}
from
'~/api/interface/categoryManage'
;
}
from
'~/api/interface/categoryManage'
;
...
@@ -116,6 +118,8 @@ export class CategoryManageAPI {
...
@@ -116,6 +118,8 @@ export class CategoryManageAPI {
// 分类管理-1级分类删除(新)
// 分类管理-1级分类删除(新)
static
deletePrimaryCategory
:
deletePrimaryCategoryType
=
(
params
)
=>
static
deletePrimaryCategory
:
deletePrimaryCategoryType
=
(
params
)
=>
axios
.
get
(
'/pms/category/deletePrimaryCategory'
,
{
params
});
axios
.
get
(
'/pms/category/deletePrimaryCategory'
,
{
params
});
//分类管理-1级分类交换顺序
static
exchangeCategory
:
exchangeType
=
(
data
)
=>
axios
.
post
(
'/pms/category/exchange'
,
data
);
// 分类管理-2级分类新增(新)
// 分类管理-2级分类新增(新)
static
addSubCategory
:
addSubCategoryType
=
(
data
)
=>
static
addSubCategory
:
addSubCategoryType
=
(
data
)
=>
axios
.
post
(
'/pms/category/addSubCategory'
,
data
);
axios
.
post
(
'/pms/category/addSubCategory'
,
data
);
...
@@ -123,6 +127,6 @@ export class CategoryManageAPI {
...
@@ -123,6 +127,6 @@ export class CategoryManageAPI {
static
updateSubCategory
:
updateSubCategoryType
=
(
data
)
=>
static
updateSubCategory
:
updateSubCategoryType
=
(
data
)
=>
axios
.
post
(
'/pms/category/updateSubCategory'
,
data
);
axios
.
post
(
'/pms/category/updateSubCategory'
,
data
);
// 分类管理-2级分类删除(新)
// 分类管理-2级分类删除(新)
static
deleteSubCategory
:
delete
Primary
CategoryType
=
(
params
)
=>
static
deleteSubCategory
:
delete
Sub
CategoryType
=
(
params
)
=>
axios
.
get
(
'/pms/category/deleteSubCategory'
,
{
params
});
axios
.
get
(
'/pms/category/deleteSubCategory'
,
{
params
});
}
}
src/pages/categoryManage/categoryList/index.tsx
浏览文件 @
e604c922
import
SearchBox
from
'~/components/search-box'
;
import
SearchBox
from
'~/components/search-box'
;
import
{
Button
,
Checkbox
,
Form
,
Image
,
message
,
Modal
,
Table
,
Tooltip
}
from
'antd'
;
import
{
Button
,
Form
,
Image
,
message
,
Modal
,
Radio
,
Table
,
Tooltip
}
from
'antd'
;
import
{
import
{
ArrowDownOutlined
,
ArrowDownOutlined
,
ArrowUpOutlined
,
ArrowUpOutlined
,
...
@@ -14,6 +14,7 @@ import { CategoryManageAPI } from '~/api';
...
@@ -14,6 +14,7 @@ import { CategoryManageAPI } from '~/api';
import
EditableCell
from
'~/components/EditableCell'
;
import
EditableCell
from
'~/components/EditableCell'
;
import
AddOrEditCategoryModal
from
'./components/addOrEditCategoryModal'
;
import
AddOrEditCategoryModal
from
'./components/addOrEditCategoryModal'
;
import
'./index.scss'
;
import
'./index.scss'
;
import
_
from
'lodash'
;
type
EditableTableProps
=
Parameters
<
typeof
Table
>
[
0
];
type
EditableTableProps
=
Parameters
<
typeof
Table
>
[
0
];
type
ColumnTypes
=
Exclude
<
EditableTableProps
[
'columns'
],
undefined
>
;
type
ColumnTypes
=
Exclude
<
EditableTableProps
[
'columns'
],
undefined
>
;
...
@@ -147,6 +148,7 @@ const CategoryList = () => {
...
@@ -147,6 +148,7 @@ const CategoryList = () => {
};
};
});
});
const
[
tableData
,
setTableData
]
=
useState
<
categoryType
>
([]);
const
[
tableData
,
setTableData
]
=
useState
<
categoryType
>
([]);
const
[
allTableData
,
setAllTableData
]
=
useState
<
categoryType
>
([]);
//分页
//分页
const
[
pagination
,
setPagination
]
=
useState
<
PaginationProps
&
{
totalCount
:
number
}
>
({
const
[
pagination
,
setPagination
]
=
useState
<
PaginationProps
&
{
totalCount
:
number
}
>
({
pageNo
:
1
,
pageNo
:
1
,
...
@@ -155,16 +157,21 @@ const CategoryList = () => {
...
@@ -155,16 +157,21 @@ const CategoryList = () => {
});
});
//获取分类列表
//获取分类列表
const
getCategoryList
=
()
=>
{
const
getCategoryList
=
(
query
?:
PaginationProps
,
isAll
?:
boolean
)
=>
{
setLoading
(
true
);
setLoading
(
true
);
CategoryManageAPI
.
getCategoryRespList
({
CategoryManageAPI
.
getCategoryRespList
({
pageNo
:
pagination
.
pageNo
,
pageNo
:
pagination
.
pageNo
,
pageSize
:
pagination
.
pageSize
,
pageSize
:
pagination
.
pageSize
,
...
query
,
}).
then
(({
result
})
=>
{
}).
then
(({
result
})
=>
{
setLoading
(
false
);
setLoading
(
false
);
if
(
isAll
)
{
setAllTableData
(
result
.
list
?
[...
result
.
list
]
:
[]);
}
else
{
setTableData
(
result
.
list
?
[...
result
.
list
]
:
[]);
setTableData
(
result
.
list
?
[...
result
.
list
]
:
[]);
pagination
.
totalCount
=
result
.
totalCount
;
pagination
.
totalCount
=
result
.
totalCount
;
setPagination
(
pagination
);
setPagination
(
pagination
);
}
});
});
};
};
const
paginationChange
=
(
pageNo
:
number
,
pageSize
:
number
)
=>
{
const
paginationChange
=
(
pageNo
:
number
,
pageSize
:
number
)
=>
{
...
@@ -182,6 +189,7 @@ const CategoryList = () => {
...
@@ -182,6 +189,7 @@ const CategoryList = () => {
setSelectedRowKeys
([...
selectedRowKeys
,
record
.
id
]);
setSelectedRowKeys
([...
selectedRowKeys
,
record
.
id
]);
}
}
};
};
//新增、编辑分类弹窗
//新增、编辑分类弹窗
const
addOrEditCategoryModalShowClick
=
(
record
?:
categoryType
[
0
]
|
any
)
=>
{
const
addOrEditCategoryModalShowClick
=
(
record
?:
categoryType
[
0
]
|
any
)
=>
{
if
(
record
&&
!
record
.
subDTOList
)
{
if
(
record
&&
!
record
.
subDTOList
)
{
...
@@ -306,9 +314,74 @@ const CategoryList = () => {
...
@@ -306,9 +314,74 @@ const CategoryList = () => {
}
}
}
}
};
};
// 切换排序
const
handleSort
=
_
.
debounce
(
async
(
from
:
'up'
|
'down'
)
=>
{
if
(
selectedRowKeys
.
length
===
0
)
{
message
.
warning
(
'请选择需要排序的数据'
).
then
();
return
;
}
// 当前选项
const
id
=
selectedRowKeys
.
at
(
-
1
);
// 当前索引
const
index
=
allTableData
.
findIndex
((
i
)
=>
i
.
id
===
id
);
// 当前表格中的索引
const
tableIndex
=
tableData
.
findIndex
((
i
)
=>
i
.
id
===
id
);
// 第一条数据不能上移
if
(
index
===
0
&&
from
===
'up'
)
{
message
.
warning
(
'已是第一条数据'
).
then
();
return
;
}
// 最后一条数据不能下移
if
(
index
===
allTableData
.
length
-
1
&&
from
===
'down'
)
{
message
.
warning
(
'已是最后一条数据'
).
then
();
return
;
}
// 转换位置
const
res
=
await
CategoryManageAPI
.
exchangeCategory
(
from
===
'up'
?
[
{
id
:
allTableData
[
index
-
1
].
id
,
sort
:
allTableData
[
index
-
1
].
sort
},
{
id
:
allTableData
[
index
].
id
,
sort
:
allTableData
[
index
].
sort
},
]
:
[
{
id
:
allTableData
[
index
+
1
].
id
,
sort
:
allTableData
[
index
+
1
].
sort
},
{
id
:
allTableData
[
index
].
id
,
sort
:
allTableData
[
index
].
sort
},
],
);
if
(
res
&&
res
.
code
===
'200'
)
{
message
.
success
(
'操作成功'
).
then
();
// 如果是当前页的第一条数据
if
(
tableIndex
===
0
&&
from
===
'up'
)
{
paginationChange
(
pagination
.
pageNo
-
1
,
pagination
.
pageSize
);
getCategoryList
({
pageNo
:
1
,
pageSize
:
9999
},
true
);
return
;
}
// 如果是当前页的最后一条数据
if
(
tableIndex
===
tableData
.
length
-
1
&&
from
===
'down'
)
{
paginationChange
(
pagination
.
pageNo
+
1
,
pagination
.
pageSize
);
getCategoryList
({
pageNo
:
1
,
pageSize
:
9999
},
true
);
return
;
}
paginationChange
(
pagination
.
pageNo
,
pagination
.
pageSize
);
getCategoryList
({
pageNo
:
1
,
pageSize
:
9999
},
true
);
}
},
500
);
//防抖
// const debounce:<T extends ()=>T>= (func: T, delay: number)=> {
// let timeout: NodeJS.Timeout;
//
// return function (this: ThisParameterType<T>, ...args: Parameters<T>): ReturnType<T> {
// clearTimeout(timeout);
//
// timeout = setTimeout(() => {
// func.apply(this, args);
// }, delay);
// } as T;
// }
useEffect
(()
=>
{
useEffect
(()
=>
{
getCategoryList
();
getCategoryList
();
getCategoryList
({
pageNo
:
1
,
pageSize
:
99999
},
true
);
},
[]);
},
[]);
return
(
return
(
...
@@ -323,8 +396,16 @@ const CategoryList = () => {
...
@@ -323,8 +396,16 @@ const CategoryList = () => {
>
>
新增分类
新增分类
</
Button
>
</
Button
>
<
Button
icon=
{
<
ArrowUpOutlined
/>
}
type=
'primary'
></
Button
>
<
Button
<
Button
icon=
{
<
ArrowDownOutlined
/>
}
type=
'primary'
></
Button
>
icon=
{
<
ArrowUpOutlined
/>
}
type=
'primary'
onClick=
{
()
=>
handleSort
(
'up'
)
}
></
Button
>
<
Button
icon=
{
<
ArrowDownOutlined
/>
}
type=
'primary'
onClick=
{
()
=>
handleSort
(
'down'
)
}
></
Button
>
</>
</>
}
}
/>
/>
...
@@ -336,7 +417,7 @@ const CategoryList = () => {
...
@@ -336,7 +417,7 @@ const CategoryList = () => {
hideSelectAll
:
true
,
hideSelectAll
:
true
,
renderCell
:
(
_checked
:
boolean
,
record
:
categoryType
[
0
])
=>
{
renderCell
:
(
_checked
:
boolean
,
record
:
categoryType
[
0
])
=>
{
return
(
return
(
<>
{
record
.
subDTOList
?
<
Checkbox
onChange=
{
()
=>
onSelectChange
(
record
)
}
/>
:
''
}
</>
<>
{
record
.
subDTOList
?
<
Radio
onChange=
{
()
=>
onSelectChange
(
record
)
}
/>
:
''
}
</>
);
);
},
},
}
}
}
}
...
...
src/pages/customManage/customList/index.tsx
浏览文件 @
e604c922
...
@@ -239,7 +239,7 @@ function CustomListView() {
...
@@ -239,7 +239,7 @@ function CustomListView() {
label: '手机号',
label: '手机号',
name: 'phoneNum',
name: 'phoneNum',
type: 'input',
type: 'input',
placeholder: '请输入
用户账
号',
placeholder: '请输入
手机
号',
},
},
{
{
label: '来源',
label: '来源',
...
...
src/pages/mallManage/mallGoods/goodsAddOrEditOrDetail/components/baseInfo/index.tsx
浏览文件 @
e604c922
...
@@ -175,6 +175,7 @@ const BaseInfo = forwardRef<any, selfProps>((_props, ref) => {
...
@@ -175,6 +175,7 @@ const BaseInfo = forwardRef<any, selfProps>((_props, ref) => {
listType=
'picture-card'
listType=
'picture-card'
onChange=
{
(
fileList
)
=>
uploadSuccess
(
fileList
,
'subImgList'
)
}
onChange=
{
(
fileList
)
=>
uploadSuccess
(
fileList
,
'subImgList'
)
}
defaultFileList=
{
subFileList
}
defaultFileList=
{
subFileList
}
fileLength=
{
4
}
>
>
<
UploadOutlined
/>
<
UploadOutlined
/>
</
Uploader
>
</
Uploader
>
...
...
src/pages/mallManage/mallGoods/goodsAddOrEditOrDetail/components/skuAddOrEditModal/index.tsx
浏览文件 @
e604c922
...
@@ -6,7 +6,6 @@ import { InterDataType, InterReqType } from '~/api/interface';
...
@@ -6,7 +6,6 @@ import { InterDataType, InterReqType } from '~/api/interface';
import
{
addMallGoodsType
,
skuUnitType
}
from
'~/api/interface/goodsType'
;
import
{
addMallGoodsType
,
skuUnitType
}
from
'~/api/interface/goodsType'
;
import
{
filterObjAttr
}
from
'~/utils'
;
import
{
filterObjAttr
}
from
'~/utils'
;
import
{
isEmptyBol
,
regPriceNumber
}
from
'~/utils/validateUtils'
;
import
{
isEmptyBol
,
regPriceNumber
}
from
'~/utils/validateUtils'
;
import
_
from
'lodash'
;
type
EditableTableProps
=
Parameters
<
typeof
Table
>
[
0
];
type
EditableTableProps
=
Parameters
<
typeof
Table
>
[
0
];
type
ColumnTypes
=
Exclude
<
EditableTableProps
[
'columns'
],
undefined
>
;
type
ColumnTypes
=
Exclude
<
EditableTableProps
[
'columns'
],
undefined
>
;
...
@@ -108,7 +107,6 @@ const SkuAddOrEditModal: FC<ModalProps & selfProps> = ({
...
@@ -108,7 +107,6 @@ const SkuAddOrEditModal: FC<ModalProps & selfProps> = ({
editable
:
true
,
editable
:
true
,
dataIndex
:
'specValueImage'
,
dataIndex
:
'specValueImage'
,
inputType
:
'uploader'
,
inputType
:
'uploader'
,
rules
:
[{
required
:
true
,
message
:
'请上传图片'
}],
},
},
{
{
title
:
'选项名称'
,
title
:
'选项名称'
,
...
@@ -123,7 +121,6 @@ const SkuAddOrEditModal: FC<ModalProps & selfProps> = ({
...
@@ -123,7 +121,6 @@ const SkuAddOrEditModal: FC<ModalProps & selfProps> = ({
align
:
'center'
,
align
:
'center'
,
editable
:
true
,
editable
:
true
,
dataIndex
:
'partNo'
,
dataIndex
:
'partNo'
,
rules
:
[{
required
:
true
,
message
:
'请输入料号'
}],
maxLength
:
30
,
maxLength
:
30
,
},
},
{
{
...
@@ -147,7 +144,7 @@ const SkuAddOrEditModal: FC<ModalProps & selfProps> = ({
...
@@ -147,7 +144,7 @@ const SkuAddOrEditModal: FC<ModalProps & selfProps> = ({
editable
:
true
,
editable
:
true
,
align
:
'center'
,
align
:
'center'
,
dataIndex
:
'stock'
,
dataIndex
:
'stock'
,
rules
:
[{
required
:
fals
e
,
validator
:
stockPriceValidator
}],
rules
:
[{
required
:
tru
e
,
validator
:
stockPriceValidator
}],
inputType
:
'number'
,
inputType
:
'number'
,
},
},
{
{
...
@@ -350,7 +347,7 @@ const SkuAddOrEditModal: FC<ModalProps & selfProps> = ({
...
@@ -350,7 +347,7 @@ const SkuAddOrEditModal: FC<ModalProps & selfProps> = ({
<
Form
<
Form
labelCol=
{
{
span
:
2
}
}
labelCol=
{
{
span
:
2
}
}
wrapperCol=
{
{
span
:
22
}
}
wrapperCol=
{
{
span
:
22
}
}
initialValues=
{
{
chooseType
:
0
,
must
:
0
}
}
initialValues=
{
{
chooseType
:
0
,
must
:
0
,
skuUnitId
:
skuUnitList
[
0
]?.
id
||
undefined
}
}
form=
{
goodsSpecForm
}
form=
{
goodsSpecForm
}
>
>
<
Form
.
Item
<
Form
.
Item
...
...
src/pages/mallManage/mallGoods/goodsAddOrEditOrDetail/components/skuInfo/index.tsx
浏览文件 @
e604c922
import
{
Button
,
Popconfirm
,
Table
}
from
'antd'
;
import
{
Button
,
Popconfirm
,
Table
,
Tag
}
from
'antd'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
FC
}
from
'react'
;
import
{
FC
}
from
'react'
;
...
@@ -54,6 +54,17 @@ const SkuInfo: FC<selfProps> = ({
...
@@ -54,6 +54,17 @@ const SkuInfo: FC<selfProps> = ({
render
:
(
text
:
number
)
=>
skuUnitList
.
find
((
v
)
=>
v
.
id
===
text
)?.
unitName
||
''
,
render
:
(
text
:
number
)
=>
skuUnitList
.
find
((
v
)
=>
v
.
id
===
text
)?.
unitName
||
''
,
},
},
{
{
title
:
'规格值'
,
align
:
'center'
,
dataIndex
:
'goodsSpecValuesList'
,
render
:
(
text
:
goodsSpecType
[
'goodsSpecValuesList'
])
=>
text
.
map
((
v
)
=>
(
<
Tag
key=
{
v
.
id
}
>
{
v
.
specValueName
}
(
{
v
.
partNo
}
)
</
Tag
>
)),
},
{
title
:
'操作'
,
title
:
'操作'
,
align
:
'center'
,
align
:
'center'
,
render
:
(
_text
:
string
,
record
)
=>
(
render
:
(
_text
:
string
,
record
)
=>
(
...
...
src/pages/mallManage/mallGoods/goodsAddOrEditOrDetail/index.tsx
浏览文件 @
e604c922
...
@@ -159,6 +159,9 @@ const GoodsAddOrEditOrDetail = () => {
...
@@ -159,6 +159,9 @@ const GoodsAddOrEditOrDetail = () => {
.
find
((
j
)
=>
j
.
id
===
v
.
id
)
.
find
((
j
)
=>
j
.
id
===
v
.
id
)
?.
goodsSpecValuesList
.
find
((
k
)
=>
k
.
id
===
i
.
id
)?.
id
?.
goodsSpecValuesList
.
find
((
k
)
=>
k
.
id
===
i
.
id
)?.
id
:
undefined
,
:
undefined
,
goodsSpecId
:
goodsDetailsInfo
?
goodsDetailsInfo
.
goodsSpecList
.
find
((
i
)
=>
i
.
id
===
v
.
id
)?.
id
:
undefined
,
})),
})),
}));
}));
const
addGoodsEditReq
=
{
const
addGoodsEditReq
=
{
...
@@ -241,13 +244,14 @@ const GoodsAddOrEditOrDetail = () => {
...
@@ -241,13 +244,14 @@ const GoodsAddOrEditOrDetail = () => {
下一步
下一步
</
Button
>
</
Button
>
)
:
(
)
:
(
<
Button
type=
'primary'
onClick=
{
saveGoods
}
>
''
保存
</
Button
>
)
}
)
}
</
div
>
</
div
>
<
div
className=
'back-btn'
>
<
div
className=
'back-btn'
>
<
Button
type=
'primary'
onClick=
{
backRoute
}
>
<
Button
type=
'primary'
onClick=
{
saveGoods
}
style=
{
{
marginRight
:
'10px'
}
}
>
保存
</
Button
>
<
Button
type=
'default'
onClick=
{
backRoute
}
>
返回
返回
</
Button
>
</
Button
>
</
div
>
</
div
>
...
...
src/pages/mallManage/mallGoods/goodsDetails/index.scss
0 → 100644
浏览文件 @
e604c922
.goods-detail
{
position
:
relative
;
&
-info
{
margin-bottom
:
20px
;
}
&
-sku
{
.sku-title
{
line-height
:
50px
;
font-weight
:
bold
;
font-size
:
14px
;
}
}
&
-introduce
{
.introduce-title
{
line-height
:
50px
;
font-weight
:
bold
;
font-size
:
14px
;
}
}
&
-operate
{
position
:
absolute
;
right
:
0
;
top
:
0
;
}
}
src/pages/mallManage/mallGoods/goodsDetails/index.tsx
浏览文件 @
e604c922
import
{
useSearchParams
,
useNavigate
}
from
'react-router-dom'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
GoodsAPI
from
'~/api/modules/goodsAPI'
;
import
{
InterDataType
}
from
'~/api/interface'
;
import
{
mallGoodsDetailsType
,
skuUnitType
}
from
'~/api/interface/goodsType'
;
import
{
Badge
,
Button
,
Descriptions
,
Image
,
Table
,
Tag
}
from
'antd'
;
import
{
CategoryManageAPI
}
from
'~/api'
;
import
{
categoryListRespType
}
from
'~/api/interface/categoryManage'
;
import
'./index.scss'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
//详情返回类型
type
detailType
=
InterDataType
<
mallGoodsDetailsType
>
;
//分类返回类型
type
categoryType
=
InterDataType
<
categoryListRespType
>
[
'list'
];
//单位返回类型
type
unitType
=
InterDataType
<
skuUnitType
>
;
const
GoodsDetails
=
()
=>
{
const
GoodsDetails
=
()
=>
{
return
<
div
className=
'goods-detail'
></
div
>;
const
[
searchParams
]
=
useSearchParams
();
const
navigate
=
useNavigate
();
//分类列表
const
[
categoryList
,
setCategoryList
]
=
useState
<
categoryType
>
([]);
//单位列表
const
[
skuUnitList
,
setSkuUnitList
]
=
useState
<
unitType
>
([]);
const
[
goodsInfoDetails
,
setGoodsInfoDetails
]
=
useState
<
detailType
>
();
const
tableColumns
:
ColumnsType
<
detailType
[
'goodsSpecList'
][
0
]
>
=
[
{
title
:
'序号'
,
align
:
'center'
,
render
:
(
_text
:
string
,
_record
,
index
:
number
)
=>
index
+
1
,
},
{
title
:
'规格名称'
,
align
:
'center'
,
dataIndex
:
'specName'
,
},
{
title
:
'选择方式'
,
align
:
'center'
,
dataIndex
:
'chooseType'
,
render
:
(
text
:
number
)
=>
(
text
?
'多选'
:
'单选'
),
},
{
title
:
'是否必选'
,
align
:
'center'
,
dataIndex
:
'must'
,
render
:
(
text
:
number
)
=>
(
text
?
'必选'
:
'非必选'
),
},
{
title
:
'规格单位'
,
align
:
'center'
,
dataIndex
:
'skuUnitId'
,
render
:
(
text
:
number
)
=>
skuUnitList
.
find
((
v
)
=>
v
.
id
===
text
)?.
unitName
||
''
,
},
{
title
:
'规格值'
,
align
:
'center'
,
dataIndex
:
'goodsSpecValuesList'
,
render
:
(
text
:
detailType
[
'goodsSpecList'
][
0
][
'goodsSpecValuesList'
])
=>
text
.
map
((
v
)
=>
(
<
Tag
key=
{
v
.
id
}
>
{
v
.
specValueName
}
(
{
v
.
partNo
}
)
</
Tag
>
)),
},
];
const
getGoodsDetails
=
(
id
:
number
)
=>
{
GoodsAPI
.
getMallGoodsDetails
({
id
}).
then
(({
result
})
=>
{
setGoodsInfoDetails
(
result
);
});
};
//分类列表
const
getCategoryList
=
()
=>
{
CategoryManageAPI
.
getCategoryRespList
({
pageNo
:
1
,
pageSize
:
99999
}).
then
(({
result
})
=>
{
setCategoryList
(
result
.
list
||
[]);
});
};
//单位列表
const
getSkuUnit
=
()
=>
{
GoodsAPI
.
getSkuUnit
().
then
(({
result
})
=>
{
setSkuUnitList
(
result
||
[]);
});
};
//返回
const
backRoute
=
()
=>
{
navigate
(
-
1
);
};
useEffect
(()
=>
{
getGoodsDetails
(
Number
(
searchParams
.
get
(
'id'
)));
getCategoryList
();
getSkuUnit
();
},
[]);
return
(
<
div
className=
'goods-detail'
>
<
div
className=
'goods-detail-info'
>
<
Descriptions
title=
'基本信息'
bordered
>
<
Descriptions
.
Item
label=
'商品名称'
>
{
goodsInfoDetails
?.
tradeName
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'商品副图'
>
{
goodsInfoDetails
?.
resourcesList
.
filter
((
v
)
=>
v
.
type
===
1
)
.
map
((
v
)
=>
(
<
Image
src=
{
v
.
url
}
width=
{
50
}
height=
{
50
}
key=
{
v
.
id
}
/>
))
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'商品主图'
>
{
goodsInfoDetails
?.
resourcesList
.
filter
((
v
)
=>
v
.
type
===
0
)
.
map
((
v
)
=>
(
<
Image
src=
{
v
.
url
}
width=
{
50
}
height=
{
50
}
key=
{
v
.
id
}
/>
))
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'商品标签'
>
{
goodsInfoDetails
?.
goodsLabel
||
'暂无'
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'商品分类'
>
{
categoryList
.
reduce
((
pre
:
string
[],
cur
)
=>
{
if
(
cur
.
id
===
goodsInfoDetails
?.
categoryPrimaryId
)
{
pre
.
push
(
cur
.
name
);
if
(
goodsInfoDetails
?.
categorySubId
)
{
pre
.
push
(
cur
.
subDTOList
.
find
((
v
)
=>
v
.
id
===
goodsInfoDetails
?.
categorySubId
)?.
name
||
''
,
);
}
}
return
pre
;
},
[])
.
join
(
'/'
)
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'商品状态'
>
<
Badge
status=
{
goodsInfoDetails
?.
shelfStatus
?
'processing'
:
'default'
}
text=
{
goodsInfoDetails
?.
shelfStatus
?
'上架中'
:
'已下架'
}
/>
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'商品视频'
span=
{
1
}
>
{
goodsInfoDetails
?.
resourcesList
.
filter
((
v
)
=>
v
.
type
===
2
)
.
map
((
v
)
=>
(
<
video
src=
{
v
.
url
}
key=
{
v
.
id
}
style=
{
{
width
:
'200px'
,
height
:
'200px'
}
}
controls
/>
))
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'商品描述'
>
{
goodsInfoDetails
?.
description
}
</
Descriptions
.
Item
>
</
Descriptions
>
</
div
>
<
div
className=
'goods-detail-sku'
>
<
div
className=
'sku-title'
>
商品规格
</
div
>
<
Table
bordered
columns=
{
tableColumns
}
dataSource=
{
goodsInfoDetails
?.
goodsSpecList
}
rowKey=
'id'
pagination=
{
false
}
></
Table
>
</
div
>
<
div
className=
'goods-detail-introduce'
>
<
div
className=
'introduce-title'
>
商品详情
</
div
>
<
div
className=
'introduce-content'
dangerouslySetInnerHTML=
{
{
__html
:
goodsInfoDetails
?.
goodsDetails
||
''
}
}
></
div
>
</
div
>
<
div
className=
'goods-detail-operate'
>
<
Button
type=
'primary'
onClick=
{
backRoute
}
>
返回
</
Button
>
</
div
>
</
div
>
);
};
};
export
default
GoodsDetails
;
export
default
GoodsDetails
;
src/pages/mallManage/mallGoods/goodsList/index.tsx
浏览文件 @
e604c922
...
@@ -205,10 +205,10 @@ const GoodsList = () => {
...
@@ -205,10 +205,10 @@ const GoodsList = () => {
};
};
//商品详情
//商品详情
const
toGoodsDetail
=
(
id
:
number
)
=>
{
const
toGoodsDetail
=
(
id
:
number
)
=>
{
//
navigate({
navigate
({
//
pathname: '/mallManage/mallGoods/detail',
pathname
:
'/mallManage/mallGoods/detail'
,
// search: `id=${id}&isDetail=1
`,
search
:
`id=
${
id
}
`
,
//
});
});
};
};
// 表格多选事件
// 表格多选事件
const
onSelectChange
=
(
newSelectedRowKeys
:
React
.
Key
[])
=>
{
const
onSelectChange
=
(
newSelectedRowKeys
:
React
.
Key
[])
=>
{
...
@@ -253,8 +253,6 @@ const GoodsList = () => {
...
@@ -253,8 +253,6 @@ const GoodsList = () => {
const
upGoodsClick
=
()
=>
{
const
upGoodsClick
=
()
=>
{
if
(
selectedRowKeys
.
length
===
0
)
{
if
(
selectedRowKeys
.
length
===
0
)
{
message
.
warning
(
'请选择商品'
);
message
.
warning
(
'请选择商品'
);
}
else
if
(
selectedRowKeys
.
length
>
1
)
{
message
.
warning
(
'最多选择一个商品'
);
}
else
{
}
else
{
const
index
=
tableData
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
const
index
=
tableData
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
const
allIndex
=
allGoods
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
const
allIndex
=
allGoods
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
...
@@ -296,8 +294,6 @@ const GoodsList = () => {
...
@@ -296,8 +294,6 @@ const GoodsList = () => {
const
downGoodsClick
=
()
=>
{
const
downGoodsClick
=
()
=>
{
if
(
selectedRowKeys
.
length
===
0
)
{
if
(
selectedRowKeys
.
length
===
0
)
{
message
.
warning
(
'请选择商品'
);
message
.
warning
(
'请选择商品'
);
}
else
if
(
selectedRowKeys
.
length
>
1
)
{
message
.
warning
(
'最多选择一个商品'
);
}
else
{
}
else
{
const
index
=
tableData
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
const
index
=
tableData
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
const
allIndex
=
allGoods
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
const
allIndex
=
allGoods
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
...
@@ -335,7 +331,6 @@ const GoodsList = () => {
...
@@ -335,7 +331,6 @@ const GoodsList = () => {
}
}
}
}
};
};
//分类列表
//分类列表
const
getCategoryList
=
()
=>
{
const
getCategoryList
=
()
=>
{
CategoryManageAPI
.
getCategoryRespList
({
pageNo
:
1
,
pageSize
:
99999
}).
then
(({
result
})
=>
{
CategoryManageAPI
.
getCategoryRespList
({
pageNo
:
1
,
pageSize
:
99999
}).
then
(({
result
})
=>
{
...
...
src/router/router.tsx
浏览文件 @
e604c922
...
@@ -91,7 +91,9 @@ const RentAddOrEditOrDetailView = React.lazy(
...
@@ -91,7 +91,9 @@ const RentAddOrEditOrDetailView = React.lazy(
const
MallGoodsView
=
React
.
lazy
(()
=>
import
(
'~/pages/mallManage/mallGoods/goodsList'
));
//商城商品
const
MallGoodsView
=
React
.
lazy
(()
=>
import
(
'~/pages/mallManage/mallGoods/goodsList'
));
//商城商品
const
MallAddOrEditOrDetailView
=
React
.
lazy
(
const
MallAddOrEditOrDetailView
=
React
.
lazy
(
()
=>
import
(
'~/pages/mallManage/mallGoods/goodsAddOrEditOrDetail'
),
()
=>
import
(
'~/pages/mallManage/mallGoods/goodsAddOrEditOrDetail'
),
);
//商城商品新增、编辑、详情
);
//商城商品新增、编辑、租赁商品详情
const
MallGoodsDetailsView
=
React
.
lazy
(()
=>
import
(
'~/pages/mallManage/mallGoods/goodsDetails'
));
//商城商品(新)
const
ProduceListView
=
React
.
lazy
(()
=>
import
(
'~/pages/mallManage/produceManage/produceList'
));
//产品列表
const
ProduceListView
=
React
.
lazy
(()
=>
import
(
'~/pages/mallManage/produceManage/produceList'
));
//产品列表
const
ProduceDetailView
=
React
.
lazy
(
const
ProduceDetailView
=
React
.
lazy
(
()
=>
import
(
'~/pages/mallManage/produceManage/produceDetail'
),
()
=>
import
(
'~/pages/mallManage/produceManage/produceDetail'
),
...
@@ -579,7 +581,7 @@ export const routerList: Array<RouteObjectType> = [
...
@@ -579,7 +581,7 @@ export const routerList: Array<RouteObjectType> = [
},
},
{
{
path
:
'/mallManage/mallGoods/detail'
,
path
:
'/mallManage/mallGoods/detail'
,
element
:
withLoadingComponent
(<
Mall
AddOrEditOrDetail
View
/>),
element
:
withLoadingComponent
(<
Mall
GoodsDetails
View
/>),
errorElement
:
<
ErrorPage
/>,
errorElement
:
<
ErrorPage
/>,
meta
:
{
meta
:
{
id
:
10146
,
id
:
10146
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论