<view class="numEdit">
<text>共20件商品</text>
<text>编辑</text>
</view>
<view class="oversf orderBuy">
<view class="storeLists" wx:for="{{buyerList}}" wx:key='index' wx:for-index="father_index">
<checkbox-group class='marLab'>
<label class="checkbox oneji" data-store_id="{{item.store_id}}" data-parent_id="{{father_index}}" bindtap="checkboxChange">
<view class="paddl">
<checkbox class="imgCheackone" value="{{item.name}}" checked="{{item.checked}}" />
<text class="titles imgCheackone">{{item.category_title}}</text>
</view>
</label>
</checkbox-group>
<!-- 二级 -->
<view class="goodsList" wx:for="{{item.goods_item}}" wx:for-item='goods_item' wx:key='index' wx:for-index="son_index">
<checkbox-group class='checkboxTwo'>
<label class="checkbox twoJi" data-child_id="{{son_index}}" data-category_id="{{goods_item.category_id}}" data-store_id="{{goods_item.store_id}}" data-id="{{son_index}}" catchtap='childChange'>
<checkbox value="{{store_item.name}}" checked="{{goods_item.checked}}" />
<image class="dians" src="{{goods_item.goods.logo}}"></image>
<view class="oversList">
<view class="username">{{goods_item.goods.title}}</view>
<view class="color_size">花瓣紫
<text>S</text>
</view>
<view class="price_num">
<view class="price">¥419.00</view>
</view>
</view>
</label>
</checkbox-group>
<view class="cart-count-box">
<text class="cart-count-down" bindtap="minusCount" data-index="{{goods_item.id}}" data-count="{{goods_item.count}}">-</text>
<input class="cart-count-num" type="number" value="{{goods_item.count}}"></input>
<text class="cart-count-add" bindtap="addCount" data-index="{{goods_item.id}}" data-count="{{goods_item.count}}">+</text>
</view>
</view>
</view>
<view class="database" wx:if='{{buyerListlength<1}}'>暂无数据~</view>
</view>
<view class="setProvice">
<view class="checkAll">
<checkbox-group bindtap='checkAll'>
<label>
<checkbox checked="{{checkedAll}}"></checkbox>
<text>全选</text>
</label>
</checkbox-group>
</view>
<view class="totalNum">
<view class="realTotal">合计
<text>¥419.00</text> </view>
<view class="total">总额419元,立减0元</view>
</view>
<view class="settlement">立即结算</view>
</view>
@import "../../weui.wxss";
.numEdit {
display: flex;
justify-content: space-between;
color:
font-size: 32rpx;
padding: 20rpx;
box-sizing: border-box;
background:
margin-bottom: 20rpx;
}
.dians {
width: 150rpx;
height: 150rpx;
display: inline-block;
vertical-align: middle;
}
checkbox-group>label {
display: block;
color:
font-size: 30rpx;
position: relative;
}
.titles {
vertical-align: middle;
}
.storeLists {
margin: 25rpx;
border-radius: 20rpx;
margin-bottom: 0;
}
.menContain text.actives {
color:
border: 1px solid
}
.orderBuy {
padding-bottom: 130rpx;
}
.database {
color:
font-size: 30rpx;
padding: 20rpx 0;
text-align: center;
}
.paddl {
padding: 15rpx;
font-size: 34rpx;
background-color:
}
.checkboxTwo label {
display: flex;
padding: 15rpx;
margin-bottom: 2rpx;
background-color:
}
.oversList {
width: 70%;
padding-left: 20rpx;
box-sizing: border-box;
}
.color_size {
padding: 10rpx 0;
}
.color_size text {
padding-left: 20rpx;
}
.price_num {
display: flex;
justify-content: space-between;
}
.price_num .price {
color:
}
/* 加入购物车 */
.cart-count-box {
width: 200rpx;
border: 1px solid
box-sizing: border-box;
}
.cart-count-box text {
display: inline-block;
text-align: center;
line-height: 57rpx;
vertical-align: middle;
}
.cart-count-down, .cart-count-add {
font-size: 44rpx;
width: 56rpx;
}
.cart-count-num {
width: 80rpx;
display: inline-block;
text-align: center;
vertical-align: middle;
font-size: 32rpx;
border-left: 1px solid
border-right: 1px solid
}
.goodsList {
position: relative;
border-bottom: 1px solid
}
.cart-count-box {
position: absolute;
bottom: 15rpx;
right: 15rpx;
}
.setProvice {
bottom: 0;
width: 100%;
left: 0;
position: fixed;
background:
text-align: center;
z-index: 99;
display: flex;
justify-content: space-between;
height: 110rpx;
padding: 20rpx;
box-sizing: border-box;
font-size: 34rpx;
}
.realTotal text {
color:
}
.checkAll {
padding-top: 15rpx;
}
.checkAll text {
vertical-align: middle;
}
.total {
font-size: 28rpx;
color:
}
.settlement {
background: linear-gradient(to right,
color:
width: 35%;
border-radius: 50rpx;
line-height: 73rpx;
height: 73rpx;
}
Page({
data: {
buyerList: [{
"category_id": 6,
"store_id": 3,
"category_title": "咏仕旗舰店",
"goods_item": [{
"id": 30,
"order_id": 14,
"goods_id": 1,
"count": 2,
"store_id": 3,
"supplier_id": 0,
"category_id": 6,
"unit_id": 1,
"is_self": 1,
"unit_rate": 1,
"goods": {
"id": 1,
"title": "2020夏季新款连衣裙时尚收腰中长款显瘦气质轻熟风衬衫裙子",
"category_id": 6,
"logo": "../../image/05.jpg",
"stock_unit": 1,
"sale_unit": 0,
"unit_rate": "",
"supplier_ids": ""
},
}, {
"id": 31,
"order_id": 14,
"goods_id": 2,
"count": 3,
"store_id": 3,
"supplier_id": 0,
"category_id": 6,
"unit_id": 1,
"is_self": 1,
"unit_rate": 1,
"goods": {
"id": 2,
"title": "时尚收腰中长款显瘦气质轻熟风衬衫",
"category_id": 6,
"logo": "../../image/05.jpg",
"stock_unit": 1,
"sale_unit": 0,
"unit_rate": "",
"supplier_ids": ""
},
}, {
"id": 33,
"order_id": 14,
"goods_id": 30,
"count": 3,
"store_id": 3,
"supplier_id": 38,
"category_id": 6,
"unit_id": 1,
"is_self": 0,
"unit_rate": 1,
"goods": {
"id": 30,
"title": "2020夏季新款连衣裙",
"category_id": 6,
"logo": "../../image/05.jpg",
"stock_unit": 1,
"sale_unit": 0,
"unit_rate": "",
"supplier_ids": "38,39"
},
}],
}, {
"category_title": "蔬菜2",
"category_id": 6,
"store_id": 4,
"goods_item": [{
"id": 35,
"order_id": 15,
"goods_id": 1,
"count": 2,
"store_id": 4,
"supplier_id": 0,
"category_id": 6,
"unit_id": 1,
"is_self": 1,
"unit_rate": 1,
"goods": {
"id": 1,
"title": "有机花菜",
"category_id": 6,
"logo": "../../image/05.jpg",
"stock_unit": 1,
"sale_unit": 0,
"unit_rate": "",
"supplier_ids": ""
},
}, {
"id": 38,
"order_id": 15,
"goods_id": 4,
"count": 2,
"store_id": 4,
"supplier_id": 0,
"category_id": 6,
"unit_id": 1,
"is_self": 1,
"unit_rate": 1,
"goods": {
"id": 4,
"title": "小山药",
"category_id": 6,
"logo": "../../image/05.jpg",
"stock_unit": 1,
"sale_unit": 0,
"unit_rate": "",
"supplier_ids": ""
},
}, {
"id": 41,
"order_id": 15,
"goods_id": 30,
"count": 3,
"store_id": 4,
"supplier_id": 38,
"category_id": 6,
"unit_id": 1,
"is_self": 0,
"unit_rate": 1,
"goods": {
"id": 30,
"title": "水果萝卜",
"category_id": 6,
"logo": "../../image/05.jpg",
"stock_unit": 1,
"sale_unit": 0,
"unit_rate": "",
"supplier_ids": "38,39"
},
}, {
"id": 39,
"order_id": 15,
"goods_id": 30,
"count": 2,
"store_id": 4,
"supplier_id": 39,
"category_id": 6,
"unit_id": 1,
"is_self": 0,
"unit_rate": 1,
"goods": {
"id": 30,
"title": "水果萝卜",
"category_id": 6,
"logo": "../../image/05.jpg",
"stock_unit": 1,
"sale_unit": 0,
"unit_rate": "",
"supplier_ids": "38,39"
},
}, {
"id": 40,
"order_id": 15,
"goods_id": 31,
"count": 2,
"store_id": 4,
"supplier_id": 39,
"category_id": 6,
"unit_id": 1,
"is_self": 0,
"unit_rate": 1,
"goods": {
"id": 31,
"title": "象牙白萝卜",
"category_id": 6,
"logo": "../../image/05.jpg",
"stock_unit": 1,
"sale_unit": 0,
"unit_rate": "",
"supplier_ids": "39"
},
}],
}],
checkedAll: false
},
/**
* 一级选择
*/
checkboxChange: function(e) {
var that = this
var buyerList = this.data.buyerList;
var store_id = e.currentTarget.dataset.store_id;
var checkArr = e.currentTarget.dataset.parent_id;
var allCheackList = []
for (var i = 0; i < buyerList.length; i++) {
if (buyerList[i].store_id == store_id) {
buyerList[i].checked = !buyerList[i].checked
if (buyerList[i].checked == true) {
for (var j = 0; j < buyerList[i].goods_item.length; j++) {
buyerList[i].goods_item[j].checked = true
}
} else {
for (var j = 0; j < buyerList[i].goods_item.length; j++) {
buyerList[i].goods_item[j].checked = false
}
}
}
}
that.selectLists()
this.setData({
buyerList: buyerList,
})
},
/**
* 二级选择
*/
childChange: function(e) {
var that = this
var buyerList = that.data.buyerList;
var store_id = e.currentTarget.dataset.store_id;
var checkArr = e.currentTarget.dataset.child_id;
var category_id = e.currentTarget.dataset.category_id;
var id = e.currentTarget.dataset.id; //二级的
for (var i = 0; i < buyerList.length; i++) {
if (buyerList[i].store_id == store_id) {
if (buyerList[i].category_id == category_id) {
buyerList[i].goods_item[id].checked = !buyerList[i].goods_item[id].checked
var cheackListOne = []
for (var k = 0; k < buyerList[i].goods_item.length; k++) {
if (buyerList[i].goods_item[k].checked == true) {
cheackListOne.push(buyerList[i].goods_item[k].checked)
}
if (buyerList[i].goods_item.length == cheackListOne.length) {
buyerList[i].checked = true
} else {
buyerList[i].checked = false
}
}
} else {
}
}
}
that.selectLists()
that.setData({
buyerList: buyerList,
})
},
checkAll: function(e) {
var that = this
console.log(e)
var buyerList = that.data.buyerList;
var checkedAll = that.data.checkedAll
if (checkedAll == true) {
for (var i = 0; i < buyerList.length; i++) {
var goods_item = buyerList[i].goods_item
buyerList[i].checked = false
for (var j = 0; j < goods_item.length; j++) {
goods_item[j].checked = false
}
}
} else {
for (var i = 0; i < buyerList.length; i++) {
var goods_item = buyerList[i].goods_item
buyerList[i].checked = true
for (var j = 0; j < goods_item.length; j++) {
goods_item[j].checked = true
}
}
}
that.selectLists()
that.setData({
buyerList: buyerList,
})
},
// 传给后台的商品id 函数
selectLists: function() {
var buyerList = this.data.buyerList;
var goods_itemlistsTwo = []
var allLength = []
for (var j = 0; j < buyerList.length; j++) {
var goods_item = buyerList[j].goods_item
for (var k = 0; k < goods_item.length; k++) {
allLength.push(goods_item[k])
if (goods_item[k].checked == true) {
// goods_itemlistsTwo.push(goods_item[k].goods_id)
goods_itemlistsTwo.push({
"goods_id": goods_item[k].goods_id,
"store_id": goods_item[k].store_id,
})
}
}
}
if (allLength.length == goods_itemlistsTwo.length) {
this.setData({
checkedAll: true
})
} else {
this.setData({
checkedAll: false
})
}
var cheaclLists = JSON.stringify(goods_itemlistsTwo)
this.setData({
store_goods: cheaclLists, //传给后台的商品id
})
},
/**
*
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
// console.log(this.data.buyerList)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})