feat: 新增更新资产实名认证策略
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m5s

This commit is contained in:
sexygoat
2026-04-20 15:10:23 +08:00
parent d721c4b8a9
commit 3acb626a34
10 changed files with 352 additions and 21 deletions

View File

@@ -197,11 +197,6 @@
</ElTag>
</template>
</ElTableColumn>
<ElTableColumn label="实名认证策略" width="180">
<template #default="scope">
{{ getRealnamePolicyName(scope.row.realname_policy) }}
</template>
</ElTableColumn>
<ElTableColumn label="实名时间" width="180">
<template #default="scope">
{{ scope.row.real_name_at ? formatDateTime(scope.row.real_name_at) : '-' }}
@@ -375,6 +370,7 @@
<ElButton type="success" @click="handleEnableCard"> 启用此卡 </ElButton>
<ElButton type="warning" @click="handleDisableCard"> 停用此卡 </ElButton>
<ElButton type="danger" @click="handleManualDeactivate"> 手动停用 </ElButton>
<ElButton type="primary" @click="handleShowRealnamePolicy"> 实名认证策略 </ElButton>
</div>
<!-- 设备操作按钮 -->
@@ -384,6 +380,7 @@
<ElButton type="warning" @click="handleResetDevice"> 恢复出厂 </ElButton>
<ElButton type="success" @click="handleShowSwitchCard"> 切换SIM卡 </ElButton>
<ElButton type="primary" @click="handleShowSetWiFi"> 设置WiFi </ElButton>
<ElButton type="primary" @click="handleShowRealnamePolicy"> 实名认证策略 </ElButton>
</div>
</ElCard>
</template>
@@ -420,6 +417,7 @@
network_status?: number
real_name_status?: number
real_name_at?: string
realname_policy?: string
}
interface AssetInfo {
@@ -509,6 +507,7 @@
(e: 'showSwitchCard'): void
(e: 'showSwitchMode'): void
(e: 'show-set-wifi'): void
(e: 'showRealnamePolicy'): void
(e: 'enableBindingCard', payload: { card: BindingCard }): void
(e: 'disableBindingCard', payload: { card: BindingCard }): void
(e: 'navigateToCard', iccid: string): void
@@ -610,6 +609,10 @@
emit('show-set-wifi')
}
const handleShowRealnamePolicy = () => {
emit('showRealnamePolicy')
}
// 绑定卡操作
const handleEnableBindingCard = (card: BindingCard) => {
ElMessageBox.confirm(`确定要启用此卡(${card.iccid})吗?`, '启用确认', {

View File

@@ -98,7 +98,10 @@
<ElDescriptionsItem label="套餐类型">
{{ getPackageTypeName(currentPackage.package_type) }}
</ElDescriptionsItem>
<ElDescriptionsItem v-if="currentPackage.enable_virtual_data && isSuperAdmin" label="虚流量比例">
<ElDescriptionsItem
v-if="currentPackage.enable_virtual_data && isSuperAdmin"
label="虚流量比例"
>
{{ currentPackage.virtual_ratio || '-' }}
</ElDescriptionsItem>
<ElDescriptionsItem v-if="currentPackage.duration_days" label="套餐时长" :span="3">
@@ -110,11 +113,6 @@
<ElDescriptionsItem label="到期时间">
{{ formatDateTime(currentPackage.expire_time) || '-' }}
</ElDescriptionsItem>
<ElDescriptionsItem label="状态">
<ElTag :type="getPackageStatusTagType(currentPackage.status)" size="small">
{{ currentPackage.status_name || '-' }}
</ElTag>
</ElDescriptionsItem>
</ElDescriptions>
<!-- 空状态 -->

View File

@@ -67,13 +67,13 @@ export function useAssetFormatters(deviceRealtime?: Ref<any>) {
// 获取实名认证策略名称
const getRealnamePolicyName = (policy?: string) => {
if (!policy) return '-'
if (!policy || policy === '') return '未知'
const policyMap: Record<string, string> = {
none: '无需实名',
before_order: '先实名后充值/购买',
after_order: '先充值/购买后实名'
}
return policyMap[policy] || policy
return policyMap[policy] || '未知'
}
// 获取资产状态名称

View File

@@ -25,6 +25,7 @@
@show-switch-card="showSwitchCardDialog"
@show-switch-mode="showSwitchModeDialog"
@show-set-wifi="showSetWiFiDialog"
@show-realname-policy="showRealnamePolicyDialog"
@enable-binding-card="handleEnableBindingCard"
@disable-binding-card="handleDisableBindingCard"
@navigate-to-card="handleNavigateToCard"
@@ -116,6 +117,12 @@
:asset-identifier="cardInfo?.identifier"
:asset-type="cardInfo?.asset_type"
/>
<RealnamePolicyDialog
v-model="realnamePolicyDialogVisible"
:asset-identifier="cardInfo?.identifier || ''"
:current-policy="cardInfo?.realname_policy"
@confirm="handleConfirmRealnamePolicy"
/>
</div>
</template>
@@ -140,6 +147,7 @@
DailyRecordsDialog,
OrderHistoryDialog
} from './components/dialogs'
import RealnamePolicyDialog from '@/components/device/RealnamePolicyDialog.vue'
// 引入 composables
import { useAssetInfo } from './composables/useAssetInfo'
@@ -196,6 +204,7 @@
const rechargeDialogVisible = ref(false)
const dailyRecordsDialogVisible = ref(false)
const orderHistoryDialogVisible = ref(false)
const realnamePolicyDialogVisible = ref(false)
const selectedPackageUsageId = ref<number | null>(null)
// ========== 套餐列表分页状态 ==========
@@ -343,6 +352,34 @@
setWiFiDialogVisible.value = false
}
/**
* 显示实名认证策略对话框
*/
const showRealnamePolicyDialog = () => {
realnamePolicyDialogVisible.value = true
}
/**
* 确认实名认证策略
*/
const handleConfirmRealnamePolicy = async (form: { realname_policy: string }) => {
try {
const { AssetService } = await import('@/api/modules')
const identifier = cardInfo.value?.identifier || ''
const res = await AssetService.updateRealnamePolicy(identifier, form.realname_policy)
if (res.code === 0) {
ElMessage.success('设置实名认证策略成功')
realnamePolicyDialogVisible.value = false
await refreshAsset(cardInfo.value!.identifier, cardInfo.value!.asset_type)
} else {
ElMessage.error(res.msg || '设置实名认证策略失败')
}
} catch (error: any) {
console.error('设置实名认证策略失败:', error)
ElMessage.error('设置实名认证策略失败')
}
}
/**
* 绑定卡操作 - 启用绑定卡
*/