<template>
  <div class="list">
    <div class="line-box flex">
      <div class="line"></div>
    </div>
    <div class="sub">
      <!-- 当前交易账户 -->
      {{ $t('fund.l17') }}
    </div>
    <div class="item" @click="selectItem(item)" :class="{'active': item.id == info.id || (!item.id && !info.id)}" v-for="(item, index) in list" :key="index">
      <van-image
        width="20"
        height="20"
        round
        fit="cover"
        :src="`/img/user/${item.server ? item.server : 'usd'}.png?14`"
      />
      <div class="right">
        <!-- 美元钱包账户 -->
        <div>{{ serverName[item.server] || $t('account.l1') }}</div>
        <!-- 现金 -->
        <div class="balance">{{ $t('exchange.l38') }}: {{ $numToThousand((item.margin_free)) }} {{ serverUtil[item.server] }}</div>
      </div>
      <img class="check" src="/img/user/check.png" alt="极度证券">
    </div>
  </div>
</template>
<script>
export default {
  props: ['info', 'list'],
  data () {
    return {
      
    }
  },
  methods: {
    selectItem(item) {
      this.$emit('success', item)
    }
  }
}
</script>
<style lang="less" scoped>
.list {
  padding: 11px 11px 46px;
  .item {
    padding: 13px 7px;
    border-radius: 6px;
    font-size: 16px;
    color: var(--color-1-);
    border: 1px solid transparent;
    position: relative;
    display: flex;
    align-items: flex-start;
    &.active {
      border-color: #858585;
      .check {
        display: block;
      }
    }
  }
  .right {
    font-size: 15px;
    padding-left: 8px;
    margin-top: -1px;
  }
  .balance {
    margin-top: 6px;
    font-size: 11px;
    color: #828282;
  }
  .check {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: 13px;
    display: none;
  }
}
.line-box {
  justify-content: center;
  margin-bottom: 28px;
  .line {
    width: 36px;
    height: 4px;
    background: #E7E7E7;
    border-radius: 2px;
  }
}
.sub {
  font-weight: 500;
  color: #000000;
  font-size: 16px;
  padding-bottom: 18px;
  padding-left: 8px;
}
</style>