<template>
  <div :class="{ deep: index % 2 === 0, }" class="flex-box">
    <div class="left-box">
      <div class="date">{{ data.createTime | filterData }}</div>
      <div class="time">{{ data.createTime | filterTime }}</div>
    </div>
    <div class="data-box">
      <div class="value-box">
        <div class="row">
          <img class="icon" src="https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/Textures/second/coin.png" alt="">
          {{ data.beginningCashBalance | filterFixed }}
        </div>
        <div class="row">
          <img class="icon" src="https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/Textures/second/coin.png" alt="">
          {{ data.endingCashBalance - data.beginningCashBalance | filterFixed }}
        </div>
        <div class="row">
          <img class="icon" src="https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/Textures/second/coin.png" alt="">
          {{ data.endingCashBalance | filterFixed }}
        </div>
      </div>
      <div class="line"/>
      <div class="value-box">
        <div class="row">
          <img class="icon" src="https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/Textures/second/ic_bi.png" alt="">
          {{ data.beginningRestrictedBalance | filterFixed }}
        </div>
        <div class="row">
          <img class="icon" src="https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/Textures/second/ic_bi.png" alt="">
          {{ data.endingRestrictedBalance - data.beginningRestrictedBalance | filterFixed }}
        </div>
        <div class="row">
          <img class="icon" src="https://kuawai.s3.ap-east-1.amazonaws.com/resource/assets/Textures/second/ic_bi.png" alt="">
          {{ data.endingRestrictedBalance | filterFixed }}
        </div>
      </div>
    </div>
    <div class="right-box">
      {{ data.detail }}
    </div>
  </div>
</template>

<script>
export default {
  filters: {
    filterData(value) {
      return value.split(' ')[0]
    },
    filterTime(value) {
      return value.split(' ')[1]
    },
    filterFixed(value) {
      return (value * 1).toFixed(2)
    },
  },
  props: {
    data: {
      type: Object,
      default: () => {
        return {}
      },
    },
    index: {
      type: Number,
      default: 0,
    },
  },
}
</script>

<style lang="scss" scoped>
.flex-box {
  display: flex;
  height: 80px;
  &.deep {
    background: #004156;
  }
  .left-box, .right-box {
    width: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    .date {
      font-size: 12px;
    }
  }
  .right-box {
    width: 140px;
  }
  .data-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    .value-box {
      display: flex;
      // justify-content: space-around;
      line-height: 32px;
      .row {
        display: flex;
        // justify-content: center;
        align-items: center;
        width: 33%;
        font-size: 12px;
        .icon {
          display: block;
          height: 24px;
          margin-right: 4px;
        }
      }
    }
    .line {
      flex: none;
      height: 1px;
      background: color(srgb 0.0303 0.3369 0.47);
    }
  }
}
</style>
