1
PC-20250623MANY\Administrator
2025-07-06 580572e6a215291e6bc10faed249d6e13a00e8d8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<template>
  <div>
    <div class="contact-futrue">
      <div class="font-24 text-grey mb-24">{{ $t('交割时间') }}</div>
      <ul class="flex flex-wrap w-full" v-if="initFutrue.para">
        <li v-for="(item, index) in initFutrue.para" :key="item.uuid" class="h-92 flex items-center mb-22"
          @click="onSelect(item, index)">
          <p class="w-125 h-full flex justify-center items-center font-26 flex-1 bg-yellow text-white"
            :class="active === item.para_id ? 'bg-semi-transparent' : ''">
            {{ item.time_num + item.time_unit.substr(0, 1) }}
          </p>
          <p class="w-150 h-full flex justify-center items-center font-26 flex-1 bg-yellow text-white"
            :class="active === item.para_id ? 'bg-semi-transparent' : ''">
            {{ item.profit_ratio }}%
          </p>
        </li>
      </ul>
    </div>
  </div>
</template>
 
<script>
export default {
  name: 'ContractFutrue',
  props: {
    initFutrue: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  watch: {
    initFutrue: {
      handler(val) {
        console.log("initFutrue", val);
      },
    }
  },
  data() {
    return {
      active: '',
      initParam: [] // 初始化参数
    }
  },
  created() {
    if (this.initFutrue.para.length > 0) {
      this.active = this.initFutrue.para[0].para_id || ''
      this.$emit('paraId', { id: this.active, index: 0 })
    }
  },
  methods: {
    onSelect(item, index) { // 选中
      this.active = item.para_id
      this.$emit('paraId', { id: this.active, index })
    },
    bgChange(n) {
      if (n <= 30) {
        return ''
      } else if (n > 30 && n <= 60) {
        return 'bg-dark-blue'
      } else if (n > 60 && n <= 90) {
        return 'bg-green'
      } else {
        return 'bg-red'
      }
    },
  }
}
</script>
 
<style lang="scss" scoped>
@import "@/assets/init.scss";
 
.textColor {
  color: $mainTextColor;
}
 
.bgDark {
 
  background: 242424
}
 
.bg-light-blue {
  background: $btn_main;
}
 
.bg-yellow {
  // background: $bg_yellow !important;
  background: rgba($color: $purple, $alpha: 0.6) !important;
  border-left: solid 1px #fff;
}
 
.bg-dark-blue {
  background: #1255A3 !important;
}
 
.bg-green {
  background: $green !important;
}
 
.bg-red {
  background: $red !important;
}
 
.bg-semi-transparent {
  background: $bg_yellow !important;
  opacity: 0.5;
}
</style>