| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327 |
- <template>
- <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
- <cwg-header :title="t('Ib.Report.Tit4')" />
- <view class="info-card">
- <cwg-complex-search :fields="filterFields" v-model="searchParams" @search="handleSearch"
- @reset="handleReset" />
- <cwg-tabel ref="tableRef" :columns="columns" :mobilePrimaryFields="mobilePrimaryFields"
- :queryParams="search" :api="listApi" :show-operation="false" :showPagination="false">
- <template #symbol="{ row }">
- <view class="symbol-cell">
- <view class="pair">{{ getSymbolParts(row.symbol)[0] }}/{{ getSymbolParts(row.symbol)[1]
- }}</view>
- <view class="desc">{{ row.openPrice }}
- <text :class="getCmdColorClass(row.cmdName)">{{ formatCmdName(row.cmdName) }}{{ row.volume
- }}{{ t('Label.Lot') }}</text>
- </view>
- </view>
- </template>
- <template #profit="{ row }">
- <view class="symbol-cell">
- <text :class="getProfitColorClass(row.profit)">{{ row.profit || 0 }}</text>
- </view>
- </template>
- </cwg-tabel>
- </view>
- </cwg-page-wrapper>
- </template>
- <script setup lang="ts">
- import { computed, ref, nextTick } from 'vue';
- import { useI18n } from 'vue-i18n';
- const { t, locale } = useI18n();
- import { customApi } from '@/service/custom';
- const search = ref(
- {
- "reportType": 3,
- "agentId": null,
- "groupType": null,
- "login": "",
- "cId": "",
- "customName": "",
- "ibNo": "",
- "symbol": "",
- "cmdName": "",
- "platform": "MT4",
- "salesNo": "",
- "salesName": "",
- "dwType": null,
- "customType": 0,
- "rankingType": 1,
- "loginTypes": [],
- "isShort": 0,
- "detail_type": 4,
- "date": [
- "1970-01-01",
- "2026-03-27"
- ],
- "startDate": "1970-01-01",
- "endDate": "2026-03-27",
- "orderColumn": null,
- "orderType": null,
- "page": {
- "current": 1,
- "row": 10
- }
- }
- )
- const typeMap = computed(() => ([
- { value: null, text: t('Custom.PaymentHistory.All') },
- { value: 1, text: t('Custom.PaymentHistory.Deposit') },
- { value: 2, text: t('Custom.PaymentHistory.Withdrawals') }
- ]));
- const orderStatusMap = computed(() => ([
- { value: null, text: t('Custom.PaymentHistory.All') },
- { value: 1, text: t('State.ToBeProcessed') },
- { value: 2, text: t('State.Completed') },
- { value: 3, text: t('State.InTheProcessing') },
- { value: 4, text: t('State.Refused') },
- { value: 5, text: t('State.expireTime') },
- { value: 6, text: t('State.Cancelled') },
- ]));
- // 表格列配置
- const columns = computed(() => [
- {
- prop: 'symbol',
- label: t('Label.Varieties'), // 交易品种
- align: 'left'
- },
- {
- prop: 'cmdName',
- label: t('Label.Type'), // 类型
- align: 'left'
- },
- {
- prop: 'openTime',
- label: t('Label.OpenTime'), // 开仓时间(协调世界时)
- align: 'left'
- },
- {
- prop: 'volume',
- label: t('Label.Volume'), // 手
- formatter: ({ row }) => `${row.volume || 0} ${t('Label.Lot')}`,
- align: 'right'
- },
- {
- prop: 'openPrice',
- label: t('Label.OpenPrice'), // 开仓价
- align: 'right'
- },
- {
- prop: 'tp',
- label: t('Label.EP'), // 止盈
- align: 'right'
- },
- {
- prop: 'sl',
- label: t('Label.EL'), // 止损
- align: 'right'
- },
- {
- prop: 'profit',
- label: t('Label.ProfitLoss') + '(USD)', // 利润, USD
- slot: 'profit',
- align: 'right'
- },
- {
- prop: 'comment',
- label: t('Label.Note'),
- align: 'right',
- isTabel: false
- },
- {
- prop: 'more',
- type: 'more',
- width: 20,
- align: 'right'
- },
- ])
- const mobilePrimaryFields = computed(() => [
- {
- prop: 'symbol',
- label: t('Label.Varieties'), // 交易品种
- align: 'left',
- slot: 'symbol'
- },
- {
- prop: 'profit',
- label: t('Label.ProfitLoss') + '(USD)', // 利润, USD
- slot: 'profit',
- align: 'right'
- },
- {
- prop: 'more',
- type: 'more',
- width: 20,
- align: 'right'
- },
- ])
- // 动态传入筛选字段配置
- const filterFields = computed(() => [
-
- { key: 'type', type: 'select', label: t('Custom.PaymentHistory.payType'), placeholder: t('placeholder.choose'), options: typeMap.value, defaultValue: 1 },
- { key: 'login', type: 'input', label: t('Custom.PaymentHistory.TradingAccount'), placeholder: t('placeholder.login'), defaultValue: '' },
- {
- key: 'orderStatus', type: 'select', label: t('Custom.PaymentHistory.Status'), placeholder: t('placeholder.choose'), options: orderStatusMap.value, defaultValue: null
- },
- { key: 'date', label: t('placeholder.Start') + ' - ' + t('placeholder.End'), type: 'daterange' }
- ])
- const searchParams = ref({})
- const tableRef = ref(null)
- const handleSearch = (params) => {
- search.value = params
- nextTick(() => {
- tableRef.value.refreshTable()
- })
- }
- const handleReset = (emptyParams) => {
- search.value = emptyParams
- nextTick(() => {
- tableRef.value.refreshTable()
- })
- }
- const listApi = ref(null)
- listApi.value = customApi.tradePosition
- const getSymbolParts = (sym: string) => {
- if (!sym) return ['', '']
- const s = String(sym).toUpperCase()
- if (s.includes('/')) {
- const [base, quote] = s.split('/')
- return [base, quote]
- }
- const base = s.slice(0, 3)
- const quote = s.slice(3)
- return [base, quote]
- }
- const formatCmdName = (cmd: string) => {
- const v = String(cmd || '').toLowerCase()
- if (v.includes('sell')) return '卖出'
- if (v.includes('buy')) return '买入'
- return cmd || ''
- }
- const getCmdColorClass = (cmd: string) => {
- const v = String(cmd || '').toLowerCase()
- if (v.includes('sell')) return 'is-sell'
- if (v.includes('buy')) return 'is-buy'
- return ''
- }
- const getProfitColorClass = (profit: any) => {
- const n = Number(profit)
- if (!Number.isFinite(n) || n === 0) return ''
- return n > 0 ? 'is-profit' : 'is-loss'
- }
- </script>
- <style scoped lang="scss">
- @import "@/uni.scss";
- .avatar {
- width: px2rpx(60);
- height: px2rpx(60);
- border-radius: 4px;
- }
- .content-title {
- display: flex;
- justify-content: space-between;
- align-items: center;
- font-size: px2rpx(20);
- font-weight: 500;
- .content-title-btns {
- margin: px2rpx(8) 0;
- display: flex;
- align-items: center;
- justify-content: center;
- gap: px2rpx(12);
- .btn-primary {
- min-width: px2rpx(120);
- background-color: var(--color-error);
- color: white;
- padding: 0 px2rpx(12);
- border: none;
- font-size: px2rpx(14);
- text-align: center;
- cursor: pointer;
- display: flex;
- align-items: center;
- justify-content: center;
- gap: px2rpx(8);
- }
- .btn-primary:active {
- background-color: var(--color-navy-700);
- }
- }
- }
- .operation-btn {
- :deep(span) {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: px2rpx(4);
- cursor: pointer;
- background-color: var(--color-slate-150);
- padding: px2rpx(8) 0;
- }
- }
- .operation-btn.disabled {
- cursor: not-allowed;
- opacity: 0.5;
- }
- .symbol-cell {
- display: inline-flex;
- align-items: flex-start;
- gap: 0.25rem;
- flex-direction: column;
- .pair {
- font-weight: 600;
- color: var(--color-slate-900);
- }
- .desc {
- color: var(--color-slate-600);
- }
- }
- .is-sell,
- .is-loss {
- color: #eb483f;
- }
- .is-buy,
- .is-profit {
- color: #46cd7c;
- }
- .search-bar {
- display: flex;
- align-items: center;
- justify-content: flex-start;
- flex-wrap: wrap;
- gap: px2rpx(16);
- margin: px2rpx(16) 0;
- .cwg-combox,
- .uni-easyinput,
- .uni-date {
- width: px2rpx(240) !important;
- flex: none;
- }
- }
- </style>
|