<import src="index.skeleton.wxml" />
<template is="skeleton" wx:if="{{loading}}" />

<van-search class="search" value="{{ params.content.where.condition }}" shape="round" placeholder="请输入搜索关键词" bind:search='startSearch' bind:clear='onClear' />
<view class="total">共{{params.content.total}}个</view>

<Yl_ListBox id='ListBox' bind:getlist='getList'>
    <view class="setclient-list-item" wx:for="{{list}}" wx:key="itemno">
        <navigator url="#" class="mian" data-id="{{item[idname]}}" bindtap="changeResult">
            <van-checkbox wx:if="{{!radio}}" value="{{ handle.isCheck(item[idname],result) }}" shape="square" icon-size='28rpx' />
            <view class="img" data-file="{{item.attinfos}}" catchtap="viewImage">
                <van-image width="100%" height="100%" wx:if="{{item.cover}}" src="{{item.cover}}" use-loading-slot use-error-slot lazy-load>
                    <van-loading slot="loading" type="spinner" size="20" vertical />
                    <text slot="error" style="font-size: 24rpx;">暂无图片</text>
                </van-image>
                <text wx:else class="err">暂无图片</text>
            </view>
            <view class="dec">
                <view class="title line-1">
                    {{item.itemname}}
                </view>
                <view class="subfield line-1">
                    产品编码：{{item.itemno}}
                </view>
                <view class="subfield line-1">
                    <text>品牌:{{item.brandName}}</text>
                    领域:{{item.tradefields}}
                </view>
                <view class="subfield line-1">
                    型号:{{item.model||' --'}}
                </view>
                <view class="subfield line-1">
                    规格:{{item.spec||' --'}}
                </view>
                <view class="price line-1">
                    价格：<text class="num">{{handleHide.query(item.newPrice,hidePrice)}}元</text>
                </view>
            </view>
        </navigator>
        <view class="bottom">
            <view class="check" bindtap="changeResults" data-item="{{item}}">
                <view class="label-class">
                    起订量:{{item.orderminqty}}，增减量:{{item.orderaddqty}}，包装量:{{item.packageqty}}
                </view>
            </view>
            <van-stepper value="{{ item.qty }}" min="{{item.orderminqty}}" step="{{item.orderaddqty}}" input-class='input-class' data-index="{{index}}" data-iscatch="catch" catch:minus='stepperChange' catch:plus='stepperChange' catch:blur='inputBlur' />
        </view>
    </view>
    <view wx:if="{{!radio}}" style="height: 130rpx;" />
    <Yl_Empty wx:if="{{list.length==0}}" />
</Yl_ListBox>

<block wx:if="{{!radio}}">
    <view class="footer">
        <view class="count">
            已选：{{result.length}}
        </view>
        <van-button custom-class='but' disabled='{{result.length==0}}' bind:click="submit">确定</van-button>
    </view>
    <wxs module="handle">
        module.exports = {
            isCheck: function (id, list) {
                return list.some(function (v) {
                    return v == id
                });
            },
        }
    </wxs>
</block>

<wxs src="/utils/hidePrice.wxs" module="handleHide" />