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
37562e6a
Commit
37562e6a
authored
Mar 02, 2021
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 商品详情库存修改为通过接口获取
parent
6e9f33e7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
47 deletions
+14
-47
index.tsx
...nents/ProductDescription/components/TradeRecord/index.tsx
+0
-1
index.tsx
src/pages/lxMall/commodityDetail/index.tsx
+14
-46
No files found.
src/pages/lxMall/commodityDetail/components/ProductDescription/components/TradeRecord/index.tsx
View file @
37562e6a
...
...
@@ -50,7 +50,6 @@ const TradeRecord: React.FC<TradeRecordPropsType> = (props) => {
item
.
id
=
current
*
10
+
index
return
item
})
console
.
log
(
result
,
"result"
)
setRecordList
(
result
)
}
...
...
src/pages/lxMall/commodityDetail/index.tsx
View file @
37562e6a
...
...
@@ -366,12 +366,25 @@ const CommodityDetail = (props) => {
setSelectCommodityUnitPriceId
(
item
.
commodityUnitPriceAndPicId
)
setCurrentPriceRange
(
sortUnitPrice
(
item
.
unitPrice
))
setAttrAndValList
(
item
)
setStockCount
(
item
.
stockCount
)
getStockCountByProductId
(
item
.
id
)
}
}
}
}
const
getStockCountByProductId
=
(
productId
:
number
)
=>
{
const
param
:
any
=
{
productId
,
shopId
:
storeId
,
}
PublicApi
.
getWarehouseStockByProductId
(
param
).
then
((
res
=>
{
if
(
res
.
code
===
1000
)
{
setStockCount
(
res
.
data
)
}
}))
}
const
judgeArrisCommon
=
(
list
,
otherList
)
=>
{
if
(
list
.
length
===
otherList
.
length
)
{
const
result
=
list
.
every
(
listItem
=>
{
...
...
@@ -815,7 +828,6 @@ const CommodityDetail = (props) => {
})
})
try
{
console
.
log
(
tempPriceRange
,
"tempPriceRange"
)
tempPriceRange
=
tempPriceRange
.
sort
((
a
,
b
)
=>
a
.
min
>
b
.
max
?
1
:
-
1
)
}
catch
(
error
)
{
console
.
log
(
error
)
...
...
@@ -939,49 +951,6 @@ const CommodityDetail = (props) => {
return
result
[
0
]
}
/**
* 判断商品是否含有该属性
*/
const
judgeHasAttr
=
(
attrId
:
number
,
attrValId
:
number
)
=>
{
let
result
=
true
const
newSelectAttrVal
=
JSON
.
parse
(
JSON
.
stringify
(
selectAttrVal
))
if
(
selectAttrVal
.
length
>
0
)
{
// newSelectAttrVal.pop()
if
(
commodityDetail
?.
unitPricePicList
)
{
const
tempList
=
[]
for
(
const
item
of
commodityDetail
?.
unitPricePicList
)
{
const
temp
=
item
.
attributeAndValueList
.
map
(
attrItem
=>
{
return
{
attrId
:
attrItem
.
customerAttribute
.
id
,
attrValId
:
attrItem
.
customerAttributeValue
.
id
}
})
if
(
judegeListInList
(
temp
,
newSelectAttrVal
))
{
tempList
.
push
(
temp
)
}
}
if
(
newSelectAttrVal
.
length
<=
attributeList
.
length
&&
selectAttrVal
[
0
].
attrId
===
attrId
)
{
return
true
}
result
=
tempList
.
some
(
item
=>
item
.
some
(
childItem
=>
childItem
.
attrId
===
attrId
&&
childItem
.
attrValId
===
attrValId
))
}
}
return
result
}
/**
* 判断选的的数组是有在商品属性数组中
*/
const
judegeListInList
=
(
mainList
,
subList
)
=>
{
const
result
=
subList
.
every
(
listItem
=>
{
const
subRes
=
mainList
.
some
(
item
=>
{
return
JSON
.
stringify
(
item
)
===
JSON
.
stringify
(
listItem
)
})
return
subRes
})
return
result
}
const
checkItemInRang
=
(
item
)
=>
{
if
(
Number
(
item
.
min
)
<=
Number
(
buyCount
)
&&
Number
(
item
.
max
)
>=
Number
(
buyCount
))
{
return
true
...
...
@@ -1068,7 +1037,6 @@ const CommodityDetail = (props) => {
key=
{
`product_info_line_list_item_${childItem.id}_${index}`
}
className=
{
cx
(
styles
.
product_info_line_list_item
,
judgeSelectAttrInList
(
selectAttrVal
,
childItem
.
id
,
'attrValId'
)
?
styles
.
active
:
''
,
// judgeHasAttr(item.customerAttribute.id, childItem.id) ? '' : styles.disabled
)
}
onClick=
{
()
=>
handleSelectAttrVal
(
item
.
customerAttribute
.
id
,
childItem
.
id
)
}
>
{
...
...
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