diff --git a/.workbuddy/memory/2026-07-15.md b/.workbuddy/memory/2026-07-15.md index 758dbed..70e482f 100644 --- a/.workbuddy/memory/2026-07-15.md +++ b/.workbuddy/memory/2026-07-15.md @@ -78,3 +78,10 @@ - 参考 `websopy-pc/app/pages/console/pay/[subscriptionNo].vue`:它用 `subscribe` 创建订阅 + `pay(id,'wechat')` 生成二维码(两步),避开了 `generatePayQrcode`,所以没遇到此 bug。 - 修复(后端 `AppSubscriptionController.java` generatePayQrcode 方法):补全 `setPriceType(product.getPriceType())` + `setOriginalPrice`/`setPayStatus(0)`/`setTenantId`,对齐 subscribe。**前端无需改动**,重启后端即可。 - 注意:`subscribe` 价格计算用 `price/100`(当分转元),`generatePayQrcode` 直接用 `price`(当元),两者不一致;schema 标注 price 为「元」,故 `generatePayQrcode` 价格逻辑更合理,保留不动。 + +## 修复价格多了100倍(product.price 实际单位是分) + +- 用户反馈:`generatePayQrcode` 算出的金额多了100倍。确认 `product.price` 实际存的是**分**(非 schema 标注的元),故 `subscribe` 的 `/100` 是对的,`generatePayQrcode` 直接用 price 是错的。 +- 后端 `AppSubscriptionController.generatePayQrcode` 价格计算改为 `price/100` 转元(对齐 subscribe),年付按10个月(*10,对齐 subscribe 年付优惠),季付*3,月付*1。 +- 前端 `dashboard/index.vue` 参考价同步修正:`monthPrice = price/100`,`yearPrice = monthPrice*10`(原为 price 直接 + *12)。 +- 结论:product.price 实际单位是**分**,所有价格展示/计算都需 /100 转元。 diff --git a/src/views/shop/dashboard/index.vue b/src/views/shop/dashboard/index.vue index 9ae1beb..096752e 100644 --- a/src/views/shop/dashboard/index.vue +++ b/src/views/shop/dashboard/index.vue @@ -410,10 +410,10 @@ const isFreeProduct = computed(() => { return p.priceType === 'free' || !p.price || Number(p.price) === 0; }); -// 月付参考价格(元) -const monthPrice = computed(() => Number(currentProduct.value?.price) || 0); -// 年付参考价格(元,按12个月) -const yearPrice = computed(() => monthPrice.value * 12); +// 月付参考价格(product.price 单位为分,除以100转为元) +const monthPrice = computed(() => (Number(currentProduct.value?.price) || 0) / 100); +// 年付参考价格(按10个月计费,对齐后端 subscribe/generatePayQrcode 年付优惠) +const yearPrice = computed(() => monthPrice.value * 10); // 距到期天数(负数表示已过期),null 表示无到期时间 const daysToExpire = computed(() => {