<!--pages/mine/shop/choose.wxml-->
<cu-custom isBack="{{true}}">
    <view slot="content">商品管理</view>
</cu-custom>
<view class="cu-bar bg-white search fixed" style="top:{{CustomBar}}px" bindtap="doSearchGoods">
    <view class="search-form round" style="margin-top:5rpx;margin-bottom:5rpx">
        <text class="cuIcon-search"></text>
        <view type="text">请输入搜索关键字,例如:手机</view>
    </view>
</view>
<view class="category" style="margin-top:21rpx;">
    <!-- 左边分类 -->
    <scroll-view class="nav_left" scroll-y="true">
        <block wx:for="{{productList}}" wx:key="index">
            <view class="nav_left_bg {{curIndex==index ? 'nav_left_item-active nav_left_border' : ''}}"
                data-curindex="{{index}}">
                <view class="nav_left_items {{curIndex==index ? 'nav_left_item-active' : ''}} text-cut flex-twice"
                    data-curindex="{{index}}" bindtap="switchRightTap">{{item.categoryName}}
                </view>
                <text class="cuIcon-roundclosefill text-red" data-item="{{item}}" bindtap="showConfirmDialog"></text>
            </view>
        </block>
    </scroll-view>
    <!-- 右边商品 -->
    <scroll-view class="nav_right" scroll-y="true" bindscrolltolower="doLoadMore" style="height:{{contentHeight}}px">
        <view class="cu-card" bindtap="doAdd" data-key="addGoods" data-item="{{productList[curIndex]}}">
            <view class="cu-item bg-img">
                <view class="card-title-sm">
                    <text class="cuIcon-roundaddfill text-gray"></text>
                </view>
            </view>
        </view>
        <view class="cu-list menu-avatar" wx:for="{{productList[curIndex].goodsList}}" wx:key="index">
            <view class="cu-item" data-item="{{item}}" bindtap="manageGoods">
                <view class="cu-avatar radius xl" style="background-image:url({{baseImageUrl+item.goodsIcon}});">
                    <view class="{{item.goodsStatus == 1 ? 'cu-tag badge' : 'cu-tag badgegray'}}">
                        {{item.goodsStatus=='1' ? '在售' : '下架' }}</view>
                </view>
                <view class="content" style="width:85%;">
                    <view class="text-depblack" style="width:80%;">
                        <text class="text-cut">{{item.goodsName}}</text>
                        <text class="cuIcon-hotfill lg text-red" wx:if="{{item.isPopular == '1' }}"></text>
                    </view>
                    <view class="text-gray text-sm flex" style="width:80%;">
                        <text class="text-cut">{{item.goodsSummary}}</text>
                    </view>
                    <view class="bottom-action margin-top-ls">
                        <view class="text-lg text-red">¥:{{item.goodsUnitPrice}}</view>
                        <view class="text-grey text-sm">
                            库存:{{item.goodsTotal > 1000 ? '999+' : item.goodsTotal}}</view>
                    </view>
                </view>
            </view>
        </view>
        <van-loading wx:if="{{isLoadMore}}" size="24px">加载中...</van-loading>
    </scroll-view>
</view>

<view class="foot bg-white padding-sm">
    <button class="cu-btn bg-blue" style="width:100%" bindtap="doAdd" data-key="chooseCatalog">类目添加</button>
</view>