TradeInfo.vue 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <div>
  3. <v-container>
  4. <div v-for="trade in item.tradeInfo">
  5. <v-row>
  6. <!--token symbol-->
  7. <v-chip v-if="!trade.tokenSymbol"
  8. label class="ma-2 tradeLabel" @click="httpKit.jumpToEthw(trade.token, 'token')">
  9. <!-- 没有名字的 -->
  10. <div class="tokenName">{{ hashKit.headAndEnd2(trade.token) }}</div>
  11. <div class="tokenAmount">{{ numKit._N(trade.amount, 4) }} </div>
  12. </v-chip>
  13. <v-chip v-else
  14. label class="ma-2 tradeLabel" :color="hashKit.generateColorByHash(trade.token)"
  15. @click="httpKit.jumpToEthw(trade.token, 'token')">
  16. <!-- 有名字的和Ethereum/EthereumPow -->
  17. <div class="tokenName">{{ trade.tokenSymbol }}</div>
  18. <div class="tokenAmount">{{ numKit._N(trade.amount, 4) }}</div>
  19. </v-chip>
  20. <!--from-->
  21. <div>
  22. <v-chip v-if="trade.from === item.from"
  23. label class="ma-2" color="green lighten-3" @click="httpKit.jumpToEthw(trade.from)">
  24. {{ hashKit.headAndEnd2(trade.from) }}
  25. </v-chip>
  26. <v-chip v-else-if="trade.from === item.to"
  27. label class="ma-2" color="indigo lighten-4" @click="httpKit.jumpToEthw(trade.from)">
  28. <div v-if="!trade.fromName">{{ hashKit.headAndEnd2(trade.from) }}</div>
  29. <div v-else>{{ trade.fromName }}</div>
  30. </v-chip>
  31. <v-chip v-else
  32. label class="ma-2" :color="hashKit.generateColorByHash(trade.from)"
  33. @click="httpKit.jumpToEthw(trade.from)">
  34. <div v-if="!trade.fromName">{{ hashKit.headAndEnd2(trade.from) }}</div>
  35. <div v-else>{{ trade.fromName }}</div>
  36. </v-chip>
  37. </div>
  38. <v-icon>mdi-arrow-expand-right</v-icon>
  39. <!--to-->
  40. <div>
  41. <v-chip v-if="trade.to === item.from"
  42. label class="ma-2" color="green lighten-3" @click="httpKit.jumpToEthw(trade.to)">
  43. {{ hashKit.headAndEnd2(trade.to) }}
  44. </v-chip>
  45. <v-chip v-else-if="trade.to === item.to"
  46. label class="ma-2" color="indigo lighten-4" @click="httpKit.jumpToEthw(trade.to)">
  47. <div v-if="!trade.toName">{{ hashKit.headAndEnd2(trade.to) }}</div>
  48. <div v-else>{{ trade.toName }}</div>
  49. </v-chip>
  50. <v-chip v-else
  51. label class="ma-2" :color="hashKit.generateColorByHash(trade.to)" @click="httpKit.jumpToEthw(trade.to)">
  52. <div v-if="!trade.toName">{{ hashKit.headAndEnd2(trade.to) }}</div>
  53. <div v-else>{{ trade.toName }}</div>
  54. </v-chip>
  55. </div>
  56. </v-row>
  57. <v-row>
  58. <v-divider></v-divider>
  59. </v-row>
  60. </div>
  61. </v-container>
  62. </div>
  63. </template>
  64. <script>
  65. import NumKit from '@/plugins/kit/NumKit'
  66. import HashKit from '@/plugins/kit/HashKit'
  67. import HttpKit from '@/plugins/kit/HttpKit'
  68. export default {
  69. name: 'TradeInfo',
  70. props: ['item'],
  71. data: () => ({
  72. numKit: NumKit,
  73. hashKit: HashKit,
  74. httpKit: HttpKit
  75. })
  76. }
  77. </script>
  78. <style scoped>
  79. </style>