currency-select.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <!-- 货币列表 -->
  2. <template>
  3. <div class="list-item" v-for="(item, index) in props.list" :key="index">
  4. <div class="item-title">
  5. <img class="icon" :src="item.chainInfo.iconPath" />
  6. {{item.chainInfo.chainName}}
  7. </div>
  8. <div class="item-detail" @click="selectCurrency(item)">
  9. <div class="left">
  10. <img class="icon-currency" :src="item.iconPath" />
  11. <div class="currency-info">
  12. <div class="name">{{ item.currencyCode == 'USD' ? 'USD' : item.tokenSymbol }}</div>
  13. <div class="desc">{{ item.currencyCode == 'USD' ? 'Paypal' : item.currencyName }}</div>
  14. </div>
  15. </div>
  16. <div class="right">
  17. <div class="num">
  18. <a-tooltip :title="item.balance">
  19. {{ getBit(item.balance) }}
  20. </a-tooltip>
  21. </div>
  22. <div class="amount" v-if="item.currencyType == 2">
  23. <a-tooltip :title="'$'+item.usdEstimateBalance">
  24. ${{ getBit(item.usdEstimateBalance) }}
  25. </a-tooltip>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. </template>
  31. <script setup>
  32. import { defineProps, defineEmits } from 'vue';
  33. import { getBit } from "@/uilts/help";
  34. let props = defineProps({
  35. list: {
  36. type: Array,
  37. default: [],
  38. }
  39. })
  40. let emits = defineEmits(['selectCurrency']);
  41. let selectCurrency = (params) => {
  42. emits('selectCurrency', params);
  43. }
  44. </script>
  45. <style scoped lang="scss">
  46. .list-item {
  47. .item-title {
  48. display: flex;
  49. align-items: center;
  50. height: 42px;
  51. padding: 0 10px;
  52. box-sizing: border-box;
  53. background: #f7f7f7;
  54. font-weight: 500;
  55. font-size: 14px;
  56. color: #a2a2a2;
  57. .icon {
  58. width: 24px;
  59. height: 24px;
  60. margin-right: 6px;
  61. }
  62. }
  63. .item-detail {
  64. display: flex;
  65. justify-content: space-between;
  66. align-items: center;
  67. padding: 12px 20px;
  68. box-sizing: border-box;
  69. cursor: pointer;
  70. .left {
  71. display: flex;
  72. .icon-currency {
  73. width: 24px;
  74. height: 24px;
  75. margin-right: 12px;
  76. }
  77. .currency-info {
  78. .name {
  79. font-weight: 500;
  80. font-size: 15px;
  81. margin-bottom: 5px;
  82. }
  83. .desc {
  84. font-weight: 400;
  85. font-size: 12px;
  86. color: #a2a2a2;
  87. }
  88. }
  89. }
  90. .right {
  91. text-align: right;
  92. max-width: calc(100% - 150px);
  93. .num, .amount {
  94. word-break: break-all;
  95. }
  96. .num {
  97. font-weight: 500;
  98. font-size: 15px;
  99. margin-bottom: 5px;
  100. }
  101. .amount {
  102. font-weight: 400;
  103. font-size: 12px;
  104. color: #a2a2a2;
  105. }
  106. }
  107. }
  108. }
  109. </style>