<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'>
	<navigator class="setclient-list-item" url="#" wx:for="{{list}}" wx:key="itemno" data-id="{{item[idname]}}" bindtap="changeResult">
		<view class="mian">
			<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">
					<text>{{item.type}}：{{item.sonum||' --'}}</text>
				</view>
				<view class="subfield line-1">
					<text>数量：{{item.qty||' --'}}</text>
					<text>单价：{{item.price||' --'}}</text>
				</view>
				<view class="price line-1">
					可开票金额：<text class="num">￥{{item.amount - item.invoiceamount}}元</text>
				</view>
			</view>
		</view>
		<view class="bot">
			<text>型号:{{item.model||' --'}}</text>
			<text>规格:{{item.spec||' --'}}</text>
		</view>
	</navigator>
	<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>