index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <!-- 合约 - 合约明细 -->
  2. <template>
  3. <app-view class="contract-detail g-form">
  4. <template #header>
  5. <app-navbar title="合约明细" />
  6. </template>
  7. <Grid :border="false" :column-num="quotes.length ? 2 : 1">
  8. <GridItem icon="peer-pay" text="划转" :to="{ name: 'wallet-transfer', query: { id: accountid } }" />
  9. <GridItem icon="chart-trending-o" text="交易" @click="navigateToContractDetail()" v-if="quotes.length" />
  10. </Grid>
  11. <div class="g-detail-table" v-if="accountItem">
  12. <table cellspacing="0" cellpadding="0">
  13. <tbody>
  14. <tr>
  15. <td>
  16. <span class="text-small">账户权益(USDT)</span>
  17. <span>{{ accountItem.balance }}</span>
  18. </td>
  19. <td>
  20. <span class="text-small">浮动盈亏</span>
  21. <span>{{ formatDecimal(accountItem.profitLoss) }}</span>
  22. </td>
  23. <td>
  24. <span class="text-small">风险率</span>
  25. <span :class="accountItem.hazardRatioColor">{{ parsePercent(accountItem.hazardRatio) }}</span>
  26. </td>
  27. </tr>
  28. <tr>
  29. <td>
  30. <span class="text-small">可用(USDT)</span>
  31. <span>{{ accountItem.avaiableBalance }}</span>
  32. </td>
  33. <td>
  34. <span class="text-small">占用(USDT)</span>
  35. <span>{{ accountItem.usedmargin }}</span>
  36. </td>
  37. <td>
  38. <span class="text-small">冻结(USDT)</span>
  39. <span>{{ accountItem.freezeMargin }}</span>
  40. </td>
  41. </tr>
  42. </tbody>
  43. </table>
  44. </div>
  45. <Tabs>
  46. <Tab title="委托">
  47. <contract-order v-bind="{ accountid }" />
  48. </Tab>
  49. <Tab title="成交">
  50. <contract-trade v-bind="{ accountid }" />
  51. </Tab>
  52. <Tab title="持仓">
  53. <contract-position :params="{ accountid }" />
  54. </Tab>
  55. <Tab title="资金明细">
  56. <contract-statement v-bind="{ accountid }" />
  57. </Tab>
  58. </Tabs>
  59. <ActionSheet v-model:show="showSheet" title="请选择">
  60. <CellGroup style="min-height: 200px;">
  61. <template v-for="(item, index) in quotes" :key="index">
  62. <Cell :title="item.goodsname" :value="item.goodscode" :border="false" is-link
  63. @click="navigateToContractDetail(item.goodsid)" />
  64. </template>
  65. </CellGroup>
  66. </ActionSheet>
  67. </app-view>
  68. </template>
  69. <script lang="ts" setup>
  70. import { shallowRef, computed } from 'vue'
  71. import { Cell, CellGroup, Tab, Tabs, Grid, GridItem, ActionSheet } from 'vant'
  72. import { formatDecimal,parsePercent } from '@/filters'
  73. import { useNavigation } from '@mobile/router/navigation'
  74. import { useAccountStore, useFuturesStore } from '@/stores'
  75. import ContractOrder from '../components/order/index.vue'
  76. import ContractTrade from '../components/trade/index.vue'
  77. import ContractPosition from '../components/position/list/index.vue'
  78. import ContractStatement from '../components/statement/index.vue'
  79. const { router, getQueryStringToNumber } = useNavigation()
  80. const futuresStore = useFuturesStore()
  81. const accountStore = useAccountStore()
  82. const accountid = getQueryStringToNumber('id')
  83. const showSheet = shallowRef(false)
  84. // 合约账户
  85. const accountItem = computed(() => accountStore.getAccountItem({ accountid }))
  86. const quotes = computed(() => futuresStore.quotationList.filter((e) => e.trademode === 10 && (e.goodscurrencyid === accountItem.value?.currencyid || e.currencyid === accountItem.value?.currencyid)))
  87. const navigateToContractDetail = (goodsid?: number) => {
  88. showSheet.value = false
  89. // 多个商品弹出列表选择,单个商品直接跳转
  90. if (quotes.value.length > 1 && !goodsid) {
  91. showSheet.value = true
  92. } else {
  93. router.push({
  94. name: 'contract-goods-detail',
  95. query: {
  96. id: goodsid ?? quotes.value[0].goodsid
  97. }
  98. })
  99. }
  100. }
  101. </script>