<template>
  <div class="pop">
    <div class="line-box flex">
      <div class="line"></div>
    </div>
    <div>
      <!-- 时间周期 -->
      {{ $t('option.l47') }}
    </div>
    <van-row>
      <van-col span="6" v-for="(item, index) in list" :key="index" @click="selectItem(item)">
        <div class="li flex" :class="{ active: timeSign == item.time && !timeShare }">
          <div>{{ item.text }}</div>
        </div>
      </van-col>
    </van-row>
  </div>
</template>
<script>
export default {
  props: ['symbolInfo', 'timeSign', 'timeShare'],
  data () {
    return {
      timeOptions: [
        {
          text: '1' + this.$t('exchange.l74'),
          type: 1,
          time: '1',
        },
        {
          text: '5' + this.$t('exchange.l74'),
          type: 1,
          time: '5',
        },
        {
          text: this.$t('product.l49'),
          type: 1,
          time: '7',
        },
        {
          text: this.$t('product.l50'),
          type: 1,
          time: '31',
        },
        {
          text: this.$t('product.l51'),
          type: 1,
          time: '365',
        }
      ],
      timeOptions1: [
        {
          text: '1' + this.$t('exchange.l74'),
          type: 2,
          time: '1',
        },
        {
          text: '5' + this.$t('exchange.l74'),
          type: 2,
          time: '5',
        },
        {
          text: '15' + this.$t('exchange.l74'),
          type: 2,
          time: '15',
        },
        {
          text: '30' + this.$t('exchange.l74'),
          type: 2,
          time: '30',
        },
        {
          text: '60' + this.$t('exchange.l74'),
          type: 2,
          time: '60',
        }
      ],
    }
  },
  computed: {
    list() {
      return this.symbolInfo.crypto != '1' ? this.timeOptions1 : this.timeOptions
    }
  },
  methods: {
    selectItem(item) {
      this.$emit('success', item)
    }
  }
}
</script>
<style lang="less" scoped>
.pop {
  padding: 10px 20px 30px;
}
.line-box {
  justify-content: center;
  margin-bottom: 20px;
  .line {
    width: 40px;
    height: 4px;
    background: #D8D8D8;
    border-radius: 2px;
  }
}
.van-row {
  padding-top: 12px;
  margin: 0 -9px;
  .van-col {
    margin-top: 18px;
    padding: 0 9px;
  }
}
.li {
  border-radius: 4px;
  border: 1px solid #F6F6F6;
  font-size: 12px;
  text-align: center;
  height: 30px;
  justify-content: center;
  cursor: pointer;
  &.active {
    border-color: #000;
  }
}
</style>