|
|
@@ -521,6 +521,18 @@
|
|
|
</span>
|
|
|
</span>
|
|
|
</template>
|
|
|
+ <template v-else-if="column.key === 'cardRate'">
|
|
|
+ <a-input-number
|
|
|
+ :value="record.cardRate"
|
|
|
+ :min="0"
|
|
|
+ :max="10"
|
|
|
+ :precision="2"
|
|
|
+ size="small"
|
|
|
+ style="width: 60px;"
|
|
|
+ placeholder="比例"
|
|
|
+ @change="(val: number | null) => handleBoundSteamCardRateChange(record, val)"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
<template v-else-if="column.key === 'status'">
|
|
|
<a-tag v-if="isAutoRelogining(record.steam_username)" color="processing">
|
|
|
自动登录中
|
|
|
@@ -1191,12 +1203,14 @@ type BoundSteamApiAccount = {
|
|
|
type BoundSteamLocalAccount = {
|
|
|
steam_account?: string
|
|
|
steamLoginSecure?: string
|
|
|
+ card_rate?: number | null
|
|
|
}
|
|
|
type BoundSteamRow = {
|
|
|
id: number
|
|
|
steam_username: string
|
|
|
steam_id: string
|
|
|
hasSteamLoginSecure: boolean
|
|
|
+ cardRate?: number | null
|
|
|
}
|
|
|
const boundSteamLoading = ref(false)
|
|
|
const boundSteamAccounts = ref<BoundSteamRow[]>([])
|
|
|
@@ -1537,9 +1551,10 @@ const sweepColumns = [
|
|
|
{ title: '扫货时间', dataIndex: 'created_at', key: 'created_at', minWidth: 160, resizable: true }
|
|
|
]
|
|
|
const boundSteamColumns = [
|
|
|
- { title: 'Steam ID', dataIndex: 'steam_id', key: 'steam_id', width: 220 },
|
|
|
- { title: 'Steam 账号', dataIndex: 'steam_username', key: 'steam_username', width: 180 },
|
|
|
+ { title: 'Steam ID', dataIndex: 'steam_id', key: 'steam_id', width: 150 },
|
|
|
+ { title: 'Steam 账号', dataIndex: 'steam_username', key: 'steam_username', width: 120 },
|
|
|
{ title: '余额', key: 'balance', width: 120 },
|
|
|
+ { title: '充值卡价比例', key: 'cardRate', width: 100 },
|
|
|
{ title: '状态', key: 'status', width: 120 },
|
|
|
{ title: '操作', key: 'action', width: 180 }
|
|
|
]
|
|
|
@@ -2088,6 +2103,22 @@ async function handleBoundSteamRelogin(record: BoundSteamRow) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+async function handleBoundSteamCardRateChange(record: BoundSteamRow, rate: number | null) {
|
|
|
+ try {
|
|
|
+ await invoke('update_account_card_rate', {
|
|
|
+ steamUsername: record.steam_username,
|
|
|
+ cardRate: rate
|
|
|
+ })
|
|
|
+ const idx = boundSteamAccounts.value.findIndex(a => a.steam_username === record.steam_username)
|
|
|
+ if (idx !== -1) {
|
|
|
+ boundSteamAccounts.value[idx].cardRate = rate
|
|
|
+ }
|
|
|
+ message.success('充值卡价比例已保存')
|
|
|
+ } catch (err: any) {
|
|
|
+ message.error(err?.message || err?.toString() || '保存失败')
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
async function loadBoundSteamAccounts(autoRefreshBalances: boolean = true) {
|
|
|
const userId = authStore.userId
|
|
|
if (!userId) {
|
|
|
@@ -2111,13 +2142,20 @@ async function loadBoundSteamAccounts(autoRefreshBalances: boolean = true) {
|
|
|
.filter((item) => item.steam_account && item.steamLoginSecure)
|
|
|
.map((item) => String(item.steam_account))
|
|
|
)
|
|
|
+ const localCardRateMap: Record<string, number | null> = {}
|
|
|
+ for (const item of localList) {
|
|
|
+ if (item.steam_account) {
|
|
|
+ localCardRateMap[item.steam_account] = item.card_rate ?? null
|
|
|
+ }
|
|
|
+ }
|
|
|
const boundList = (apiRes.data || [])
|
|
|
.filter((item) => !!item.steam_id && String(item.steam_id).trim() !== '')
|
|
|
.map((item) => ({
|
|
|
id: item.id,
|
|
|
steam_username: item.steam_username,
|
|
|
steam_id: String(item.steam_id),
|
|
|
- hasSteamLoginSecure: localSecureSet.has(item.steam_username)
|
|
|
+ hasSteamLoginSecure: localSecureSet.has(item.steam_username),
|
|
|
+ cardRate: localCardRateMap[item.steam_username] ?? null
|
|
|
}))
|
|
|
boundSteamAccounts.value = boundList
|
|
|
// 初始化账号选择状态(默认全选)
|