订单售后v3

This commit is contained in:
2022-06-21 20:32:27 +08:00
parent f92a8913f4
commit 51ff3eefe7
26 changed files with 1111 additions and 220 deletions
@@ -16,6 +16,7 @@ import UseLogin from "@/use/useLogin"
import { formatHashTag, formatPriceDiv } from "@/common/fotmat";
import { debounce, getFilterData } from "@/common/util";
import LabAndImg from "@/components/LabAndImg";
import VirtualList from '@tarojs/components/virtual-list'
@@ -123,11 +124,14 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param)
//计数组件
const getInputValue = (num, item) => {
item.count = parseFloat(num)
if(num == 0) item.show = false
setList([...list])
console.log(num)
item.count = parseFloat(num)
if(num == 0) item.show = false
setList([...list])
console.log(num)
}
const onAdd = (item) => {
item.show = true
item.count = selectList[selectIndex].defaultNum
@@ -198,10 +202,41 @@ 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 Rows = memo(({id, index, style, data}:any) => {
let item = data[index]
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>
)
})
return (
<View className={styles.shop_cart_main}>
<Popup showTitle={false} show={showPopup} onClose={() => closePopup()} >
<View className={styles.popup_con}>
<View className={styles.header}>{title}</View>
@@ -227,39 +262,52 @@ 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>}
// <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
height={500} /* 列表的高度 */
width='100%' /* 列表的宽度 */
itemData={list} /* 渲染列表的数据 */
itemCount={list.length} /* 渲染列表的长度 */
itemSize={100} /* 列表单项的高度 */
overscanCount={1}
>
{Rows}
</VirtualList>
<View className="common_safe_area_y"></View>
</View>}
{(list.length <= 0 && !colorState.loading)&&<View className={styles.noData}>暂无此商品</View>}
</View>
<View className={styles.buy_btn}>