dcc
2024-08-03 1613da5e0d5b13b20fc384da3595766efe8ffb24
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<!-- 单个币种基本信息-->
<template>
  <div
    class="trade-header-box"
    :class="[isFullscreen ? 'trade-header-box-full' : '']"
  >
    <div class="ticker-xl-box">
      <!-- 币种名称 -->
      <div class="watch-drop-box" @click="handleClickSymbol">
        <span class="ticker-title">{{ pageData.name }}</span
        ><i class="icon iconfont icon-Mul_Dropdown arrow-icon"></i>
      </div>
      <!-- 币种的其他信息 -->
      <div class="ticker-top-box">
        <div class="ticker-item">
          <span
            class="label last"
            :style="{
              color: pageData.change_ratio >= 0 ? '#0db27c' : '#db4355',
            }"
            >{{ pageData.close }}</span
          ><span
            class="value"
            :style="{
              color: pageData.change_ratio >= 0 ? '#0db27c' : '#db4355',
            }"
            >{{ addAndSubtr(pageData.change_ratio) }}</span
          >
        </div>
 
        <div class="ticker-item">
          <span class="label">{{ $t("message.home.biaojijiage") }}</span
          ><span class="value">{{ pageData.close }}</span>
        </div>
        <div class="ticker-item">
          <span class="label">{{ $t("message.home.zhishujiage") }}</span
          ><span class="value">{{ pageData.close }}</span>
        </div>
        <div class="ticker-item">
          <span class="label">{{ $t("message.hangqing.24hzhangfu") }}</span>
          <span
            class="value"
            :class="[
              'text-end',
              pageData.change_ratio >= 0 ? 'color-up' : 'color-down',
            ]"
            >{{ pageData.close }}&nbsp; {{ pageData.change_ratio }}%</span
          >
        </div>
 
        <div class="ticker-item">
          <span class="label">24h {{ $t("message.home.zuidi") }}</span
          ><span class="value">{{ pageData.low }}</span>
        </div>
        <div class="ticker-item">
          <span class="label">24h {{ $t("message.home.zuigao") }}</span
          ><span class="value">{{ pageData.high }}</span>
        </div>
        <div class="ticker-item">
          <span class="label"
            >24h{{ t("message.home.liang") }}({{
              t(`${unitMap.amount[pageType]}`)
            }})</span
          >
          <span class="value"
            >{{ Number(pageData.amount || 0).toFixed(4) }}
          </span>
        </div>
        <div class="ticker-item">
          <span class="label"
            >24h{{ t("message.home.e") }}({{
              t(`${unitMap.volumn[pageType]}`)
            }})</span
          ><span class="value">
            {{ Number(pageData.volume || 0).toFixed(4) }}</span
          >
        </div>
      </div>
    </div>
  </div>
</template>
<script setup>
import { addAndSubtr } from "@/utils/index";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const emit = defineEmits(["showSerachCollect"]);
const props = defineProps({
  pageData: {
    type: Object,
    default: {},
  },
  isFullscreen: {
    type: Boolean,
    default: false,
  },
  pageType: {
    type: String,
    default: "etf",
  },
});
 
const handleClickSymbol = () => {
  emit("showSerachCollect");
};
const unitMap = {
  amount: {
    etf: "message.home.wangu",
    usStocks: "message.home.wangu",
    coin: "USD", //当前币种
    forex: "USDT", //当前币种
  },
  volumn: {
    etf: "message.home.wan",
    usStocks: "message.home.wan",
    forex: "USD",
    coin: "USDT",
  },
};
</script>
<style scoped>
.trade-header-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
 
.trade-header-box-full {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: #171a1e;
  z-index: 3000000;
  padding: 10px 0;
}
 
.trade-header-box .ticker-xl-box,
.trade-header-box .ticker-xl-box .ticker-top-box {
  width: 100%;
}
 
.watch-drop-box {
  margin: 0 28px;
  position: relative;
}
 
.watch-drop-box p {
  position: absolute;
  display: block;
  width: 100%;
  top: 30px;
}
 
.trade-header-box .ticker-item .label {
  padding-bottom: 5px;
}
 
.trade-header-box .ticker-item .last {
  font-size: 16px;
  font-weight: 600;
}
</style>