<template>
    <view class="container" style="paddingBottom:1rpx;">
      <u-navbar
			leftIconSize="40rpx"
			leftIconColor="#ffffff"
			title="信用卡还款详情"
			:bgColor="'linear-gradient(135deg, #667eea 0%, #764ba2 100%)'"
			titleStyle="color: #ffffff; font-weight: 600;"
		>
		</u-navbar>
      <view class="section">
        <view class="header-card">
          <view class="header-icon">
            <uni-icons type="redo" size="28" color="#ffffff"></uni-icons>
          </view>
          <view class="header-info">
            <text class="card-name">{{ detailInfo.name }}</text>
            <view class="info-row">
              <text class="type-text">{{ detailInfo.dealType }}</text>
              <text class="amount-value">{{ detailInfo.amount }}元</text>
            </view>
          </view>
        </view>
        
        <view class="info-card">
          <view class="card-title">
            <text>还款信息</text>
          </view>
           <view class="detail-row">
            <text class="detail-label">信用卡</text>
            <text class="detail-value">{{ detailInfo.inAccountName }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">储蓄账户</text>
            <text class="detail-value">{{ detailInfo.outAccountName }}</text>
          </view>
          
          <view class="detail-row">
            <text class="detail-label">还款时间</text>
            <text class="detail-value">{{ detailInfo.createTime }}</text>
          </view>
        </view>
      </view>
   
      <u-toast ref="uToast"></u-toast>
    </view>
  </template>
  
<script setup>
import { getAccountsTransferRecord} from '@/api/invest/accountsTransferRecord'
import {onLoad} from "@dcloudio/uni-app";
import { getDicts } from '@/api/system/dict/data.js'
import {reactive ,toRefs,ref }from "vue";
const id = ref('')
const data = reactive({
  detailInfo: {} 
})
const {detailInfo} = toRefs(data)
onLoad((option) => {
    id.value = option.id
    getInfo()
  })
  function getInfo() {
    getAccountsTransferRecord(id.value).then(res => {
          detailInfo.value = res.data
            // 类型
          getDicts('credit_repayment_type').then(result => {
         detailInfo.value.dealType=dictStr(detailInfo.value.dealType, result.data)
      })
        })
  }
  function dictStr(val, arr) {
      let str = ''
      arr.map(item => {
        if (item.dictValue === val) {
          str = item.dictLabel
        }
      })
      return str
    }
  </script>
  
  <style lang="scss" scoped>
  page {
    overflow: hidden;
  }
  
  
  .section {
    margin: 24rpx;
    display: flex;
    flex-direction: column;
    gap: 24rpx;
  }
  
  .header-card {
    display: flex;
    align-items: center;
    gap: 16rpx;
    padding: 24rpx;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16rpx;
    box-shadow: 0 6rpx 20rpx rgba(102, 126, 234, 0.25);
  
    .header-icon {
      width: 48rpx;
      height: 48rpx;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.25);
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
  
    .header-info {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 8rpx;
      min-width: 0;
  
      .card-name {
        font-size: 29rpx;
        font-weight: 600;
        color: #ffffff;
        line-height: 1.2;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      
      .info-row {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        gap: 12rpx;
      }
  
      .type-text {
        font-size: 26rpx;
        color: rgba(255, 255, 255, 0.85);
        font-weight: 500;
        line-height: 1;
      }
      
      .amount-value {
        font-size: 32rpx;
        font-weight: 700;
        color: #52c41a;
        line-height: 1;
      }
    }
  }
  
  .info-card {
    padding: 32rpx;
    background-color: #fff;
    border-radius: 16rpx;
    box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
  
    .card-title {
      display: flex;
      align-items: center;
      gap: 8rpx;
      padding-bottom: 24rpx;
      margin-bottom: 24rpx;
      border-bottom: 2rpx solid #f0f0f0;
      position: relative;
      padding-left: 20rpx;
      
      &::before {
        content: '';
        position: absolute;
        left: 0;
        width: 6rpx;
        height: 32rpx;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-radius: 3rpx;
      }
  
      text {
        font-size: 30rpx;
        font-weight: 700;
        color: #333;
      }
    }
  
    .detail-row {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      padding: 16rpx 0;
      border-bottom: 1rpx solid #f5f5f5;
  
      &:last-child {
        border-bottom: none;
      }
  
      .detail-label {
        font-size: 26rpx;
        color: #999;
        font-weight: 400;
        flex-shrink: 0;
        width: 160rpx;
      }
  
      .detail-value {
        font-size: 28rpx;
        color: #333;
        font-weight: 600;
        text-align: right;
        flex: 1;
      }
    }
  }
  </style>