feat: 积分商城子页面 + 日常监测 + 统计报表 (Chunk 6)
小程序 — 积分商城 (3 新页面): - mall/exchange: 兑换确认 (余额校验/QR码生成) - mall/orders: 我的订单 (状态筛选/分页/QR展示) - mall/detail: 积分明细 (余额卡片/收入支出筛选/流水列表) 小程序 — 上报 Tab 改造: - health/daily-monitoring: 日常监测表单 (血压/体重/血糖/出入量) - health/index: 增加快捷操作/打卡状态/近期监测卡片 - consultation: 替换占位为咨询列表 (会话/状态/未读) - profile: 新增积分余额/打卡天数/我的订单/积分明细入口 小程序 — 新增服务: - services/consultation.ts: 咨询会话 API - services/points.ts: 扩展兑换/订单/流水 API - services/health.ts: 扩展日常监测 API PC 管理端: - StatisticsDashboard: 统计报表仪表盘 (患者/咨询/随访/积分卡片 + Top10排行 + 快速链接) - 侧边栏新增统计报表入口 (健康模块首页)
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useDidShow } from '@tarojs/taro';
|
||||
import { useAuthStore } from '../../stores/auth';
|
||||
import { getAccount, getCheckinStatus } from '../../services/points';
|
||||
import type { PointsAccount, CheckinStatus } from '../../services/points';
|
||||
import './index.scss';
|
||||
|
||||
const MENU_ITEMS = [
|
||||
{ label: '我的订单', icon: '🛒', path: '/pages/mall/orders/index' },
|
||||
{ label: '积分明细', icon: '📊', path: '/pages/mall/detail/index' },
|
||||
{ label: '就诊人管理', icon: '👥', path: '/pages/profile/family/index' },
|
||||
{ label: '我的报告', icon: '📋', path: '/pages/profile/reports/index' },
|
||||
{ label: '我的随访', icon: '💬', path: '/pages/profile/followups/index' },
|
||||
@@ -13,11 +18,27 @@ const MENU_ITEMS = [
|
||||
|
||||
export default function Profile() {
|
||||
const { user, restore: restoreAuth, logout } = useAuthStore();
|
||||
const [pointsAccount, setPointsAccount] = useState<PointsAccount | null>(null);
|
||||
const [checkinInfo, setCheckinInfo] = useState<CheckinStatus | null>(null);
|
||||
|
||||
useDidShow(() => {
|
||||
restoreAuth();
|
||||
loadPointsInfo();
|
||||
});
|
||||
|
||||
const loadPointsInfo = useCallback(async () => {
|
||||
try {
|
||||
const [acct, status] = await Promise.all([
|
||||
getAccount(),
|
||||
getCheckinStatus(),
|
||||
]);
|
||||
setPointsAccount(acct);
|
||||
setCheckinInfo(status);
|
||||
} catch {
|
||||
// 账户可能尚未创建,静默处理
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleMenuClick = (path: string) => {
|
||||
Taro.navigateTo({ url: path });
|
||||
};
|
||||
@@ -43,6 +64,26 @@ export default function Profile() {
|
||||
</View>
|
||||
<Text className='profile-name'>{user?.display_name || '未登录'}</Text>
|
||||
<Text className='profile-phone'>{user?.phone || ''}</Text>
|
||||
|
||||
{/* 积分余额信息 */}
|
||||
<View
|
||||
className='profile-points'
|
||||
onClick={() => Taro.navigateTo({ url: '/pages/mall/detail/index' })}
|
||||
>
|
||||
<View className='points-info-item'>
|
||||
<Text className='points-info-value'>
|
||||
{(pointsAccount?.balance ?? 0).toLocaleString()}
|
||||
</Text>
|
||||
<Text className='points-info-label'>积分</Text>
|
||||
</View>
|
||||
<View className='points-info-divider' />
|
||||
<View className='points-info-item'>
|
||||
<Text className='points-info-value'>
|
||||
{checkinInfo?.consecutive_days ?? 0}
|
||||
</Text>
|
||||
<Text className='points-info-label'>连续打卡(天)</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className='profile-menu'>
|
||||
|
||||
Reference in New Issue
Block a user