feat(miniprogram): TabBar 重构 + 积分商城页面 (Chunk 5)
Some checks failed
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled

TabBar: 首页|健康|预约|资讯|我的 → 首页|上报|咨询|商城|我的

新增页面:
- 商城(mall): 积分余额卡片 + 签到 + 商品网格(分类型筛选/分页)
- 咨询(consultation): 占位页(即将上线)

新增服务:
- services/points.ts: 积分账户/签到/商品列表 API

API: getAccount, dailyCheckin, getCheckinStatus, listProducts
This commit is contained in:
iven
2026-04-25 17:44:24 +08:00
parent 7b18a7398d
commit 1507ec6036
6 changed files with 563 additions and 3 deletions

View File

@@ -0,0 +1,57 @@
import { api } from './request';
export interface PointsAccount {
id: string;
patient_id: string;
balance: number;
total_earned: number;
total_spent: number;
total_expired: number;
}
export interface PointsProduct {
id: string;
name: string;
product_type: string; // physical / service / privilege
points_cost: number;
stock: number;
image_url: string | null;
description: string | null;
is_active: boolean;
sort_order: number;
version: number;
}
export interface CheckinStatus {
checked_in_today: boolean;
consecutive_days: number;
next_streak_milestone: number | null;
}
export interface ProductListResponse {
data: PointsProduct[];
total: number;
page: number;
page_size: number;
total_pages: number;
}
export async function getAccount() {
return api.get<PointsAccount>('/health/points/account');
}
export async function dailyCheckin() {
return api.post<CheckinStatus>('/health/points/checkin');
}
export async function getCheckinStatus() {
return api.get<CheckinStatus>('/health/points/checkin/status');
}
export async function listProducts(params?: {
page?: number;
page_size?: number;
product_type?: string;
}) {
return api.get<ProductListResponse>('/health/points/products', params);
}