<template>
|
<div id="MiningPoolFinanceHistory" class="MiningPoolFinanceHistory">
|
<assets-head :title="$t('历史')" :back-func="() => {
|
$router.push({
|
path: '/cryptos/funds',
|
query: {
|
tab: 3,
|
index: type // 0: 查看理财订单 1: 矿机
|
}
|
})
|
}"></assets-head>
|
<van-tabs v-model:active="active" ref="tabs" @change="onchange">
|
<van-tab :title="$t('购买')">
|
<div class="contBackground h-2"></div>
|
<van-pull-refresh :pulling-text="$t('下拉即可刷新')" :loosing-text="$t('释放即可刷新')" :loading-text="$t('加载中')"
|
v-model="isLoading" @refresh="onRefresh">
|
<van-list v-model:loading="loading" :finished="finished" @load="onLoad" :loading-text="$t('加载中')">
|
<div v-for="(item, index) in list" :key="'buy' + index" class="history-card-wrap">
|
<div class="history-card" @click="type === 1 ? handleGoOrderDetail(item) : null">
|
<div class="history-row">
|
<span class="history-label">{{ $t('时间') }}</span>
|
<span class="history-value">{{ item.create_time }}</span>
|
</div>
|
<div class="history-row">
|
<span class="history-label">{{ $t('数量') }}</span>
|
<span class="history-value">{{ item.amount }} USDT</span>
|
</div>
|
<div class="history-row">
|
<span class="history-label">{{ type === 1 && !isMinerTest(item.test) ? $t('可解锁周期') : $t('周期') }}</span>
|
<span class="history-value">{{ item.cycle == 0 ? $t('无限期') : item.cycle + (type === 1 && !isMinerTest(item.test) ? $t('分钟') : $t('天')) }}</span>
|
</div>
|
<div class="history-row">
|
<span class="history-label">{{ $t('累计收益') }}</span>
|
<span class="history-value" :class="item.profit / 1 > 0 ? 'text-green' : 'text-red'">{{ item.profit }}</span>
|
</div>
|
<div v-if="type === 1" class="history-tip">{{ $t('点击查看详情') }}</div>
|
</div>
|
</div>
|
</van-list>
|
</van-pull-refresh>
|
</van-tab>
|
<van-tab :title="$t('赎回')">
|
<div class="contBackground h-2"></div>
|
<van-pull-refresh :pulling-text="$t('下拉即可刷新')" :loosing-text="$t('释放即可刷新')" :loading-text="$t('加载中')"
|
v-model="isLoading" @refresh="onRefresh">
|
<van-list v-model:loading="loading" :finished="finished" :finished-text="$t('没有更多了')" @load="onLoad">
|
<div class="flex justify-center">
|
<financial-list :list="list" :btnShow="false" :type="type" :goBack="true"></financial-list>
|
</div>
|
</van-list>
|
</van-pull-refresh>
|
|
</van-tab>
|
<van-tab :title="$t('利息')">
|
<div class="contBackground h-2"></div>
|
<van-pull-refresh :pulling-text="$t('下拉即可刷新')" :loosing-text="$t('释放即可刷新')" :loading-text="$t('加载中')"
|
v-model="isLoading" @refresh="onRefresh">
|
<van-list v-model:loading="loading" :finished="finished" :finished-text="$t('没有更多了')" @load="onLoad">
|
<div v-for="(item, index) in list" :key="'interest' + index" class="history-card-wrap">
|
<div class="interest-row">
|
<div class="flex items-center">
|
<img v-if="item.amount / 1 > 0 ? false : true" :src="require('@/assets/image/assets-center/out.png')"
|
alt="" class="interest-icon">
|
<img v-else :src="require('@/assets/image/assets-center/in.png')" alt="" class="interest-icon">
|
<div class="flex flex-col">
|
<div class="interest-title">{{ $t('利息数量') }}(USDT)</div>
|
<div class="interest-time">{{ item.createTimeStr }}</div>
|
</div>
|
</div>
|
<div class="interest-amount" :class="item.amount / 1 > 0 ? 'text-green' : 'text-red'">{{ item.amount }}</div>
|
</div>
|
</div>
|
</van-list>
|
</van-pull-refresh>
|
</van-tab>
|
</van-tabs>
|
</div>
|
</template>
|
|
<script>
|
import { Tab, Tabs, Icon, List, PullRefresh, Button } from 'vant';
|
import assetsHead from '@/components/Transform/assets-head/index.vue';
|
|
import { getfinacialProductsBought, getMachineBought } from '@/service/financialManagement.api.js';
|
import { _fundRecord } from '@/service/fund.api';
|
import financialList from "@/components/Transform/assetsCenter/financialList.vue";
|
import { isMinerTest } from '@/utils/index.js'
|
export default {
|
name: "index",
|
components: {
|
[Tab.name]: Tab,
|
[Tabs.name]: Tabs,
|
[Icon.name]: Icon,
|
[List.name]: List,
|
[Button.name]: Button,
|
[PullRefresh.name]: PullRefresh,
|
assetsHead,
|
financialList
|
},
|
data() {
|
return {
|
type: 0, // 是普通理财历史 1 是矿池理财历史
|
isLoading: false, // 下拉刷新LOADING
|
loading: false,
|
finished: false,
|
page: 1,
|
active: 0,
|
list: [],
|
}
|
},
|
methods: {
|
isMinerTest,
|
handleGoOrderDetail(item) {
|
if (this.type === 0) {
|
this.$router.push({
|
path: '/cryptos/financialOrder',
|
query: {
|
...item,
|
showBtn: this.active === 0,
|
goBack: true
|
}
|
})
|
} else {
|
this.$router.push({
|
path: '/cryptos/miningMachineOrder',
|
query: {
|
...item,
|
showBtn: this.active === 0,
|
goBack: true
|
}
|
})
|
}
|
},
|
onRefresh() {
|
console.log('refresh')
|
this.init()
|
},
|
onLoad() {
|
this.get()
|
},
|
onchange() {
|
this.init()
|
},
|
init() {
|
this.page = 1
|
this.list = []
|
this.get()
|
},
|
get() {
|
if (this.type === 0) { // 普通理财历史
|
if (this.active === 0) {
|
getfinacialProductsBought({
|
page_no: this.page,
|
state: '1'
|
}).then(res => { // 已购理财产品
|
this.handleData(res)
|
})
|
} else if (this.active === 1) {
|
getfinacialProductsBought({
|
page_no: this.page,
|
state: '2'
|
}).then(res => { // 已赎回理财产品
|
this.handleData(res)
|
})
|
} else {
|
_fundRecord('finance', this.page, 'finance_profit').then(res => { // 利息
|
this.handleData(res)
|
})
|
}
|
} else { // 矿机理财历史
|
if (this.active === 0) {
|
getMachineBought({
|
page_no: this.page,
|
state: '1'
|
}).then(res => { // 已购理财产品
|
this.handleData(res)
|
})
|
} else if (this.active === 1) {
|
getMachineBought({
|
page_no: this.page,
|
state: '2'
|
}).then(res => { // 已赎回理财产品
|
this.handleData(res)
|
})
|
} else {
|
_fundRecord('miner', this.page, 'miner_profit').then(res => { // 利息
|
this.handleData(res)
|
})
|
}
|
}
|
},
|
handleData(data) {
|
this.isLoading = false;
|
console.log(data)
|
this.list = this.list.concat(data)
|
this.loading = false
|
if (data.length < 10) {
|
this.finished = true
|
}
|
this.page++
|
}
|
},
|
created() {
|
if (this.$route.query.tab) {
|
this.active = this.$route.query.tab
|
}
|
if (this.$route.query.type) {
|
this.type = this.$route.query.type / 1
|
}
|
},
|
mounted() {
|
},
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
@import '@/assets/init.scss';
|
|
.MiningPoolFinanceHistory {
|
width: 100%;
|
box-sizing: border-box;
|
|
:deep(.van-tabs__nav) {
|
background-color: $main_background;
|
}
|
|
:deep(.van-tab) {
|
font-size: 32px;
|
}
|
|
:deep(.van-tab--active) {
|
color: $text_color;
|
font-weight: 600;
|
}
|
}
|
|
.history-card-wrap {
|
padding: 16px 32px 0;
|
}
|
|
.history-card {
|
padding: 28px 28px 24px;
|
border-radius: 20px;
|
@include themify() {
|
background: themed('cont_background');
|
}
|
}
|
|
.history-row {
|
display: flex;
|
justify-content: space-between;
|
align-items: flex-start;
|
gap: 20px;
|
padding: 18px 0;
|
font-size: 32px;
|
line-height: 1.45;
|
|
& + & {
|
@include themify() {
|
border-top: 1px solid themed('line_color');
|
}
|
}
|
}
|
|
.history-label {
|
flex-shrink: 0;
|
@include themify() {
|
color: themed('text_color1');
|
}
|
}
|
|
.history-value {
|
text-align: right;
|
font-weight: 500;
|
word-break: break-all;
|
@include themify() {
|
color: themed('text_color');
|
}
|
}
|
|
.history-tip {
|
margin-top: 12px;
|
padding-top: 16px;
|
text-align: center;
|
font-size: 28px;
|
color: #004aee;
|
@include themify() {
|
border-top: 1px solid themed('line_color');
|
}
|
}
|
|
.interest-row {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
margin: 16px 32px 0;
|
padding: 28px;
|
border-radius: 20px;
|
@include themify() {
|
background: themed('cont_background');
|
}
|
}
|
|
.interest-icon {
|
width: 52px;
|
height: 52px;
|
margin-right: 24px;
|
}
|
|
.interest-title {
|
margin-bottom: 12px;
|
font-size: 34px;
|
font-weight: 500;
|
@include themify() {
|
color: themed('text_color');
|
}
|
}
|
|
.interest-time {
|
font-size: 28px;
|
@include themify() {
|
color: themed('text_color1');
|
}
|
}
|
|
.interest-amount {
|
font-size: 40px;
|
font-weight: 600;
|
}
|
</style>
|