<view class="container">
  <view class="cart-panel" wx:if="{{footCart.goodsCount>0}}">
    <view class="cart-icon">
      <navigator class="nav-cell" open-type='switchTab' url="/pages/cart/cart">
        <image src="../../static/images/cart-fixed.png">
        </image>
      </navigator>
      <view class="cart-num" bindtap="switchNav" data-name="cart">{{footCart.goodsCount}}</view>
    </view>
    <view class="cart-body" bindtap="switchNav" data-name="cart">￥{{footCart.checkedGoodsAmount}}</view>
    <navigator class="nav-cell" open-type='switchTab' url="/pages/cart/cart">
      <view class="cart-pay">去结算 > </view>
    </navigator>
  </view>
  <view wx:if="{{showNavList}}" class="modal-wrap"></view>
  <view class="fast-nav">
    <contact-button wx:if="{{!showNavList}}" class="contact" size="25" type="primary" session-from="weapp">
      <text>找客服</text>
    </contact-button>
    <view wx:if="{{!showNavList}}" class="nav" bindtap="toggleNav">
      <text>快捷</text>
      <text>导航</text>
    </view>
    <view class="nav-list" wx:if="{{showNavList}}">
      <view class="nav-item">
        <text class="nav-text">首页</text>
        <view class="nav-cell" bindtap="switchNav" data-name="index">
          <image src="../../static/images/nav-1.png"></image>
        </view>
      </view>
      <view class="nav-item">
        <text class="nav-text">足迹</text>
        <navigator class="nav-cell" url="../ucenter/footprint/footprint">
          <image src="../../static/images/nav-2.png"></image>
        </navigator>
      </view>
      <view class="nav-item">
        <text class="nav-text">搜索</text>
        <navigator class="nav-cell" url="../search/search">
          <image src="../../static/images/nav-3.png"></image>
        </navigator>
      </view>
      <view class="nav-item">
        <text class="nav-text">购物车</text>
        <view class="nav-cell" bindtap="switchNav" data-name="cart">
          <image src="../../static/images/nav-4.png"></image>
        </view>
      </view>
    </view>
    <view wx:if="{{showNavList}}" class="close" bindtap="toggleNav">X</view>
  </view>
  <view class="brand-info" bindtap="hideSwitchAttrPop">
    <view class="name">
      <image class="img" src="{{bannerInfo.img_url}}"></image>
      <view class="info-box">
        <view class="info">
          <text class="txt">{{bannerInfo.name}}</text>
          <text class="line"></text>
        </view>
      </view>
    </view>
  </view>
  <view class="sort">
    <view class="sort-box" bindtap="hideSwitchAttrPop">
      <view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort">
        <text class="txt">综合</text>
      </view>
      <view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc'  ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort">
        <text class="txt">价格</text>
      </view>
      <view class="item {{currentSortType == 'category' ? 'active' : ''}}" bindtap="openSortFilter" id="categoryFilter">
        <text class="txt">分类</text>
      </view>
    </view>
    <view class="sort-box-category" wx-if="{{categoryFilter}}" bindtap="hideSwitchAttrPop">
      <view class="item {{item.checked ? 'active' : ''}}" wx:for="{{filterCategory}}" wx:key="cate-{{item.id}}" data-category-index="{{index}}" bindtap="selectCategory">{{item.name}}</view>
    </view>
  </view>
  <view class="cate-item" bindtap="hideSwitchAttrPop">
    <view class="b">
      <block wx:for="{{goodsList}}" wx:for-index="iindex" wx:for-item="iitem" wx:key="unique">
        <view class="item {{iindex % 2 == 0 ? 'item-b' : '' }}">

          <navigator url="../goods/goods?id={{iitem.id}}&&storeId={{item.storeId}}">
            <image class="img" src="{{iitem.list_pic_url}}" ></image>
            <text class="name">{{iitem.name}}</text>
          </navigator>

          <view class="price">￥{{iitem.retail_price}}
            <image class="cart" src="/static/images/cart.png" data-goods-id="{{iitem.id}}" data-retail-price="{{iitem.retail_price}}" bindtap='addCart' background-size="cover"></image>
          </view>
        </view>
      </block>
    </view>
  </view>

  <view wx:if="{{openAttr}}" class="attr-pop">
    <view class="attr-close" bindtap="switchAttrPop">X</view>
    <view class="img-info">
      <image class="img" src="{{goodsVo.list_pic_url}}"></image>
      <view class="info">
        <view class="c">
          <view class="p">价格：￥{{retailPrice}}</view>
          <view class="a" wx:if="{{productList.length>0}}">已选择：{{checkedSpecText}}</view>
          <view class="a">库存{{goodsVo.goodsBizType==00 && goodsVo.isStockShare==1?goodsVo.goods_number:goodsVo.stockNum}}件</view>
        </view>
      </view>
    </view>
    <view class="spec-con">
      <view class="spec-item" wx:for="{{specificationList}}" wx:key="{{item.specification_id}}" wx:for-index="itemIndex">
        <view class="name">{{item.name}}</view>
        <view class="values">
          <view class="value {{vitem.checked ? 'selected' : ''}}" bindtap="clickSkuValue" wx:for="{{item.valueList}}" wx:for-item="vitem" wx:key="{{vitem.id}}" data-index="{{itemIndex}}" data-value-id="{{vitem.id}}" data-name-id="{{vitem.specification_id}}">{{vitem.value}}</view>
        </view>
      </view>
      <view class="number-item">
        <view class="name">数量</view>
        <view class="selnum">
          <view class="cut" bindtap="cutNumber">-</view>
          <input value="{{number}}" class="number" disabled="true" type="number" />
          <view class="{{number+cartNumber>= stockNum? 'addEnabel':'add'}}" bindtap="{{number+cartNumber>= stockNum ? '':'addNumber'}}">+</view>
        </view>
      </view>
    </view>
    <view class="bottom-btn">
      <view class="r" bindtap="addToCart">加入购物车</view>
    </view>
  </view>
</view>