<!--packageF/storeManagement/storeGoodsManagement/storeGoodsManagement.wxml-->
<view>
  <view class="stkcky">

    <view class="header-search">
      <van-search value="{{keyWord}}" bindsearch="handSearch" clearable shape="round" style="flex: 1;" placeholder="搜索商品">
      </van-search>
      <view class="btn-search" data-name="releaseStoreGoods" bindtap="gotoPage">发布商品</view>
    </view>

    <van-tabs active="{{active}}" bindchange="changeTabs" class="status-tab">
      <van-tab title="全部" name="-1"></van-tab>
      <van-tab title="在售商品" name="1"></van-tab>
      <van-tab title="下架商品" name="0"></van-tab>
    </van-tabs>


    <view class="control-column">
      <text class="goods-count">商品数：{{goodsCount}}</text>
      <view class="batch-option" bindtap="selectBolfun" wx:if="{{!isBatchOperation}}">
        <i class="iconfont icon-fontclass-piliang"></i>
        <text>批量操作</text>
      </view>
      <view wx:else bindtap="cancelBatchOperation">取消</view>
    </view>
  </view>



<van-checkbox-group value="{{ batchGoods }}" bind:change="checkboxGroupChange">
  <view class="goods-box" wx:for="{{goodsList}}" wx:for-item="goods" wx:key="id">
    <view class="goods">
      <view class="goods-info">
        <view class="left-img">
          <van-checkbox class="checkbox" wx:if="{{isBatchOperation}}" name="{{goods.id}}"></van-checkbox>
          <image src="{{goods.thumb_src}}" />
        </view>
        <view class="right-detail">
          <view class="goods-title text-over-2">{{goods.title}}</view>
          <view class="stock">
            <text>库存：{{goods.stock ? goods.stock : 0}}</text>
            <text style="margin-left: 0.5rem">销量：{{goods.real_sale ? goods.real_sale : 0}}</text>
          </view>
          <view style="display:flex">
            <view class="price">
              <text class="money-icon">￥</text>
              {{goods.price}}
            </view>
            <text wx:if="{{goods.status == 1}}">上架</text>
            <text wx:else style="color: #929292;">下架</text>
          </view>
        </view>
      </view>
      <view class="option-goods">
        <view class="option edit" data-id="{{goods.id}}" data-name="releaseStoreGoods" bindtap="gotoPage">
          <text>编辑</text>
          <i class="iconfont icon-fontclass-qianshu"></i>
        </view>
        <view class="option release">
          <view wx:if="{{goods.status != 1}}" data-goodsId="{{goods.id}}" data-option="{{1}}" bindtap="onShelf">
            <text>上架</text>
            <i class="iconfont icon-fontclass-shangchuan"></i>
          </view>
          <view wx:else data-goodsId="{{goods.id}}" data-option="{{0}}" bindtap="onShelf">
            <text>下架</text>
            <i class="iconfont icon-fontclass-xiazai"></i>
          </view>
        </view>
        <view class="option delete" data-goodsId="{{goods.id}}" bindtap="deleteGoods">
          <text>删除</text>
          <i class="iconfont icon-fontclass-shanchu"></i>
        </view>
      </view>
    </view>
  </view>
</van-checkbox-group>

  <view wx:if="{{isBatchOperation}}">
      <view class="empty-placeholder"></view>
      <view class="all-handler">
        <view class="check-all">
          <van-checkbox value="{{allCheck}}" bindchange="toggleAll">
         
              <!-- <i slot="icon" class="iconfont icon-all_select_active {{allCheck ? 'activeIcon' : ''}}"></i> -->
           
            <text>全选</text>
          </van-checkbox>
        </view>
        <view class="btns">
          <view class="btn" wx:for="{{optionBtns}}" wx:key="index" data-item="{{item}}" bindtap="handlerBatchOpt">{{item.text}}</view>
        </view>
        <view class="complete" bindtap="cancelBatchOperation">完成</view>
      </view>
    </view>


</view>