feat: batch update - gift card breakdown spec, backend APIs, miniprogram pages, ETL finance recharge, docs & migrations

This commit is contained in:
Neo
2026-03-20 01:43:48 +08:00
parent 075caf067f
commit 79f9a0e1da
437 changed files with 118603 additions and 976 deletions

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@@ -0,0 +1,58 @@
/**
* 自定义 tabBar 组件
*
* 微信 custom-tab-bar 机制tabBar 页面由框架自动挂载;
* 非 tabBar 页面(如 board-customer/board-coach可手动引用。
*
* 支持 2/3 按钮动态布局,权限数据由外部注入(当前 mock 为 3 按钮)。
*/
/** tab 路由映射key → url + 是否为 tabBar 页面) */
const TAB_ROUTES: Record<string, { url: string; isTabBarPage: boolean }> = {
task: { url: '/pages/task-list/task-list', isTabBarPage: true },
board: { url: '/pages/board-finance/board-finance', isTabBarPage: true },
my: { url: '/pages/my-profile/my-profile', isTabBarPage: true },
}
// TODO: 联调时从全局状态/接口获取权限,过滤可见 tab
// 示例const visibleKeys = getApp().globalData.visibleTabs || ['task', 'board', 'my']
const VISIBLE_KEYS = ['task', 'board', 'my']
/** 根据权限过滤后的 tab 列表 */
const TABS = [
{ key: 'task', label: '任务', icon: '/assets/icons/tab-task-nav.svg', activeIcon: '/assets/icons/tab-task-nav-active.svg' },
{ key: 'board', label: '看板', icon: '/assets/icons/tab-board-nav.svg', activeIcon: '/assets/icons/tab-board-nav-active.svg' },
{ key: 'my', label: '我的', icon: '/assets/icons/tab-my-nav.svg', activeIcon: '/assets/icons/tab-my-nav-active.svg' },
].filter((t) => VISIBLE_KEYS.includes(t.key))
Component({
properties: {
/** 当前激活的 tab key */
active: {
type: String,
value: '',
},
},
data: {
tabs: TABS,
tabCount: TABS.length,
},
methods: {
onTap(e: WechatMiniprogram.TouchEvent) {
const key = e.currentTarget.dataset.key as string
// 通过 properties 获取 active避免 this.data 类型推断问题
if (key === (this as unknown as { data: { active: string } }).data.active) return
const route = TAB_ROUTES[key]
if (!route) return
if (route.isTabBarPage) {
wx.switchTab({ url: route.url })
} else {
wx.navigateTo({ url: route.url })
}
},
},
})

View File

@@ -0,0 +1,17 @@
<!-- 自定义 tabBar — 支持 2/3 按钮动态布局 -->
<view class="tab-bar tab-bar--{{tabCount}}">
<view
wx:for="{{tabs}}"
wx:key="key"
class="tab-bar-item {{active === item.key ? 'tab-bar-item--active' : ''}}"
bindtap="onTap"
data-key="{{item.key}}"
>
<image
class="tab-bar-icon"
src="{{active === item.key ? item.activeIcon : item.icon}}"
mode="aspectFit"
/>
<text class="tab-bar-label">{{item.label}}</text>
</view>
</view>

View File

@@ -0,0 +1,49 @@
/* 自定义 tabBar — 统一底部导航样式 */
.tab-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
display: flex;
align-items: center;
height: 100rpx;
background: #ffffff;
border-top: 1rpx solid #eeeeee;
padding-bottom: env(safe-area-inset-bottom);
z-index: 999;
}
/* 3 按钮:等宽三分 */
.tab-bar--3 .tab-bar-item {
flex: 1;
}
/* 2 按钮:各占一半,内容居中 */
.tab-bar--2 .tab-bar-item {
width: 50%;
flex: none;
}
.tab-bar-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 4rpx;
height: 100%;
}
.tab-bar-icon {
width: 44rpx;
height: 44rpx;
}
.tab-bar-label {
font-size: 20rpx;
color: #8b8b8b;
}
.tab-bar-item--active .tab-bar-label {
color: #0052d9;
font-weight: 500;
}