trading-center-single.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  1. <template>
  2. <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
  3. <cwg-header :title="t('Custom.Settings.Title')">
  4. <template #right>
  5. <view class="time-header">
  6. <text>{{ t('Documentary.console.item2') }}:</text>
  7. <text class="time-value" @click="toReload">{{ time }}</text>
  8. <cwg-icon name="crm-refresh" @click="toReload" style="margin-left: 6px; cursor: pointer;" />
  9. </view>
  10. </template>
  11. </cwg-header>
  12. <view class="info-card">
  13. <cwg-asset-tabs :tabs="tabs" v-model="activeTab" />
  14. <!-- Tab 1: 个人指标 -->
  15. <view v-if="activeTab === '1'" class="tab-content">
  16. <!-- 个人名片和品种摘要 -->
  17. <view class="section-row">
  18. <view class="section-col">
  19. <view class="fllow-title">
  20. <view class="title">
  21. <text>{{ t('TradingCenter.item12') }}</text>
  22. </view>
  23. </view>
  24. <view class="fllow-info-list">
  25. <cwg-label-line-value :label="t('TradingCenter.item13')" :value="DailyIndex1.nickname || '--'" />
  26. <cwg-label-line-value :label="t('TradingCenter.item14')" :value="DailyIndex1.personalSignature || '--'" />
  27. <cwg-label-line-value :label="t('TradingCenter.item11')"
  28. :value="getAccountTypeText(DailyIndex.groupType)" />
  29. <cwg-label-line-value :label="t('TradingCenter.item15')" :value="DailyIndex1.addTime || '--'" />
  30. </view>
  31. </view>
  32. <view class="section-col">
  33. <view class="fllow-title">
  34. <view class="title">
  35. <text>{{ t('TradingCenter.item16') }}</text>
  36. </view>
  37. </view>
  38. <view class="chart-container">
  39. <cwg-match-media :max-width="991">
  40. <cwg-charts type="pie" :chartData="symbolSummaryData" :opts="pieOpts" ontouch />
  41. </cwg-match-media>
  42. <cwg-match-media :min-width="991">
  43. <cwg-charts type="pie" :chartData="symbolSummaryData" :opts="pieOpts" />
  44. </cwg-match-media>
  45. </view>
  46. </view>
  47. </view>
  48. <!-- 数据指标部分 -->
  49. <view class="section-row">
  50. <!-- 历史表现 -->
  51. <view class="section-col">
  52. <view class="fllow-title">
  53. <view class="title">
  54. <text>{{ t('TradingCenter.item17') }}</text>
  55. </view>
  56. </view>
  57. <view class="fllow-info-grid">
  58. <cwg-label-line-value :label="t('TradingCenter.item18')"
  59. :value="formatCurrency(DailyIndex.pl, DailyIndex.currency, DailyIndex.groupType)" />
  60. <cwg-label-line-value :label="t('TradingCenter.item21')"
  61. :value="formatCurrency(DailyIndex.loss, DailyIndex.currency, DailyIndex.groupType)" />
  62. <cwg-label-line-value :label="t('TradingCenter.item19')" :value="DailyIndex.plRate || '0'" />
  63. <cwg-label-line-value :label="t('TradingCenter.item7')" :value="DailyIndex.maxDdRate || '0'" />
  64. <cwg-label-line-value :label="t('TradingCenter.item20')"
  65. :value="formatCurrency(DailyIndex.profit, DailyIndex.currency, DailyIndex.groupType)" />
  66. </view>
  67. </view>
  68. <!-- 交易规模与效率 -->
  69. <view class="section-col">
  70. <view class="fllow-title">
  71. <view class="title">
  72. <text>{{ t('TradingCenter.item22') }}</text>
  73. </view>
  74. </view>
  75. <view class="fllow-info-grid">
  76. <cwg-label-line-value :label="t('TradingCenter.item23')" :value="DailyIndex.trades || '0'" />
  77. <cwg-label-line-value :label="t('TradingCenter.item29')" :value="DailyIndex.avgHoldVolume || '0'" />
  78. <cwg-label-line-value :label="t('TradingCenter.item24')" :value="DailyIndex.volume || '0'" />
  79. <cwg-label-line-value :label="t('TradingCenter.item39')" :value="DailyIndex.maxHoldVolume || '0'" />
  80. <cwg-label-line-value :label="t('TradingCenter.item25')" :value="DailyIndex.tradesWin || '0'" />
  81. <cwg-label-line-value :label="t('TradingCenter.item30')" :value="DailyIndex.avgDailyTrades || '0'" />
  82. <cwg-label-line-value :label="t('TradingCenter.item26')" :value="DailyIndex.tradesLoss || '0'" />
  83. <cwg-label-line-value :label="t('TradingCenter.item31')" :value="DailyIndex.tradesSl || '0'" />
  84. <cwg-label-line-value :label="t('TradingCenter.item27')" :value="DailyIndex.avgHoldVolume || '0'" />
  85. <cwg-label-line-value :label="t('TradingCenter.item32')" :value="DailyIndex.slRate || '0'" />
  86. <cwg-label-line-value :label="t('TradingCenter.item28')" :value="DailyIndex.avgHoldTime || '--'" />
  87. <cwg-label-line-value :label="t('TradingCenter.item6')" :value="DailyIndex.winRate || '0'" />
  88. </view>
  89. </view>
  90. </view>
  91. <view class="section-row">
  92. <!-- 资金流向 -->
  93. <view class="section-col">
  94. <view class="fllow-title">
  95. <view class="title">
  96. <text>{{ t('TradingCenter.item33') }}</text>
  97. </view>
  98. </view>
  99. <view class="fllow-info-grid">
  100. <cwg-label-line-value :label="t('TradingCenter.item34')"
  101. :value="formatCurrency(DailyIndex.deposit, DailyIndex.currency, DailyIndex.groupType)" />
  102. <cwg-label-line-value :label="t('TradingCenter.item36')"
  103. :value="formatCurrency(DailyIndex.credit, DailyIndex.currency, DailyIndex.groupType)" />
  104. <cwg-label-line-value :label="t('TradingCenter.item35')"
  105. :value="formatCurrency(DailyIndex.withdraw, DailyIndex.currency, DailyIndex.groupType)" />
  106. </view>
  107. </view>
  108. <!-- 订阅与跟单 -->
  109. <view class="section-col">
  110. <view class="fllow-title">
  111. <view class="title">
  112. <text>{{ t('TradingCenter.item40') }}</text>
  113. </view>
  114. </view>
  115. <view class="fllow-info-grid">
  116. <cwg-label-line-value :label="t('TradingCenter.item37')" :value="DailyIndex.follows || '0'" />
  117. <cwg-label-line-value :label="t('TradingCenter.item38')"
  118. :value="formatCurrency(DailyIndex.followsPl, DailyIndex.currency, DailyIndex.groupType)" />
  119. </view>
  120. </view>
  121. </view>
  122. <!-- 排名曲线和净值曲线 -->
  123. <view class="section-row">
  124. <!-- 排名曲线 -->
  125. <view class="section-col">
  126. <view class="fllow-title">
  127. <view class="title">
  128. <text>{{ t('TradingCenter.item41') }}</text>
  129. </view>
  130. </view>
  131. <view class="chart-container">
  132. <cwg-match-media :max-width="991">
  133. <cwg-charts type="line" :chartData="rankingChartData" :opts="rankingChartOpts" ontouch />
  134. </cwg-match-media>
  135. <cwg-match-media :min-width="991">
  136. <cwg-charts type="line" :chartData="rankingChartData" :opts="rankingChartOpts" />
  137. </cwg-match-media>
  138. </view>
  139. </view>
  140. <!-- 净值曲线 -->
  141. <view class="section-col">
  142. <view class="fllow-title">
  143. <view class="title">
  144. <text>{{ t('Documentary.tradingCenter.item140') }}</text>
  145. </view>
  146. </view>
  147. <view class="chart-container">
  148. <cwg-match-media :max-width="991">
  149. <cwg-charts type="line" :chartData="equityChartData" :opts="equityChartOpts" ontouch />
  150. </cwg-match-media>
  151. <cwg-match-media :min-width="991">
  152. <cwg-charts type="line" :chartData="equityChartData" :opts="equityChartOpts" />
  153. </cwg-match-media>
  154. </view>
  155. </view>
  156. </view>
  157. </view>
  158. <!-- Tab 2: 交易订单 -->
  159. <view v-if="activeTab === '2'" class="tab-content">
  160. <cwg-complex-search :fields="tab2FilterFields" v-model="tab2SearchParams" @search="handleTab2Search"
  161. @reset="handleTab2Reset" />
  162. <cwg-tabel ref="table2Ref" :columns="tab2Columns" :immediate="true" :queryParams="tab2QueryParams"
  163. :api="tab2Api" :show-operation="false" :showSummary="true" :summaryMethod="getSummaries1">
  164. <template #openClosePrice="{ row }">
  165. <view class="sp-div-tab">{{ formatNumber(row.openPrice) }}</view>
  166. <view class="sp-div-tab-b">{{ formatNumber(row.closePrice) }}</view>
  167. </template>
  168. <template #openCloseTime="{ row }">
  169. <view class="sp-div-tab">{{ row.openTime || '--' }}</view>
  170. <view class="sp-div-tab-b">{{ row.closeTime || '--' }}</view>
  171. </template>
  172. <template #tpSl="{ row }">
  173. <view class="sp-div-tab">{{ formatNumber(row.tp) }}</view>
  174. <view class="sp-div-tab-b">{{ formatNumber(row.sl) }}</view>
  175. </template>
  176. </cwg-tabel>
  177. </view>
  178. <!-- Tab 3: 订阅总览 -->
  179. <view v-if="activeTab === '3'" class="tab-content">
  180. <view class="summary-top">
  181. <view class="search-operation-l">
  182. <text>{{ t('Documentary.tradingCenter.item123') }}</text>
  183. : {{ tableSumData.profit || '0' }}
  184. </view>
  185. <view class="search-operation-r">
  186. <text>{{ t('Documentary.tradingCenter.item124') }}</text>
  187. : {{ tableSumData.volume || '0' }}
  188. </view>
  189. </view>
  190. <cwg-complex-search :fields="tab3FilterFields" v-model="tab3SearchParams" @search="handleTab3Search"
  191. @reset="handleTab3Reset" />
  192. <cwg-tabel ref="table3Ref" :columns="tab3Columns" :immediate="true" :queryParams="tab3QueryParams"
  193. :api="tab3Api" :show-operation="false" />
  194. </view>
  195. </view>
  196. </cwg-page-wrapper>
  197. </template>
  198. <script setup lang="ts">
  199. import { computed, ref, onMounted, onUnmounted, nextTick, watch } from 'vue'
  200. import { useI18n } from 'vue-i18n'
  201. import { documentaryApi } from '@/service/documentary'
  202. import { onLoad, onShow } from '@dcloudio/uni-app'
  203. import { useWindowWidth } from '@/composables/useWindowWidth'
  204. const windowWidth = useWindowWidth(300)
  205. const isMobile = computed(() => windowWidth.value <= 991)
  206. const { t } = useI18n()
  207. // --- Params ---
  208. const myLogin = ref('')
  209. const myRanking = ref('')
  210. const myId = ref('')
  211. onLoad((options: any) => {
  212. myLogin.value = options.dealLogin || options.login || ''
  213. myRanking.value = options.ranking || ''
  214. myId.value = options.id || ''
  215. activeTab.value = '1'
  216. getDate()
  217. getPersonalIndicators()
  218. })
  219. // --- Time fetching ---
  220. const time = ref('')
  221. const getLocalTime = () => {
  222. let timezone = 2
  223. let offset_GMT = new Date().getTimezoneOffset()
  224. let nowDate = new Date().getTime()
  225. let now = new Date(nowDate + offset_GMT * 60 * 1000 + timezone * 60 * 60 * 1000)
  226. let year = now.getFullYear()
  227. let month = String(now.getMonth() + 1).padStart(2, '0')
  228. let day = String(now.getDate()).padStart(2, '0')
  229. let hh = String(now.getHours()).padStart(2, '0')
  230. let mm = String(now.getMinutes()).padStart(2, '0')
  231. time.value = `${year}/${month}/${day} ${hh}:${mm}`
  232. }
  233. const getDate = async () => {
  234. try {
  235. let res = await documentaryApi.followDealSignalRefreshDate()
  236. if (res.code === 200 && res.data) {
  237. time.value = res.data
  238. } else {
  239. getLocalTime()
  240. }
  241. } catch (error) {
  242. getLocalTime()
  243. }
  244. }
  245. const toReload = () => {
  246. getDate()
  247. if (activeTab.value === '1') {
  248. getPersonalIndicators()
  249. } else if (activeTab.value === '2') {
  250. table2Ref.value?.refreshTable()
  251. } else if (activeTab.value === '3') {
  252. table3Ref.value?.refreshTable()
  253. }
  254. }
  255. onMounted(() => {
  256. })
  257. onUnmounted(() => {
  258. })
  259. // --- Tabs ---
  260. const activeTab = ref('1')
  261. const tabs = computed(() => [
  262. { text: t('Documentary.tradingCenter.item60'), value: '1' },
  263. { text: t('Documentary.tradingCenter.item58'), value: '2' },
  264. { text: t('Documentary.tradingCenter.item59'), value: '3' },
  265. ])
  266. // --- Tab 1 Data ---
  267. const DailyIndex = ref<any>({})
  268. const DailyIndex1 = ref<any>({})
  269. const symbolSummaryData = ref<any>({ series: [] })
  270. const pieOpts = computed(() => ({
  271. color: ['#5470C6', '#91CC75', '#EE6666', '#FAC858', '#73C0DE', '#3BA272'],
  272. padding: [5, 5, 5, 5],
  273. enableScroll: true,
  274. legend: {
  275. show: true,
  276. position: isMobile.value ? 'top' : 'left',
  277. float: isMobile.value ? 'left' : 'center'
  278. },
  279. extra: {
  280. pie: {
  281. radius: isMobile.value ? 75 : 95
  282. }
  283. }
  284. }))
  285. const rankingChartData = ref<any>({ categories: [], series: [] })
  286. const rankingChartOpts = computed(()=>({
  287. enableScroll: true,
  288. yAxis: {
  289. data: [{
  290. axisLine: false,
  291. inverse: false,
  292. }],
  293. },
  294. xAxis: {
  295. // disableGrid: true,
  296. scrollShow: true,
  297. itemCount: isMobile.value?3:4,
  298. },
  299. }))
  300. const equityChartData = ref<any>({ categories: [], series: [] })
  301. const equityChartOpts = computed(()=>({
  302. enableScroll: true,
  303. xAxis: {
  304. // disableGrid: true,
  305. scrollShow: true,
  306. itemCount: isMobile.value?3:4,
  307. },
  308. }))
  309. const getAccountTypeText = (type: number) => {
  310. const map: Record<number, string> = {
  311. 1: 'AccountType.ClassicAccount',
  312. 2: 'AccountType.SeniorAccount',
  313. 5: 'AccountType.SpeedAccount',
  314. 6: 'AccountType.SpeedAccount',
  315. 7: 'AccountType.StandardAccount',
  316. 8: 'AccountType.CentAccount',
  317. }
  318. return type && map[type] ? t(map[type]) : '--'
  319. }
  320. const formatCurrency = (val: any, currency?: string, groupType?: number) => {
  321. if (!val) return '0'
  322. let symbol = '$'
  323. if (currency === 'GBP') symbol = '£'
  324. else if (currency === 'EUR') symbol = '€'
  325. else if (currency === 'USC' || groupType == 8) symbol = '¢'
  326. return `${symbol}${val}`
  327. }
  328. const getPersonalIndicators = async () => {
  329. if (myId.value) {
  330. let res = await documentaryApi.followDealSignalSearchSingle({ id: myId.value })
  331. if (res.code === 200 && res.data) {
  332. DailyIndex.value = res.data
  333. DailyIndex1.value = res.data
  334. if (res.data.login) {
  335. myLogin.value = res.data.login
  336. }
  337. if (res.data.symbolSummary) {
  338. drawSymbolSummary(res.data.symbolSummary)
  339. }
  340. getChart4()
  341. getChart5()
  342. }
  343. } else {
  344. // Fallback
  345. documentaryApi.followDailyIndex({ login: myLogin.value }).then(res => {
  346. if (res.code === 200) DailyIndex.value = res.data || {}
  347. })
  348. documentaryApi.followDealCard({ login: myLogin.value }).then(res => {
  349. if (res.code === 200) DailyIndex1.value = res.data || {}
  350. })
  351. documentaryApi.followDailyChartSymbol({ login: myLogin.value }).then(res => {
  352. if (res.code === 200 && res.data && res.data[0] && res.data[0].volumes) {
  353. drawSymbolSummary(res.data[0].volumes)
  354. }
  355. })
  356. getChart4()
  357. getChart5()
  358. }
  359. }
  360. const drawSymbolSummary = (data: any[]) => {
  361. let pieData = data.map(item => {
  362. let name = item.symbol || item.name || ''
  363. if (!name && item.symbolType) {
  364. const types = ['', t('Documentary.Report.item11'), t('Documentary.Report.item12'), t('Documentary.Report.item13'), t('Documentary.Report.item14'), t('Documentary.Report.item15'), t('Documentary.Report.item16')]
  365. name = types[item.symbolType] || ''
  366. }
  367. let value = item.volume !== undefined ? item.volume : (item.value !== undefined ? item.value : (item.amount || 0))
  368. return { name, value }
  369. })
  370. symbolSummaryData.value = {
  371. series: [{ data: pieData }],
  372. }
  373. }
  374. const getChart4 = async () => {
  375. let res = await documentaryApi.getEquityChart({ login: myLogin.value })
  376. if (res.code === 200 && res.data) {
  377. let categories = []
  378. let seriesData = []
  379. res.data.forEach((item: any) => {
  380. categories.push(item.date.split(' ')[0])
  381. seriesData.push(item.amount !== null ? item.amount : item.doubleAmount)
  382. })
  383. equityChartData.value = {
  384. categories,
  385. series: [{ name: t('Documentary.tradingCenter.item140'), data: seriesData }],
  386. }
  387. }
  388. }
  389. const getChart5 = async () => {
  390. let res = await documentaryApi.getRankingChart({ login: myLogin.value })
  391. if (res.code === 200 && res.data) {
  392. let categories = []
  393. let seriesData = []
  394. res.data.forEach((item: any) => {
  395. categories.push(item.date.split(' ')[0])
  396. seriesData.push(item.amount !== null ? item.amount : item.doubleAmount)
  397. })
  398. rankingChartData.value = {
  399. categories,
  400. series: [{ name: t('TradingCenter.item41'), data: seriesData }],
  401. }
  402. }
  403. }
  404. // --- Formatters ---
  405. const formatNumber = (value: any) => {
  406. if (value == '***') return '***'
  407. if (isNaN(value)) return '0'
  408. let valStr = String(value)
  409. const parts = valStr.split('.')
  410. parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',')
  411. return parts.join('.')
  412. }
  413. // --- Tab 2 ---
  414. const table2Ref = ref(null)
  415. const combined = ref<any>({})
  416. const tab2SearchParams = ref({
  417. tab4Type: 1,
  418. date: [],
  419. })
  420. const tab2FilterFields = computed(() => [
  421. {
  422. key: 'tab4Type', type: 'select', label: t('Documentary.tradingCenter.item114'), options: [
  423. { value: 1, text: t('Documentary.tradingCenter.item114') },
  424. // { value: 2, text: t('Documentary.tradingCenter.item115') }
  425. ],
  426. },
  427. { key: 'date', type: 'daterange', label: t('placeholder.choose') },
  428. ])
  429. const tab2QueryParams = computed(() => {
  430. return { ...tab2SearchParams.value, login: myLogin.value }
  431. })
  432. const tab2Columns = computed(() => [
  433. { prop: 'order', label: t('Label.OrderNumber'), align: 'center' },
  434. { prop: 'platform', label: t('Label.Platform'), align: 'center' },
  435. { prop: 'cmd', label: t('Label.Type'), align: 'center' },
  436. { prop: 'symbol', label: t('Label.Varieties'), align: 'center' },
  437. {
  438. prop: 'openClosePrice',
  439. label: t('Label.OpenPrice') + '/' + t('Label.ClosePrice'),
  440. align: 'center',
  441. slot: 'openClosePrice',
  442. },
  443. {
  444. prop: 'openCloseTime',
  445. label: t('Label.OpenTime') + '/' + t('Label.CloseTime'),
  446. align: 'center',
  447. slot: 'openCloseTime',
  448. },
  449. { prop: 'tpSl', label: t('Label.EP') + '/' + t('Label.EL'), align: 'center', slot: 'tpSl' },
  450. {
  451. prop: 'volume',
  452. label: t('Documentary.tradingCenter.item99'),
  453. align: 'center',
  454. formatter: ({ row }: any) => formatNumber(row.volume || '0'),
  455. },
  456. {
  457. prop: 'storage',
  458. label: t('Label.StorageFee'),
  459. align: 'center',
  460. formatter: ({ row }: any) => formatNumber(row.storage || '0'),
  461. },
  462. {
  463. prop: 'profit',
  464. label: t('Label.ProfitLoss'),
  465. align: 'center',
  466. formatter: ({ row }: any) => formatNumber(row.profit || '0'),
  467. },
  468. {
  469. prop: 'totalProfit',
  470. label: t('Label.TotalProfitLoss'),
  471. align: 'center',
  472. formatter: ({ row }: any) => formatNumber(row.totalProfit || '0'),
  473. },
  474. ])
  475. const tab2Api = async (params: any) => {
  476. let res = await documentaryApi.followOrderRecordList(params)
  477. if (res.code === 200 || res.code === 0 || res.code === 10000) {
  478. combined.value = res.sum || {}
  479. }
  480. return res
  481. }
  482. const getSummaries1 = ({ columns }: any) => {
  483. let sums = Array(columns.length).fill('')
  484. if (Object.keys(combined.value).length > 0) {
  485. sums[0] = t('Label.Total')
  486. const volIdx = columns.findIndex((c: any) => c.prop === 'volume')
  487. const proIdx = columns.findIndex((c: any) => c.prop === 'profit')
  488. const totIdx = columns.findIndex((c: any) => c.prop === 'totalProfit')
  489. if (volIdx > -1) sums[volIdx] = combined.value.volume ? formatNumber(combined.value.volume) : 0
  490. if (proIdx > -1) sums[proIdx] = combined.value.profit ? formatNumber(combined.value.profit) : 0
  491. if (totIdx > -1) sums[totIdx] = combined.value.totalProfit ? formatNumber(combined.value.totalProfit) : 0
  492. }
  493. return sums
  494. }
  495. const handleTab2Search = (params: any) => {
  496. tab2SearchParams.value = params
  497. nextTick(() => {
  498. table2Ref.value?.refreshTable()
  499. })
  500. }
  501. const handleTab2Reset = (params: any) => {
  502. tab2SearchParams.value = params
  503. nextTick(() => {
  504. table2Ref.value?.refreshTable()
  505. })
  506. }
  507. // --- Tab 3 ---
  508. const table3Ref = ref(null)
  509. const tableSumData = ref<any>({})
  510. const tab3SearchParams = ref({
  511. platform: 'MT4',
  512. date: [],
  513. })
  514. const tab3FilterFields = computed(() => [
  515. {
  516. key: 'platform', type: 'select', label: t('Label.Platform'), options: [
  517. { value: 'MT4', text: 'MT4' },
  518. { value: 'MT5', text: 'MT5' },
  519. ],
  520. },
  521. { key: 'date', type: 'daterange', label: t('placeholder.choose') },
  522. ])
  523. const tab3QueryParams = computed(() => {
  524. return { ...tab3SearchParams.value, login: myLogin.value }
  525. })
  526. const tab3Columns = computed(() => [
  527. { prop: 'followLogin', label: t('Documentary.tradingCenter.item102'), align: 'center' },
  528. { prop: 'platform', label: t('Label.Platform'), align: 'center' },
  529. { prop: 'startTime', label: t('Documentary.tradingCenter.item103'), align: 'center' },
  530. { prop: 'endTime', label: t('Documentary.tradingCenter.item104'), align: 'center' },
  531. {
  532. prop: 'profit',
  533. label: t('Documentary.tradingCenter.item105'),
  534. align: 'center',
  535. formatter: ({ row }: any) => formatNumber(row.profit || '0'),
  536. },
  537. {
  538. prop: 'volume',
  539. label: t('Documentary.tradingCenter.item99'),
  540. align: 'center',
  541. formatter: ({ row }: any) => formatNumber(row.volume || '0'),
  542. },
  543. ])
  544. const tab3Api = async (params: any) => {
  545. let res = await documentaryApi.followDealSubscribeSummary(params)
  546. if (res.code === 200 || res.code === 0 || res.code === 10000) {
  547. tableSumData.value = res.sum || {}
  548. }
  549. return res
  550. }
  551. const handleTab3Search = (params: any) => {
  552. tab3SearchParams.value = params
  553. nextTick(() => {
  554. table3Ref.value?.refreshTable()
  555. })
  556. }
  557. const handleTab3Reset = (params: any) => {
  558. tab3SearchParams.value = params
  559. nextTick(() => {
  560. table3Ref.value?.refreshTable()
  561. })
  562. }
  563. </script>
  564. <style scoped lang="scss">
  565. @import "@/uni.scss";
  566. .time-header {
  567. display: flex;
  568. align-items: center;
  569. font-size: 14px;
  570. font-weight: 500;
  571. color: var(--bs-heading-color);
  572. .time-value {
  573. margin-left: 6px;
  574. color: var(--bs-heading-color);
  575. }
  576. }
  577. .info-card {
  578. padding: 16px;
  579. background: var(--bs-body-bg);
  580. border-radius: 8px;
  581. }
  582. .tab-content {
  583. margin-top: 16px;
  584. }
  585. .section-row {
  586. display: flex;
  587. flex-wrap: wrap;
  588. gap: 20px;
  589. margin-bottom: 20px;
  590. }
  591. .section-col {
  592. flex: 1;
  593. min-width: 300px;
  594. border: 1px solid #f0f0f0;
  595. border-radius: 8px;
  596. padding: 16px;
  597. box-sizing: border-box;
  598. }
  599. .fllow-title {
  600. display: flex;
  601. justify-content: space-between;
  602. border-bottom: 1px solid #eee;
  603. padding-bottom: 10px;
  604. margin-bottom: 10px;
  605. .title {
  606. font-weight: bold;
  607. color: var(--bs-heading-color);
  608. padding-left: 8px;
  609. border-left: 4px solid #eb3f57;
  610. font-size: 16px;
  611. }
  612. }
  613. .fllow-info-list {
  614. display: flex;
  615. flex-direction: column;
  616. gap: 8px;
  617. }
  618. .fllow-info-grid {
  619. display: grid;
  620. grid-template-columns: 1fr 1fr;
  621. gap: 8px 20px;
  622. @media screen and (max-width: 750px) {
  623. grid-template-columns: none;
  624. }
  625. }
  626. .chart-container {
  627. width: 100%;
  628. height: 250px;
  629. }
  630. .sp-div-tab {
  631. border-bottom: 1px dashed #eee;
  632. padding-bottom: 4px;
  633. margin-bottom: 4px;
  634. }
  635. .sp-div-tab-b {
  636. padding-top: 4px;
  637. }
  638. .summary-top {
  639. display: flex;
  640. gap: 20px;
  641. margin-bottom: 16px;
  642. font-size: 14px;
  643. font-weight: bold;
  644. color: var(--bs-heading-color);
  645. }
  646. </style>