页面
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
.shop_cart_main{
|
||||
.popup_con{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 80vh;
|
||||
}
|
||||
.header{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
@@ -35,14 +40,15 @@
|
||||
}
|
||||
}
|
||||
.con{
|
||||
padding:30px 20px 0;
|
||||
padding:30px 20px 100px 0;
|
||||
box-sizing: border-box;
|
||||
height: 70vh;
|
||||
flex:1;
|
||||
height: 0;
|
||||
.scroll{
|
||||
height: 100%;
|
||||
}
|
||||
.product_list{
|
||||
padding-bottom: 115px;
|
||||
padding-bottom: 20px;
|
||||
.product_item{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { Checkbox, Image, ScrollView, View } from "@tarojs/components"
|
||||
import {Image, ScrollView, View } from "@tarojs/components"
|
||||
import Popup from "@/components/popup"
|
||||
import classnames from "classnames";
|
||||
import MCheckbox from "@/components/checkbox";
|
||||
import LoadingCard from "@/components/loadingCard";
|
||||
import InfiniteScroll from "@/components/infiniteScroll";
|
||||
import styles from "./index.module.scss"
|
||||
import { useEffect, useState } from "react";
|
||||
import Taro from "@tarojs/taro";
|
||||
|
||||
type param = {
|
||||
show?: true|false,
|
||||
@@ -17,15 +20,19 @@ export default ({show = false, onClose}: param) => {
|
||||
}
|
||||
|
||||
const [list, setList] = useState<any[]>([])
|
||||
const [loading, setLoading] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
let lists:any[] = []
|
||||
for(let i = 0; i < 20; i++) {
|
||||
setList((e) => [...e, {
|
||||
lists = [...lists, {
|
||||
title:`${i}#薄荷绿`,
|
||||
subtitle: '0770# 21S单面平纹(食毛)',
|
||||
tag: '剪板',
|
||||
select: i%2?true: false
|
||||
}])
|
||||
}]
|
||||
}
|
||||
setList([...lists])
|
||||
}, [])
|
||||
|
||||
const [showPopup, setShowPopup] = useState(false)
|
||||
@@ -33,11 +40,13 @@ export default ({show = false, onClose}: param) => {
|
||||
setShowPopup(show)
|
||||
}, [show])
|
||||
|
||||
|
||||
const [selectStatus, setSelectStatus] = useState(false)
|
||||
const selectAll = () => {
|
||||
console.log('123123')
|
||||
list.map(item => {
|
||||
item.select = true
|
||||
item.select = !selectStatus
|
||||
})
|
||||
setSelectStatus(!selectStatus)
|
||||
setList([...list])
|
||||
}
|
||||
|
||||
@@ -58,64 +67,84 @@ export default ({show = false, onClose}: param) => {
|
||||
onClose?.()
|
||||
setShowPopup(false)
|
||||
}
|
||||
|
||||
const delSelect = () => {
|
||||
Taro.showModal({
|
||||
content: '删除所选商品?',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
Taro.showToast({
|
||||
title: '成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<View className={styles.shop_cart_main}>
|
||||
<Popup showTitle={false} show={showPopup} onClose={() => closePopup()}>
|
||||
<View className={styles.header}>
|
||||
<View onClick={selectAll}>全选</View>
|
||||
<View>
|
||||
<text className={classnames('iconfont', 'icon-lajixiang', styles.miconfont)}></text>
|
||||
删除勾选项
|
||||
<View className={styles.popup_con}>
|
||||
<View className={styles.header}>
|
||||
<View onClick={selectAll}>{!selectStatus?'全选':'反选'}</View>
|
||||
<View onClick={delSelect}>
|
||||
<text className={classnames('iconfont', 'icon-lajixiang', styles.miconfont)}></text>
|
||||
删除勾选项
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.search}>
|
||||
{selectList.map((item, index) => {
|
||||
return <View key={index} onClick={() => selectProduct(index)} className={classnames(styles.search_item, (selectIndex==index)&&styles.search_item_select)}>{item}</View>
|
||||
})}
|
||||
|
||||
</View>
|
||||
<View className={styles.con}>
|
||||
{list.length > 0&&<ScrollView scrollY className={styles.scroll}>
|
||||
<View className={styles.product_list}>
|
||||
{list.map((item, index) => {
|
||||
return <View key={index} className={styles.product_item}>
|
||||
<View className={styles.checkbox}>
|
||||
<MCheckbox status={item.select} onSelect={() => selectCallBack(item)} onClose={() => colseCallBack(item)}/>
|
||||
<View className={styles.search}>
|
||||
{selectList.map((item, index) => {
|
||||
return <View key={index} onClick={() => selectProduct(index)} className={classnames(styles.search_item, (selectIndex==index)&&styles.search_item_select)}>{item}</View>
|
||||
})}
|
||||
|
||||
</View>
|
||||
<View className={styles.con}>
|
||||
{loading&&<LoadingCard/>}
|
||||
{!loading&&list.length > 0&&<InfiniteScroll selfonScrollToLower={() => {console.log('触底了')}}>
|
||||
<View className={styles.product_list}>
|
||||
{list.map((item, index) => {
|
||||
return <View key={index} className={styles.product_item}>
|
||||
<View className={styles.checkbox}>
|
||||
<MCheckbox status={item.select} onSelect={() => selectCallBack(item)} onClose={() => colseCallBack(item)}/>
|
||||
</View>
|
||||
<View className={styles.img}>
|
||||
<Image src="https://bpic.588ku.com//back_origin_min_pic/22/01/11/aa3da17bab9a6556564028e4f1d77874.jpg!/fw/750/quality/99/unsharp/true/compress/true"/>
|
||||
</View>
|
||||
<View className={styles.des}>
|
||||
<View className={styles.title}>{item.title}</View>
|
||||
<View className={styles.subtitle}>0770# 21S单面平纹(食毛)</View>
|
||||
<View className={styles.tag}>剪板</View>
|
||||
</View>
|
||||
<View className={styles.count}>
|
||||
<View className={styles.price}><text>¥</text>40.5<text>/kg</text></View>
|
||||
<View className={styles.long}>×12m</View>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.img}>
|
||||
<Image src="https://bpic.588ku.com//back_origin_min_pic/22/01/11/aa3da17bab9a6556564028e4f1d77874.jpg!/fw/750/quality/99/unsharp/true/compress/true"/>
|
||||
</View>
|
||||
<View className={styles.des}>
|
||||
<View className={styles.title}>{item.title}</View>
|
||||
<View className={styles.subtitle}>0770# 21S单面平纹(食毛)</View>
|
||||
<View className={styles.tag}>剪板</View>
|
||||
</View>
|
||||
<View className={styles.count}>
|
||||
<View className={styles.price}><text>¥</text>40.5<text>/kg</text></View>
|
||||
<View className={styles.long}>×12m</View>
|
||||
</View>
|
||||
</View>
|
||||
})}
|
||||
</View>
|
||||
})}
|
||||
</View>
|
||||
</InfiniteScroll>}
|
||||
{!loading&&list.length > 0&&<View className={styles.empty}>
|
||||
<View className={styles.title}>暂未选择商品</View>
|
||||
<View className={styles.btn}>去选购</View>
|
||||
</View>}
|
||||
|
||||
</ScrollView>||
|
||||
<View className={styles.empty}>
|
||||
<View className={styles.title}>暂未选择商品</View>
|
||||
<View className={styles.btn}>去选购</View>
|
||||
</View>}
|
||||
</View>
|
||||
<View className={styles.buy_btn}>
|
||||
<View className={styles.buy_con}>
|
||||
<View className={styles.icon}>
|
||||
<View className={classnames('iconfont', 'icon-gouwuche', styles.miconfont)}></View>
|
||||
</View>
|
||||
<View className={styles.price_con}>
|
||||
<View className={styles.price_real}><text>¥</text>200</View>
|
||||
<View className={styles.price_forecast}>预估金额</View>
|
||||
</View>
|
||||
<View className={styles.goPay}>
|
||||
去结算
|
||||
</View>
|
||||
<View className={styles.buy_btn}>
|
||||
<View className={styles.buy_con}>
|
||||
<View className={styles.icon}>
|
||||
<View className={classnames('iconfont', 'icon-gouwuche', styles.miconfont)}></View>
|
||||
</View>
|
||||
<View className={styles.price_con}>
|
||||
<View className={styles.price_real}><text>¥</text>200</View>
|
||||
<View className={styles.price_forecast}>预估金额</View>
|
||||
</View>
|
||||
<View className={styles.goPay}>
|
||||
去结算
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user