搜的都是单个店铺的,经过一番折腾,改了改,还凑合吧,直接上代码,不足之处多多指点
- wxml
<!--pages/shoppingCart/shoppingCart.wxml-->
<view class='container' hidden="{
{iscart}}">
<view class='header'>
<text class='title'>购物车</text>
<block wx:if="{
{isDelete==0}}">
<text class="icon-right green" bindtap="getEdit">编辑</text>
</block>
<block wx:else>
<text class="icon-right green" bindtap="getEdit">完成</text>
</block>
</view>
<view class="cart-list">
<view class="cart-box" wx:for='{
{cartList}}' wx:for-index="idx" wx:key="*">
<view class="cart-shop" >
<icon type="circle" size="23" wx:if="{
{!item.shopCheck}}" bindtap='storeselected' data-index="{
{idx}}"></icon>
<icon type="success" size="23" wx:if="{
{item.shopCheck}}" bindtap='storeselected' data-index="{
{idx}}"></icon>
<view class="shop-name">{
{item.shop_name}}</view>
</view>
<view class='section section-good'>
<view class='good' wx:for='{
{item.goodsList}}' wx:key="{
{index}}">
<icon type="circle" size="23" wx:if="{
{!item.check}}" bindtap='goodsselected' data-index="{
{index}}" data-select-index="{
{idx}}" data-goodsid="{
{item.goods_id}}"></icon>
<icon type="success" size="23" wx:if="{
{item.check}}" bindtap='goodsselected' data-index="{
{index}}" data-select-index="{
{idx}}" data-goodsid="{
{item.goods_id}}"></icon>
<image class='cover' src='{
{item.cover}}'></image>
<view class='content'>
<view class='text name'>{
{item.name}}</view>
<view class='stepper'>
<view class='text price'>¥{
{item.price}}</view>
<view class='subtract {
{item.count == 1 ? "disabled": ""}}' data-index="{
{index}}" bindtap='reduce' data-select-index="{
{idx}}">-</view>
<input class='count' type='number' value='{
{item.count.quantity}}' disabled='disabled'></input>
<view class='add' bindtap='add' data-index="{
{index}}" data-select-index="{
{idx}}">+</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class='section-bottom'>