feat(miniprogram): 温润东方风全面 UI 重设计

73 文件变更,覆盖全部 40 个页面 SCSS + TabBar 图标 + 组件样式。
统一赤陶主色 #C4623A + 暖米背景 + 衬线标题字体 + 12px 圆角体系。
This commit is contained in:
iven
2026-04-28 00:19:52 +08:00
parent fbb28e655d
commit 50eae8b809
97 changed files with 7633 additions and 2373 deletions

View File

@@ -9,21 +9,20 @@ import {
} from '../../services/points';
import type { PointsAccount, PointsProduct, CheckinStatus } from '../../services/points';
import { useAuthStore } from '../../stores/auth';
import EmptyState from '../../components/EmptyState';
import Loading from '../../components/Loading';
import './index.scss';
const PRODUCT_TYPE_TABS = [
{ key: '', label: '全部' },
{ key: 'physical', label: '实物' },
{ key: 'service', label: '服务券' },
{ key: 'privilege', label: '权益' },
{ key: 'physical', label: '实物', char: '物' },
{ key: 'service', label: '服务券', char: '券' },
{ key: 'privilege', label: '权益', char: '权' },
];
const TYPE_COLORS: Record<string, string> = {
physical: '#0891B2',
service: '#059669',
privilege: '#D97706',
const TYPE_BG: Record<string, string> = {
physical: 'type-physical',
service: 'type-service',
privilege: 'type-privilege',
};
export default function Mall() {
@@ -117,14 +116,9 @@ export default function Mall() {
try {
const result = await dailyCheckin();
setCheckinStatus(result);
// 刷新积分余额
const acct = await getAccount();
setAccount(acct);
Taro.showToast({
title: '签到成功',
icon: 'success',
duration: 2000,
});
Taro.showToast({ title: '签到成功', icon: 'success', duration: 2000 });
} catch (err) {
Taro.showToast({
title: err instanceof Error ? err.message : '签到失败',
@@ -150,40 +144,36 @@ export default function Mall() {
const balance = account?.balance ?? 0;
if (noProfile) {
return (
<View className='mall-page'>
<View className='mall-empty-state'>
<View className='empty-icon'>
<Text className='empty-char'></Text>
</View>
<Text className='empty-title'></Text>
<Text className='empty-hint'>使</Text>
<View className='empty-action' onClick={() => Taro.navigateTo({ url: '/pages/profile/family-add/index' })}>
<Text className='empty-action-text'></Text>
</View>
</View>
</View>
);
}
return (
<View className='mall-page'>
{/* 未关联患者档案时显示引导 */}
{noProfile && (
<View className='mall-page'>
<EmptyState
icon='👤'
text='请先完善个人档案'
hint='建档后即可使用积分商城、签到等功能'
actionText='去建档'
onAction={() => Taro.navigateTo({ url: '/pages/profile/family-add/index' })}
/>
</View>
)}
{!noProfile && (
<>
{/* 积分余额卡片 */}
<View className='mall-header'>
<View className='points-card'>
<View className='points-card-top'>
<View className='points-top'>
<Text className='points-label'></Text>
<View
className={`checkin-btn ${
checkinStatus?.checked_in_today ? 'checked' : ''
}`}
className={`checkin-btn ${checkinStatus?.checked_in_today ? 'checked' : ''}`}
onClick={handleCheckin}
>
<Text className='checkin-btn-text'>
{checkinLoading
? '...'
: checkinStatus?.checked_in_today
? '已签到'
: '签到'}
{checkinLoading ? '...' : checkinStatus?.checked_in_today ? '已签到' : '签到'}
</Text>
</View>
</View>
@@ -204,11 +194,7 @@ export default function Mall() {
className={`type-tab ${productType === tab.key ? 'active' : ''}`}
onClick={() => handleTabChange(tab.key)}
>
<Text
className={`type-tab-text ${
productType === tab.key ? 'active' : ''
}`}
>
<Text className={`type-tab-text ${productType === tab.key ? 'active' : ''}`}>
{tab.label}
</Text>
</View>
@@ -217,35 +203,28 @@ export default function Mall() {
{/* 商品列表 */}
{products.length === 0 && !loading ? (
<EmptyState
icon='🎁'
text='暂无商品'
hint='更多好物即将上架'
/>
<View className='mall-empty-state'>
<View className='empty-icon'>
<Text className='empty-char'></Text>
</View>
<Text className='empty-title'></Text>
<Text className='empty-hint'></Text>
</View>
) : (
<View className='product-grid'>
{products.map((item) => (
<View className='product-card' key={item.id} onClick={() => handleProductClick(item)}>
<View
className='product-image'
style={{ backgroundColor: TYPE_COLORS[item.product_type] || '#94A3B8' }}
>
<Text className='product-image-icon'>
{item.product_type === 'physical'
? '📦'
: item.product_type === 'service'
? '🎫'
: '👑'}
<View className={`product-image ${TYPE_BG[item.product_type] || ''}`}>
<Text className='product-image-char'>
{item.product_type === 'physical' ? '物' : item.product_type === 'service' ? '券' : '权'}
</Text>
</View>
<View className='product-info'>
<Text className='product-name'>{item.name}</Text>
<View className='product-bottom'>
<View className='product-points'>
<Text className='product-points-icon'>🪙</Text>
<Text className='product-points-value'>
{item.points_cost}
</Text>
<Text className='product-points-char'>P</Text>
<Text className='product-points-value'>{item.points_cost}</Text>
</View>
{item.stock <= 0 ? (
<Text className='product-stock out'></Text>
@@ -262,8 +241,6 @@ export default function Mall() {
)}
</View>
)}
</>
)}
</View>
);
}