<!--pages/cattle/detail/detail.wxml-->
<view class="page-container">
  <!-- 加载状态 -->
  <view class="loading-container" wx:if="{{loading}}">
    <text>加载中...</text>
  </view>

  <!-- 详情内容 -->
  <view class="detail-content" wx:else>
    <!-- 头部：耳号 -->
    <view class="detail-header">
      <text class="ear-number">耳号：{{cattle.earNumber}}</text>
      <text class="sex-badge {{cattle.sex === 1 ? 'male' : 'female'}}">{{cattle.sexText}}</text>
    </view>

    <!-- 基本信息 -->
    <view class="info-section">
      <view class="section-title">基本信息</view>
      <view class="info-list">
        <view class="info-item">
          <text class="label">ID：</text>
          <text class="value">{{cattle.id}}</text>
        </view>
        <view class="info-item">
          <text class="label">耳号：</text>
          <text class="value">{{cattle.earNumber}}</text>
        </view>
        <view class="info-item">
          <text class="label">性别：</text>
          <text class="value">{{cattle.sexText}}</text>
        </view>
        <view class="info-item">
          <text class="label">品种：</text>
          <text class="value">{{cattle.varieties || '-'}}</text>
        </view>
        <view class="info-item">
          <text class="label">品系：</text>
          <text class="value">{{cattle.strain || '-'}}</text>
        </view>
        <view class="info-item">
          <text class="label">分类：</text>
          <text class="value">{{cattle.cate || '-'}}</text>
        </view>
      </view>
    </view>

    <!-- 出生信息 -->
    <view class="info-section">
      <view class="section-title">出生信息</view>
      <view class="info-list">
        <view class="info-item">
          <text class="label">出生日期：</text>
          <text class="value">{{cattle.birthdayText}}</text>
        </view>
        <view class="info-item">
          <text class="label">出生体重：</text>
          <text class="value">{{cattle.birthWeight || '-'}} kg</text>
        </view>
        <view class="info-item">
          <text class="label">月龄：</text>
          <text class="value">{{cattle.ageInMonths || 0}} 个月</text>
        </view>
        <view class="info-item">
          <text class="label">出生天数：</text>
          <text class="value">{{cattle.dayOfBirthday || 0}} 天</text>
        </view>
      </view>
    </view>

    <!-- 入场信息 -->
    <view class="info-section">
      <view class="section-title">入场信息</view>
      <view class="info-list">
        <view class="info-item">
          <text class="label">入场时间：</text>
          <text class="value">{{cattle.intoTimeText}}</text>
        </view>
        <view class="info-item">
          <text class="label">来源：</text>
          <text class="value">{{cattle.sourceText}}</text>
        </view>
        <view class="info-item">
          <text class="label">来源日龄：</text>
          <text class="value">{{cattle.sourceDay || 0}} 天</text>
        </view>
        <view class="info-item">
          <text class="label">来源体重：</text>
          <text class="value">{{cattle.sourceWeight || '-'}} kg</text>
        </view>
      </view>
    </view>

    <!-- 生理信息 -->
    <view class="info-section">
      <view class="section-title">生理信息</view>
      <view class="info-list">
        <view class="info-item">
          <text class="label">生理阶段：</text>
          <text class="value">{{cattle.physiologicalStageText}}</text>
        </view>
        <view class="info-item">
          <text class="label">胎次：</text>
          <text class="value">{{cattle.parity || 0}} 胎</text>
        </view>
      </view>
    </view>

    <!-- 体重信息 -->
    <view class="info-section">
      <view class="section-title">体重信息</view>
      <view class="info-list">
        <view class="info-item">
          <text class="label">当前体重：</text>
          <text class="value">{{cattle.currentWeight || 0}} kg</text>
        </view>
        <view class="info-item">
          <text class="label">体重计算时间：</text>
          <text class="value">{{cattle.weightCalculateTimeText}}</text>
        </view>
      </view>
    </view>

    <!-- 场地信息 -->
    <view class="info-section">
      <view class="section-title">场地信息</view>
      <view class="info-list">
        <view class="info-item">
          <text class="label">养殖场ID：</text>
          <text class="value">{{cattle.farmId || '-'}}</text>
        </view>
        <view class="info-item">
          <text class="label">养殖场名称：</text>
          <text class="value">{{cattle.farmName || '-'}}</text>
        </view>
        <view class="info-item">
          <text class="label">栏舍ID：</text>
          <text class="value">{{cattle.penId || '-'}}</text>
        </view>
        <view class="info-item">
          <text class="label">栏舍名称：</text>
          <text class="value">{{cattle.penName || '-'}}</text>
        </view>
        <view class="info-item">
          <text class="label">批次ID：</text>
          <text class="value">{{cattle.batchId || '-'}}</text>
        </view>
        <view class="info-item">
          <text class="label">批次名称：</text>
          <text class="value">{{cattle.batchName || '-'}}</text>
        </view>
      </view>
    </view>

    <!-- 原始数据（调试用） -->
    <!-- <view class="info-section">
      <view class="section-title">原始数据</view>
      <view class="raw-data">
        <text>{{cattle}}</text>
      </view>
    </view> -->
  </view>
</view>

