<!--pages/business/loan-applications/loan-applications.wxml-->
<view class="loan-applications-container">
  <!-- 搜索栏 -->
  <view class="search-bar">
    <view class="search-input">
      <text class="search-icon">🔍</text>
      <input 
        placeholder="搜索申请人姓名或申请单号" 
        value="{{searchKeyword}}"
        bindinput="onSearchInput"
      />
    </view>
  </view>

  <!-- 筛选栏 -->
  <view class="filter-bar">
    <picker 
      bindchange="onFilterChange" 
      value="{{filterStatus}}" 
      range="{{['全部', '待审核', '审核中', '已通过', '已拒绝']}}"
      range-key=""
    >
      <view class="filter-item">
        <text>状态筛选</text>
        <text class="filter-value">{{filterStatus === 'all' ? '全部' : filterStatus}}</text>
        <text class="arrow">></text>
      </view>
    </picker>
  </view>

  <!-- 申请列表 -->
  <view class="application-list">
    <view 
      class="application-item" 
      wx:for="{{applications}}" 
      wx:key="id"
      data-application-id="{{item.id}}"
      bindtap="viewApplicationDetail"
    >
      <view class="application-header">
        <text class="application-number">{{item.applicationNumber}}</text>
        <view class="application-status {{item.status}}">
          <text>{{item.statusText}}</text>
        </view>
      </view>
      
      <view class="application-info">
        <view class="info-row">
          <text class="info-label">申请人：</text>
          <text class="info-value">{{item.applicantName}}</text>
        </view>
        
        <view class="info-row">
          <text class="info-label">申请人ID：</text>
          <text class="info-value">{{item.applicantId}}</text>
        </view>
        
        <view class="info-row">
          <text class="info-label">申请类型：</text>
          <text class="info-value">{{item.typeText}}</text>
        </view>
        
        <view class="info-row">
          <text class="info-label">申请金额：</text>
          <text class="info-value">{{item.amount}}元</text>
        </view>
        
        <view class="info-row">
          <text class="info-label">申请期限：</text>
          <text class="info-value">{{item.term}}个月</text>
        </view>
        
        <view class="info-row">
          <text class="info-label">利率：</text>
          <text class="info-value">{{item.interestRate}}%</text>
        </view>
        
        <view class="info-row">
          <text class="info-label">申请时间：</text>
          <text class="info-value">{{item.applicationTime}}</text>
        </view>
        
        <view class="info-row">
          <text class="info-label">联系电话：</text>
          <text class="info-value">{{item.phone}}</text>
        </view>
        
        <view class="info-row">
          <text class="info-label">申请用途：</text>
          <text class="info-value">{{item.purpose}}</text>
        </view>
        
        <view class="info-row">
          <text class="info-label">资产类型：</text>
          <text class="info-value">{{item.assetType || '暂无'}}</text>
        </view>
        
        <view class="info-row">
          <text class="info-label">申请数量：</text>
          <text class="info-value">{{item.applicationQuantity || '1'}}</text>
        </view>
        
        <view class="info-row">
          <text class="info-label">身份证号：</text>
          <text class="info-value">{{item.borrowerIdNumber || '暂无'}}</text>
        </view>
        
        <view class="info-row" wx:if="{{item.remark}}">
          <text class="info-label">备注：</text>
          <text class="info-value">{{item.remark}}</text>
        </view>
      </view>
    </view>
  </view>

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

  <!-- 空状态 -->
  <view class="empty-state" wx:if="{{!loading && applications.length === 0}}">
    <text class="empty-icon">📋</text>
    <text class="empty-text">暂无申请数据</text>
  </view>
</view>
