diff --git a/.workbuddy/memory/2026-07-15.md b/.workbuddy/memory/2026-07-15.md index 30c6b51..ef40be7 100644 --- a/.workbuddy/memory/2026-07-15.md +++ b/.workbuddy/memory/2026-07-15.md @@ -146,3 +146,23 @@ - form reactive 默认值新增 `paymentVoucher: undefined`,对齐 `ShopOrder` model。 - `ShopOrder` model 中 `paymentVoucher?: string` 字段早就存在(payTime 之后),无需改 model/API。 - 用户场景:仅线下付款(payType=9)的订单才有此凭证图,条件渲染自然处理。 + +## Dashboard 基本信息 6 字段数据源重构(product + subscription) + +- 需求:dashboard「基本信息」面板原先混用硬编码/tenant/siteStore,改为统一从 `app_product.product_id=65` + `app_subscription` 读取,语义更准确。 +- 字段映射决策(用户确认): + - 系统名称 → `currentProduct.productName`(原硬编码 '小程序商城') + - 版本号 → `currentProduct.version`(原硬编码 '2.0.0') + - 运行状态 → `currentProduct.publishStatus` + 中文映射 + a-tag 颜色(原 `siteStore.statusText`) + - 创建时间 → `currentSubscription.startTime`(原 `tenantStore.company?.createTime`) + - 到期时间 → `currentSubscription.expireTime`(保持不变,原本就是这个) + - 系统运行天数 → 自 `currentSubscription.startTime` 起累计(原自 `tenantStore.company?.createTime`;后改为 startTime,与"创建时间"行同源,语义统一) +- 改动 `src/views/shop/dashboard/index.vue`: + - 删除硬编码 `systemInfo` reactive(已确认 cms 那两个 systemInfo 是独立 const,互不影响)。 + - import 移除 `reactive`。 + - 新增 `productStatusText` computed:publishStatus → {text,color} 映射(published=已发布/green、pending_review=审核中/orange、developing=开发中/blue、rejected=已驳回/red、deprecated=已下架/red),未知状态显示原始值,无 product 显示 '-'。 + - 重写 `runDays` computed:数据源由 `tenantStore.company?.createTime` 改为 `currentSubscription.value?.startTime`(与"创建时间"行同源),注释说明续费新增订阅记录会重置计数的边界行为。 + - 模板 6 个字段全部重绑,每个字段加 `subscriptionLoading` 骨架屏分支(避免空白/老数据闪现)。 + - 「系统运行」加 `a-tooltip title="自您首次开通小程序商城起"`(用户要求)。 +- 数据流复用:`loadSubscriptionInfo()` 原本就调 `getProductDetail(65)` 填充 `currentProduct`,无需新增接口调用。 +- 类型校验:vue-tsc 对 `shop/dashboard/index.vue` 行级错误 0 条;cms 那批历史错误与本次无关。 diff --git a/src/views/shop/dashboard/index.vue b/src/views/shop/dashboard/index.vue index 3269f61..1a8adf6 100644 --- a/src/views/shop/dashboard/index.vue +++ b/src/views/shop/dashboard/index.vue @@ -158,7 +158,7 @@
- + @@ -620,14 +620,15 @@ const onPayModalClose = () => { // 计算属性 const now = ref(Date.now()); let runDaysTimer: ReturnType; -// 系统运行天数:自首次开通订阅起累计 +// 系统运行天数:自订阅生效时间起累计 +// 锚定 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);