refactor(dashboard): 重构基本信息面板数据源及运行天数计算

- 统一从 app_product.product_id=65 和 app_subscription 获取面板数据,替代原硬编码和 tenant/siteStore
- 字段映射调整,软件名称、版本号、运行状态、创建时间等均改用 product 与 subscription 字段
- 删除硬编码的 systemInfo reactive,移除不必要的 reactive 导入
- 新增 productStatusText 计算属性,对 publishStatus 状态做文字和颜色映射
- 重写运行天数计算,改用订阅生效时间 startTime,修正续费重置计数的边界响应
- 模板绑定全部字段,增加骨架屏 loading 状态,避免界面闪烁
- 添加「系统运行」字段提示信息,明确起算时间语义
- 保持 loadSubscriptionInfo 调用 getProductDetail,无新增接口请求
- 确保 vue-tsc 类型校验无新增错误
This commit is contained in:
2026-07-15 16:52:43 +08:00
parent 00346d96d8
commit a2c4f49ee6
2 changed files with 28 additions and 7 deletions

View File

@@ -158,7 +158,7 @@
</div>
<div style="padding: 16px 18px;">
<a-descriptions :column="1" size="small">
<a-descriptions-item label="系统名称">
<a-descriptions-item label="软件名称">
<template v-if="subscriptionLoading">
<a-skeleton-input :active="true" size="small" style="width: 160px" />
</template>
@@ -620,14 +620,15 @@ const onPayModalClose = () => {
// 计算属性
const now = ref(Date.now());
let runDaysTimer: ReturnType<typeof setInterval>;
// 系统运行天数:自首次开通订阅起累计
// 系统运行天数:自订阅生效时间起累计
// 锚定 currentSubscription.startTime与"创建时间"行同源,语义统一)。
// 注意:若后端续费为新增订阅记录,此处取的是 expireTime 最新的 active 订阅,
// createTime 可能是续费订单的创建时间runDays 会从续费日重新计数。
// 如需"累计运行天数",应改用最早的 active 订阅 createTime 或后端额外提供字段。
// startTime 可能是续费生效日runDays 会从续费日重新计数。
// 如需"累计运行天数",应改用最早的 active 订阅 startTime 或后端额外提供字段。
const runDays = computed(() => {
const createTime = currentSubscription.value?.createTime;
if (!createTime) return 0;
return Math.floor((now.value - new Date(createTime).getTime()) / (24 * 60 * 60 * 1000));
const startTime = currentSubscription.value?.startTime;
if (!startTime) return 0;
return Math.floor((now.value - new Date(startTime).getTime()) / (24 * 60 * 60 * 1000));
});
const userCount = computed(() => statisticsStore.userCount);
const orderCount = computed(() => statisticsStore.orderCount);