Commit c132c008 authored by GuanHua's avatar GuanHua

fix:修改商品详情库存默认显示

parent 90d9032f
......@@ -636,11 +636,23 @@ const CommodityDetail = (props) => {
}
}
setCurrentPriceRange(sortUnitPrice(unitPricePicList[0].unitPrice))
setStockCount(unitPricePicList[0].stockCount)
initStockCount(unitPricePicList)
// setStockCount(unitPricePicList[0].stockCount)
setCommodityImgList(tempImgList)
setAttributeList(tempAttrList)
}
const initStockCount = (unitPricePicList: any) => {
if (!unitPricePicList) {
return
}
let total = 0
for (let item of unitPricePicList) {
total += item.stockCount
}
setStockCount(total)
}
/**
* 对阶梯价格进行从大到小的排序
* @param priceObj
......
......@@ -515,7 +515,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
priceRange: item.commodityUnitPrice.priceRange,
category: item.commodityUnitPrice.commodity.customerCategory.name,
brand: item.commodityUnitPrice.commodity.brand.name,
commodityPic: item.commodityUnitPrice.commodityPic[0],
commodityPic: item.commodityUnitPrice.commodity.mainPic,
attribute: item.commodityUnitPrice.attributeAndValueList,
stockCount: item.stockCount || 0
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment