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
| <template>
| <view class="coin-list">
| <view class="main layout-page">
| <view :style="{height:taskHeight+'px'}"></view>
| <view>
| <van-search background="transparent" v-model="filterName" show-action @cancel="$emit('close')" @change="filterName=$event.detail" :placeholder="$t('assets.b5')" />
| </view>
| <view class="layout-main">
| <template v-for="item in showList">
| <view
| v-if="coins.indexOf(item.coin_name) != -1"
| class="p-y-md p-x-xs align-center justify-between d-flex link-active m-x-md border-b"
| @click="$emit('input',item.coin_name);$emit('close');$emit('imgs',item)"
| >
|
| <view class="d-flex align-center">
| <img :src="item.image" class="h-25 m-r-xs"/>
| {{item.coin_name}}
| </view>
| <view class="color-light">{{item.usable_balance}}</view>
| </view>
| </template>
| </view>
| </view>
| </view>
| </template>
| <script>
| import Wallet from "@/api/wallet";
| export default {
| props: {
| value: {
| default: "",
| type: String,
| required: false,
| },
| },
| data() {
| return {
| filterName: "",
| coinList: [],
| taskHeight:0,
| // coins:['USDT','USDC','BTC','ETH','DOT','LTC','TRX','ARB','AGIX','DOGE','SOL','BCH','ETC']
| coins:['USDT','USDC','BTC','ETH',]
| };
| },
| computed: {
| showList() {
| return this.coinList.filter((item) => this.isShow(item.coin_name));
| },
| },
| methods: {
| getCoinList() {
| Wallet.fundAccount()
| .then((res) => {
| this.coinList = res.data.list;
| if (!this.value) {
| this.$emit("input", this.coinList[0].coin_name);
| }
| })
| .catch(() => {});
| },
| isShow(str) {
| return (
| str.toLocaleLowerCase().indexOf(this.filterName.toLocaleLowerCase()) !=
| -1
| );
| },
| getTaskHeight(){
| uni.getSystemInfo({
| success:(obj)=>{
| this.taskHeight = obj.statusBarHeight
| }
| })
| }
| },
| created() {
| this.getTaskHeight()
| this.getCoinList();
| },
| };
| </script>
| <style lang="scss" scoped>
| .coin-list {
| position: fixed;
| left: 0;
| top: 0;
| right: 0;
| bottom: 0;
| z-index: 9;
| animation: coinList 0.3s;
| background: rgba(0,0,0,0.5);
| }
| .main{
| position: fixed;
| top: 5%;
| left: 0;
| bottom: 0;
| right: 0;
| border-radius: 20px 20px 0 0;
| }
| @keyframes coinList {
| from {
| transform: translateY(100%);
| }
| to {
| transform: translateY(0);
| }
| }
| </style>
|
|