合入主线登录和营业时段策略,对齐旧界面与 React 访问流程

This commit is contained in:
黄健铭 committed 2026-12-05 21:46:55 -08:00
commit 42395de23a
113 files changed
+1915 -558

No files matched your search

+15 -1
View File
@@ -1,6 +1,7 @@
'use strict';
// 每个账本独立保存店铺配置;成员键、账号ID及历史财务记录不随展示设置改变。
const Printing = require('../printing/printing');
const { businessHoursError } = require('../../public/ledger-values');
const TeamMembers = require('./team-members');
const KEY = 'shop-settings-v1';
const FeePresets = require('../../public/fee-estimates');
@@ -53,6 +54,7 @@ function seed(ledger) {
return {
version: 1,
revision: 0,
businessHours: null,
storeName: printing.store,
receiptSubtitle: printing.subtitle,
contact: printing.contact,
@@ -78,6 +80,7 @@ function read(ledger) {
return {
version: 1,
revision: raw.revision,
businessHours: raw.businessHours ?? null,
storeName: raw.storeName,
receiptSubtitle: raw.receiptSubtitle,
contact: raw.contact,
@@ -117,7 +120,7 @@ function aliases(ledger, config = read(ledger)) {
function publicSettings(ledger, actor) {
const config = read(ledger);
if (actor?.role === 'owner') return config;
const { profitSharePercent, profitShareEffectiveMonth, profitShareHistory, ...visible } = config;
const { businessHours, profitSharePercent, profitShareEffectiveMonth, profitShareHistory, ...visible } = config;
visible.members = visible.members.map(({ member, label }) => ({ member, label }));
return visible;
}
@@ -187,6 +190,7 @@ function update(ledger, input, actor = ledger.actor) {
'profitShareEffectiveMonth',
'feeDefaults',
'costPresets',
'businessHours',
],
'店铺配置',
);
@@ -206,6 +210,16 @@ function update(ledger, input, actor = ledger.actor) {
['contact', '店铺联系方式', 80, true],
])
if (own(input, field)) next[field] = string(input[field], name, max, { empty });
if (own(input, 'businessHours')) {
if (input.businessHours === null) next.businessHours = null;
else {
const hours = object(input.businessHours, '营业时间');
only(hours, ['open', 'close'], '营业时间');
const message = businessHoursError(hours.open, hours.close);
if (message) fail(message);
next.businessHours = { open: hours.open, close: hours.close };
}
}
if (own(input, 'creditCardRatePermille'))
next.creditCardRatePermille = integer(input.creditCardRatePermille, '信用卡手续费率', 0, 1000);
if (own(input, 'costPresets')) {