<!--pages/bindLock/bindLock.wxml-->
<view class="btnnormal"  wx:if="{{selectindex==1 || selectindex==4}}">
	<van-button type="primary" size="large" class="btn" color="#02BFFF" bindtap="scanning">扫一扫</van-button>
	<van-field
    value="{{ deviceNum }}"
    label="锁号"
		border="{{true}}"
    placeholder="请输入锁号" clearable="{{true}}"  bind:change="onChange1" title-width="2em" center="{{true}}"
		use-button-slot>
    <van-button slot="button" size="small" type="primary" bindtap="linkBule">
      蓝牙连接
    </van-button>
  </van-field>
</view>
<view class="btnnormal" wx:if="{{selectindex==2 || selectindex==3}}">
	<van-button type="primary" size="large" class="btn" color="#02BFFF" bindtap="scanning">扫一扫</van-button>
	<van-field
    value="{{ deviceNum }}"
    label="锁号"
		border="{{true}}"
    placeholder="请输入锁号" bind:change="onChange1" clearable="{{true}}" title-width="2em" center="{{true}}"
		use-button-slot>
    <van-button slot="button" size="small" type="primary" bindtap="linkBule">
      蓝牙连接
    </van-button>
  </van-field>
  <van-cell title="已选房源" icon="location-o" value="{{selectRoomName}}" />
  <van-radio-group value="{{ radio }}" bind:change="onChange2" custom-class="radiselect" direction="horizontal" class="radio1">
    <van-radio name="1">aep</van-radio>
    <van-radio name="0">直连</van-radio>
  </van-radio-group>
  <!-- <view wx:for="alldevice" wx:key="index">
    {{item}}
  </view> -->
</view>
<van-popup
  show="{{ show }}"
  position="left"
  custom-style="width: 100%;"
  bind:close="onClose"
>
  <view class="height-percentage-100 popUp">
    <view class=" d-flex popUpSearchBg">
      <view class="d-inline-block width-percentage-25 pa-2 box-sizing-border">
        <van-icon name="arrow-left" bindtap="onClose" /> <view class="jt d-inline-block " bindtap="bindroom">{{selectRoomName}} </view> <view class="d-inline-block font-size-12" bindtap="bindroom">▼</view>
      </view>
      <van-search
        value="{{ searchValue }}"
        placeholder="请输入搜索关键词" background="#02BFFF" shape="round" bind:change="onChangeSearch"
        use-action-slot class="d-inline-block width-percentage-75"
      >
        <view slot="action" bind:tap="onClick" class="color-fff">搜索</view>
      </van-search>  
    </view>
    <scroll-view 	scroll-y="{{true}}" bindscrolltolower="bottomingOut" class="scroll-height-100vh">    
      <view class="search-margin">
        <view class="roomlist">
          <view class="cu-item mb-4" bindtap="godetail" data-item="{{item}}" wx:for="{{list}}" wx:for-index="{{index}}" wx:for-item="item">
            <view class="d-flex justify-content-between pa-2 b-line align-center">
              <view class="d-flex align-center  w-100 position-relative">
                <view class="iconfont icon-fangjianliebiao text-orange d-line {{item.deviceNum?'':'colorRed'}}"></view>
                <view class="d-line ml-1 font-size-16 w-80 text-ellipsis">{{item.path}}</view>        
                <view class="position-absolute confselect"><van-button round type="info" size="mini" data-select="{{item}}" catchtap="selectRoomId" disabled="{{item.deviceNum?true:false}}">确认选择</van-button></view>   
              </view>          
            </view>
            <view class="content pa-2 d-flex justify-content-between">
              <view class="font-size-14 text-bold w-50 text-ellipsis">设备号：{{item.deviceNum?item.deviceNum:'无'}}</view>
              <view class="font-size-14 text-bold w-50  text-ellipsis">电量：<text class="{{item.battery<20?'color-red':item.battery<80?'color-orange':item.battery>80?'color-green':''}}">{{item.battery?item.battery:'无'}}</text></view>
              <view class="font-size-14 text-bold w-50  text-ellipsis">信号：<text class="{{item.rssi<15?'color-red':item.rssi<20?'color-orange':item.rssi>20?'color-green':''}}">{{item.rssi?item.rssi:'无'}}</text></view>
              <view class="font-size-14 colorhui w-50  text-ellipsis">联网：<text class="{{item.isOnline==0?'color-red':item.isOnline==1?'color-green':item.isOnline==2?'color-orange':''}}">{{item.isOnline===0?'离线':item.isOnline==1?'在线':item.isOnline==2?'异常':'无'}}</text></view>
              <!-- <view class="font-size-14 colorhui w-50  text-ellipsis" wx:if="item.count">入住人数：{{item.count}}</view> -->
            </view>
          </view>
        </view>    
      </view>
    </scroll-view>
  </view>
</van-popup>
<view class="devicelist" wx:if="{{selectindex == 4}}">
    <van-button custom-class="titleText" type="primary" size="normal" class="btn" color="#02BFFF" bindtap="searchDevicesMethods">搜索设备</van-button>
		<van-cell title="{{item.name}}" value="{{item.roomName}} 点击连接" data-select="{{item.name}}" bindtap="ConnectTo" is-link  wx:for="{{deviceList}}" wx:key="indexone" wx:for-index="{{index}}" wx:for-item="item" />
	</view>  
<view class="devicelist" wx:else>
    <van-button custom-class="titleText" type="primary" size="normal" class="btn" color="#02BFFF" bindtap="searchDevicesMethods">搜索设备</van-button>
    <van-button size="normal" type="primary" bindtap="selectRoom">
      选择房间
    </van-button>
		<van-cell title="{{item.name}}" value="{{item.roomName}} 点击连接" data-select="{{item}}" bindtap="searchBlueButton" is-link  wx:for="{{deviceList}}" wx:key="indexone" wx:for-index="{{index}}" wx:for-item="item" />
  
	</view>

  <van-popup show="{{ showSelect }}" bind:close="onClose1"  position="bottom" custom-style="height: 60%">
    <tree
    dataTree="{{dataList}}"
    selectKey="{{selectKey}}"
    bind:select="handleSelect"
    isSelectLastNode="true"
    isOpenAll="{{false}}"
  ></tree>
  </van-popup>