<!--pages/index/info.wxml-->
<view>
  <!-- top -->
  <view class="top" style="position: relative; z-index: 2;">
    <t-swiper style="width: 100vw;"      height="640rpx" wx:if="{{info.pic}}"  list="{{info.picList}}" >

    </t-swiper>

    <image wx:else="" src="https://res.catter.cn/pub/2025/09/30/20250930150006852.png" style="width: 100vw; height: 680rpx;" mode="aspectFill"></image>
  </view>


  <!-- back -->
  <view style="z-index: 999;position: fixed; top: 110rpx; left: 32rpx;  background-color: #34343482 ; width: 60rpx  ; height: 60rpx; border-radius: 30rpx; " bind:tap="goBack">
    <view class="flex flex-center" style="width: 100%;height: 100%;">
      <t-icon name="chevron-left" size="48rpx" style="color: white;"></t-icon>
    </view>
  </view>

  <!-- info -->
  <view style="background-color:white;margin-top: -160rpx;z-index: 99;position: absolute; width: 100vw; border-top-right-radius: 50rpx; border-top-left-radius: 50rpx;">
    <view class="flex flex-center flex-justify-between" style="padding: 52rpx 32rpx 10rpx 32rpx">
      <view class="flex flex-center flex-justify-start">
        <view class="font-16 bold ">{{info.name}}</view>
        <view class="font-12 grey ml-16">{{info.genus}}</view>
      </view>
      <view style="width: 100rpx;" class="flex flex-center flex-justify-end" bind:tap="goEdit">
        <t-icon name="setting"></t-icon>
      </view>
    </view>
    <view style="padding: 0rpx 0 10rpx 32rpx" class="flex flex-center flex-justify-start font-12">
      <view class="grey">常用名：</view>
      <view>{{info.aliases}}</view>
    </view>

    <view style="padding: 0rpx 0 10rpx 32rpx" class="flex flex-center flex-justify-start font-12">
      <view class="grey">植物学名：</view>
      <view>{{info.latinName}}</view>
    </view>
  </view>

  <view class="padding" style="padding-bottom: 240rpx;">
    <view>
      <view class="row padding mt-32">
        <view>今日任务</view>
        <view wx:if="{{info.todayFarms.length === 0}}">
          <view class="flex flex-center flex-col padding">
            <view >
              <t-icon class="grey" name="notification-error"></t-icon>
            </view>
            <view class="font-14 grey">暂无任务</view>
          </view>
        </view>
        <view class="flex flex-center flex-justify-between mt-16" wx:for="{{info.todayFarms}}">
          <view class="flex flex-justify-start flex-aligin-center mt-16">
            <t-avatar icon="color-invert" />
            <view class="ml-16">
              <view class="font-14 bold">{{item.name}}</view>
            </view>
          </view>
          <view>
            <t-button wx:if="{{item.status == 1}}" theme="danger" variant="outline" shape="round" size="small" data-item="{{item}}" bind:tap="addFarmLog">未完成</t-button>
            <t-button wx:if="{{item.status == 2}}" theme="primary" shape="round" size="small" data-item="{{item}}" bind:tap="addFarmLog">完成</t-button>
            <t-button wx:if="{{item.status == 3}}" disabled shape="round" size="small" >已跳过</t-button>
            <t-button wx:if="{{item.status == 4}}" theme="danger" variant="outline"  shape="round" size="small" data-item="{{item}}" bind:tap="addFarmLog">逾期</t-button>
            
          </view>
        </view>
      </view>

      <view class="row padding mt-32">
        <view>当前状态</view>
        <view class="flex flex-justify-start flex-aligin-center mt-16">
          <t-avatar icon="color-invert" />
          <view class="ml-16">
            <view class="font-14 bold">当前：健康</view>
            <view class="font-12 grey">健康状态</view>
          </view>
        </view>
        <view class="flex flex-center mt-32">
          <t-button theme="primary" icon="chat-bubble-error" shape="round" style="width: 100%;">AI 病害诊断</t-button>
        </view>
      </view>

      <view class="row padding mt-32">
        <view>养护提示</view>
        <view class="flex flex-center flex-justify-between mt-16">
          <view class="flex flex-justify-start flex-aligin-center mt-16">
            <view class="font-14 bold ml-16">{{info.growthHabit}}</view>
          </view>
        </view>
        <view class="mt-16">
          <t-tag class="margin-16" wx:for="{{info.farms.suitableFertilizer}}" theme="danger" style="margin-right: 10rpx;" variant="light">{{item}}</t-tag>
        </view>
      </view>

      <view class="row padding mt-32">
        <view>花期</view>
        <view class="flex flex-center flex-justify-between mt-16">
          <view class="flex flex-justify-start flex-aligin-center mt-16">
            <view class="font-14 bold ml-16">{{info.floweringPeriod}}</view>
          </view>
        </view>
      </view>

      <view class="row padding mt-32">
        <view>其他</view>
        <view class="flex flex-center flex-justify-between mt-16">
          <view class="flex flex-justify-start flex-aligin-center mt-16">
            <t-tag theme="primary" class="font-14 bold ml-16">{{info.lifeCycle}}</t-tag>
            <t-tag theme="primary" class="font-14 bold ml-16">{{info.lightIntensity}}</t-tag>
            <t-tag theme="primary" class="font-14 bold ml-16">{{info.lightType}}</t-tag>
            <t-tag theme="primary" class="font-14 bold ml-16">{{info.foliageType}}</t-tag>
          </view>
        </view>
      </view>
    </view>
  </view>
</view>