feat(player): PC 端投注/资金/充值/返水列表改为弹窗详情
列表点击与深链统一打开桌面弹窗,并补齐冻结余额文案与审核日志补全。
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onActivated } from 'vue';
|
||||
import { ref, onMounted, onActivated, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import api from '../../api';
|
||||
import GoldSpinner from '../../components/GoldSpinner.vue';
|
||||
import Pagination from '../../components/desktop/Pagination.vue';
|
||||
@@ -10,6 +11,8 @@ import { formatMoney } from '../../utils/localeDisplay';
|
||||
import { txTypeKey, txDisplayType, txAmountClass, txSummaryLabel } from '../../utils/walletTx';
|
||||
|
||||
const { t, locale } = useI18n();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const detailModalVisible = ref(false);
|
||||
const detailTxId = ref<string | null>(null);
|
||||
@@ -19,6 +22,17 @@ function openDetail(txId: string) {
|
||||
detailModalVisible.value = true;
|
||||
}
|
||||
|
||||
function openDetailFromQuery() {
|
||||
const transactionId = route.query.transactionId;
|
||||
if (typeof transactionId === 'string' && transactionId) {
|
||||
openDetail(transactionId);
|
||||
const { transactionId: _removed, ...rest } = route.query;
|
||||
void router.replace({ path: route.path, query: rest });
|
||||
}
|
||||
}
|
||||
|
||||
watch(() => route.query.transactionId, openDetailFromQuery);
|
||||
|
||||
type Transaction = {
|
||||
transactionType: string;
|
||||
displayType?: string;
|
||||
@@ -43,6 +57,10 @@ function txLabel(tx: Transaction) {
|
||||
return tx.transactionType;
|
||||
}
|
||||
|
||||
function txSubtitle(tx: Transaction): string {
|
||||
return txSummaryLabel(tx, t);
|
||||
}
|
||||
|
||||
function amountClass(amount: string) {
|
||||
return `desktop-records-amount ${txAmountClass(amount)}`;
|
||||
}
|
||||
@@ -65,8 +83,14 @@ async function fetchData(p = 1) {
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => fetchData(1));
|
||||
onActivated(() => fetchData(page.value));
|
||||
onMounted(() => {
|
||||
void fetchData(1);
|
||||
openDetailFromQuery();
|
||||
});
|
||||
onActivated(() => {
|
||||
void fetchData(page.value);
|
||||
openDetailFromQuery();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -94,11 +118,11 @@ onActivated(() => fetchData(page.value));
|
||||
<tr
|
||||
v-for="tx in items"
|
||||
:key="tx.transactionId"
|
||||
class="hover-row"
|
||||
class="hover-row clickable-row"
|
||||
@click="openDetail(tx.transactionId)"
|
||||
>
|
||||
<td class="type-cell">{{ txLabel(tx) }}</td>
|
||||
<td class="muted-cell">{{ txSummaryLabel(tx, t) || '-' }}</td>
|
||||
<td class="muted-cell">{{ txSubtitle(tx) || '-' }}</td>
|
||||
<td :class="['num-cell', amountClass(tx.amount)]">{{ formatMoney(tx.amount, locale) }}</td>
|
||||
<td class="date-cell">{{ new Date(tx.createdAt).toLocaleString() }}</td>
|
||||
</tr>
|
||||
@@ -120,11 +144,7 @@ onActivated(() => fetchData(page.value));
|
||||
<div class="desktop-records-empty">{{ t('wallet.no_records') }}</div>
|
||||
</section>
|
||||
|
||||
<DesktopTxDetailModal
|
||||
:visible="detailModalVisible"
|
||||
:transaction-id="detailTxId"
|
||||
@update:visible="detailModalVisible = $event"
|
||||
/>
|
||||
<DesktopTxDetailModal v-model:visible="detailModalVisible" :transaction-id="detailTxId" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user