fix(shop): 修正订阅流程及产品价格单位处理
- 后端 generatePayQrcode 价格计算改为 price/100 转元,年付按 10 个月计价 - 前端 dashboard 订阅价格同步调整,保持与后端一致的单位换算 - 解决 generatePayQrcode price_type 参数无生效导致的报错问题 - confirmSubscribe 改用 subscribe + pay 两步流程,规避后端未重启的问题 - 移除 confirmSubscribe 中的 isFreeProduct 分支,改用订阅状态判断 - 订阅信息加载策略调整,固定使用 productId=65 查询产品详情 - 保证前端代码通过 vue-tsc 校验,未引入新 TS 错误
This commit is contained in:
@@ -348,7 +348,7 @@ import { getShopSettingCategoryValues } from '@/api/shop/shopSetting';
|
||||
import { getCompressedImageUrl } from '@/utils/image';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { removeSiteInfoCache } from '@/api/cms/cmsWebsite';
|
||||
import { pageProducts } from '@/api/app/appProduct';
|
||||
import { getProductDetail } from '@/api/app/appProduct';
|
||||
import type { AppProduct } from '@/api/app/appProduct/model';
|
||||
import type { AppSubscription } from '@/api/app/appSubscription/model';
|
||||
import dayjs from 'dayjs';
|
||||
@@ -430,22 +430,14 @@ const formatDateTime = (dt?: string) => {
|
||||
|
||||
// 加载当前应用的订阅信息
|
||||
const loadSubscriptionInfo = async () => {
|
||||
const tenantId = userStore.info?.tenantId;
|
||||
if (!tenantId) {
|
||||
console.warn('无法获取租户ID,跳过订阅信息加载');
|
||||
return;
|
||||
}
|
||||
// 固定订阅产品:productId=65(小程序商城)
|
||||
const FIXED_PRODUCT_ID = 65;
|
||||
subscriptionLoading.value = true;
|
||||
try {
|
||||
// 1. 按租户ID查询应用产品(取第一条)
|
||||
const productRes = await pageProducts({
|
||||
tenantId,
|
||||
current: 1,
|
||||
size: 1
|
||||
});
|
||||
const product = productRes.list?.[0];
|
||||
// 1. 按固定 productId 查询产品详情
|
||||
const product = await getProductDetail(FIXED_PRODUCT_ID);
|
||||
if (!product || !product.productId) {
|
||||
console.warn('当前租户未找到应用产品');
|
||||
console.warn(`未找到产品 ${FIXED_PRODUCT_ID}`);
|
||||
return;
|
||||
}
|
||||
currentProduct.value = product;
|
||||
@@ -456,7 +448,7 @@ const loadSubscriptionInfo = async () => {
|
||||
false
|
||||
);
|
||||
const subs = (subRes.list || []).filter(
|
||||
(s) => s.productId === product.productId
|
||||
(s) => s.productId === FIXED_PRODUCT_ID
|
||||
);
|
||||
// 优先取 active 中 expireTime 最新;否则取 pending 最新
|
||||
const active = subs
|
||||
|
||||
Reference in New Issue
Block a user