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
shenshaokai
jinfa-platform
Commits
21512abe
Commit
21512abe
authored
Oct 19, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:进货单推荐商品跳转
parent
517b09fb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
+19
-8
index.tsx
src/pages/lxMall/components/Recommand/index.tsx
+19
-8
No files found.
src/pages/lxMall/components/Recommand/index.tsx
View file @
21512abe
...
...
@@ -40,12 +40,23 @@ const Recommand: React.FC<RecommandPropsType> = (props) => {
break
}
}
console
.
log
(
result
,
"result"
)
if
(
result
.
length
<=
0
)
{
getCategoryComponents
()
}
}
const
changeDataKey
=
(
data
)
=>
{
return
data
.
map
(
item
=>
{
item
.
id
=
item
.
goodsId
item
.
mainPic
=
item
.
goodsPicUrl
item
.
name
=
item
.
goodsName
item
.
min
=
item
.
goodsPrice
item
.
storeId
=
item
.
shopId
return
item
})
}
const
getListById
=
(
categoryId
:
number
)
=>
{
return
new
Promise
((
resolve
)
=>
{
let
param
:
any
=
{
...
...
@@ -118,20 +129,20 @@ const Recommand: React.FC<RecommandPropsType> = (props) => {
const
getCategoryComponents
=
async
()
=>
{
let
firstCategory
:
any
=
await
fetchFirstCategory
()
let
categoryDetail
:
any
=
await
fetchCategoryById
(
firstCategory
[
0
].
id
)
setList
(
c
ategoryDetail
.
goodsBOList
)
setList
(
c
hangeDataKey
(
categoryDetail
.
goodsBOList
)
)
}
const
getCommodityDetailLink
=
(
item
)
=>
{
let
link
=
""
switch
(
layoutType
)
{
case
LAYOUT_TYPE
.
channel
:
link
=
`/channelmall/commodity/detail?id=
${
item
.
goodsId
}
&channelId=
${
btoa
(
JSON
.
stringify
({
shopId
:
item
.
shop
Id
,
memberId
:
item
.
memberId
}))}
`
link
=
`/channelmall/commodity/detail?id=
${
item
.
id
}
&channelId=
${
btoa
(
JSON
.
stringify
({
shopId
:
item
.
store
Id
,
memberId
:
item
.
memberId
}))}
`
break
case
LAYOUT_TYPE
.
ichannel
:
link
=
`/ichannelmall/commodity/detail?id=
${
item
.
goodsId
}
&channelId=
${
btoa
(
JSON
.
stringify
({
shopId
:
item
.
shop
Id
,
memberId
:
item
.
memberId
}))}
`
link
=
`/ichannelmall/commodity/detail?id=
${
item
.
id
}
&channelId=
${
btoa
(
JSON
.
stringify
({
shopId
:
item
.
store
Id
,
memberId
:
item
.
memberId
}))}
`
break
default
:
link
=
`/shop/commodity/detail?id=
${
item
.
goodsId
}
&shopId=
${
btoa
(
JSON
.
stringify
({
shopId
:
item
.
shop
Id
,
memberId
:
item
.
memberId
}))}
`
link
=
`/shop/commodity/detail?id=
${
item
.
id
}
&shopId=
${
btoa
(
JSON
.
stringify
({
shopId
:
item
.
store
Id
,
memberId
:
item
.
memberId
}))}
`
break
}
return
link
...
...
@@ -146,13 +157,13 @@ const Recommand: React.FC<RecommandPropsType> = (props) => {
<
a
href=
{
getCommodityDetailLink
(
item
)
}
key=
{
`recommand_list_item_${index}`
}
target=
"_blank"
>
<
div
className=
{
styles
.
recommand_list_item
}
>
<
div
className=
{
styles
.
recommand_list_item_img
}
>
<
ImageBox
width=
{
224
}
height=
{
224
}
imgUrl=
{
item
.
goodsPicUrl
}
direction=
"column"
/>
<
ImageBox
width=
{
224
}
height=
{
224
}
imgUrl=
{
item
.
mainPic
}
direction=
"column"
/>
</
div
>
<
div
className=
{
styles
.
recommand_list_item_price
}
>
<
span
>
¥
</
span
>
{
priceFormat
(
item
.
goodsPrice
)
}
{
priceFormat
(
item
.
min
)
}
</
div
>
<
div
className=
{
styles
.
recommand_list_item_name
}
>
{
item
.
goodsN
ame
}
</
div
>
<
div
className=
{
styles
.
recommand_list_item_name
}
>
{
item
.
n
ame
}
</
div
>
</
div
>
</
a
>
))
...
...
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