<template>
|
<section class="inner-tab-container">
|
<section class="banner-container">
|
<van-swipe class="swipe-box" :autoplay="false" indicator-color="white">
|
<van-swipe-item>
|
<div class="swipe-container">
|
<h1 class="h1-title">{{ t('UStockAccount') }}</h1>
|
<p class="flex justify-between mt-5">
|
<span>{{ t('AccountAssets') }}</span>
|
</p>
|
<ul>
|
<li class="flex line">
|
<div class="flex-1">
|
<div> {{ t('USStockLoss') }}</div>
|
<p class="value">{{ assets?.sumPrice ?? '--' }}</p>
|
</div>
|
<div class="flex-1">
|
<p class="label"> {{ t('UStotalLoss') }}</p>
|
<p class="value">{{ assets?.profitLoss ?? '--' }}</p>
|
</div>
|
<div class="flex-1">
|
<div>
|
<p>{{ t('USStockProfitDay') }}</p>
|
</div>
|
<p class="value">{{ assets?.toDayProfitLoss ?? '--' }}</p>
|
</div>
|
</li>
|
<li class="flex line">
|
<div class="flex-1">
|
<p class="label"> {{ t('USStockBalance') }}</p>
|
<p class="value">{{ assets?.sumVolume ?? '--' }}</p>
|
</div>
|
<div class="flex-1">
|
<p> {{ t('USdesirable') }}</p>
|
<p class="value">{{ assets?.sumVolume ?? '--' }}</p>
|
</div>
|
<div class="flex-1">
|
</div>
|
</li>
|
</ul>
|
</div>
|
</van-swipe-item>
|
</van-swipe>
|
</section>
|
<section class="etf-container">
|
<div class="all-etf-ranking">
|
<div class="etf-table">
|
<ul>
|
<li class="title-line">
|
<div class="flex-l">
|
<p>{{ t('marketValue') }}</p>
|
</div>
|
<div class="flex-r">
|
<div class="flex-r-item">
|
<p>{{ t('totalLoss') }}</p>
|
</div>
|
<div class="flex-r-item">
|
<p>{{ t('openAvailable') }}</p>
|
</div>
|
<div class="flex-r-item">
|
<p>{{ t('costCurrentPrice') }}</p>
|
</div>
|
<div class="flex-r-item">
|
<p>{{ t('ProfitDay') }}</p>
|
</div>
|
</div>
|
</li>
|
<li v-for="(item) in etfList" :key="item.symbol" @click="itemClick(item)">
|
<div class="flex-l">
|
<p>{{ item.symbol }}</p>
|
<p class="gray-text">{{ item.marketValue }}</p>
|
</div>
|
<div class="flex-r">
|
<div class="flex-r-item">
|
<p :class="item.open < 1 ? 'text-up' : 'text-down'">{{
|
item.profitLoss
|
}}</p>
|
<p :class="item.open < 1 ? 'text-up' : 'text-down'">{{
|
item.profitLossPercentage
|
}}</p>
|
</div>
|
<div class="flex-r-item">
|
<p :class="item.close < 1 ? 'text-up' : 'text-down'">{{
|
item.positionVolume
|
}}</p>
|
<p :class="item.close < 1 ? 'text-up' : 'text-down'">{{
|
item.volume
|
}}</p>
|
</div>
|
<div class="flex-r-item">
|
<p :class="item.close < 1 ? 'text-up' : 'text-down'">{{
|
item.price
|
}}</p>
|
<p :class="item.close < 1 ? 'text-up' : 'text-down'">{{
|
item.currentPrice
|
}}</p>
|
</div>
|
<div class="flex-r-item">
|
<p :class="item.close < 1 ? 'text-up' : 'text-down'">{{
|
item.toDayProfitLoss
|
}}</p>
|
<p :class="item.close < 1 ? 'text-up' : 'text-down'">{{
|
item.toDayProfitLossPercentage
|
}}</p>
|
</div>
|
</div>
|
</li>
|
</ul>
|
</div>
|
</div>
|
</section>
|
</section>
|
</template>
|
|
<script setup>
|
import { ref, onMounted, onBeforeUnmount } from 'vue';
|
import { useUserStore } from '@/store/user';
|
import { useRoute, useRouter } from 'vue-router';
|
import {
|
_getETFList, _getETFSum
|
} from "@/service/etf.api";
|
import { _getQuotes } from '@/service/quotes.api'
|
import { useI18n } from 'vue-i18n'
|
import { useQuotesStore } from '@/store/quotes.store'
|
|
const props = defineProps({
|
isSell: {
|
type: Boolean,
|
default: false
|
}
|
})
|
const quotesStore = useQuotesStore()
|
const { t } = useI18n()
|
const router = useRouter()
|
const route = useRoute()
|
const etfList = ref([])
|
const assets = ref({})
|
const interval = ref(null)
|
|
onMounted(async () => {
|
getETFList()
|
getETFSum()
|
// interval.value = setInterval(() => {
|
// getETFList()
|
// }, 1000)
|
})
|
|
onBeforeUnmount(() => {
|
// if (interval.value) {
|
// clearInterval(interval.value)
|
// }
|
})
|
|
const getETFList = () => {
|
_getETFList('US-stocks').then(data => {
|
etfList.value = data
|
})
|
}
|
|
const getETFSum = () => {
|
_getETFSum('US-stocks').then(data => {
|
assets.value = data
|
})
|
}
|
|
const onRoute = (path) => {
|
router.push(path)
|
}
|
|
const itemClick = () => {
|
router.push('/quotes/detail')
|
}
|
|
const handleClickHotSymbol = (value) => {
|
console.log(value, 'value')
|
}
|
|
</script>
|
<style lang="scss" scoped>
|
.container-box {
|
.h1-title {
|
font-size: 16px;
|
}
|
|
.inner-tab-container {
|
margin-top: 8px;
|
}
|
|
.banner-container {
|
height: 100%;
|
|
.van-swipe-item {
|
box-sizing: border-box;
|
padding: 0 12px;
|
color: $text_color;
|
font-size: 12px;
|
height: 168px;
|
background-color: $selectSymbol_background;
|
|
.line {
|
margin-top: 10px;
|
}
|
}
|
}
|
|
.etf-container {
|
padding: 0;
|
|
.all-etf-ranking {
|
margin-top: 10px;
|
|
.title {
|
font-weight: 700;
|
padding: 0 12px;
|
}
|
|
.tabs {
|
padding: 0 12px;
|
margin-top: 10px;
|
// height: 40px;
|
min-height: 40px;
|
line-height: 24px;
|
color: #BBBCBD;
|
|
.tab-item {
|
margin: 4px;
|
text-align: center;
|
padding: 4px 6px;
|
font-size: 12px;
|
color: $text_color5;
|
background: $US_tab_background;
|
border-radius: 10px;
|
background-size: cover;
|
}
|
|
.active {
|
font-weight: 700;
|
color: $color_main !important;
|
background: $US_tabActice_background;
|
border-radius: 10px;
|
background-size: cover;
|
}
|
}
|
|
.etf-table {
|
.right {
|
text-align: right;
|
}
|
|
ul {
|
margin-top: 10px;
|
}
|
|
.title-line {
|
color: #747A8F;
|
font-size: 12px;
|
font-weight: 400;
|
padding: 0 12px;
|
border: none;
|
}
|
|
li {
|
padding: 14px 12px;
|
display: flex;
|
font-size: 12px;
|
line-height: 18px;
|
border-bottom: 1px solid $border_color;
|
|
.gray-text {
|
color: #BCBDC2;
|
font-size: 12px;
|
}
|
|
.flex-l {
|
width: 100px;
|
}
|
|
.flex-r {
|
display: inline-flex;
|
flex: 1;
|
|
.flex-r-item {
|
flex: 1;
|
align-self: center;
|
text-align: center;
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
</style>
|