<!--pages/device/eartag-detail/eartag-detail.wxml-->
<view class="eartag-detail-container">
  <!-- 顶部导航 -->
  <view class="header">
    <view class="back-btn" bindtap="goBack">
      <text class="back-icon">←</text>
    </view>
    <text class="title">耳标详情</text>
    <view class="placeholder"></view>
  </view>

  <!-- 耳标信息 -->
  <view class="eartag-info">
    <view class="info-header">
      <text class="eartag-number">{{eartagData.eartagNumber}}</text>
      <view class="bind-status {{eartagData.isBound ? 'bound' : 'unbound'}}">
        {{eartagData.isBound ? '已绑定' : '未绑定'}}
      </view>
    </view>

    <view class="info-details">
      <view class="detail-item">
        <text class="label">设备电量</text>
        <text class="value">{{eartagData.batteryLevel}}%</text>
      </view>
      
      <view class="detail-item">
        <text class="label">设备温度</text>
        <text class="value">{{eartagData.temperature}}°C</text>
      </view>
      
      <view class="detail-item">
        <text class="label">被采集主机</text>
        <text class="value">{{eartagData.hostNumber}}</text>
      </view>
      
      <view class="detail-item">
        <text class="label">总运动量</text>
        <text class="value">{{eartagData.totalMovement}}</text>
      </view>
      
      <view class="detail-item">
        <text class="label">今日运动量</text>
        <text class="value">{{eartagData.todayMovement}}</text>
      </view>
      
      <view class="detail-item">
        <text class="label">佩戴状态</text>
        <text class="value">{{eartagData.wearStatus}}</text>
      </view>
      
      <view class="detail-item">
        <text class="label">设备状态</text>
        <text class="value">{{eartagData.deviceStatus}}</text>
      </view>
      
      <view class="detail-item">
        <text class="label">位置信息</text>
        <text class="value">{{eartagData.location}}</text>
      </view>
      
      <view class="detail-item">
        <text class="label">GPS状态</text>
        <text class="value">{{eartagData.gpsState}}</text>
      </view>
      
      <view class="detail-item">
        <text class="label">纬度</text>
        <text class="value">{{eartagData.latitude}}</text>
      </view>
      
      <view class="detail-item">
        <text class="label">经度</text>
        <text class="value">{{eartagData.longitude}}</text>
      </view>
      
      <view class="detail-item">
        <text class="label">绑定状态</text>
        <text class="value">{{eartagData.bindingStatus}}</text>
      </view>
      
      <view class="detail-item">
        <text class="label">电压值</text>
        <text class="value">{{eartagData.voltage}}V</text>
      </view>
      
      <view class="detail-item">
        <text class="label">数据更新时间</text>
        <text class="value">{{eartagData.updateTime}}</text>
      </view>
    </view>
  </view>

  <!-- 操作按钮 -->
  <view class="action-buttons">
    <view class="btn primary" bindtap="onBind" wx:if="{{!eartagData.isBound}}">
      <text>绑定牛只</text>
    </view>
    <view class="btn secondary" bindtap="onUnbind" wx:if="{{eartagData.isBound}}">
      <text>解绑牛只</text>
    </view>
    <view class="btn default" bindtap="onEdit">
      <text>编辑信息</text>
    </view>
  </view>

  <!-- 加载状态 -->
  <view wx:if="{{loading}}" class="loading-container">
    <view class="loading-spinner"></view>
    <text class="loading-text">加载中...</text>
  </view>
</view>
