accountList.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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-complex-search :fields="filterFields" v-model="searchParams" @search="handleSearch" @reset="handleReset" />
  8. </view>
  9. </view>
  10. <cwg-tabel
  11. ref="tableRef"
  12. :columns="columns"
  13. :mobilePrimaryFields="mobilePrimaryFields"
  14. :queryParams="search"
  15. :api="listApi"
  16. :show-operation="true"
  17. :showPagination="true"
  18. >
  19. <template #action="{ row }">
  20. <cwg-dropdown :menu-list="menuList(row)" @menuClick="handleMenuClick">
  21. <view class="pc-header-btn">
  22. <cwg-icon name="crm-ellipsis" :size="24" />
  23. </view>
  24. </cwg-dropdown>
  25. </template>
  26. </cwg-tabel>
  27. </view>
  28. </cwg-page-wrapper>
  29. </template>
  30. <script setup lang="ts">
  31. // 账户管理
  32. import { ref } from 'vue'
  33. import { useI18n } from 'vue-i18n'
  34. import { ibApi } from '@/service/ib'
  35. import { useFilters } from '@/composables/useFilters'
  36. const { numberFormat } = useFilters()
  37. const { t } = useI18n()
  38. const searchParams = ref({})
  39. const search = ref({
  40. cId: '',
  41. login: '',
  42. platform: 'MT4',
  43. startDate: '',
  44. endDate: '',
  45. })
  46. const platformOptions = [
  47. { text: 'MT4', value: 'MT4' },
  48. { text: 'MT5', value: 'MT5' },
  49. ]
  50. const filterFields = [
  51. { key: 'platform', type: 'select', label: t('Label.Platform'), placeholder: t('placeholder.choose'), options: platformOptions, defaultValue: 'MT4', isSelect: true },
  52. { key: 'login', type: 'input', label: t('Label.Login'), placeholder: t('Label.Login'), defaultValue: '' },
  53. { key: 'cId', type: 'input', label: 'CID', placeholder: 'CID', defaultValue: '' },
  54. { key: 'date', label: t('placeholder.Start') + ' - ' + t('placeholder.End'), type: 'daterange' },
  55. ]
  56. const tableRef = ref<any>(null)
  57. const handleSearch = (params: any) => {
  58. const payload = { ...params }
  59. if (payload.date && Array.isArray(payload.date) && payload.date.length === 2) {
  60. payload.startDate = payload.date[0]
  61. payload.endDate = payload.date[1]
  62. } else {
  63. payload.startDate = ''
  64. payload.endDate = ''
  65. }
  66. delete payload.date
  67. search.value = payload
  68. tableRef.value?.refreshTable?.()
  69. }
  70. const handleReset = () => {
  71. search.value = {
  72. cId: '',
  73. login: '',
  74. platform: 'MT4',
  75. startDate: '',
  76. endDate: '',
  77. }
  78. tableRef.value?.refreshTable?.()
  79. }
  80. // 表格列配置
  81. const columns = ref([
  82. {
  83. prop: 'login',
  84. label: t('Label.Login'),
  85. align: 'center',
  86. },
  87. {
  88. prop: 'name',
  89. label: t('Ib.Custom.NameLabel'),
  90. align: 'center',
  91. },
  92. {
  93. prop: 'platform',
  94. label: t('Label.Platform'),
  95. align: 'center',
  96. },
  97. {
  98. prop: 'groupName',
  99. label: t('Label.GroupName'),
  100. align: 'center',
  101. },
  102. {
  103. prop: 'type',
  104. type: 'tag',
  105. label: t('Label.LoginType'),
  106. align: 'center',
  107. tagMap: {
  108. 1: t('AccountType.ClassicAccount'),
  109. 2: t('AccountType.SeniorAccount'),
  110. 5: t('AccountType.SpeedAccount'),
  111. 6: t('AccountType.SpeedAccount'),
  112. 7: t('AccountType.StandardAccount'),
  113. 8: t('AccountType.CentAccount'),
  114. },
  115. },
  116. {
  117. prop: 'Leverage',
  118. label: t('Label.Leverage'),
  119. align: 'center',
  120. formatter: ({ row }) => row.leverage ? `1:${row.leverage}` : '--',
  121. },
  122. {
  123. prop: 'currency',
  124. label: t('Label.Currency'),
  125. align: 'center',
  126. },
  127. {
  128. prop: 'balance',
  129. label: t('Label.LoginBalance'),
  130. align: 'center',
  131. formatter: ({ row }) => numberFormat(row.balance ?? 0),
  132. },
  133. {
  134. prop: 'countryEnName',
  135. label: t('Label.Country'),
  136. align: 'center',
  137. },
  138. {
  139. prop: 'registration',
  140. label: t('Label.ApplyTime'),
  141. align: 'center',
  142. },
  143. ])
  144. const mobilePrimaryFields = ref([
  145. {
  146. prop: 'login',
  147. label: t('Label.Login'),
  148. align: 'center',
  149. },
  150. {
  151. prop: 'name',
  152. label: t('Ib.Custom.NameLabel'),
  153. align: 'center',
  154. },
  155. {
  156. prop: 'platform',
  157. label: t('Label.Platform'),
  158. align: 'center',
  159. },
  160. {
  161. prop: 'more',
  162. type: 'more',
  163. width: 20,
  164. align: 'right',
  165. },
  166. ])
  167. const listApi = ref(ibApi.accountSubs)
  168. </script>
  169. <style lang="scss" scoped>
  170. @import "@/uni.scss";
  171. .search-content {
  172. display: flex;
  173. justify-content: space-between;
  174. }
  175. </style>