index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <app-view class="spot-detail g-form">
  3. <template #header>
  4. <app-navbar title="现货明细" />
  5. </template>
  6. <Grid :border="false" :column-num="quotes.length ? 3 : 2">
  7. <GridItem icon="pending-payment" text="充值"
  8. :to="{ name: 'wallet-deposit', query: { id: digitalaccountid } }" />
  9. <GridItem icon="paid" text="提现" :to="{ name: 'wallet-withdraw', query: { id: digitalaccountid } }" />
  10. <GridItem icon="chart-trending-o" text="交易" @click="navigateToSpotDetail()" v-if="quotes.length" />
  11. </Grid>
  12. <div class="g-detail-table" v-if="accountItem">
  13. <table cellspacing="0" cellpadding="0">
  14. <tbody>
  15. <tr>
  16. <td colspan="2">
  17. <span class="text-small">余额({{ accountItem.currencycode }})</span>
  18. <span>
  19. {{ formatDecimal(accountItem.currentbalance, accountItem.currencydecimalplace) }}
  20. </span>
  21. </td>
  22. </tr>
  23. <tr>
  24. <td>
  25. <span class="text-small">可用({{ accountItem.currencycode }})</span>
  26. <span>
  27. {{ formatDecimal(spotAccountStore.getAvailableBalance(accountItem), accountItem.currencydecimalplace) }}
  28. </span>
  29. </td>
  30. <td>
  31. <span class="text-small">冻结({{ accountItem.currencycode }})</span>
  32. <span>
  33. {{ formatDecimal(accountItem.freezemargin, accountItem.currencydecimalplace) }}
  34. </span>
  35. </td>
  36. </tr>
  37. </tbody>
  38. </table>
  39. </div>
  40. <Tabs>
  41. <Tab title="充值">
  42. <wallet-record :params="{ digitalaccountid, transfertypes: '1' }" />
  43. </Tab>
  44. <Tab title="提现">
  45. <wallet-record :params="{ digitalaccountid, transfertypes: '2' }" />
  46. </Tab>
  47. <Tab title="转入">
  48. <wallet-record :params="{ digitalaccountid, transfertypes: '3' }" />
  49. </Tab>
  50. <Tab title="转出">
  51. <wallet-record :params="{ digitalaccountid, transfertypes: '4' }" />
  52. </Tab>
  53. <Tab title="委托">
  54. <spot-order :params="{ digitalaccountid }" showDatePicker />
  55. </Tab>
  56. <Tab title="成交">
  57. <spot-trade :params="{ digitalaccountid }" showDatePicker />
  58. </Tab>
  59. <Tab title="资金明细">
  60. <spot-statement :params="{ digitalaccountid }" />
  61. </Tab>
  62. </Tabs>
  63. <ActionSheet v-model:show="showSheet" title="请选择">
  64. <CellGroup style="min-height: 200px;">
  65. <template v-for="(item, index) in quotes" :key="index">
  66. <Cell :title="item.goodsname" :value="item.goodscode" :border="false" is-link
  67. @click="navigateToSpotDetail(item.goodsid)" />
  68. </template>
  69. </CellGroup>
  70. </ActionSheet>
  71. </app-view>
  72. </template>
  73. <script lang="ts" setup>
  74. import { shallowRef, computed } from 'vue'
  75. import { Cell, CellGroup, Tab, Tabs, Grid, GridItem, ActionSheet } from 'vant'
  76. import { formatDecimal } from '@/filters'
  77. import { useNavigation } from '@mobile/router/navigation'
  78. import { useFuturesStore } from '@/stores'
  79. import { useSpotAccountStore } from '../../wallet/components/spot/composables'
  80. import WalletRecord from '../../wallet/components/record/index.vue'
  81. import SpotOrder from '../components/order/index.vue'
  82. import SpotTrade from '../components/trade/index.vue'
  83. import SpotStatement from '../components/statement/index.vue'
  84. const { router, getQueryStringToNumber } = useNavigation()
  85. const futuresStore = useFuturesStore()
  86. const spotAccountStore = useSpotAccountStore()
  87. const currencyid = getQueryStringToNumber('id')
  88. const showSheet = shallowRef(false)
  89. const accountItem = computed(() => spotAccountStore.getAccountItem({ currencyid }))
  90. const digitalaccountid = computed(() => accountItem.value?.digitalaccountid || '0')
  91. const quotes = computed(() => futuresStore.quotationList.filter((e) => e.trademode === 80 && (e.goodscurrencyid === currencyid || e.currencyid === currencyid)))
  92. const navigateToSpotDetail = (goodsid?: number) => {
  93. showSheet.value = false
  94. // 多个商品弹出列表选择,单个商品直接跳转
  95. if (quotes.value.length > 1 && !goodsid) {
  96. showSheet.value = true
  97. } else {
  98. router.push({
  99. name: 'spot-goods-detail',
  100. query: {
  101. id: goodsid ?? quotes.value[0].goodsid
  102. }
  103. })
  104. }
  105. }
  106. </script>