<template>
  <view class="container">
    <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="header-card">
      <view class="header-icon">
        <uni-icons type="loop" size="24" color="#ffffff"></uni-icons>
      </view>
      <text class="transfer-name">{{ detailInfo.name }}</text>
    </view>

    <view class="detail-card">
      <view class="card-title">
        <view class="title-icon"></view>
        <text>转账信息</text>
      </view>
      
      <view class="detail-item">
        <text class="detail-label">转出账户</text>
        <text class="detail-value">{{ detailInfo.outAccountName }}</text>
      </view>
      
      <view class="detail-item">
        <text class="detail-label">转入账户</text>
        <text class="detail-value">{{ detailInfo.inAccountName }}</text>
      </view>
      
      <view class="detail-item">
        <text class="detail-label">转账金额</text>
        <text class="detail-value amount">{{ detailInfo.amount }}元</text>
      </view>
      
      <view class="detail-item">
        <text class="detail-label">转账时间</text>
        <text class="detail-value">{{ detailInfo.createTime }}</text>
      </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 {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
        })
  }
  </script>
  
  <style lang="scss" scoped>
  page {
    overflow: hidden;
  }

  .header-card {
    margin: 24rpx;
    padding: 20rpx 24rpx;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16rpx;
    display: flex;
    align-items: center;
    gap: 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;
    }

    .transfer-name {
      font-size: 28rpx;
      font-weight: 600;
      color: #ffffff;
      flex: 1;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }

  .detail-card {
    margin: 0 24rpx 24rpx;
    padding: 0;
    background: #ffffff;
    border-radius: 16rpx;
    overflow: hidden;
    box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);

    .card-title {
      padding: 24rpx;
      font-size: 30rpx;
      font-weight: 600;
      color: #2c3e50;
      display: flex;
      align-items: center;
      gap: 12rpx;
      border-bottom: 1rpx solid #f0f0f0;
      position: relative;
      padding-left: 44rpx;

      .title-icon {
        position: absolute;
        left: 24rpx;
        width: 6rpx;
        height: 32rpx;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-radius: 3rpx;
      }
    }

    .detail-item {
      padding: 24rpx;
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1rpx solid #f5f5f5;

      &:last-child {
        border-bottom: none;
      }

      .detail-label {
        font-size: 26rpx;
        color: #666;
      }

      .detail-value {
        font-size: 26rpx;
        color: #333;
        font-weight: 500;
        
        &.amount {
          color: #fa8c16;
          font-weight: 600;
        }
      }
    }
  }
  </style>