<template>
  <div class="list">
    <div class="li" v-for="item in followedList" :key="item.eid">
      <div class="box">
        <div class="left flex">
          <van-image
            width="42"
            height="42"
            round
            fit="cover"
            :src="item.header || '/img/follow/follow.png'"
          />
          <div class="right">
            <div class="flex name-box">
              <div class="name">
                {{ item.expert_title }}
              </div>
              <div class="level">
                {{ followLevelName[item.expert_level] }}
              </div>
            </div>
          </div>
        </div>
      </div>
      <van-row gutter="6" type="flex">
        <van-col span="8">
          <div class="lab">
            <!-- 收益 -->
            {{ $t('follow.l138') }}
          </div>
          <div class="amount" :class="{up: item.profit >= 0, down: item.profit < 0}">
            {{ item.profit > 0 ? '+' : '' }} {{ $numToThousand(item.profit) }} USD
          </div>
        </van-col>
        <van-col span="8">
          <div class="lab">
            <!-- 分润 -->
            {{ $t('follow.l139') }}
          </div>
          <div class="amount" :class="{up: item.expert_profit >= 0, down: item.expert_profit < 0}">
            {{ item.expert_profit > 0 ? '+' : '' }} {{ $numToThousand(item.expert_profit) }} USD
          </div>
        </van-col>
        <van-col span="8">
          <div class="btn-box flex">
            <div class="btn" @click="$router.push('/trade/detail/' + item.eid)">
              <!-- 再次跟单 -->
              {{ $t('follow.l141') }}
            </div>
          </div>
        </van-col>
      </van-row>
    </div>
    <NoData v-if="followedList.length == 0" />
  </div>
</template>
<script>
import { mapGetters } from "vuex";
export default {
  data () {
    return {
      loaded: false,
    }
  },
  computed: {
    ...mapGetters(['followList', 'followLevelNumber', 'followLevelRate', 'followLevelName']),
    followedList() {
      return this.followList.filter(item => item.status != 1)
    }
  },
  methods: {
  }
}
</script>
<style lang="less" scoped>
.list {
  padding: 0 10px 6px;
}
.li {
  border-radius: 8px;
  border: 1px solid #F6F6F6;
  padding: 9px;
  position: relative;
  margin-bottom: 10px;
}
.box {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  column-gap: 6px;
  padding-bottom: 8px;
  .left,.right {
    flex: 1;
    min-width: 0;
  }
  .left {
    column-gap: 10px;
  }
  .name-box {
    column-gap: 4px;
  }
  .name {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .level {
    border-radius: 2px;
    border: 1px solid #F6F6F6;
    padding: 2px 3px;
    font-size: 10px;
  }
  .detail {
    column-gap: 4px;
    font-size: 12px;
    cursor: pointer;
    padding-top: 4px;
  }
  .icon {
    width: 6px;
  }
}
.tip {
  font-size: 12px;
  color: #B6B6B6;
  .radius {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #64C063;
    margin-right: 4px;
  }
}
.van-row {
  align-items: flex-end;
  font-size: 10px;
  .lab {
    color: #B6B6B6;
    margin-bottom: 4px;
  }
  .btn-box {
    justify-content: flex-end;
  }
  .btn {
    cursor: pointer;
    background-color: #000000;
    border-radius: 15px;
    padding: 7px 14px;
    font-size: 12px;
    color: #FFFFFF;
  }
}
.up {
  color: var(--red-);
}
.down {
  color: var(--green-);
}
</style>