1.对局新增查看异常订单

This commit is contained in:
2026-04-24 17:22:38 +08:00
parent d9b574676b
commit 5ab9172b31
6 changed files with 325 additions and 3 deletions

View File

@@ -26,4 +26,13 @@ export default {
manual_create_label: 'Allow manual create next round',
manual_create_tip: 'When enabled, button below can create next round manually',
btn_create_next: 'Create next round (manual)',
view_abnormal_rounds: 'View abnormal rounds',
abnormal_dialog_title: 'Abnormal round recovery logs',
abnormal_dialog_tip: 'Shows rounds auto-recovered after service restart (auto-void + refund).',
abnormal_from_status: 'Status before recovery',
refunded_user_count: 'Refunded users',
refunded_order_count: 'Refunded orders',
refunded_total_amount: 'Total refunded amount',
recovered_at: 'Recovered at',
load_abnormal_failed: 'Failed to load abnormal rounds',
}

View File

@@ -26,4 +26,13 @@ export default {
manual_create_label: '允许手动创建下一局',
manual_create_tip: '开启后可在本页使用「手动创建下一局」按钮',
btn_create_next: '手动创建下一局',
view_abnormal_rounds: '查看异常对局',
abnormal_dialog_title: '异常对局恢复记录',
abnormal_dialog_tip: '展示服务重启后自动恢复的异常对局(自动作废并退款)。',
abnormal_from_status: '异常前状态',
refunded_user_count: '退款用户数',
refunded_order_count: '退款注单数',
refunded_total_amount: '退款总金额',
recovered_at: '恢复时间',
load_abnormal_failed: '加载异常对局失败',
}

View File

@@ -6,22 +6,58 @@
:buttons="['refresh', 'comSearch', 'quickSearch', 'columnDisplay']"
:quick-search-placeholder="t('Quick search placeholder', { fields: t('game.record.quick Search Fields') })"
></TableHeader>
<div class="record-top-actions">
<el-button type="warning" @click="openAbnormalDialog">{{ t('game.record.view_abnormal_rounds') }}</el-button>
</div>
<Table ref="tableRef"></Table>
<PopupForm />
<el-dialog
class="ba-operate-dialog"
:title="t('game.record.abnormal_dialog_title')"
:model-value="abnormalDialog.visible"
width="900px"
:close-on-click-modal="false"
@close="closeAbnormalDialog"
>
<div v-loading="abnormalDialog.loading">
<el-alert type="info" :closable="false" show-icon class="mb-12">
{{ t('game.record.abnormal_dialog_tip') }}
</el-alert>
<el-table :data="abnormalDialog.list" border size="small" max-height="420">
<el-table-column prop="period_no" :label="t('game.record.period_no')" min-width="180" />
<el-table-column :label="t('game.record.abnormal_from_status')" min-width="120">
<template #default="scope">{{ formatStatusLabel(scope.row.abnormal_from_status) }}</template>
</el-table-column>
<el-table-column prop="refunded_user_count" :label="t('game.record.refunded_user_count')" min-width="120" />
<el-table-column prop="refunded_order_count" :label="t('game.record.refunded_order_count')" min-width="120" />
<el-table-column prop="refunded_total_amount" :label="t('game.record.refunded_total_amount')" min-width="140" />
<el-table-column prop="recovered_at" :label="t('game.record.recovered_at')" min-width="170">
<template #default="scope">{{ formatRecoveredTime(scope.row.recovered_at) }}</template>
</el-table-column>
</el-table>
</div>
<template #footer>
<el-button @click="closeAbnormalDialog">{{ t('Cancel') }}</el-button>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { onMounted, provide, useTemplateRef } from 'vue'
import { onMounted, provide, reactive, useTemplateRef } from 'vue'
import { useI18n } from 'vue-i18n'
import { ElMessage } from 'element-plus'
import PopupForm from './popupForm.vue'
import { baTableApi } from '/@/api/common'
import { defaultOptButtons } from '/@/components/table'
import TableHeader from '/@/components/table/header/index.vue'
import Table from '/@/components/table/index.vue'
import baTableClass from '/@/utils/baTable'
import createAxios from '/@/utils/axios'
import { timeFormat } from '/@/utils/common'
defineOptions({
name: 'game/record',
@@ -30,6 +66,11 @@ defineOptions({
const { t } = useI18n()
const tableRef = useTemplateRef('tableRef')
const optButtons: OptButton[] = defaultOptButtons(['edit'])
const abnormalDialog = reactive({
visible: false,
loading: false,
list: [] as any[],
})
const formatCoin = (_row: any, _column: any, cellValue: number | string | null | undefined) => {
if (cellValue === null || cellValue === undefined || cellValue === '') return '—'
@@ -99,6 +140,50 @@ const baTable = new baTableClass(
}
)
const formatStatusLabel = (status: number) => {
const key = String(status)
if (!['0', '1', '2', '3', '4', '5'].includes(key)) {
return '-'
}
return t(`game.record.status ${key}`)
}
const openAbnormalDialog = async () => {
abnormalDialog.visible = true
abnormalDialog.loading = true
try {
const response = await createAxios(
{
url: '/admin/game.Record/abnormalList',
method: 'get',
params: { limit: 100 },
},
{
showSuccessMessage: false,
}
)
const data = response?.data?.data ?? {}
abnormalDialog.list = Array.isArray(data.list) ? data.list : []
} catch (error: any) {
const message = typeof error?.message === 'string' && error.message !== '' ? error.message : t('game.record.load_abnormal_failed')
ElMessage.error(message)
abnormalDialog.list = []
} finally {
abnormalDialog.loading = false
}
}
const closeAbnormalDialog = () => {
abnormalDialog.visible = false
}
const formatRecoveredTime = (timestamp: number) => {
if (!timestamp) {
return '-'
}
return timeFormat(timestamp)
}
provide('baTable', baTable)
onMounted(() => {