Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄庭坚
jinfa-platform
Commits
da845132
Commit
da845132
authored
Sep 15, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:商品详情图片的显示
parent
9127cbda
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
index.tsx
src/pages/lxMall/commodityDetail/index.tsx
+17
-9
No files found.
src/pages/lxMall/commodityDetail/index.tsx
View file @
da845132
...
...
@@ -80,7 +80,7 @@ const CommodityDetail = (props) => {
PublicApi
.
getSearchShopStoreGetCommodityDetail
({
commodityId
:
id
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setCommodityDetail
(
res
.
data
)
initAttributeAndValueList
(
res
.
data
?.
unitPriceAndPicList
)
initAttributeAndValueList
(
res
.
data
)
getPayWayListByMemberId
(
res
.
data
?.
memberId
)
res
.
data
?.
isMemberPrice
&&
getMemberCredit
(
res
.
data
?.
memberId
,
res
.
data
?.
memberRoleId
)
}
...
...
@@ -301,18 +301,26 @@ const CommodityDetail = (props) => {
* 初始化商品详情数据
* @param unitPriceAndPicList
*/
const
initAttributeAndValueList
=
(
unitPriceAndPicList
:
any
)
=>
{
let
tempAttrList
=
[]
let
tempImgList
=
[]
const
initAttributeAndValueList
=
(
dataInfo
:
any
)
=>
{
let
unitPriceAndPicList
=
dataInfo
?.
unitPriceAndPicList
if
(
!
unitPriceAndPicList
)
{
return
}
let
tempAttrList
=
[]
let
tempImgList
:
any
=
[{
id
:
dataInfo
.
id
,
commodityPic
:
dataInfo
.
mainPic
}]
for
(
let
item
of
unitPriceAndPicList
)
{
if
(
item
.
commodityPic
)
{
tempImgList
=
[...
tempImgList
,
{
id
:
item
.
id
,
commodityPic
:
item
.
commodityPic
[
0
]
}]
let
tempCommodityPic
=
item
.
commodityPic
.
map
((
picItem
,
picIndex
)
=>
{
return
{
id
:
`
${
item
.
id
}
-
${
picIndex
}
`
,
commodityPic
:
picItem
}
})
tempImgList
=
[...
tempImgList
,
...
tempCommodityPic
]
}
for
(
let
attrListItem
of
item
.
attributeAndValueList
)
{
if
(
judgeAttrInList
(
tempAttrList
,
attrListItem
.
customerAttribute
.
id
))
{
...
...
@@ -343,7 +351,7 @@ const CommodityDetail = (props) => {
}
}
}
console
.
log
(
tempImgList
,
"tempImgList"
)
setCurrentPriceRange
(
unitPriceAndPicList
[
0
].
unitPrice
)
setStockCount
(
unitPriceAndPicList
[
0
].
stockCount
||
2000
)
setCommodityImgList
(
tempImgList
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment