complexReport.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
  3. <cwg-header :title="t('Home.page_ib.item11')" />
  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. :showSummary="true"
  19. @sort-change="handleSortChange"
  20. >
  21. <template #action="{ row }">
  22. <cwg-dropdown :menu-list="menuList(row)" @menuClick="handleMenuClick">
  23. <view class="pc-header-btn">
  24. <cwg-icon name="crm-ellipsis" :size="24" />
  25. </view>
  26. </cwg-dropdown>
  27. </template>
  28. </cwg-tabel>
  29. </view>
  30. </cwg-page-wrapper>
  31. </template>
  32. <script setup lang="ts">
  33. // 账户管理
  34. import { ref, nextTick, computed, reactive } from 'vue'
  35. import { useI18n } from 'vue-i18n'
  36. import { ibApi } from '@/service/ib'
  37. import { useFilters } from '@/composables/useFilters'
  38. const { numberFormat } = useFilters()
  39. const { t } = useI18n()
  40. const searchParams = ref({})
  41. const search = reactive({
  42. cId: '',
  43. customName: '',
  44. login: '',
  45. groupType: 0,
  46. platform: null,
  47. date: null
  48. })
  49. const listApi = ref(ibApi.ComplexReport)
  50. const tableRef = ref<any>(null)
  51. const platformOptions = [
  52. { text: 'MT4', value: 'MT4' },
  53. { text: 'MT5', value: 'MT5' },
  54. ]
  55. const filterFields = computed(() => [
  56. { key: 'platform', type: 'select', label: t('Label.Platform'), placeholder: t('placeholder.choose'), options: platformOptions,defaultValue: null, clearable: true },
  57. { key: 'cId', type: 'input', label: t('Label.CidAccount'), placeholder: t('Label.CidAccount'), defaultValue: '' },
  58. { key: 'customName', type: 'input', label: t('Documentary.Report.item19'), placeholder: t('Documentary.Report.item19'), defaultValue: '' },
  59. { key: 'login', type: 'input', label: t('Label.TradingAccount'), placeholder: t('Label.TradingAccount'), defaultValue: '' },
  60. {
  61. key: 'groupType',
  62. type: 'select',
  63. label: t('Documentary.Report.item20'),
  64. placeholder: t('Documentary.Report.item20'),
  65. options: [
  66. { text: t('State.All'), value: 0 },
  67. { text: t('AccountType.SeniorAccount'), value: 2 },
  68. { text: t('AccountType.NewSpeedAccount'), value: 6 },
  69. { text: t('AccountType.StandardAccount'), value: 7 },
  70. { text: t('AccountType.CentAccount'), value: 8 },
  71. ],
  72. defaultValue: 0,
  73. clearable: true
  74. },
  75. { key: 'date', label: t('placeholder.Start') + ' - ' + t('placeholder.End'), type: 'daterange' },
  76. ])
  77. // 表格列配置
  78. const columns = computed(() => [
  79. {
  80. prop: 'cId',
  81. label: t('Label.CidAccount'),
  82. align: 'center',
  83. },
  84. {
  85. prop: 'customName',
  86. label: t('Documentary.Report.item19'),
  87. align: 'center',
  88. formatter: ({ row }: any) => row.customName || '--',
  89. },
  90. {
  91. prop: 'login',
  92. label: t('Label.TradingAccount'),
  93. align: 'center',
  94. formatter: ({ row }: any) => row.login || '--',
  95. },
  96. {
  97. prop: 'groupType',
  98. type: 'tag',
  99. label: t('Documentary.Report.item20'),
  100. align: 'center',
  101. tagMap: {
  102. 1: t('AccountType.ClassicAccount'),
  103. 2: t('AccountType.SeniorAccount'),
  104. 5: t('AccountType.SpeedAccount'),
  105. 6: t('AccountType.NewSpeedAccount'),
  106. 7: t('AccountType.StandardAccount'),
  107. 8: t('AccountType.CentAccount'),
  108. },
  109. },
  110. {
  111. prop: 'ibNo',
  112. label: t('Label.AgentNumber'),
  113. align: 'center',
  114. formatter: ({ row }: any) => row.ibNo || '--',
  115. },
  116. {
  117. prop: 'salesNo',
  118. label: t('Label.Encode'),
  119. align: 'center',
  120. formatter: ({ row }: any) => row.salesNo || '--',
  121. },
  122. {
  123. prop: 'salesName',
  124. label: '销售姓名',
  125. align: 'center',
  126. formatter: ({ row }: any) => row.salesName || '--',
  127. },
  128. {
  129. prop: 'deposit',
  130. label: t('Documentary.Report.item21'),
  131. align: 'center',
  132. sortable: 'custom',
  133. formatter: ({ row }: any) => row.deposit ? parseFloat(row.deposit).toFixed(2) : '0.00',
  134. },
  135. {
  136. prop: 'withdrawal',
  137. label: t('Documentary.Report.item22'),
  138. align: 'center',
  139. sortable: 'custom',
  140. formatter: ({ row }: any) => row.withdrawal ? parseFloat(row.withdrawal).toFixed(2) : '0.00',
  141. },
  142. {
  143. prop: 'netDeposit',
  144. label: t('Documentary.Report.item23'),
  145. align: 'center',
  146. sortable: 'custom',
  147. formatter: ({ row }: any) => row.netDeposit ? parseFloat(row.netDeposit).toFixed(2) : '0.00',
  148. },
  149. {
  150. prop: 'volume',
  151. label: t('Documentary.Report.item24'),
  152. align: 'center',
  153. sortable: 'custom',
  154. formatter: ({ row }: any) => row.volume ? parseFloat(row.volume).toFixed(2) : '0.00',
  155. },
  156. {
  157. prop: 'sumRebate',
  158. label: t('Documentary.Report.item25'),
  159. align: 'center',
  160. sortable: 'custom',
  161. formatter: ({ row }: any) => row.sumRebate ? parseFloat(row.sumRebate).toFixed(2) : '0.00',
  162. },
  163. {
  164. prop: 'storage',
  165. label: t('Documentary.Report.item26'),
  166. align: 'center',
  167. sortable: 'custom',
  168. formatter: ({ row }: any) => row.storage ? parseFloat(row.storage).toFixed(2) : '0.00',
  169. },
  170. {
  171. prop: 'balance',
  172. label: t('Label.Balance'),
  173. align: 'center',
  174. sortable: 'custom',
  175. formatter: ({ row }: any) => row.balance != null && row.balance !== '' ? parseFloat(row.balance).toFixed(2) : '--',
  176. },
  177. {
  178. prop: 'equity',
  179. label: t('Label.equity'),
  180. align: 'center',
  181. sortable: 'custom',
  182. formatter: ({ row }: any) => row.equity != null && row.equity !== '' ? parseFloat(row.equity).toFixed(2) : '--',
  183. },
  184. {
  185. prop: 'profit',
  186. label: '盈亏',
  187. align: 'center',
  188. sortable: 'custom',
  189. formatter: ({ row }: any) => row.profit ? parseFloat(row.profit).toFixed(2) : '0.00',
  190. },
  191. {
  192. prop: 'marginLevel',
  193. label: t('Label.MarginLevel'),
  194. align: 'center',
  195. sortable: 'custom',
  196. formatter: ({ row }: any) => row.marginLevel || '--',
  197. },
  198. {
  199. prop: 'credit',
  200. label: t('Label.Credit'),
  201. align: 'center',
  202. sortable: 'custom',
  203. formatter: ({ row }: any) => row.credit != null && row.credit !== '' ? parseFloat(row.credit).toFixed(2) : '--',
  204. },
  205. {
  206. prop: 'regDate',
  207. label: t('Label.RegDate'),
  208. align: 'center',
  209. formatter: ({ row }: any) => row.regDate || '--',
  210. },
  211. ])
  212. const mobilePrimaryFields = computed(()=>[
  213. {
  214. prop: 'cId',
  215. label: t('Label.CidAccount'),
  216. align: 'center',
  217. },
  218. {
  219. prop: 'customName',
  220. label: '客户姓名',
  221. align: 'center',
  222. formatter: ({ row }: any) => row.customName || '--',
  223. },
  224. {
  225. prop: 'login',
  226. label: t('Label.TradingAccount'),
  227. align: 'center',
  228. formatter: ({ row }: any) => row.login || '--',
  229. },
  230. {
  231. prop: 'more',
  232. type: 'more',
  233. width: 20,
  234. align: 'right',
  235. },
  236. ])
  237. const handleSearch = (params: any) => {
  238. Object.assign(search, params)
  239. nextTick(() => {
  240. tableRef.value?.refreshTable?.()
  241. })
  242. }
  243. const handleReset = (params: any) => {
  244. Object.assign(search, {
  245. ...params,
  246. platform: null,
  247. groupType: 0,
  248. })
  249. nextTick(() => {
  250. tableRef.value?.refreshTable?.()
  251. })
  252. }
  253. const handleSortChange = (params: any) => {
  254. Object.assign(search, {
  255. orderColumn: params.prop,
  256. orderType: params.order,
  257. })
  258. nextTick(() => {
  259. tableRef.value?.refreshTable?.()
  260. })
  261. }
  262. </script>
  263. <style lang="scss" scoped>
  264. @import "@/uni.scss";
  265. .search-content {
  266. display: flex;
  267. justify-content: space-between;
  268. }
  269. </style>