<template>
    <view class="container" style="paddingBottom:1rpx;">
      <u-navbar
			leftIconSize="40rpx"
			leftIconColor="#333333"
			title="借贷账户记账详情"
		>
		</u-navbar>
      <view class="section">
        <!-- <view class="section-title">{{ detailInfo.name }}</view> -->
  <u-cell-group>
        <u-cell title="名称:" titleStyle="font-weight:bolder" :value="detailInfo.name"></u-cell>
        <u-cell title="交易类型:" titleStyle="font-weight:bolder" :value="detailInfo.dealType"></u-cell>
        <u-cell title="转出账户:" titleStyle="font-weight:bolder" :value="detailInfo.outAccountName"></u-cell>
        <u-cell title="转入账户:" titleStyle="font-weight:bolder" :value="detailInfo.inAccountName"></u-cell>
        <u-cell title="借贷时间:" titleStyle="font-weight:bolder" :value="detailInfo.createTime"></u-cell>
        <u-cell title="借贷金额:" titleStyle="font-weight:bolder" :value="detailInfo.amount"></u-cell>
        <u-cell title="还款利息:" titleStyle="font-weight:bolder" :value="detailInfo.commission"></u-cell>
      </u-cell-group>
      </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('record_lend_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>
  .section {
    margin: 24rpx;
    padding: 16rpx 24rpx;
    background-color: #fff;
    border-radius: 8rpx;
  
    .section-title {
      width: 280rpx;
      color: #333333;
      line-height: 44rpx;
      font-size: 30rpx;
      border-left: 6rpx solid #2681FF;
      padding-left: 26rpx;
    }
  
    .content {
      width: 647rpx;
      font-size: 28rpx;
      color: #333333;
      line-height: 40rpx;
      text-align: left;
    }
  
    .img-con {
      display: flex;
      flex-wrap: wrap;
      gap: 20rpx
    }
    .form-view {
      padding: 20rpx 0rpx 0 10rpx;
  
      .form-btn {
        padding-top: 20rpx;
      }
    }
  }
  </style>