Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin-ci-test
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
test-ci
admin-ci-test
Commits
7cece82e
提交
7cece82e
authored
8月 08, 2023
作者:
龚洪江
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
功能:商城商品sku修改
上级
59067fe9
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
164 行增加
和
17 行删除
+164
-17
goodsType.ts
src/api/interface/goodsType.ts
+10
-1
index.tsx
...Goods/goodsAddOrEditOrDetail/components/skuInfo/index.tsx
+0
-0
old-index.tsx
...s/goodsAddOrEditOrDetail/components/skuInfo/old-index.tsx
+135
-0
index.tsx
...ges/mallManage/mallGoods/goodsAddOrEditOrDetail/index.tsx
+19
-16
没有找到文件。
src/api/interface/goodsType.ts
浏览文件 @
7cece82e
...
@@ -86,7 +86,7 @@ export type editGoodsType = InterFunction<
...
@@ -86,7 +86,7 @@ export type editGoodsType = InterFunction<
export
type
detailGoodsType
=
InterFunction
<
export
type
detailGoodsType
=
InterFunction
<
{
goodsInfoId
:
number
;
type
:
number
;
leaseTerm
?:
number
},
{
goodsInfoId
:
number
;
type
:
number
;
leaseTerm
?:
number
},
BaseInfoType
&
{
BaseInfoType
&
{
goodsSpec
:
specEntity
[];
goodsSpec
?
:
specEntity
[];
goodsDetail
:
{
goodsDesc
:
string
;
productDesc
:
string
;
content
:
string
};
goodsDetail
:
{
goodsDesc
:
string
;
productDesc
:
string
;
content
:
string
};
otherService
:
{
id
:
number
;
saleServiceName
:
string
;
saleServiceId
:
number
}[];
otherService
:
{
id
:
number
;
saleServiceName
:
string
;
saleServiceId
:
number
}[];
goodsVideoId
:
number
;
goodsVideoId
:
number
;
...
@@ -143,6 +143,15 @@ export type addMallGoodsType = InterFunction<
...
@@ -143,6 +143,15 @@ export type addMallGoodsType = InterFunction<
}[];
}[];
shelfStatus
:
number
;
shelfStatus
:
number
;
tradeName
:
string
;
tradeName
:
string
;
priceStock
:
{
channelPrice
:
number
;
id
?:
number
;
productSpec
:
string
;
salePrice
:
number
;
skuImage
:
string
;
skuNo
:
string
;
stock
:
number
;
}[];
},
},
any
any
>
;
>
;
...
...
src/pages/mallManage/mallGoods/goodsAddOrEditOrDetail/components/skuInfo/index.tsx
浏览文件 @
7cece82e
差异被折叠。
点击展开。
src/pages/mallManage/mallGoods/goodsAddOrEditOrDetail/components/skuInfo/old-index.tsx
0 → 100644
浏览文件 @
7cece82e
import
{
Button
,
Popconfirm
,
Table
,
Tag
}
from
'antd'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
FC
,
useState
}
from
'react'
;
import
{
InterDataType
,
InterReqType
,
PaginationProps
}
from
'~/api/interface'
;
import
{
addMallGoodsType
,
skuUnitType
}
from
'~/api/interface/goodsType'
;
//商品sku规格类型
type
goodsSpecType
=
Exclude
<
InterReqType
<
addMallGoodsType
>
,
undefined
>
[
'goodsSpecList'
][
0
];
//单位返回类型
type
unitType
=
InterDataType
<
skuUnitType
>
;
interface
selfProps
{
addOrEditSkuClick
:
()
=>
void
;
skuTableData
:
goodsSpecType
[];
skuUnitList
:
unitType
;
deleteSkuClick
:
(
record
:
goodsSpecType
)
=>
void
;
editSkuClick
:
(
record
:
goodsSpecType
)
=>
void
;
}
const
SkuInfo
:
FC
<
selfProps
>
=
({
addOrEditSkuClick
,
skuTableData
,
skuUnitList
,
deleteSkuClick
,
editSkuClick
,
})
=>
{
const
tableColumns
:
ColumnsType
<
goodsSpecType
>
=
[
{
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
:
goodsSpecType
[
'goodsSpecValuesList'
])
=>
text
.
map
((
v
)
=>
(
<
Tag
key=
{
v
.
id
}
>
{
v
.
specValueName
}
{
v
.
partNo
?
`(${v.partNo})`
:
''
}
</
Tag
>
)),
},
{
title
:
'操作'
,
align
:
'center'
,
render
:
(
_text
:
string
,
record
)
=>
(
<>
<
Button
type=
'link'
onClick=
{
()
=>
editSkuClick
(
record
)
}
>
编辑
</
Button
>
<
Popconfirm
placement=
'topLeft'
title=
{
'删除规格'
}
description=
{
'确认删除该规格吗?'
}
onConfirm=
{
()
=>
deleteSkuClick
(
record
)
}
okText=
'确定'
cancelText=
'取消'
>
<
Button
type=
'link'
danger
>
删除
</
Button
>
</
Popconfirm
>
</>
),
},
];
const
[
pagination
,
setPagination
]
=
useState
<
PaginationProps
>
({
pageNo
:
1
,
pageSize
:
10
,
});
//分页
const
paginationChange
=
(
pageNo
:
number
,
pageSize
:
number
)
=>
{
pagination
.
pageNo
=
pageNo
;
pagination
.
pageSize
=
pageSize
;
setPagination
({
...
pagination
});
};
return
(
<
div
className=
'sku-info'
>
<
div
className=
'sku-info-operate'
style=
{
{
margin
:
' 20px 0 '
}
}
>
<
Button
type=
'primary'
icon=
{
<
PlusOutlined
></
PlusOutlined
>
}
onClick=
{
()
=>
addOrEditSkuClick
()
}
>
添加规格
</
Button
>
</
div
>
<
Table
bordered
columns=
{
tableColumns
}
dataSource=
{
skuTableData
.
slice
(
(
pagination
.
pageNo
-
1
)
*
pagination
.
pageSize
,
pagination
.
pageNo
*
pagination
.
pageSize
,
)
}
rowKey=
'id'
pagination=
{
{
total
:
skuTableData
.
length
,
pageSize
:
pagination
.
pageSize
,
current
:
pagination
.
pageNo
,
showSizeChanger
:
true
,
showQuickJumper
:
true
,
onChange
:
(
page
:
number
,
pageSize
:
number
)
=>
paginationChange
(
page
,
pageSize
),
showTotal
:
(
total
,
range
)
=>
`当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`
,
}
}
/>
</
div
>
);
};
export
default
SkuInfo
;
src/pages/mallManage/mallGoods/goodsAddOrEditOrDetail/index.tsx
浏览文件 @
7cece82e
...
@@ -41,10 +41,10 @@ const GoodsAddOrEditOrDetail = () => {
...
@@ -41,10 +41,10 @@ const GoodsAddOrEditOrDetail = () => {
const
[
goodsDetailsInfo
,
setGoodsDetailsInfo
]
=
useState
<
goodsDetailType
>
();
const
[
goodsDetailsInfo
,
setGoodsDetailsInfo
]
=
useState
<
goodsDetailType
>
();
//新增、编辑sku弹窗显示
//新增、编辑sku弹窗显示
const
addOrEditSkuClick
=
(
record
?:
goodsSpecType
)
=>
{
//
const addOrEditSkuClick = (record?: goodsSpecType) => {
setCurrentSku
(
record
?
{
...
record
}
:
undefined
);
//
setCurrentSku(record ? { ...record } : undefined);
setAddOrEditSkuModalShow
(
true
);
//
setAddOrEditSkuModalShow(true);
};
//
};
const
addOrEditSkuModalCancel
=
()
=>
{
const
addOrEditSkuModalCancel
=
()
=>
{
setAddOrEditSkuModalShow
(
false
);
setAddOrEditSkuModalShow
(
false
);
};
};
...
@@ -59,11 +59,11 @@ const GoodsAddOrEditOrDetail = () => {
...
@@ -59,11 +59,11 @@ const GoodsAddOrEditOrDetail = () => {
}
}
};
};
//sku删除
//sku删除
const
deleteSkuClick
=
(
record
:
goodsSpecType
)
=>
{
//
const deleteSkuClick = (record: goodsSpecType) => {
const
skuIndex
:
number
=
skuTable
.
findIndex
((
v
)
=>
v
.
id
===
record
.
id
);
//
const skuIndex: number = skuTable.findIndex((v) => v.id === record.id);
skuTable
.
splice
(
skuIndex
,
1
);
//
skuTable.splice(skuIndex, 1);
setSkuTable
([...
skuTable
]);
//
setSkuTable([...skuTable]);
};
//
};
//商品详情获取
//商品详情获取
const
getIntroduceInfo
=
(
richText
:
string
)
=>
{
const
getIntroduceInfo
=
(
richText
:
string
)
=>
{
setGoodsDetails
(
richText
);
setGoodsDetails
(
richText
);
...
@@ -79,13 +79,16 @@ const GoodsAddOrEditOrDetail = () => {
...
@@ -79,13 +79,16 @@ const GoodsAddOrEditOrDetail = () => {
key
:
'2'
,
key
:
'2'
,
label
:
`商品规格`
,
label
:
`商品规格`
,
children
:
(
children
:
(
<
SkuInfo
// (旧)
addOrEditSkuClick=
{
addOrEditSkuClick
}
// <SkuInfo
skuTableData=
{
skuTable
}
// addOrEditSkuClick={addOrEditSkuClick}
skuUnitList=
{
skuUnitList
}
// skuTableData={skuTable}
deleteSkuClick=
{
deleteSkuClick
}
// skuUnitList={skuUnitList}
editSkuClick=
{
addOrEditSkuClick
}
// deleteSkuClick={deleteSkuClick}
/>
// editSkuClick={addOrEditSkuClick}
// />
//(新)
<
SkuInfo
/>
),
),
},
},
{
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论