投屏pc端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

214 lines
6.1 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. <template>
  2. <div class="global-width">
  3. <div class="container">
  4. <!--当前位置-->
  5. <div class="hc-breadcrumb">
  6. <router-link to="/assets/coincoin" class="otc-index-btn">{{$t('币币账户')}}</router-link>
  7. <router-link to="/assets/currency" class="otc-index-btn hc-btn-active">{{$t('法币账户')}}</router-link>
  8. </div>
  9. <div class="order-table-top hc-bgColor3">
  10. <div class="order-top-div1">
  11. <span class="assetManang-span1">
  12. {{$t('总资产折合')}}{{currencyBalance}} BTC<span class="assetManang-span2"> {{currencyTransfer}} CNY</span>
  13. </span>
  14. <label role="checkbox" class="el-checkbox set-default">
  15. <el-checkbox v-model="isView"></el-checkbox>
  16. <span class="el-checkbox_label">{{$t('隐藏数量为0的币种')}}</span>
  17. </label>
  18. </div>
  19. <div class="order-top-div1">
  20. <div class="soso-box soso-boxs">
  21. <el-input class="inp" :placeholder="$t('搜索币种')" v-model="searchKeywords" type="text" clearable autocomplete="off">
  22. </el-input>
  23. <i class="icon-search icon-searchs"></i>
  24. </div>
  25. </div>
  26. <div class="order-top-div2">
  27. <span class="hc-color4" @click="$router.push('/assets/currencyRecords')">{{$t('财务记录')}}</span>
  28. <!-- <span class="hc-color4">{{$t('提币地址管理')}}</span> -->
  29. </div>
  30. </div>
  31. <div class="account-table">
  32. <table class="table">
  33. <thead>
  34. <tr>
  35. <th>
  36. <div class="cell">{{$t('币种')}}</div>
  37. </th>
  38. <th>
  39. <div class="cell">
  40. {{$t('可用')}}
  41. <!-- <span class="caret-wrapper">
  42. <i class="sort-caret ascending active"></i>
  43. <i class="sort-caret descending"></i>
  44. </span> -->
  45. </div>
  46. </th>
  47. <th>
  48. <div class="cell">
  49. {{$t('冻结')}}
  50. <!-- <span class="caret-wrapper">
  51. <i class="sort-caret ascending"></i>
  52. <i class="sort-caret descending"></i>
  53. </span> -->
  54. </div>
  55. </th>
  56. <th class="is-right">{{$t('操作')}}</th>
  57. </tr>
  58. </thead>
  59. <tbody>
  60. <tr v-for="(item, index) of currencyList" :key="index">
  61. <td>
  62. <div class="cell">
  63. <img class="quotation-table-img" :src="'data:img/jpg;base64,' + item.iconUrl" v-if="item.iconUrl">
  64. <div class="quotation-table-text">{{item.coinEngName}}</div>
  65. </div>
  66. </td>
  67. <td>
  68. <div class="cell">{{item.normalAmount}}</div>
  69. </td>
  70. <td>
  71. <div class="cell">{{item.freezeAmount}}</div>
  72. </td>
  73. <td class="is-right">
  74. <div class="cell">
  75. <ul class="operation-ul nav-dropdown">
  76. <li>
  77. <span class="hc-color4 el-dropdown-selfdefine" @click="gotoTrade(item.coinEngName)">
  78. <img src="../../assets/images/icon-deal-with.png">
  79. <span>{{$t('去交易')}}</span>
  80. </span>
  81. </li>
  82. <li>
  83. <span class="hc-color2 el-dropdown-selfdefine" @click="$router.push('/assets/transfer/2/' + item.coinEngName)">
  84. <img src="../../assets/images/trade/icon-transfer.png">
  85. <span>{{$t('划转')}}</span>
  86. </span>
  87. </li>
  88. <li class="chdui">
  89. <span class="hc-color1 el-dropdown-selfdefine" @click="$router.push('/assets/exchange/2/' + item.coinEngName)">
  90. <img src="../../assets/images/dui.png">
  91. <span>{{$t('兑换')}}</span>
  92. </span>
  93. </li>
  94. </ul>
  95. </div>
  96. </td>
  97. </tr>
  98. </tbody>
  99. </table>
  100. <no-content :isText="$t('暂无数据')" :isContent="currencyList.length == 0"></no-content>
  101. </div>
  102. </div>
  103. </div>
  104. </template>
  105. <script>
  106. import { mapState } from 'vuex'
  107. import noContent from '@/components/no_content'
  108. export default {
  109. name: 'coincoinAssets',
  110. components: {
  111. noContent,
  112. },
  113. data() {
  114. return {
  115. assetsList: [], //所有资产
  116. isView: false, //是否隐藏小额币种
  117. searchKeywords: '', //搜索关键字
  118. }
  119. },
  120. computed: {
  121. ...mapState('trend', ['allCoinList']),
  122. currencyBalance() { //法币总资产
  123. let value = 0;
  124. this.assetsList.forEach(item => {
  125. value = value + parseFloat(item.toTargetCoin);
  126. })
  127. return value;
  128. },
  129. currencyTransfer() { //法币总资产转换
  130. let value = 0;
  131. this.assetsList.forEach(item => {
  132. value = value + parseFloat(item.toCurrency);
  133. })
  134. return value;
  135. },
  136. currencyList() { //法币资产列表
  137. let list = [];
  138. if(this.searchKeywords && this.isView) {
  139. this.assetsList.forEach(item => {
  140. if (item.coinEngName.toUpperCase().indexOf(this.searchKeywords.toUpperCase()) > -1 && item.normalAmount > 0) {
  141. let icon = this.getIcon(item.coinId);
  142. this.$set(item, 'iconUrl', icon);
  143. list.push(item);
  144. }
  145. });
  146. } else if (!this.searchKeywords && this.isView) { //过滤余额为0的资产
  147. this.assetsList.forEach(item => {
  148. if (item.normalAmount > 0) {
  149. let icon = this.getIcon(item.coinId);
  150. this.$set(item, 'iconUrl', icon);
  151. list.push(item);
  152. }
  153. })
  154. } else if(this.searchKeywords && !this.isView) {
  155. this.assetsList.forEach(item => {
  156. if (item.coinEngName.toUpperCase().indexOf(this.searchKeywords.toUpperCase()) > -1) {
  157. let icon = this.getIcon(item.coinId);
  158. this.$set(item, 'iconUrl', icon);
  159. list.push(item);
  160. }
  161. });
  162. } else {
  163. list = this.assetsList;
  164. list.forEach(item => {
  165. let icon = this.getIcon(item.coinId);
  166. this.$set(item, 'iconUrl', icon);
  167. });
  168. }
  169. return list;
  170. },
  171. },
  172. methods: {
  173. getAssetsList() { //获取法币账户
  174. this.getAxios('/api/user/assets/list?type=F_COIN')
  175. .then(data => {
  176. this.assetsList = data.data;
  177. })
  178. },
  179. getIcon(id) { //获取币种图标
  180. let img;
  181. this.allCoinList.forEach(item => {
  182. if(item.id == id) {
  183. img = item.image;
  184. }
  185. })
  186. return img;
  187. },
  188. gotoTrade(id) { //去交易
  189. this.$router.push({
  190. path: '/currency/trade',
  191. query: {
  192. id: id,
  193. }
  194. });
  195. }
  196. },
  197. created() {
  198. this.getAssetsList();
  199. }
  200. }
  201. </script>
  202. <style>
  203. </style>