优化页面不显示小数
This commit is contained in:
@@ -71,6 +71,16 @@
|
|||||||
{{ row.direction === 0 ? t('page.search.clockwise') : row.direction === 1 ? t('page.search.anticlockwise') : '-' }}
|
{{ row.direction === 0 ? t('page.search.clockwise') : row.direction === 1 ? t('page.search.anticlockwise') : '-' }}
|
||||||
</ElTag>
|
</ElTag>
|
||||||
</template>
|
</template>
|
||||||
|
<!-- 平台币相关:统一整数显示 -->
|
||||||
|
<template #win_coin="{ row }">
|
||||||
|
<span>{{ formatPlatformCoin(row?.win_coin) }}</span>
|
||||||
|
</template>
|
||||||
|
<template #super_win_coin="{ row }">
|
||||||
|
<span>{{ formatPlatformCoin(row?.super_win_coin) }}</span>
|
||||||
|
</template>
|
||||||
|
<template #reward_win_coin="{ row }">
|
||||||
|
<span>{{ formatPlatformCoin(row?.reward_win_coin) }}</span>
|
||||||
|
</template>
|
||||||
<!-- 摇取点数 tag -->
|
<!-- 摇取点数 tag -->
|
||||||
<template #roll_array="{ row }">
|
<template #roll_array="{ row }">
|
||||||
<ElTag size="small">
|
<ElTag size="small">
|
||||||
@@ -166,6 +176,13 @@
|
|||||||
return String(val)
|
return String(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatPlatformCoin(val: unknown): string {
|
||||||
|
if (val === '' || val === null || val === undefined) return '-'
|
||||||
|
const n = typeof val === 'number' ? val : Number(val)
|
||||||
|
if (!Number.isFinite(n)) return '-'
|
||||||
|
return String(Math.trunc(n))
|
||||||
|
}
|
||||||
|
|
||||||
// 表格配置
|
// 表格配置
|
||||||
const {
|
const {
|
||||||
columns,
|
columns,
|
||||||
@@ -202,9 +219,9 @@
|
|||||||
{ prop: 'ante', label: 'page.table.ante', width: 80, align: 'center' },
|
{ prop: 'ante', label: 'page.table.ante', width: 80, align: 'center' },
|
||||||
{ prop: 'paid_amount', label: 'page.table.paidAmount', width: 110, align: 'center' },
|
{ prop: 'paid_amount', label: 'page.table.paidAmount', width: 110, align: 'center' },
|
||||||
{ prop: 'is_win', label: 'page.table.isBigWin', width: 100, useSlot: true },
|
{ prop: 'is_win', label: 'page.table.isBigWin', width: 100, useSlot: true },
|
||||||
{ prop: 'win_coin', label: 'page.table.winCoin', width: 110 },
|
{ prop: 'win_coin', label: 'page.table.winCoin', width: 110, useSlot: true },
|
||||||
{ prop: 'super_win_coin', label: 'page.table.superWinCoin', width: 120 },
|
{ prop: 'super_win_coin', label: 'page.table.superWinCoin', width: 120, useSlot: true },
|
||||||
{ prop: 'reward_win_coin', label: 'page.table.rewardWinCoin', width: 140 },
|
{ prop: 'reward_win_coin', label: 'page.table.rewardWinCoin', width: 140, useSlot: true },
|
||||||
{ prop: 'direction', label: 'page.table.direction', width: 90, useSlot: true },
|
{ prop: 'direction', label: 'page.table.direction', width: 90, useSlot: true },
|
||||||
{ prop: 'start_index', label: 'page.table.startIndex', width: 90 },
|
{ prop: 'start_index', label: 'page.table.startIndex', width: 90 },
|
||||||
{ prop: 'target_index', label: 'page.table.targetIndex', width: 90 },
|
{ prop: 'target_index', label: 'page.table.targetIndex', width: 90 },
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="formData.win_coin"
|
v-model="formData.win_coin"
|
||||||
:placeholder="$t('page.form.placeholderWinCoin')"
|
:placeholder="$t('page.form.placeholderWinCoin')"
|
||||||
:precision="2"
|
:precision="0"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:disabled="dialogType === 'edit'"
|
:disabled="dialogType === 'edit'"
|
||||||
/>
|
/>
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="formData.super_win_coin"
|
v-model="formData.super_win_coin"
|
||||||
:placeholder="$t('page.form.placeholderSuperWinCoin')"
|
:placeholder="$t('page.form.placeholderSuperWinCoin')"
|
||||||
:precision="2"
|
:precision="0"
|
||||||
:min="0"
|
:min="0"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:disabled="dialogType === 'edit'"
|
:disabled="dialogType === 'edit'"
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="formData.reward_win_coin"
|
v-model="formData.reward_win_coin"
|
||||||
:placeholder="$t('page.form.placeholderRewardWinCoin')"
|
:placeholder="$t('page.form.placeholderRewardWinCoin')"
|
||||||
:precision="2"
|
:precision="0"
|
||||||
:min="0"
|
:min="0"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:disabled="dialogType === 'edit'"
|
:disabled="dialogType === 'edit'"
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="formData.win_coin_min"
|
v-model="formData.win_coin_min"
|
||||||
:placeholder="$t('table.searchBar.min')"
|
:placeholder="$t('table.searchBar.min')"
|
||||||
:precision="2"
|
:precision="0"
|
||||||
controls-position="right"
|
controls-position="right"
|
||||||
class="range-input"
|
class="range-input"
|
||||||
/>
|
/>
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="formData.win_coin_max"
|
v-model="formData.win_coin_max"
|
||||||
:placeholder="$t('table.searchBar.max')"
|
:placeholder="$t('table.searchBar.max')"
|
||||||
:precision="2"
|
:precision="0"
|
||||||
controls-position="right"
|
controls-position="right"
|
||||||
class="range-input"
|
class="range-input"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -146,6 +146,13 @@
|
|||||||
return player?.username ?? row.player_id ?? '-'
|
return player?.username ?? row.player_id ?? '-'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatInteger(val: unknown): string {
|
||||||
|
if (val === '' || val === null || val === undefined) return '-'
|
||||||
|
const n = typeof val === 'number' ? val : Number(val)
|
||||||
|
if (!Number.isFinite(n)) return '-'
|
||||||
|
return String(Math.trunc(n))
|
||||||
|
}
|
||||||
|
|
||||||
// 表格配置
|
// 表格配置
|
||||||
const {
|
const {
|
||||||
columns,
|
columns,
|
||||||
@@ -190,8 +197,20 @@
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
formatter: operatorFormatter
|
formatter: operatorFormatter
|
||||||
},
|
},
|
||||||
{ prop: 'wallet_before', label: 'page.table.walletBefore', width: 110, align: 'center' },
|
{
|
||||||
{ prop: 'wallet_after', label: 'page.table.walletAfter', width: 110, align: 'center' },
|
prop: 'wallet_before',
|
||||||
|
label: 'page.table.walletBefore',
|
||||||
|
width: 110,
|
||||||
|
align: 'center',
|
||||||
|
formatter: (row: Record<string, any>) => formatInteger(row?.wallet_before)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'wallet_after',
|
||||||
|
label: 'page.table.walletAfter',
|
||||||
|
width: 110,
|
||||||
|
align: 'center',
|
||||||
|
formatter: (row: Record<string, any>) => formatInteger(row?.wallet_after)
|
||||||
|
},
|
||||||
{
|
{
|
||||||
prop: 'remark',
|
prop: 'remark',
|
||||||
label: 'page.table.remark',
|
label: 'page.table.remark',
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="formData.coin"
|
v-model="formData.coin"
|
||||||
:placeholder="$t('page.form.placeholderCoinChange')"
|
:placeholder="$t('page.form.placeholderCoinChange')"
|
||||||
:precision="2"
|
:precision="0"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
@change="onCoinChange"
|
@change="onCoinChange"
|
||||||
:disabled="dialogType === 'edit'"
|
:disabled="dialogType === 'edit'"
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="formData.wallet_before"
|
v-model="formData.wallet_before"
|
||||||
:placeholder="$t('page.form.placeholderWalletBefore')"
|
:placeholder="$t('page.form.placeholderWalletBefore')"
|
||||||
:precision="2"
|
:precision="0"
|
||||||
disabled
|
disabled
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
/>
|
/>
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="formData.wallet_after"
|
v-model="formData.wallet_after"
|
||||||
:placeholder="$t('page.form.placeholderWalletAfter')"
|
:placeholder="$t('page.form.placeholderWalletAfter')"
|
||||||
:precision="2"
|
:precision="0"
|
||||||
disabled
|
disabled
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
/>
|
/>
|
||||||
@@ -131,14 +131,22 @@
|
|||||||
type: [{ required: true, message: '请选择类型', trigger: 'change' }]
|
type: [{ required: true, message: '请选择类型', trigger: 'change' }]
|
||||||
})
|
})
|
||||||
|
|
||||||
const initialFormData = {
|
const initialFormData: {
|
||||||
id: null as number | null,
|
id: number | null
|
||||||
player_id: null as number | null,
|
player_id: number | null
|
||||||
coin: 0 as number,
|
coin: number
|
||||||
type: null as number | null,
|
type: number | null
|
||||||
wallet_before: 0 as number,
|
wallet_before: number
|
||||||
wallet_after: 0 as number,
|
wallet_after: number
|
||||||
remark: '' as string
|
remark: string
|
||||||
|
} = {
|
||||||
|
id: null,
|
||||||
|
player_id: null,
|
||||||
|
coin: 0,
|
||||||
|
type: null,
|
||||||
|
wallet_before: 0,
|
||||||
|
wallet_after: 0,
|
||||||
|
remark: ''
|
||||||
}
|
}
|
||||||
|
|
||||||
const formData = reactive({ ...initialFormData })
|
const formData = reactive({ ...initialFormData })
|
||||||
@@ -170,7 +178,7 @@
|
|||||||
function calcWalletAfter() {
|
function calcWalletAfter() {
|
||||||
const before = Number(formData.wallet_before) || 0
|
const before = Number(formData.wallet_before) || 0
|
||||||
const coin = Number(formData.coin) || 0
|
const coin = Number(formData.coin) || 0
|
||||||
formData.wallet_after = Math.round((before + coin) * 100) / 100
|
formData.wallet_after = Math.trunc(before + coin)
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
@@ -196,23 +204,24 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const numKeys = ['id', 'player_id', 'coin', 'type', 'wallet_before', 'wallet_after']
|
function normalizeInteger(val: unknown, fallback: number): number {
|
||||||
|
if (val === '' || val === null || val === undefined) return fallback
|
||||||
|
const n = typeof val === 'number' ? val : Number(val)
|
||||||
|
if (!Number.isFinite(n)) return fallback
|
||||||
|
return Math.trunc(n)
|
||||||
|
}
|
||||||
|
|
||||||
const initForm = () => {
|
const initForm = () => {
|
||||||
if (!props.data) return
|
if (!props.data) return
|
||||||
for (const key of Object.keys(formData)) {
|
|
||||||
if (!(key in props.data)) continue
|
formData.id = props.data.id != null && props.data.id !== '' ? Number(props.data.id) : null
|
||||||
const val = props.data[key]
|
formData.player_id =
|
||||||
if (numKeys.includes(key)) {
|
props.data.player_id != null && props.data.player_id !== '' ? Number(props.data.player_id) : null
|
||||||
if (key === 'id' || key === 'player_id' || key === 'type') {
|
formData.type = props.data.type != null && props.data.type !== '' ? Number(props.data.type) : null
|
||||||
;(formData as any)[key] = val != null && val !== '' ? Number(val) : null
|
formData.coin = normalizeInteger(props.data.coin, 0)
|
||||||
} else {
|
formData.wallet_before = normalizeInteger(props.data.wallet_before, 0)
|
||||||
;(formData as any)[key] = val != null && val !== '' ? Number(val) : 0
|
formData.wallet_after = normalizeInteger(props.data.wallet_after, 0)
|
||||||
}
|
formData.remark = props.data.remark ?? ''
|
||||||
} else {
|
|
||||||
;(formData as any)[key] = val ?? ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
|
|||||||
@@ -70,6 +70,13 @@
|
|||||||
return api.list({ ...params, direction: currentDirection.value })
|
return api.list({ ...params, direction: currentDirection.value })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatInteger(val: unknown): string {
|
||||||
|
if (val === '' || val === null || val === undefined) return '-'
|
||||||
|
const n = typeof val === 'number' ? val : Number(val)
|
||||||
|
if (!Number.isFinite(n)) return '-'
|
||||||
|
return String(Math.trunc(n))
|
||||||
|
}
|
||||||
|
|
||||||
const handleSearch = (params: Record<string, any>) => {
|
const handleSearch = (params: Record<string, any>) => {
|
||||||
Object.assign(searchParams, { ...params, direction: currentDirection.value })
|
Object.assign(searchParams, { ...params, direction: currentDirection.value })
|
||||||
getData()
|
getData()
|
||||||
@@ -117,7 +124,13 @@
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
showOverflowTooltip: true
|
showOverflowTooltip: true
|
||||||
},
|
},
|
||||||
{ prop: 'real_ev', label: 'page.table.realEv', width: 110, align: 'center' },
|
{
|
||||||
|
prop: 'real_ev',
|
||||||
|
label: 'page.table.realEv',
|
||||||
|
width: 110,
|
||||||
|
align: 'center',
|
||||||
|
formatter: (row: Record<string, any>) => formatInteger(row?.real_ev)
|
||||||
|
},
|
||||||
{ prop: 'remark', label: 'page.table.remark', minWidth: 80, align: 'center', showOverflowTooltip: true },
|
{ prop: 'remark', label: 'page.table.remark', minWidth: 80, align: 'center', showOverflowTooltip: true },
|
||||||
{ prop: 'weight', label: 'page.table.weight', width: 110, align: 'center' }
|
{ prop: 'weight', label: 'page.table.weight', width: 110, align: 'center' }
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -60,7 +60,11 @@
|
|||||||
width="90"
|
width="90"
|
||||||
align="center"
|
align="center"
|
||||||
show-overflow-tooltip
|
show-overflow-tooltip
|
||||||
/>
|
>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span>{{ formatInteger(row?.real_ev) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
:label="$t('page.weightShared.colUiText')"
|
:label="$t('page.weightShared.colUiText')"
|
||||||
prop="ui_text"
|
prop="ui_text"
|
||||||
@@ -250,6 +254,13 @@
|
|||||||
import api from '../../../api/reward/index'
|
import api from '../../../api/reward/index'
|
||||||
import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue'
|
import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
|
function formatInteger(val: unknown): string {
|
||||||
|
if (val === '' || val === null || val === undefined) return '-'
|
||||||
|
const n = typeof val === 'number' ? val : Number(val)
|
||||||
|
if (!Number.isFinite(n)) return '-'
|
||||||
|
return String(Math.trunc(n))
|
||||||
|
}
|
||||||
|
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|||||||
@@ -54,7 +54,11 @@
|
|||||||
width="90"
|
width="90"
|
||||||
align="center"
|
align="center"
|
||||||
show-overflow-tooltip
|
show-overflow-tooltip
|
||||||
/>
|
>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span>{{ formatInteger(row?.real_ev) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
:label="$t('page.weightShared.colUiText')"
|
:label="$t('page.weightShared.colUiText')"
|
||||||
prop="ui_text"
|
prop="ui_text"
|
||||||
@@ -315,6 +319,13 @@
|
|||||||
import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue'
|
import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
function formatInteger(val: unknown): string {
|
||||||
|
if (val === '' || val === null || val === undefined) return '-'
|
||||||
|
const n = typeof val === 'number' ? val : Number(val)
|
||||||
|
if (!Number.isFinite(n)) return '-'
|
||||||
|
return String(Math.trunc(n))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const { t, locale } = useI18n()
|
const { t, locale } = useI18n()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user