xc-app/pages/components/quotationList.vue

295 lines
5.6 KiB
Vue

<!-- 行情列表组件 -->
<template>
<view>
<view class="header">
<view class="listheader listItem borderRadius12">
<view class="itemL">币种</view>
<view class="itemM">最新价</view>
<view class="ItemR">24H涨跌
<image src="@/static/index/ups.png" mode="" class="ups"></image>
</view>
</view>
</view>
<view class="main">
<view class="quotationListMain" v-if="list.length > 0">
<view class="listItem">
<view class="itemL">
<text class="name">USDT</text>
/CNY
</view>
<view class="itemM itemBig">{{list.length > 0 ? parseFloat(list[0].usdtCost).toFixed(4) : ''}}</view>
<view class="ItemNone borderRadius12"></view>
</view>
</view>
<view class="quotationListMain" v-for="(item,index) in list" :key="index" @click="goTransaction(item)">
<view class="listItem">
<view class="itemL">
<view class=""><text class="name">{{item.symbol.split('/')[1]}}</text><text>/{{item.symbol.split('/')[0]}}</text></view>
<view class="hour">24H量 {{item.statisticalDto.amount}}</view>
</view>
<view class="itemM">
<view class="name">{{item.price}}</view>
<view class="">¥{{parseFloat(mathMulFun(item.usdtCost,item.price)).toFixed(2)}}</view>
</view>
<view class="ItemR" :class="item.statisticalDto.quoteChange > 0 ? 'ItemRed' : ''">{{item.statisticalDto.quoteChange > 0 ? '+' : (item.statisticalDto.quoteChange < 0 ? '' : '') }}{{parseFloat(item.statisticalDto.quoteChange).toFixed(2)}}%</view>
</view>
</view>
</view>
<!-- <view style="height: 100rpx;"></view> -->
<!-- <view class="quotationList" v-if="list.length > 0">
<view class="listWrap">
<view class="listItem borderRadius12">
<view class="itemL">
<view class=""><text class="name">USDT</text><text>/CNY</text></view>
</view>
<view class="itemM">
<view class="name">{{list.length > 0 ? list[0].usdtCost : ''}}</view>
</view>
<view class="ItemNone borderRadius12"></view>
</view>
</view>
</view> -->
<!-- <view class="quotationList" v-for="(item,index) in list" :key="index" @click="goTransaction(item)">
<view class="listWrap">
<view class="listItem borderRadius12">
<view class="itemL">
<view class=""><text class="name">{{item.symbol.split('/')[1]}}</text><text>/{{item.symbol.split('/')[0]}}</text></view>
<view class="">24H量 {{item.statisticalDto.amount}}</view>
</view>
<view class="itemM">
<view class="name">{{item.price}}</view>
<view class="">¥{{mathMulFun(item.usdtCost,item.price)}}</view>
</view>
<view class="ItemR">{{item.statisticalDto.quoteChange > 0 ? '+' : (item.statisticalDto.quoteChange < 0 ? '-' : '') }}{{item.statisticalDto.quoteChange}}%</view>
</view>
</view>
</view> -->
</view>
</template>
<script>
import {
mathMul
} from '@/utils/mathUtils.js'
export default {
name: 'QuotationList',
props: {
list: {
type: Array,
default: () => []
}
},
data() {
return {
mathMulFun: mathMul
};
},
mounted() {
this.dataList = this.list
},
methods: {
goTransaction(item) {
this.$emit("click", item)
}
}
}
</script>
<style lang="scss" scoped>
.header {
.listItem {
display: flex;
font-size: 24rpx;
.itemL,
.itemM {
// flex: 1;
}
.itemL {
width: 404rpx;
}
.itemM {
width: 210rpx;
}
.ItemR {
width: 153rpx;
display: flex;
.ups {
width: 24rpx;
height: 24rpx;
margin-left: 10rpx;
}
}
}
.listheader {
height: 88rpx;
// padding: 23rpx 30rpx 0;
color: #636E72;
font-size: 22rpx;
// background: rgba(55, 106, 245, 0.2);
}
}
.main {
background-color: #FFFFFF;
}
.quotationListMain {
background-color: #FFFFFF;
.listItem {
// height: 70rpx;
width: 100%;
display: flex;
align-items: center;
margin-bottom: 58rpx;
.itemL {
width: 404rpx;
font-size: 22rpx;
color: #B2BEC3;
.name {
font-size: 32rpx;
color: #2D3436;
font-weight: bold;
margin-bottom: 10rpx;
}
.hour {
margin-top: 10rpx;
}
}
.itemM {
width: 210rpx;
font-size: 22rpx;
color: #B2BEC3;
.name {
font-size: 32rpx;
color: #2D3436;
margin-bottom: 10rpx;
}
}
.ItemNone {
width: 153rpx;
}
.ItemR {
width: 153rpx;
height: 64upx;
background: #10ac84;
border-radius: 4upx;
font-size: 28rpx;
color: #FFFFFF;
font-weight: bold;
text-align: center;
line-height: 64rpx;
}
.ItemRed{
background-color: #EE5253;
}
.itemBig{
font-size: 32rpx;
color: #2D3436;
}
}
}
.quotationList {
.listItem {
display: flex;
font-size: 24rpx;
.itemL,
.itemM {
// flex: 1;
}
.itemL {
width: 404rpx;
}
.itemM {
width: 210rpx;
}
.ItemR {
width: 120rpx;
}
}
.listheader {
height: 88rpx;
padding: 23rpx 30rpx 0;
color: #8E8EA2;
background: rgba(55, 106, 245, 0.2);
}
.listWrap {
position: relative;
top: -18rpx;
.listItem {
// height: 120rpx;
margin-bottom: 50rpx;
// padding: 30rpx;
background-color: #fff;
.itemL,
.itemM {
color: #B2BEC3;
.name {
font-size: 32rpx;
color: #2D3436;
font-weight: bold;
}
}
.ItemR {
width: 153rpx;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
border-radius: 4rpx;
background-color: $uni-color32C28C;
}
.ItemNone {
width: 120rpx;
}
.itemL {
width: 404rpx;
}
.itemM {
width: 210rpx;
}
}
}
}
</style>