diff --git a/src/views/asset-management/asset-information/components/CurrentPackageCard.vue b/src/views/asset-management/asset-information/components/CurrentPackageCard.vue index 317ae9c..ae8017a 100644 --- a/src/views/asset-management/asset-information/components/CurrentPackageCard.vue +++ b/src/views/asset-management/asset-information/components/CurrentPackageCard.vue @@ -34,6 +34,12 @@ {{ formatDataSize(currentPackage.package_total_data || 0) }} + + {{ getPackageTypeName(currentPackage.package_type) }} + + + {{ currentPackage.virtual_ratio || '-' }} + @@ -165,6 +171,15 @@ const handleShowRecharge = () => { emit('showRecharge') } + + // 套餐类型名称 + const getPackageTypeName = (type?: string) => { + const typeMap: Record = { + formal: '正式套餐', + addon: '加油包' + } + return typeMap[type || ''] || '-' + } diff --git a/src/views/asset-management/asset-information/components/dialogs/PackageRechargeDialog.vue b/src/views/asset-management/asset-information/components/dialogs/PackageRechargeDialog.vue index a7216db..1469bc2 100644 --- a/src/views/asset-management/asset-information/components/dialogs/PackageRechargeDialog.vue +++ b/src/views/asset-management/asset-information/components/dialogs/PackageRechargeDialog.vue @@ -47,6 +47,26 @@ + + + + + 支持 jpg、png 格式,文件大小不超过 5MB + + + @@ -73,7 +78,11 @@ :device-id="cardInfo?.id" @confirm="handleConfirmSwitchCard" /> - + (null) + // ========== 套餐列表分页状态 ========== + const packagePagination = ref({ + page: 1, + pageSize: 10, + total: 0 + }) + // ========== 轮询状态 ========== const pollingEnabled = ref(false) watch(pollingEnabled, async (val) => { @@ -188,6 +204,11 @@ // fetchAssetDetail 内部已经会并行加载所有相关数据,不需要重复调用 await fetchAssetDetail(identifier) + + // 重置分页并加载套餐列表 + packagePagination.value.page = 1 + const result = await loadPackageList(identifier, 1, packagePagination.value.pageSize) + packagePagination.value.total = result.total } /** @@ -283,7 +304,6 @@ await handleRefresh() } catch (error: any) { console.error('启用绑定卡失败:', error) - ElMessage.error(error?.message || '启用失败') } } @@ -300,7 +320,6 @@ await handleRefresh() } catch (error: any) { console.error('停用绑定卡失败:', error) - ElMessage.error(error?.message || '停用失败') } } @@ -317,8 +336,15 @@ const handleRechargeSuccess = async () => { rechargeDialogVisible.value = false if (cardInfo.value) { + // 重置分页并重新加载 + packagePagination.value.page = 1 + const result = await loadPackageList( + cardInfo.value.identifier, + packagePagination.value.page, + packagePagination.value.pageSize + ) + packagePagination.value.total = result.total await Promise.all([ - loadPackageList(cardInfo.value.identifier), loadCurrentPackage(cardInfo.value.identifier), loadAssetWallet(cardInfo.value.identifier) ]) @@ -326,10 +352,36 @@ ElMessage.success('充值成功') } + /** + * 套餐列表页码变化 + */ + const handlePackagePageChange = async (page: number) => { + if (!cardInfo.value) return + packagePagination.value.page = page + const result = await loadPackageList( + cardInfo.value.identifier, + page, + packagePagination.value.pageSize + ) + packagePagination.value.total = result.total + } + + /** + * 套餐列表每页条数变化 + */ + const handlePackageSizeChange = async (size: number) => { + if (!cardInfo.value) return + packagePagination.value.pageSize = size + packagePagination.value.page = 1 // 重置到第一页 + const result = await loadPackageList(cardInfo.value.identifier, 1, size) + packagePagination.value.total = result.total + } + /** * 显示流量详单 */ - const handleShowDailyRecords = (packageRow: any) => { + const handleShowDailyRecords = (payload: { packageRow: any }) => { + const { packageRow } = payload selectedPackageUsageId.value = packageRow.package_usage_id dailyRecordsDialogVisible.value = true } @@ -539,11 +591,20 @@ display: flex; flex: 1; flex-direction: column; + min-width: 0; // 防止被内容撑开 .info-card { height: 100%; margin-bottom: 0; } + + &:first-child { + flex: 2; + } + + &:last-child { + flex: 8; + } } } } diff --git a/src/views/asset-management/asset-information/types.ts b/src/views/asset-management/asset-information/types.ts index a36dd9b..d30277b 100644 --- a/src/views/asset-management/asset-information/types.ts +++ b/src/views/asset-management/asset-information/types.ts @@ -84,7 +84,10 @@ export interface PackageInfo { start_time: string expire_time: string status: number + status_name?: string duration_days?: number + virtual_ratio?: number // 虚流量比例 + package_type?: string // 套餐类型: formal(正式套餐)/ addon(加油包) } // 钱包信息接口 (使用已有的 AssetWalletResponse) @@ -108,6 +111,7 @@ export interface SwitchCardForm { // WiFi配置表单接口 export interface WiFiForm { + card_no: string // 流量卡号(ICCID) enabled: number ssid: string password: string