feat(miniprogram): TabBar 重构 + 积分商城页面 (Chunk 5)
TabBar: 首页|健康|预约|资讯|我的 → 首页|上报|咨询|商城|我的 新增页面: - 商城(mall): 积分余额卡片 + 签到 + 商品网格(分类型筛选/分页) - 咨询(consultation): 占位页(即将上线) 新增服务: - services/points.ts: 积分账户/签到/商品列表 API API: getAccount, dailyCheckin, getCheckinStatus, listProducts
This commit is contained in:
57
apps/miniprogram/src/services/points.ts
Normal file
57
apps/miniprogram/src/services/points.ts
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user