accountList.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
  3. <cwg-header :title="t('Home.page_ib.item10')" />
  4. <view class="account-content">
  5. <view class="search-content">
  6. <view class="search-bar">
  7. <cwg-combox v-model:value="search.platform" :options="platformOptions"
  8. :placeholder="t('placeholder.choose')" />
  9. <uni-easyinput v-model="search.login" :placeholder="t('Label.Login')" />
  10. <uni-easyinput v-model="search.cId" placeholder="CID" />
  11. <uni-datetime-picker type="daterange" v-model="search.date"
  12. :placeholder="t('placeholder.Start') + ' - ' + t('placeholder.End')" @change="handleDateChange"/>
  13. </view>
  14. <view />
  15. </view>
  16. <cwg-tabel
  17. ref="tableRef"
  18. :columns="columns"
  19. :mobilePrimaryFields="mobilePrimaryFields"
  20. :queryParams="search"
  21. :api="listApi"
  22. :show-operation="true"
  23. :showPagination="true"
  24. >
  25. <template #action="{ row }">
  26. <cwg-dropdown :menu-list="menuList(row)" @menuClick="handleMenuClick">
  27. <view class="pc-header-btn">
  28. <cwg-icon name="crm-ellipsis" :size="24" />
  29. </view>
  30. </cwg-dropdown>
  31. </template>
  32. </cwg-tabel>
  33. </view>
  34. </cwg-page-wrapper>
  35. </template>
  36. <script setup lang="ts">
  37. // 账户管理
  38. import { ref, reactive, computed, onMounted, onUnmounted } from 'vue'
  39. import { onLoad } from '@dcloudio/uni-app'
  40. import { useI18n } from 'vue-i18n' // uni-app 中已集成,但需配置
  41. import { customApi } from '@/service/custom'
  42. import { financialApi } from '@/service/financial'
  43. import Config from '@/config/index'
  44. import { lang } from '@/composables/config'
  45. import { ibApi } from '@/service/ib'
  46. import { useFilters } from '@/composables/useFilters'
  47. const { numberFormat, numberDecimal } = useFilters()
  48. const search = ref({
  49. cId: '',
  50. login: '',
  51. date: '',
  52. platform: 'MT4',
  53. startDate: '',
  54. endDate: '',
  55. })
  56. const platformOptions = [
  57. { text: 'MT4', value: 'MT4' },
  58. { text: 'MT5', value: 'MT5' },
  59. ]
  60. const { t, locale } = useI18n()
  61. // 表格列配置
  62. const columns = ref([
  63. {
  64. prop: 'login',
  65. label: t('Label.Login'),
  66. align: 'center',
  67. },
  68. {
  69. prop: 'name',
  70. label: t('Ib.Custom.NameLabel'),
  71. align: 'center',
  72. },
  73. {
  74. prop: 'platform',
  75. label: t('Label.Platform'),
  76. align: 'center',
  77. },
  78. {
  79. prop: 'groupName',
  80. label: t('Label.GroupName'),
  81. align: 'center',
  82. },
  83. {
  84. prop: 'type',
  85. type: 'tag',
  86. label: t('Label.LoginType'),
  87. align: 'center',
  88. tagMap: {
  89. 1: t('AccountType.ClassicAccount'),
  90. 2: t('AccountType.SeniorAccount'),
  91. 5: t('AccountType.SpeedAccount'),
  92. 6: t('AccountType.SpeedAccount'),
  93. 7: t('AccountType.StandardAccount'),
  94. 8: t('AccountType.CentAccount'),
  95. },
  96. },
  97. {
  98. prop: 'Leverage',
  99. label: t('Label.Leverage'),
  100. align: 'center',
  101. formatter: ({ row }) => row.leverage ? `1:${row.leverage}` : '--',
  102. },
  103. {
  104. prop: 'currency',
  105. label: t('Label.Currency'),
  106. align: 'center',
  107. },
  108. {
  109. prop: 'balance',
  110. label: t('Label.LoginBalance'),
  111. align: 'center',
  112. formatter: ({ row }) => numberFormat(row.balance ?? 0),
  113. },
  114. {
  115. prop: 'countryEnName',
  116. label: t('Label.Country'),
  117. align: 'center',
  118. },
  119. {
  120. prop: 'registration',
  121. label: t('Label.ApplyTime'),
  122. align: 'center',
  123. },
  124. ])
  125. const mobilePrimaryFields = ref([
  126. {
  127. prop: 'login',
  128. label: t('Label.Login'),
  129. align: 'center',
  130. },
  131. {
  132. prop: 'name',
  133. label: t('Ib.Custom.NameLabel'),
  134. align: 'center',
  135. },
  136. {
  137. prop: 'platform',
  138. label: t('Label.Platform'),
  139. align: 'center',
  140. },
  141. {
  142. prop: 'more',
  143. type: 'more',
  144. width: 20,
  145. align: 'right',
  146. },
  147. ])
  148. const listApi = ref(ibApi.accountSubs)
  149. const handleDateChange = (val) => {
  150. search.value.startDate = val[0]
  151. search.value.endDate = val[1]
  152. }
  153. </script>
  154. <style lang="scss" scoped>
  155. @import "@/uni.scss";
  156. .search-content {
  157. display: flex;
  158. justify-content: space-between;
  159. }
  160. </style>