<view class="page safe-bottom">
  <!-- 顶部导航栏 -->
  <view class="unified-header">
    <view class="unified-header-left" bindtap="onBack">
      <image src="/images/icon-back.png" class="unified-back-icon" mode="aspectFit"></image>
      <text class="unified-back-text">返回</text>
    </view>
    <text class="unified-header-title">余额提现</text>
    <view class="unified-header-right"></view>
  </view>

  <view class="wrap" style="padding-top: 214rpx">
    <!-- Balance Card -->
    <view class="card balance-card">
      <view class="balance-header">
        <text class="label">可提现佣金</text>
        <app-icon name="help-circle" size="32" color="#9CA3AF" />
      </view>
      <view class="balance-row">
        <text class="currency">¥</text>
        <text class="value">{{balance}}</text>
      </view>
      <view class="withdraw-tip">
        <app-icon name="info" size="24" color="#B06AB3" />
        <text>最低提现金额 ¥{{withdrawConfig.minWithdrawAmount || '1.00'}}</text>
      </view>
    </view>

    <!-- Form Card -->
    <view class="card form-card">
      <view class="field-group">
        <text class="f-label">提现金额</text>
        <view class="input-wrapper">
          <text class="input-prefix">¥</text>
          <input class="input" type="number" placeholder="0.00" placeholder-class="placeholder" value="{{amount}}" bindinput="onAmount" />
          <view class="all-btn" bindtap="fillAll">全部</view>
        </view>
      </view>

      <view class="field-group">
        <text class="f-label">提现方式</text>
        <view class="select-wrapper">
          <view class="select-left">
            <view class="wechat-icon-box">
              <app-icon name="wechat" size="40" color="#07C160" />
            </view>
            <text class="select-text">微信零钱</text>
          </view>
          <app-icon name="check-circle-fill" size="40" color="#B06AB3" />
        </view>
      </view>
      
      <button class="btn-reset submit-btn" bindtap="submit" disabled="{{submitting}}">
        {{submitting ? '处理中...' : '立即提现'}}
      </button>

      <!-- 提现说明 -->
      <view class="instruction-section">
        <view class="instruction-title">提现说明：</view>
        <view class="instruction-list">
          <view class="instruction-item">1. 单笔提现10-2000元，支持分多笔申请；</view>
          <view class="instruction-item">2. 提现扣除一定手续费，实际到账金额实时展示；</view>
          <view class="instruction-item">3. T+1工作日到账（不含节假日/周末），收款账户需实名一致；</view>
          <view class="instruction-item">4. 禁止违规获利，否则平台有权拒绝提现。</view>
        </view>
      </view>
    </view>

    <!-- Records Section -->
    <view class="records-section" wx:if="{{records.length > 0}}">
      <view class="section-header">
        <text class="section-title">提现记录</text>
      </view>
      <view class="record-list">
        <view class="record-item" wx:for="{{records}}" wx:key="id">
          <view class="record-info">
            <view class="record-type">微信提现</view>
            <view class="record-time">{{item.timeStr}}</view>
          </view>
          <view class="record-amount">
            <view class="amount-value">-¥{{item.amount}}</view>
            <view class="record-status status-{{item.status}}">{{item.statusText}}</view>
          </view>
          <!-- Rejection Reason -->
          <view class="reject-reason" wx:if="{{item.status === 'rejected' && item.rejectReason}}">
            <text class="reason-label">拒绝原因：</text>
            <text class="reason-content">{{item.rejectReason}}</text>
          </view>
        </view>
      </view>
    </view>
  </view>
</view>

