diff --git a/utils/booking-profiles.js b/utils/booking-profiles.js new file mode 100644 index 0000000..ba67396 --- /dev/null +++ b/utils/booking-profiles.js @@ -0,0 +1,15 @@ +// 只补充展示信息,不改动就诊人 ID、联系方式或订单快照。 +function withDuplicateNameHints(profiles) { + const counts = profiles.reduce((result, profile) => { + result[profile.name] = (result[profile.name] || 0) + 1 + return result + }, Object.create(null)) + return profiles.map((profile) => ({ + ...profile, + nameHint: counts[profile.name] > 1 + ? [profile.birth, profile.mobile ? `尾号${profile.mobile.slice(-4)}` : ''].filter(Boolean).join(' · ') + : '' + })) +} + +module.exports = { withDuplicateNameHints } \ No newline at end of file diff --git a/utils/navigation.js b/utils/navigation.js new file mode 100644 index 0000000..915b36e --- /dev/null +++ b/utils/navigation.js @@ -0,0 +1,11 @@ +// 浅色页面每次展示时恢复深色系统文字,防止沿用前一页面/系统主题状态。 +function restoreLightNavigation() { + wx.setNavigationBarColor({ + frontColor: '#000000', + backgroundColor: '#FAF8F5', + animation: { duration: 0, timingFunc: 'linear' }, + fail(error) { console.warn('设置导航栏颜色失败', error) } + }) +} + +module.exports = { restoreLightNavigation } \ No newline at end of file