fix: 完成商务迁移复核与接口优化并清理历史资料

This commit is contained in:
Yvan
2026-11-04 14:45:02 +08:00
parent 5a96be6a79
commit 297e80827d
176 changed files with 6803 additions and 6002 deletions
+28 -22
View File
@@ -1,27 +1,16 @@
<template>
<el-popover placement="bottom-end" :width="250" trigger="click" @show="load">
<template #reference>
<icon-button icon="lucide:sliders-horizontal" label="统计口径" />
</template>
<div v-loading="loading" class="space-y-3">
<div class="font-medium">全局统计口径</div>
<div class="flex items-center justify-between">
<span>包含下级渠道</span>
<el-switch :model-value="preference.includeSubPromote" :disabled="loading || !loaded" @change="save('includeSubPromote', $event)" />
</div>
<div class="flex items-center justify-between">
<span>身份证去重</span>
<el-switch :model-value="preference.idcardDedup" :disabled="loading || !loaded" @change="save('idcardDedup', $event)" />
</div>
<p class="text-xs text-gray-500">用于商务数据查询,充值金额不受身份证去重影响。</p>
</div>
</el-popover>
<div class="business-preferences" role="group" aria-label="统计口径" :aria-busy="loading">
<el-checkbox :model-value="preference.includeSubPromote" :disabled="loading || !loaded" @update:model-value="save('includeSubPromote', $event)">包含下级渠道</el-checkbox>
<el-tooltip content="按身份证合并玩家统计,充值金额不受影响。" placement="bottom">
<el-checkbox :model-value="preference.idcardDedup" :disabled="loading || !loaded" @update:model-value="save('idcardDedup', $event)">身份证去重</el-checkbox>
</el-tooltip>
<el-button v-if="!loaded && !loading" link type="primary" size="small" @click="load">重试</el-button>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { onMounted, ref } from 'vue'
import { ElMessage } from 'element-plus'
import IconButton from '@/components/iconButton/index.vue'
import { getUserPreference, updateUserPreference } from '@/api/business'
import { emitter } from '@/utils/bus'
@@ -38,6 +27,8 @@ const load = async () => {
preference.value = res.data
loaded.value = true
}
} catch {
ElMessage.error('统计口径读取失败,请重试')
} finally {
loading.value = false
}
@@ -46,16 +37,31 @@ const load = async () => {
const save = async (key, value) => {
if (loading.value || !loaded.value) return
loading.value = true
const previous = preference.value
const next = { ...previous, [key]: value }
preference.value = next
try {
const next = { ...preference.value, [key]: value }
const res = await updateUserPreference(next)
if (res.code === 0) {
preference.value = next
ElMessage.success('统计口径已更新')
emitter.emit('reload')
}
} else preference.value = previous
} catch {
preference.value = previous
ElMessage.error('统计口径保存失败,请重试')
} finally {
loading.value = false
}
}
onMounted(load)
</script>
<style scoped>
.business-preferences { display: flex; align-items: center; gap: 14px; margin-right: 12px; padding-right: 16px; border-right: 1px solid var(--el-border-color-lighter); }
.business-preferences :deep(.el-checkbox) { margin: 0; white-space: nowrap; }
@media (max-width: 900px) {
.business-preferences { flex-direction: column; align-items: flex-start; gap: 0; margin-right: 4px; padding-right: 8px; }
.business-preferences :deep(.el-checkbox) { height: 24px; }
.business-preferences :deep(.el-checkbox__label) { font-size: 12px; }
}
</style>