feat(appSubscription): 实现Dashboard订阅到期显示及扫码支付功能

- dashboard订阅到期时间信息支持三态渲染:激活显示剩余天数和已激活标签、待支付显示金额及去支付按钮、无订阅显示立即订阅按钮
- 通过租户ID查询应用产品,实现按租户过滤的订阅展示逻辑
- 新增appProduct分页接口及类型定义,提供应用列表获取能力
- 实现「立即订阅」流程,支持免费应用直接激活,付费应用生成微信扫码支付二维码及轮询订单状态
- 实现待支付订阅复用支付接口生成支付二维码,避免重复创建订阅
- 小程序端扫码支付流程支持订单号查询及支付确认,后端使用Redis标记支付成功状态
- 修复后端generatePayQrcode接口缺少priceType字段导致的数据库报错,前端兼容现有逻辑无需修改
- 移除dashboard中siteInfo旧的expirationTime字段相关代码,改为读订阅expireTime
- 新增订阅及支付相关样式,优化界面体验
- 支付状态轮询实现超时提示及自动停止机制,提升用户支付体验
- 组件卸载时确保支付轮询停止,避免内存泄漏
- 独立加载订阅信息,不影响其他数据请求,避免页面加载失败影响订阅展示
This commit is contained in:
2026-07-15 14:11:14 +08:00
parent e0d27f67d5
commit 29a18ffbc6
4 changed files with 613 additions and 3 deletions

View File

@@ -0,0 +1,43 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { AppProduct, AppProductQueryParam } from './model';
/**
* websopy 特殊接口域名
* 后端 Controller: com.gxwebsoft.app.controller.AppProductController
* @RequestMapping("/api/app/product"),后端无 context-path
* 完整 URL = https://websopy-api.websoft.top/api/app/product/xxx
*/
const WEBSOPY_API_BASE = 'https://websopy-api.websoft.top/api';
const BASE = `${WEBSOPY_API_BASE}/app/product`;
/**
* 分页查询应用列表
* GET /app/product/page
* 支持按 tenantId 过滤(管理后台按租户查询应用)
* 注意:分页参数为 current/size非 page/limit
*/
export async function pageProducts(
params: AppProductQueryParam
): Promise<PageResult<AppProduct>> {
const res = await request.get<ApiResult<PageResult<AppProduct>>>(
`${BASE}/page`,
{ params }
);
if (res.data.code === 0) {
return res.data.data || { list: [], count: 0 };
}
return Promise.reject(new Error(res.data.message));
}
/**
* 获取应用详情
* GET /app/product/detail/{id}
*/
export async function getProductDetail(id: number): Promise<AppProduct> {
const res = await request.get<ApiResult<AppProduct>>(`${BASE}/detail/${id}`);
if (res.data.code === 0) {
return res.data.data as AppProduct;
}
return Promise.reject(new Error(res.data.message));
}