1
李凌
2026-01-20 9a9d832dbd364557e070abcd9a7779a2c6c07ffb
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
<template>
  <div class="ico">
    <fx-header>
      <template v-slot:title>
        <div>ICO</div>
      </template>
      <template v-slot:right>
        <van-icon name="todo-list-o" @click="$router.push('/ICO/icoRecord')"/>
      </template>
    </fx-header>
 
    <div class="ico_list">
      <div class="ico_item mb-5" v-for="i in icoList" :key="i.id">
        <div class="item_1">
          <div>
            {{ i.symbol }}
          </div>
          <div class="item_1_1">
            {{ i.name }}
          </div>
        </div>
        <div class="item_2 flex justify-between">
          <div>{{ $t('每张金额') }}</div>
          <div>{{ i.unitAmount }}</div>
        </div>
        <div class="item_2 flex justify-between">
          <div>{{ $t('每张手续费') }}</div>
          <div>{{ i.unitFee }}</div>
        </div>
        <div class="item_2 flex justify-between">
          <div class="mr-5">{{ $t('申购时间') }}</div>
          <div>{{ i.startDate }} ~ {{ i.endDate }}</div>
        </div>
        <div class="item_2 flex justify-between">
          <div>{{ $t('listingDate') }}</div>
          <div>{{ i.marketDate }}</div>
        </div>
        <div class="item_3 flex justify-center">
          <van-button type="default" round size="large" @click="openBuy(i)">{{ $t('申购') }}</van-button>
        </div>
      </div>
    </div>
 
 
    <!-- 购买弹窗 -->
    <van-popup v-model:show="show" round>
      <div class="buy_popup">
        <div class="buy_title flex justify-center">{{ itemObj.symbol }}</div>
 
        <van-field v-model="sgNum" type="digit" :label="$t('申购数量')"/>
 
        <div class="flex justify-center mt-5">
          <van-button type="default" size="large" round @click="buy">{{ $t('confirm') }}</van-button>
        </div>
      </div>
    </van-popup>
  </div>
</template>
 
<script setup>
import {ref} from "vue";
import {showToast} from 'vant'
import {_icoList, _icoSubscribe} from "@/service/ico.api.js";
import {useI18n} from "vue-i18n";
 
const {t} = useI18n()
 
// 获取列表
const icoList = ref([])
_icoList().then(res => {
  icoList.value = res.records
}).catch(err => {
  showToast(err.msg)
})
 
// 打开申购弹窗
const show = ref(false) // 控制弹窗显示
const itemObj = ref({}) // ico列表项
const sgNum = ref(0) // 申购数量
const openBuy = (i) => {
  show.value = true
  itemObj.value = i
}
 
// 申购
const buy = () => {
  let opt = {
    icoProjectId: itemObj.value.id,
    subscribeNums: sgNum.value,
    subscriptionType: 1,
  }
  _icoSubscribe(opt).then(res => {
    showToast(t('submitSuccess'))
    show.value = false
  }).catch(err => {
    showToast(err)
  })
}
 
</script>
 
<style lang="scss" scoped>
.ico {
  padding: 0rem 1.2rem 2rem 1.2rem;
  font-size: 1.5rem;
 
  .buy_popup {
    width: 40rem;
    padding: 1rem;
 
    .buy_title {
      font-size: 2.5rem;
      font-weight: 700;
      border-bottom: #aaa solid 1px;
      padding: 1rem;
    }
  }
 
  .ico_list {
    padding: 1rem 0rem;
 
    .ico_item {
      padding: .5rem 1rem;
      color: #999;
      font-size: 1.6rem;
      border: #eee solid 1px;
      border-radius:6px;
      //border: #aaa solid 1px;
      //border-radius: 1rem;
 
      @include themify() {
        //background-color: themed("input_background");
      }
 
      .item_1 {
        padding: 1rem .5rem;
        border-bottom: #eee solid 1px;
        font-size: 2.5rem;
        color: black;
        .item_1_1{
          color: #999;
          font-size: 2rem;
        }
      }
 
      .item_2 {
        padding: 1rem .5rem;
        font-size: 1.4rem;
        font-weight: 500;
 
        & > div:last-child {
          font-size: 1.7rem;
          color: #333;
        }
      }
 
      .item_3 {
        padding: .5rem;
      }
    }
  }
}
</style>