1
李凌
2026-01-21 09cd59e111da050db1e26621a231c7e2eb7a415b
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<template>
    <div class="icoRecord">
        <fx-header>
            <template v-slot:title>
                <div>{{ $t('申购记录') }}</div>
            </template>
        </fx-header>
 
        <van-tabs v-model:active="active">
            <van-tab name="0" :title="$t('all')"></van-tab>
            <van-tab name="1" :title="$t('已认购')"></van-tab>
            <van-tab name="2" :title="$t('未中签')"></van-tab>
            <van-tab name="3" :title="$t('已中签')"></van-tab>
            <van-tab name="4" :title="$t('已缴纳')"></van-tab>
            <van-tab name="5" :title="$t('已分发')"></van-tab>
        </van-tabs>
 
        <div class="icoRecord_list">
            <div class="icoRecord_item mb-5" v-for="(item, index) in recordLIst" :key="index">
                <div class="item_1">
                    {{ item.symbol }} ({{ item.name }})
                </div>
                <div class="item_2 flex justify-between">
                    <div>{{ $t('state') }}</div>
                    <div>{{ getStatus(item.status) }}</div>
                </div>
                <div class="item_2 flex justify-between">
                    <div>{{ $t('申购数量') }}</div>
                    <div>{{ item.subscribeNums }}</div>
                </div>
                <div class="item_2 flex justify-between">
                    <div>{{ $t('中签数量') }}</div>
                    <div>{{ item.ballotNumber }}</div>
                </div>
 
                <div class="item_2 flex justify-between">
                    <div>{{ $t('中签时间') }}</div>
                    <div>{{ item.endTime }}</div>
                </div>
                <div class="item_2 flex justify-between">
                    <div>{{ $t('发行价') }}</div>
                    <div>{{ item.issuePrice }}</div>
                </div>
                <div class="item_2 flex justify-between">
                    <div>{{ $t('现价') }}</div>
                    <div>{{ item.currentPrice }}</div>
                </div>
                <div class="item_2 flex justify-between">
                    <div>{{ $t('利润') }}</div>
                    <div>{{ item.profit }}</div>
                </div>
                <div class="item_2 flex justify-between">
                    <div>{{ $t('申购总额') }}</div>
                    <div>{{ item.subscriptionTotalAmount }}</div>
                </div>
                <div class="item_2 flex justify-between">
                    <div>{{ $t('现价总额') }}</div>
                    <div>{{ item.currentTotalPrice }}</div>
                </div>
                <div class="item_2 flex justify-between">
                    <div>{{ $t('利润百分比') }}</div>
                    <div>{{ item.profitPercent ? (item.profitPercent + '%') : '0' }}</div>
                </div>
                <div class="item_3" v-if="item.status == 5">
                    <van-button type="primary" block round @click="goToSell(item)">{{ $t('卖出') }}</van-button>
                </div>
            </div>
        </div>
    </div>
</template>
 
<script setup>
import { ref, watch } from "vue";
import { showToast } from 'vant'
import { _icoRecordList } from "@/service/ico.api.js";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import { setStorage } from "@/utils/index.js";
const { t } = useI18n()
const router = useRouter()
 
// tab切换
const active = ref('0');
watch(active, (val) => {
    getList()
})
 
// 获取记录列表
const recordLIst = ref([]) // 记录列表
const getList = () => {
    let opt = {
        status: active.value
    }
    if (opt.status == '0') delete opt.status
    _icoRecordList(opt).then((res) => {
        console.log(res);
        recordLIst.value = res.records
    })
}
getList()
 
// 根据状态转换对应的文字
const getStatus = (status) => {
    let str = ''
    switch (status) {
        case 1:
            str = t('已认购')
            break;
        case 2:
            str = t('未中签')
            break;
        case 3:
            str = t('已中签')
            break;
        case 4:
            str = t('已缴纳')
            break;
        case 5:
            str = t('已分发')
            break;
        default:
            break;
    }
    return str
}
 
// 跳转到卖出页面
const goToSell = (item) => {
    // 将卖出参数存储到 localStorage,供交易页面读取
    setStorage('tradeSellParams', {
        volume: item.ballotNumber || '0',
        mode: 'close' // 卖出模式
    })
    if (item.symbol) {
        router.push(`/cryptos/trade/${item.symbol}`)
    } else {
        showToast(t('交易对信息错误'))
    }
}
</script>
 
<style lang="scss" scoped>
.icoRecord {
    padding: 0rem 1.2rem 2rem 1.2rem;
    font-size: 1.5rem;
 
    .icoRecord_list {
        padding: 1rem 0rem;
 
        .icoRecord_item {
            background-color: #333;
            padding: .5rem 1rem;
            border: #aaa solid 1px;
            border-radius: 1rem;
 
            .item_1 {
                padding: 1rem .5rem;
                border-bottom: #ccc solid 1px;
                font-size: 2rem;
                font-weight: 700;
            }
 
            .item_2 {
                padding: 1rem .5rem;
                border-bottom: #ccc solid 1px;
                font-size: 1.6rem;
                font-weight: 500;
 
                &>div:last-child {
                    color: #999;
                }
            }
 
            .item_3 {
                padding: 1rem .5rem;
                margin-top: 1rem;
            }
        }
    }
}
</style>