<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="item" url="#" wx:for="{{list}}" wx:key="itemno" data-id="{{item[idname]}}" bindtap="changeResult">
        <van-checkbox wx:if="{{!radio}}" value="{{ handle.isCheck(item[idname],result) }}" shape="square" icon-size='28rpx' />
        <view class="main" style="padding-left: {{!radio?'10rpx':''}};">
            <view class="title line-1">{{item.enterprisename || ' --'}}</view>
            <view class="subfield line-1">
                经销商编号：{{item.agentnum||' --'}}
            </view>
            <view class="subfield line-1">
                联系人：{{item.contact}} {{item.phonenumber}}
            </view>
            <view class="subfield line-1">
                地址：{{item.province?item.province + item.city + item.county +item.address:item.address||' --'}}
            </view>
        </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>