购物车完成
This commit is contained in:
@@ -0,0 +1,189 @@
|
||||
.shop_cart_main{
|
||||
.header{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 30px;
|
||||
font-size: $font_size;
|
||||
box-sizing: border-box;
|
||||
color: $color_font_two;
|
||||
.miconfont{
|
||||
font-size: 30px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
.search{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0 20px;
|
||||
.search_item{
|
||||
width: 148px;
|
||||
height: 55px;
|
||||
text-align: center;
|
||||
line-height: 55px;
|
||||
color: $color_font_two;
|
||||
font-size: $font_size_medium;
|
||||
background-color: #f0f0f0;
|
||||
border-radius: 50px;
|
||||
}
|
||||
.search_item_select{
|
||||
border: 2px solid $color_main;
|
||||
background-color: #ecf5ff;
|
||||
color: $color_main;
|
||||
width: 144px;
|
||||
height: 51px;
|
||||
}
|
||||
}
|
||||
.con{
|
||||
padding:30px 20px 0;
|
||||
box-sizing: border-box;
|
||||
height: 70vh;
|
||||
.scroll{
|
||||
height: 100%;
|
||||
}
|
||||
.product_list{
|
||||
padding-bottom: 115px;
|
||||
.product_item{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
&:nth-child(n+2) {
|
||||
margin-top: 30px;
|
||||
}
|
||||
.checkbox{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
}
|
||||
.img{
|
||||
width: 126px;
|
||||
height: 126px;
|
||||
margin-left: 20px;
|
||||
image{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 10px;
|
||||
}
|
||||
}
|
||||
.des{
|
||||
flex:1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
margin-left: 20px;
|
||||
.title{
|
||||
font-size: $font_size;
|
||||
color: $color_font_one;
|
||||
}
|
||||
.subtitle{
|
||||
color: $color_font_two;
|
||||
font-size: $font_size_medium;
|
||||
}
|
||||
.tag{
|
||||
font-size: $font_size_min;
|
||||
color: #fff;
|
||||
background-color: $color_main;
|
||||
border-radius: 10px;
|
||||
width: 65px;
|
||||
height: 33px;
|
||||
text-align: center;
|
||||
line-height: 33px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.count{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
.price{
|
||||
font-size: $font_size;
|
||||
font-weight: 700;
|
||||
color: $color_font_one;
|
||||
text{
|
||||
font-size: $font_size_min;
|
||||
}
|
||||
}
|
||||
.long{
|
||||
color: $color_main;
|
||||
font-size: $font_size_medium;
|
||||
}
|
||||
}
|
||||
}
|
||||
.empty{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.title{
|
||||
color: $color_font_two;
|
||||
font-size: $font_size_min;
|
||||
}
|
||||
.btn{
|
||||
width: 222px;
|
||||
height: 68px;
|
||||
background-color: $color_main;
|
||||
font-size: $font_size;
|
||||
text-align: center;
|
||||
line-height: 68px;
|
||||
margin-top: 42px;
|
||||
color: #fff;
|
||||
border-radius: 50px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.buy_btn{
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
.buy_con{
|
||||
width: 702px;
|
||||
height: 95px;
|
||||
background-color: $color_font_one;
|
||||
border-radius: 50px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20px 0;
|
||||
box-sizing: border-box;
|
||||
.icon{
|
||||
width: 100px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
.miconfont{
|
||||
font-size: 39px;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.price_con{
|
||||
flex:1;
|
||||
.price_real{
|
||||
font-size: $font_size;
|
||||
color: #fff;
|
||||
text{
|
||||
font-size: $font_size_min;
|
||||
}
|
||||
}
|
||||
.price_forecast{
|
||||
font-size: $font_size_min;
|
||||
color: $color_font_two;
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
.goPay{
|
||||
width: 200px;
|
||||
height: 95px;
|
||||
background-color: $color_main;
|
||||
border-radius: 0px 50px 50px 0px;
|
||||
text-align: center;
|
||||
line-height: 95px;
|
||||
font-size: 32px;
|
||||
color:#fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
import { Checkbox, Image, ScrollView, View } from "@tarojs/components"
|
||||
import Popup from "@/components/popup"
|
||||
import classnames from "classnames";
|
||||
import MCheckbox from "@/components/checkbox";
|
||||
import styles from "./index.module.scss"
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
type param = {
|
||||
show?: true|false,
|
||||
onClose?: () => void
|
||||
}
|
||||
export default ({show = false, onClose}: param) => {
|
||||
const selectList = ['不限', '剪板', '散剪', '大货']
|
||||
const [selectIndex, setSelectIndex] = useState(0)
|
||||
const selectProduct = (index:number) => {
|
||||
setSelectIndex(index)
|
||||
}
|
||||
|
||||
const [list, setList] = useState<any[]>([])
|
||||
useEffect(() => {
|
||||
for(let i = 0; i < 20; i++) {
|
||||
setList((e) => [...e, {
|
||||
title:`${i}#薄荷绿`,
|
||||
subtitle: '0770# 21S单面平纹(食毛)',
|
||||
tag: '剪板',
|
||||
select: i%2?true: false
|
||||
}])
|
||||
}
|
||||
}, [])
|
||||
|
||||
const [showPopup, setShowPopup] = useState(false)
|
||||
useEffect(() => {
|
||||
setShowPopup(show)
|
||||
}, [show])
|
||||
|
||||
const selectAll = () => {
|
||||
console.log('123123')
|
||||
list.map(item => {
|
||||
item.select = true
|
||||
})
|
||||
setList([...list])
|
||||
}
|
||||
|
||||
//checkbox选中回调
|
||||
const selectCallBack = (item) => {
|
||||
item.select = true
|
||||
setList([...list])
|
||||
}
|
||||
|
||||
//checkbox关闭回调
|
||||
const colseCallBack = (item) => {
|
||||
item.select = false
|
||||
setList([...list])
|
||||
}
|
||||
|
||||
//popup关闭
|
||||
const closePopup = () => {
|
||||
onClose?.()
|
||||
setShowPopup(false)
|
||||
}
|
||||
|
||||
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>
|
||||
</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>
|
||||
<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>
|
||||
|
||||
</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>
|
||||
</View>
|
||||
</Popup>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user