<import src="../components/template/loadAnimation/loadAnimation.wxml" />
<view>
  <template is="shopcartLoad" wx:if="{{loadAnimation}}" />
  <bonusTips wx:if="{{tipsFlag}}" tipsDatas="{{tipsDatas}}" bind:closeTips="closeTips"></bonusTips>
  <view wx:if="{{summary.length <= 0}}">
    <view class='flex_center'>
      <image class="empty_cart_icon" src='../../image/empty_cart.png'></image>
    </view>
    <view class='flex_center mt20'>
      <text style='font-size:26rpx;color:#a1a1a1;'>购物车空空如也~</text>
    </view>
    <view class='flex_center'>
      <button size='mini' bindtap='skip_index' style='margin:20rpx 0;background: #2b2b2b;' type='warn'>去逛逛</button>
    </view>
  </view>
  <view class='cart_list'>
    <block wx:for="{{cart_list}}" wx:for-index="cart_index" wx:key="cart_index">
      <!-- 套餐情况下循环 -->
      <block wx:if="{{item['bl_id'] > 0}}">
        <view class="mb20">
          <view class="bundl_title"><text class="bundle_tip">搭配套装</text> {{item['bl_name']}}</view>
          <view class='cart_item'>
            <icon class='cancal_btn' type="cancel" size="22" color="#333" bindtap='cancal_cart' data-goodsid="{{item['goods_id']}}"
              data-cartid="{{item['cart_id']}}"></icon>
            <view class='check_btn' data-goodsid="{{item['goods_id']}}" bindtap='goods_checked' data-cartid="{{item['cart_id']}}">
              <block wx:if="{{item['checked']}}">
                <icon type="success" size="21" color="#333"></icon>
              </block>
              <block wx:else>
                <view class="icon_empty"></view>
              </block>
            </view>

            <view>
              <view class="align_center mb20" wx:for="{{item['goods']}}" wx:for-index="bl_index" wx:for-item="bl_item"
                wx:key="bl_index">
                <view class='goods_image' catchtap="toDetails" data-goodsid="{{bl_item['goods_id']}}">
                  <image mode='scaleToFill' src="{{bl_item['goods_summary']['goods_image_url']}}"></image>
                </view>
                <view class='goods_content' catchtap="toDetails" data-goodsid="{{bl_item['goods_id']}}">
                  <view class='goods_name one_line_hidden'>{{bl_item['goods_summary']['goods_mobile_name']}}</view>
                  <view class='goods_spec one_line_hidden'>{{bl_item['goods_summary']['goods_spec']}}</view>
                  <view class='goods_price'>
                    <text class="bonus_price"><text class="f24">￥</text>{{bl_item['bl_goods_price']}}</text>
                    <text class="original_price line-through ml10">天猫价{{bl_item['goods_summary']['goods_price']}}</text>
                  </view>
                </view>
              </view>
            </view>
            <view class='num_handle align_center'>
              <text class='handle_btn' bindtap='goods_num_handle' data-goodsid="{{item['goods_id']}}" data-cartid="{{item['cart_id']}}"
                data-function='minus' data-num="{{item['goods_num']}}">-</text>
              <block>
                <text class='num'>{{item['goods_num']}}</text>
              </block>
              <text class='handle_btn' bindtap='goods_num_handle' data-goodsid="{{item['goods_id']}}" data-cartid="{{item['cart_id']}}"
                data-function='add' data-num="{{item['goods_num']}}">+</text>
            </view>
          </view>
          <view class="bundle_price"><text>套装价:</text><text class="ft_bold col333">¥{{item['bl_price']}}</text> <text
              class="line-through col666 ml10 f20">天猫价{{item['totalPrice']}}</text></view>
        </view>
      </block>

      <!-- 非套餐情况下循环 -->
      <block wx:if="{{item['bl_id'] == 0}}">
        <view class='cart_item mb20'>
          <icon class='cancal_btn' type="cancel" size="22" color="#333" bindtap='cancal_cart' data-goodsid="{{item['goods_id']}}"
            data-cartid="{{item['cart_id']}}"></icon>
          <view class='check_btn' data-goodsid="{{item['goods_id']}}" bindtap='goods_checked' data-cartid="{{item['cart_id']}}">
            <block wx:if="{{item['checked']}}">
              <icon type="success" size="21" color="#333"></icon>
            </block>
            <block wx:else>
              <view class="icon_empty"></view>
            </block>
          </view>
          <view class='goods_image' catchtap="toDetails" data-goodsid="{{item['goods_id']}}">
            <image mode='scaleToFill' src="{{item['goods_summary']['goods_image_url']}}"></image>
          </view>
          <view class='goods_content' catchtap="toDetails" data-goodsid="{{item['goods_id']}}">
            <view class='goods_name one_line_hidden'>{{item['goods_summary']['goods_mobile_name']}}</view>
            <view class='goods_spec one_line_hidden'>{{item['goods_summary']['goods_spec']}}</view>
            <view class='goods_price'>
              <text class="bonus_price" wx:if="{{item['goods_summary']['act_type'] == 0}}"><text class="f24">￥</text>{{item['goods_summary']['bonus_price']}}</text>
              <text class="bonus_price" wx:if="{{item['goods_summary']['act_type'] == 2}}"><text class="f24">￥</text>{{item['goods_summary']['goods_promotion_price']}}</text>
              <text class="original_price line-through ml10">天猫价{{item['goods_summary']['goods_price']}}</text>
            </view>
          </view>
          <view class='num_handle default_num_handle'>
            <text class='handle_btn' bindtap='goods_num_handle' data-goodsid="{{item['goods_id']}}" data-cartid="{{item['cart_id']}}"
              data-function='minus' data-num="{{item['goods_num']}}">-</text>
            <block>
              <text class='num'>{{item['goods_num']}}</text>
            </block>
            <text class='handle_btn' bindtap='goods_num_handle' data-goodsid="{{item['goods_id']}}" data-cartid="{{item['cart_id']}}"
              data-function='add' data-num="{{item['goods_num']}}">+</text>
          </view>
        </view>

      </block>
    </block>

  </view>

  <!-- 猜你喜欢 -->
  <block wx:if="{{canShow}}">
    <view wx:if="{{prop_special.length}}" class="mt30">
      <view class="text_center l_height42 f30 col333">-猜你喜欢-</view>
      <blockList prop_special="{{prop_special}}" summery="{{summery}}" special_datas="{{special_datas}}"> </blockList>
    </view>
  </block>



  <view class='clear_fixed'></view>

  <view class="handle_fixed">
    <view class="all_check_btn" bindtap='all_checked'>
      <block wx:if="{{all_checked}}">
        <icon type="success" size="21" color="#333" style='margin-right:22rpx;position:relative;top:7rpx;'></icon>
      </block>
      <block wx:else>
        <view class="icon_empty" style='position:relative;bottom:5rpx;'></view>
      </block>
      <text>全选</text>
    </view>
    <view style='float:right'>
      <view class='cope'>
        <text class='bonus_price'>应付:￥{{allPrice}}</text>
        <text class="original_price line-through ml10 mr10">￥{{allGoodsPrice}}</text>
      </view>
      <view class='settlement_btn' bindtap='settlement'>
        <text>结算</text>
      </view>
    </view>
  </view>
</view>