From 09af76e4ea86adb210f8650c2d496134303882c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Wed, 15 Jul 2026 14:12:54 +0800 Subject: [PATCH] =?UTF-8?q?fix(subscription):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E5=8D=95=E4=BD=8D=E9=94=99=E8=AF=AF=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E9=87=91=E9=A2=9D=E5=A4=9A100=E5=80=8D=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 确认 product.price 实际单位为分,修正所有价格计算需除以100转为元 - 后端 generatePayQrcode 方法价格计算改为 price/100,年付按10个月计费,季度付按3个月计费 - 前端 dashboard/index.vue 月付价格除以100,年付价格按月付价乘以10计算,保持与后端一致 - 保持 subscribe 价格计算逻辑,避免价格单位不一致的错误 - 修复后价格显示和支付逻辑统一,解决用户反馈金额偏大问题 --- .workbuddy/memory/2026-07-15.md | 7 +++++++ src/views/shop/dashboard/index.vue | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) 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(() => {