This commit is contained in:
pplokijuhyg 2019-12-20 11:09:15 +08:00
parent 3cf388faed
commit 38280893bd
3 changed files with 103 additions and 54 deletions

View File

@ -8,13 +8,15 @@ Page({
data: {
list:[],
select:[],
userid:0
userid:0,
price:"0.00"
},
sel(a){
console.log(a)
this.setData({
[`select[${a.detail.index}]`]:!a.detail.select
})
this.num();
},
/**
@ -98,8 +100,52 @@ Page({
},
num(){
let num = 0;
let sel = 0;
for(let i in this.data.select){
console.log(i)
if(this.data.select[i]){
num += parseFloat(this.data.list[i].goods_price)*100
sel++
}
}
if(sel == this.data.list.length){
this.setData({
all:true
})
}else{
this.setData({
all:false
})
}
this.setData({
price:num/100
})
},
call(){
let sel = 0;
let select = []
for(let i in this.data.list){
console.log(i)
if(this.data.select[i]){
// num += parseFloat(this.data.list[i].goods_price)*100
sel++
}else{
select[i] = true
}
}
if(sel == this.data.list.length){
this.setData({
all:false,
select:[]
})
}else{
this.setData({
all:true,
select
})
}
this.num()
}
})

View File

@ -13,9 +13,9 @@
</view> -->
<view class="bottom">
<view class="left">
<view class="select"></view>
<text class="selectall">全选</text>
<text class="pri">$0.00</text>
<view bind:tap="call" class="select {{all ? 'selects':''}}"></view>
<text bind:tap="call" class="selectall">全选</text>
<text class="pri">${{price}}</text>
</view>
<view class="right">
<text class="del">删除</text>

View File

@ -1,51 +1,54 @@
.shopping{
padding-bottom: 128rpx;
.shopping {
padding-bottom: 128rpx;
}
.item {
height: 186rpx;
margin-left: 46rpx;
margin-top: 59rpx;
}
height: 186rpx;
margin-left: 46rpx;
margin-top: 59rpx;
}
.bottom {
width: 100%;
height: 98rpx;
position: fixed;
bottom: 0;
background: linear-gradient(2deg, rgba(250, 250, 250, 0.94), rgba(255, 255, 255, 0.94));
display: flex;
justify-content: space-between;
font-size: 28rpx;
line-height: 98rpx;
}
.bottom {
width: 100%;
height: 98rpx;
position: fixed;
bottom: 0;
background: linear-gradient(2deg, rgba(250, 250, 250, 0.94), rgba(255, 255, 255, 0.94));
display: flex;
justify-content: space-between;
font-size: 28rpx;
line-height: 98rpx;
}
.left {
display: flex;
/* line-height: 26rpx; */
}
.left {
display: flex;
/* line-height: 26rpx; */
}
.select {
width: 26rpx;
height: 26rpx;
background: rgba(234, 234, 234, 1);
border-radius: 50%;
margin: auto 0;
margin-left: 46rpx;
margin-right: 24rpx;
}
.select {
width: 26rpx;
height: 26rpx;
background: rgba(234, 234, 234, 1);
border-radius: 50%;
margin: auto 0;
margin-left: 46rpx;
margin-right: 24rpx;
}
.selects{
background-color: #4cc97d;
}
.pri {
color: #E0C79D;
font-size: 26rpx;
margin-left: 19rpx;
}
.pri {
color: #e0c79d;
font-size: 26rpx;
margin-left: 19rpx;
}
.right {
color: #BBBBBB;
margin-right: 31rpx;
}
.right {
color: #bbbbbb;
margin-right: 31rpx;
}
.sub {
margin-left: 30rpx;
color: #4CC97D;
}
.sub {
margin-left: 30rpx;
color: #4cc97d;
}