商城测试版v7

This commit is contained in:
2022-07-23 21:20:18 +08:00
parent c4684c11b8
commit 7e12050a94
20 changed files with 129 additions and 100 deletions
@@ -198,14 +198,25 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param)
return <View className={styles.priceText}><Text>¥</Text>{price}<Text> /{selectList[selectIndex].eunit}</Text></View>
}, [selectIndex])
//显示图片弹窗
const [showLabImage, setShowLabImage] = useState(false)
const [labImageValue, setLabImageValue] = useState()
const getLabAndImg = useCallback((val) => {
setShowLabImage(() => true)
setLabImageValue(val)
}, [])
const closeLabImgShow = useCallback(() => {
setShowLabImage(() => false)
}, [])
//虚拟滚动
const Rows = useCallback(({id, index, style, data}:any) => {
const Rows = memo(({id, index, style, data}:any) => {
let item = data[index]
return (
<>
{item&&<View className={styles.item} key={item.id}>
<View className={styles.item_color}>
<LabAndImg value={{lab:item.lab,rgb:item.rgb,texture_url:item.texture_url, title:item.code}} showStatus={false}/>
<LabAndImg value={{lab:item.lab,rgb:item.rgb,texture_url:item.texture_url, title:item.code}} showStatus={false} onClick={getLabAndImg}/>
</View>
<View className={styles.item_con}>
<View className={styles.title}>{formatHashTag(item.code, item.name)}</View>
@@ -233,7 +244,7 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param)
}
</>
)
}, [list])
})
return (
<View className={styles.shop_cart_main}>
@@ -262,38 +273,6 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param)
<View className={styles.product_color_con}>
{(list.length <= 0 && colorState.loading)&&<LoadingCard/>}
{(list.length > 0&& !colorState.loading)&&
// <InfiniteScroll moreStatus={false}>
// <View className={styles.color_con}>
// {list.map(item => {
// return <View className={styles.item} key={item.id}>
// <View className={styles.item_color}>
// <LabAndImg value={{lab:item.lab,rgb:item.rgb,texture_url:item.texture_url}}/>
// </View>
// <View className={styles.item_con}>
// <View className={styles.title}>{formatHashTag(item.code, item.name)}</View>
// <View className={styles.num}>
// {formatPrice(item)}
// </View>
// </View>
// <View className={styles.btn_con}>
// {!item.show&&<View className={styles.btn} onClick={() => onAdd(item)}>添加</View>
// ||<View className={styles.btn_count}>
// <Counter
// onBlue={(e) => getInputValue(e, item)}
// defaultNum={item.count}
// step={selectList[selectIndex].step}
// digits={selectList[selectIndex].digits}
// onClickBtn={(e) => getInputValue(e, item)}
// unit={selectList[selectIndex].unit}
// minNum={selectList[selectIndex].minNum}
// maxNum={selectList[selectIndex].maxNum}
// />
// </View>}
// </View>
// </View>
// })}
// </View>
// </InfiniteScroll>}
<View className={styles.color_con}>
<VirtualList
className={styles.virtual_list}
@@ -319,6 +298,9 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param)
</View>
<View className="common_safe_area_y"></View>
</Popup>
<View>
<LabAndImgShow value={labImageValue} show={showLabImage} onClose={closeLabImgShow}/>
</View>
</View>
)
})