@pisell/pisellos 2.3.67 → 2.3.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dist/core/index.d.ts +0 -7
  2. package/dist/core/index.js +65 -109
  3. package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -1
  4. package/dist/model/strategy/adapter/walletPass/utils.js +0 -2
  5. package/dist/modules/BaseModule.d.ts +1 -0
  6. package/dist/modules/BaseModule.js +24 -28
  7. package/dist/modules/Customer/index.d.ts +4 -0
  8. package/dist/modules/Customer/index.js +91 -59
  9. package/dist/modules/Customer/types.d.ts +2 -0
  10. package/dist/modules/Order/index.d.ts +22 -2
  11. package/dist/modules/Order/index.js +313 -142
  12. package/dist/modules/Order/types.d.ts +13 -1
  13. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
  14. package/dist/modules/Order/utils/orderCollectionIdentity.js +75 -0
  15. package/dist/modules/Order/utils.js +0 -1
  16. package/dist/modules/Payment/index.d.ts +4 -0
  17. package/dist/modules/Payment/index.js +14 -4
  18. package/dist/modules/Payment/walletpass.js +52 -18
  19. package/dist/modules/Quotation/index.d.ts +0 -6
  20. package/dist/modules/Quotation/index.js +19 -75
  21. package/dist/modules/Rules/index.js +46 -31
  22. package/dist/plugins/request.d.ts +0 -1
  23. package/dist/server/index.d.ts +2 -8
  24. package/dist/server/index.js +143 -212
  25. package/dist/server/modules/floor-plan/index.d.ts +0 -4
  26. package/dist/server/modules/floor-plan/index.js +98 -240
  27. package/dist/server/modules/menu/index.js +23 -48
  28. package/dist/server/modules/order/index.d.ts +8 -17
  29. package/dist/server/modules/order/index.js +453 -506
  30. package/dist/server/modules/products/index.d.ts +2 -8
  31. package/dist/server/modules/products/index.js +75 -167
  32. package/dist/server/modules/resource/index.js +13 -21
  33. package/dist/server/utils/small-ticket.js +2 -1
  34. package/dist/solution/BaseSales/index.d.ts +3 -1
  35. package/dist/solution/BaseSales/index.js +99 -82
  36. package/dist/solution/BaseSales/utils.js +31 -20
  37. package/dist/solution/BookingTicket/index.d.ts +6 -2
  38. package/dist/solution/BookingTicket/index.js +123 -75
  39. package/dist/solution/ScanOrder/utils.js +31 -20
  40. package/dist/solution/UnifiedBookingSales/index.d.ts +25 -0
  41. package/dist/solution/UnifiedBookingSales/index.js +640 -321
  42. package/dist/solution/UnifiedBookingSales/types.d.ts +7 -0
  43. package/lib/core/index.d.ts +0 -7
  44. package/lib/core/index.js +2 -20
  45. package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -1
  46. package/lib/model/strategy/adapter/walletPass/utils.js +0 -1
  47. package/lib/modules/BaseModule.d.ts +1 -0
  48. package/lib/modules/BaseModule.js +24 -37
  49. package/lib/modules/Customer/index.d.ts +4 -0
  50. package/lib/modules/Customer/index.js +11 -0
  51. package/lib/modules/Customer/types.d.ts +2 -0
  52. package/lib/modules/Order/index.d.ts +22 -2
  53. package/lib/modules/Order/index.js +212 -54
  54. package/lib/modules/Order/types.d.ts +13 -1
  55. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
  56. package/lib/modules/Order/utils/orderCollectionIdentity.js +70 -0
  57. package/lib/modules/Order/utils.js +0 -1
  58. package/lib/modules/Payment/index.d.ts +4 -0
  59. package/lib/modules/Payment/index.js +7 -0
  60. package/lib/modules/Payment/walletpass.js +27 -2
  61. package/lib/modules/Quotation/index.d.ts +0 -6
  62. package/lib/modules/Quotation/index.js +5 -49
  63. package/lib/modules/Rules/index.js +17 -1
  64. package/lib/plugins/request.d.ts +0 -1
  65. package/lib/server/index.d.ts +2 -8
  66. package/lib/server/index.js +20 -58
  67. package/lib/server/modules/floor-plan/index.d.ts +0 -4
  68. package/lib/server/modules/floor-plan/index.js +6 -54
  69. package/lib/server/modules/menu/index.js +5 -31
  70. package/lib/server/modules/order/index.d.ts +8 -17
  71. package/lib/server/modules/order/index.js +106 -199
  72. package/lib/server/modules/products/index.d.ts +2 -8
  73. package/lib/server/modules/products/index.js +24 -97
  74. package/lib/server/modules/resource/index.js +2 -7
  75. package/lib/server/utils/small-ticket.js +1 -1
  76. package/lib/solution/BaseSales/index.d.ts +3 -1
  77. package/lib/solution/BaseSales/index.js +29 -16
  78. package/lib/solution/BaseSales/utils.js +29 -18
  79. package/lib/solution/BookingTicket/index.d.ts +6 -2
  80. package/lib/solution/BookingTicket/index.js +53 -14
  81. package/lib/solution/ScanOrder/utils.js +29 -18
  82. package/lib/solution/UnifiedBookingSales/index.d.ts +25 -0
  83. package/lib/solution/UnifiedBookingSales/index.js +188 -0
  84. package/lib/solution/UnifiedBookingSales/types.d.ts +7 -0
  85. package/package.json +1 -1
@@ -1206,7 +1206,6 @@ function productRequiresFormSubject(tempOrder, product) {
1206
1206
  }
1207
1207
  function resolveIsFormSubject(tempOrder, product) {
1208
1208
  var _a;
1209
- debugger;
1210
1209
  if (((_a = tempOrder == null ? void 0 : tempOrder.holder) == null ? void 0 : _a.type) === "form")
1211
1210
  return true;
1212
1211
  if (product)
@@ -41,6 +41,10 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
41
41
  * paymentModule.updateOtherParams({ fatherModule: 'bookingTicket' });
42
42
  */
43
43
  updateOtherParams(params: Record<string, any>): void;
44
+ /**
45
+ * 获取标准化后的宿主平台标识,供支付子能力做平台边界判断。
46
+ */
47
+ getPlatform(): string;
44
48
  private getPaymentNumberAppData;
45
49
  /**
46
50
  * 记录信息日志
@@ -139,6 +139,13 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
139
139
  updateOtherParams(params) {
140
140
  this.otherParams = params || {};
141
141
  }
142
+ /**
143
+ * 获取标准化后的宿主平台标识,供支付子能力做平台边界判断。
144
+ */
145
+ getPlatform() {
146
+ var _a;
147
+ return String(((_a = this.otherParams) == null ? void 0 : _a.platform) || "").trim().toLowerCase();
148
+ }
142
149
  getPaymentNumberAppData(key) {
143
150
  var _a, _b, _c, _d, _e, _f, _g;
144
151
  const getData = (_b = (_a = this.appPlugin) == null ? void 0 : _a.getData) == null ? void 0 : _b.call(_a);
@@ -109,6 +109,16 @@ function mergeWalletAssets(...groups) {
109
109
  });
110
110
  return merged;
111
111
  }
112
+ function orderWalletAssetsByIds(assets, orderedIds) {
113
+ const assetByKey = new Map(
114
+ assets.map((asset) => [getWalletAssetKey(asset), asset])
115
+ );
116
+ const orderedKeys = new Set(orderedIds.map((id) => String(id)));
117
+ return [
118
+ ...orderedIds.map((id) => assetByKey.get(String(id))).filter((asset) => asset !== void 0),
119
+ ...assets.filter((asset) => !orderedKeys.has(getWalletAssetKey(asset)))
120
+ ];
121
+ }
112
122
  function createInitialWalletAssetsState() {
113
123
  return {
114
124
  status: "idle",
@@ -543,7 +553,6 @@ var WalletPassPaymentImpl = class {
543
553
  vouchers: allList
544
554
  });
545
555
  const { recommended, transformList, noApplicableVoucher, recommendedAmount } = res;
546
- console.log(res, "resres12");
547
556
  this.walletRecommendList = recommended;
548
557
  this.walletInitData = {
549
558
  transformList,
@@ -606,8 +615,12 @@ var WalletPassPaymentImpl = class {
606
615
  const customerWalletPassList = Array.isArray(
607
616
  responseData == null ? void 0 : responseData.customer_wallet_pass_list
608
617
  ) ? responseData.customer_wallet_pass_list : [];
609
- const allList = mergeWalletAssets(
618
+ const orderedRecalculateList = orderWalletAssetsByIds(
610
619
  recalculateList,
620
+ selectedIds
621
+ );
622
+ const allList = mergeWalletAssets(
623
+ orderedRecalculateList,
611
624
  customerWalletPassList
612
625
  );
613
626
  const walletPassEvaluator = (_b = (_a = this.paymentModule.window) == null ? void 0 : _a.getWalletPassEvaluator) == null ? void 0 : _b.call(_a);
@@ -709,6 +722,18 @@ var WalletPassPaymentImpl = class {
709
722
  this.paymentModule.logInfo("[WalletPass] 商品列表为空,跳过获取用户识别码列表");
710
723
  return [];
711
724
  }
725
+ const platform = this.paymentModule.getPlatform();
726
+ if (platform === "pc" || platform === "h5") {
727
+ this.userIdentificationCodes = [];
728
+ this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesUpdated, {
729
+ userIdentificationCodes: []
730
+ });
731
+ this.paymentModule.logInfo(
732
+ "[WalletPass] 用户端平台跳过获取用户识别码列表",
733
+ { platform }
734
+ );
735
+ return [];
736
+ }
712
737
  if (typeof newParams.payment_order_id === "string" && newParams.payment_order_id.startsWith("LOCAL_")) {
713
738
  newParams.payment_order_id = void 0;
714
739
  }
@@ -9,8 +9,6 @@ export declare class QuotationModule extends BaseModule implements Module {
9
9
  private request;
10
10
  private store;
11
11
  private scheduleResolver?;
12
- private app;
13
- private quotationListUpdatedListener?;
14
12
  constructor(name?: string, version?: string);
15
13
  initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
16
14
  loadQuotations(params?: {
@@ -18,7 +16,6 @@ export declare class QuotationModule extends BaseModule implements Module {
18
16
  customer_id?: number | string;
19
17
  }): Promise<void>;
20
18
  getQuotationList(): QuotationItem[];
21
- setQuotationListUpdatedListener(listener?: () => void): void;
22
19
  getQuotationCustomerScopeInfo(): QuotationCustomerScopeInfo;
23
20
  /**
24
21
  * Look up the quotation price for a specific product (+ optional variant) at a given datetime.
@@ -63,9 +60,6 @@ export declare class QuotationModule extends BaseModule implements Module {
63
60
  customer_id?: number | string;
64
61
  }): Map<string, string | null>;
65
62
  setScheduleResolver(resolver: (id: number) => ScheduleItem | undefined): void;
66
- private applyQuotationResponse;
67
- private notifyQuotationListUpdated;
68
- private getQuotationCacheKeyData;
69
63
  private isQuotationVisibleForCustomer;
70
64
  private hasValidCustomerId;
71
65
  private normalizeCustomerId;
@@ -32,49 +32,32 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
32
32
  this.store = { list: [] };
33
33
  }
34
34
  async initialize(core, options) {
35
- var _a, _b;
36
35
  this.core = core;
37
36
  this.request = core.getPlugin("request");
38
37
  if (!this.request)
39
38
  throw new Error("QuotationModule 需要 request 插件支持");
40
- this.app = (_b = (_a = core.getPlugin("app")) == null ? void 0 : _a.getApp) == null ? void 0 : _b.call(_a);
41
39
  this.store = { list: [] };
42
40
  }
43
41
  async loadQuotations(params) {
42
+ var _a;
44
43
  const query = {};
45
44
  if (params == null ? void 0 : params.channel)
46
45
  query.channel = params.channel;
47
46
  if ((params == null ? void 0 : params.channel) === "online_store") {
48
47
  query.channel = "online-store";
49
48
  }
50
- let initialResultApplied = false;
51
- const applyRemoteUpdate = (response) => {
52
- this.applyQuotationResponse(response);
53
- if (initialResultApplied) {
54
- this.notifyQuotationListUpdated();
55
- }
56
- };
57
49
  const res = await this.request.get(
58
50
  "/quotation/available",
59
51
  query,
60
- {
61
- cache: {
62
- type: "indexDB",
63
- updateCache: true,
64
- cacheKeyData: this.getQuotationCacheKeyData(query)
65
- },
66
- cacheUpdateChange: applyRemoteUpdate
67
- }
52
+ { useCache: false, osServer: true }
68
53
  );
69
- this.applyQuotationResponse(res);
70
- initialResultApplied = true;
54
+ const list = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || (res == null ? void 0 : res.list) || [];
55
+ list.sort((a, b) => b.sort - a.sort);
56
+ this.store.list = list;
71
57
  }
72
58
  getQuotationList() {
73
59
  return this.store.list;
74
60
  }
75
- setQuotationListUpdatedListener(listener) {
76
- this.quotationListUpdatedListener = listener;
77
- }
78
61
  getQuotationCustomerScopeInfo() {
79
62
  const customerById = /* @__PURE__ */ new Map();
80
63
  const quotationScopes = this.store.list.filter((quotation) => Array.isArray(quotation.customer) && quotation.customer.length > 0).map((quotation) => {
@@ -173,33 +156,6 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
173
156
  setScheduleResolver(resolver) {
174
157
  this.scheduleResolver = resolver;
175
158
  }
176
- applyQuotationResponse(response) {
177
- var _a;
178
- const source = ((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) || (response == null ? void 0 : response.list) || [];
179
- this.store.list = [...source].sort((a, b) => Number(b.sort || 0) - Number(a.sort || 0));
180
- }
181
- notifyQuotationListUpdated() {
182
- var _a;
183
- try {
184
- (_a = this.quotationListUpdatedListener) == null ? void 0 : _a.call(this);
185
- } catch (error) {
186
- console.warn("[QuotationModule] 报价单后台更新回调失败", error);
187
- }
188
- }
189
- getQuotationCacheKeyData(query) {
190
- var _a, _b, _c;
191
- let shopId = "";
192
- try {
193
- const storedCore = (_c = (_b = (_a = this.app) == null ? void 0 : _a.storage) == null ? void 0 : _b.getStorage) == null ? void 0 : _c.call(_b, "core");
194
- const coreInfo = typeof storedCore === "string" ? JSON.parse(storedCore || "{}") : storedCore || {};
195
- shopId = String((coreInfo == null ? void 0 : coreInfo.id) || "");
196
- } catch {
197
- }
198
- return {
199
- ...query,
200
- shop_id: shopId
201
- };
202
- }
203
159
  isQuotationVisibleForCustomer(quotation, customerId) {
204
160
  const customers = quotation.customer || [];
205
161
  if (customers.length === 0)
@@ -865,10 +865,26 @@ var RulesModule = class extends import_BaseModule.BaseModule {
865
865
  );
866
866
  }) : void 0;
867
867
  const explicitlySelectedDiscountCard = explicitlySelectedDiscount && (explicitlySelectedDiscount.tag || explicitlySelectedDiscount.type) !== "good_pass" ? explicitlySelectedDiscount : void 0;
868
+ const appliedDiscountCardIds = new Set(
869
+ (product.discount_list || []).filter(
870
+ (item) => ["discount_card", "product_discount_card"].includes(
871
+ (item == null ? void 0 : item.tag) || (item == null ? void 0 : item.type)
872
+ )
873
+ ).map(
874
+ (item) => {
875
+ var _a3;
876
+ return ((_a3 = item == null ? void 0 : item.discount) == null ? void 0 : _a3.resource_id) ?? (item == null ? void 0 : item.resource_id) ?? (item == null ? void 0 : item.id);
877
+ }
878
+ ).filter((id) => id !== void 0 && id !== null).map(String)
879
+ );
880
+ const appliedDiscountCard = (options == null ? void 0 : options.scan) ? void 0 : applicableDiscounts.find((discount) => {
881
+ const discountType = discount.tag || discount.type;
882
+ return discount.isSelected === true && ["discount_card", "product_discount_card"].includes(discountType) && appliedDiscountCardIds.has(String(discount.id));
883
+ });
868
884
  const scannedSelectedDiscountCard = applicableDiscounts.find(
869
885
  (n) => n.isScan && n.isSelected && (n.tag || n.type) !== "good_pass"
870
886
  );
871
- const selectedDiscountCard = explicitlySelectedDiscountCard || scannedSelectedDiscountCard;
887
+ const selectedDiscountCard = explicitlySelectedDiscountCard || appliedDiscountCard || scannedSelectedDiscountCard;
872
888
  const selectedDiscount = explicitlySelectedDiscount || selectedDiscountCard || applicableDiscounts[0];
873
889
  const prioritizedApplicableDiscounts = explicitlySelectedDiscount && (explicitlySelectedDiscount.tag || explicitlySelectedDiscount.type) === "good_pass" ? [
874
890
  explicitlySelectedDiscount,
@@ -68,7 +68,6 @@ export interface RequestOptions {
68
68
  useCache?: boolean;
69
69
  customToast?: () => void;
70
70
  cache?: CacheProps;
71
- cacheUpdateChange?: (data: any) => void;
72
71
  osServer?: boolean;
73
72
  prefix?: boolean;
74
73
  callback?: (res: any) => void;
@@ -51,8 +51,6 @@ declare class Server {
51
51
  private productQueryScheduleTimers;
52
52
  /** 餐牌筛选为空时才触发的菜单/日程缓存自愈,避免每次商品查询都请求远端。 */
53
53
  private menuScheduleRefreshInFlight;
54
- /** 启动阶段模块预加载任务;预渲染商品查询复用该任务,避免缓存尚未 ready 时误触发远端自愈。 */
55
- private startupModulePreloadInFlight;
56
54
  private lastMenuScheduleRefreshAt;
57
55
  private readonly MENU_SCHEDULE_REFRESH_COOLDOWN_MS;
58
56
  private orderQuerySubscribers;
@@ -159,17 +157,13 @@ declare class Server {
159
157
  * 重新拉取全量 SSE 接口,更新本地数据后触发 onProductsSyncCompleted
160
158
  * 不影响当前界面展示,适用于切回前台、定时刷新等场景
161
159
  */
162
- refreshProductsInBackground(options?: {
163
- trigger?: string;
164
- }): Promise<void>;
160
+ refreshProductsInBackground(): Promise<void>;
165
161
  /**
166
162
  * 后台静默刷新订单数据
167
163
  * 重新拉取全量 SSE 接口,更新本地数据后触发 onOrdersSyncCompleted
168
164
  * 不影响当前界面展示,适用于切回前台、定时刷新等场景
169
165
  */
170
- refreshOrdersInBackground(options?: {
171
- trigger?: string;
172
- }): Promise<void>;
166
+ refreshOrdersInBackground(): Promise<void>;
173
167
  /**
174
168
  * 编辑正式订单时强制查询 Server 最新快照并覆盖本地缓存。
175
169
  * 商品成员增删由 OrderModule 在 SQLite/Store 更新完成后广播,
@@ -86,8 +86,6 @@ var Server = class {
86
86
  this.productQueryScheduleTimers = /* @__PURE__ */ new Map();
87
87
  /** 餐牌筛选为空时才触发的菜单/日程缓存自愈,避免每次商品查询都请求远端。 */
88
88
  this.menuScheduleRefreshInFlight = null;
89
- /** 启动阶段模块预加载任务;预渲染商品查询复用该任务,避免缓存尚未 ready 时误触发远端自愈。 */
90
- this.startupModulePreloadInFlight = null;
91
89
  this.lastMenuScheduleRefreshAt = 0;
92
90
  this.MENU_SCHEDULE_REFRESH_COOLDOWN_MS = 30 * 1e3;
93
91
  // ---- 订单 / 预约列表查询订阅者 ----
@@ -1385,15 +1383,7 @@ var Server = class {
1385
1383
  this.registerDeviceTaskActions();
1386
1384
  const registeredModules = await this.registerModules(moduleConfigs);
1387
1385
  if (autoPreload) {
1388
- const preloadTask = this.preloadModulesData(registeredModules, options);
1389
- this.startupModulePreloadInFlight = preloadTask;
1390
- try {
1391
- await preloadTask;
1392
- } finally {
1393
- if (this.startupModulePreloadInFlight === preloadTask) {
1394
- this.startupModulePreloadInFlight = null;
1395
- }
1396
- }
1386
+ await this.preloadModulesData(registeredModules, options);
1397
1387
  } else {
1398
1388
  this.logInfo("跳过自动预加载", { autoPreload });
1399
1389
  }
@@ -1698,22 +1688,11 @@ var Server = class {
1698
1688
  return;
1699
1689
  }
1700
1690
  try {
1691
+ await this.schedule.loadAllSchedule();
1701
1692
  this.products.clearPriceCache();
1702
1693
  await this.products.setupQuotationPriceBridge({
1703
1694
  scheduleModule: this.schedule,
1704
- channel: (_a = this.core.context) == null ? void 0 : _a.channel,
1705
- onQuotationUpdated: () => {
1706
- void this.recomputeAndNotifyProductQuery();
1707
- }
1708
- });
1709
- void this.schedule.loadAllSchedule().then(() => {
1710
- var _a2;
1711
- (_a2 = this.products) == null ? void 0 : _a2.clearPriceCache();
1712
- void this.recomputeAndNotifyProductQuery();
1713
- }).catch((error) => {
1714
- this.logWarning("Products 报价单价格桥接后台刷新 Schedule 失败,继续使用本地数据", {
1715
- error: error instanceof Error ? error.message : String(error)
1716
- });
1695
+ channel: (_a = this.core.context) == null ? void 0 : _a.channel
1717
1696
  });
1718
1697
  this.logInfo("Products 报价单价格桥接初始化完成");
1719
1698
  } catch (error) {
@@ -1771,27 +1750,22 @@ var Server = class {
1771
1750
  * 重新拉取全量 SSE 接口,更新本地数据后触发 onProductsSyncCompleted
1772
1751
  * 不影响当前界面展示,适用于切回前台、定时刷新等场景
1773
1752
  */
1774
- async refreshProductsInBackground(options = {}) {
1753
+ async refreshProductsInBackground() {
1775
1754
  if (!this.products) {
1776
1755
  this.logWarning("refreshProductsInBackground: Products 模块未注册");
1777
1756
  return;
1778
1757
  }
1779
- const trigger = options.trigger || "background";
1780
- this.logInfo("refreshProductsInBackground 开始", { trigger });
1758
+ this.logInfo("refreshProductsInBackground 开始");
1781
1759
  const startTime = Date.now();
1782
1760
  try {
1783
- await this.products.silentRefresh({ trigger });
1761
+ await this.products.silentRefresh();
1784
1762
  const duration = Date.now() - startTime;
1785
- this.logInfo("refreshProductsInBackground 完成", {
1786
- trigger,
1787
- duration: `${duration}ms`
1788
- });
1763
+ this.logInfo("refreshProductsInBackground 完成", { duration: `${duration}ms` });
1789
1764
  } catch (error) {
1790
1765
  const duration = Date.now() - startTime;
1791
1766
  const errorMessage = error instanceof Error ? error.message : String(error);
1792
1767
  console.error("[Server] refreshProductsInBackground 失败:", error);
1793
1768
  this.logError("refreshProductsInBackground 失败", {
1794
- trigger,
1795
1769
  duration: `${duration}ms`,
1796
1770
  error: errorMessage
1797
1771
  });
@@ -1802,27 +1776,22 @@ var Server = class {
1802
1776
  * 重新拉取全量 SSE 接口,更新本地数据后触发 onOrdersSyncCompleted
1803
1777
  * 不影响当前界面展示,适用于切回前台、定时刷新等场景
1804
1778
  */
1805
- async refreshOrdersInBackground(options = {}) {
1779
+ async refreshOrdersInBackground() {
1806
1780
  if (!this.order) {
1807
1781
  this.logWarning("refreshOrdersInBackground: Order 模块未注册");
1808
1782
  return;
1809
1783
  }
1810
- const trigger = options.trigger || "background";
1811
- this.logInfo("refreshOrdersInBackground 开始", { trigger });
1784
+ this.logInfo("refreshOrdersInBackground 开始");
1812
1785
  const startTime = Date.now();
1813
1786
  try {
1814
- await this.order.silentRefresh({ trigger });
1787
+ await this.order.silentRefresh();
1815
1788
  const duration = Date.now() - startTime;
1816
- this.logInfo("refreshOrdersInBackground 完成", {
1817
- trigger,
1818
- duration: `${duration}ms`
1819
- });
1789
+ this.logInfo("refreshOrdersInBackground 完成", { duration: `${duration}ms` });
1820
1790
  } catch (error) {
1821
1791
  const duration = Date.now() - startTime;
1822
1792
  const errorMessage = error instanceof Error ? error.message : String(error);
1823
1793
  console.error("[Server] refreshOrdersInBackground 失败:", error);
1824
1794
  this.logError("refreshOrdersInBackground 失败", {
1825
- trigger,
1826
1795
  duration: `${duration}ms`,
1827
1796
  error: errorMessage
1828
1797
  });
@@ -3887,9 +3856,7 @@ var Server = class {
3887
3856
  checkoutData,
3888
3857
  order: pendingOrder,
3889
3858
  response: pendingResult,
3890
- requireFullyPaid: true,
3891
- // 自动小票固定使用 print_all 的收据类型 0,不随订单 type 改成券/手环类型 99。
3892
- isManualPrint: true
3859
+ requireFullyPaid: true
3893
3860
  });
3894
3861
  }
3895
3862
  await this.dispatchCheckoutSyncTask({
@@ -3947,9 +3914,8 @@ var Server = class {
3947
3914
  checkoutData: syncResult.checkoutData,
3948
3915
  order: syncedOrder,
3949
3916
  response: syncResult.normalizedResponse,
3950
- requireFullyPaid: true,
3917
+ requireFullyPaid: true
3951
3918
  // print_all 的 type=0 是收据打印;不要沿用同步成功后的券/手环打印 type=99。
3952
- isManualPrint: true
3953
3919
  });
3954
3920
  }
3955
3921
  return response;
@@ -4126,7 +4092,7 @@ var Server = class {
4126
4092
  var _a, _b, _c, _d, _e;
4127
4093
  if (((_b = (_a = this.core.context) == null ? void 0 : _a.getPlatform) == null ? void 0 : _b.call(_a)) !== "android")
4128
4094
  return true;
4129
- return ((_e = (_d = (_c = this.app) == null ? void 0 : _c.storage) == null ? void 0 : _d.getStorage) == null ? void 0 : _e.call(_d, AUTO_PRINT_STORAGE_KEY)) === "true";
4095
+ return ((_e = (_d = (_c = this.app) == null ? void 0 : _c.storage) == null ? void 0 : _d.getStorage) == null ? void 0 : _e.call(_d, AUTO_PRINT_STORAGE_KEY)) !== "false";
4130
4096
  }
4131
4097
  shouldBuildSmallTicketData(order) {
4132
4098
  if (!order || typeof order !== "object")
@@ -5112,6 +5078,12 @@ var Server = class {
5112
5078
  const tTotal = performance.now();
5113
5079
  const { menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, extension_type, product_id, strategy_context } = context;
5114
5080
  const queryIds = Array.isArray(ids) ? ids.map((id) => Number(id)).filter((id) => Number.isFinite(id)) : [];
5081
+ const formatterContext = this.buildProductFormatterContext({
5082
+ schedule_date,
5083
+ schedule_datetime,
5084
+ customer_id,
5085
+ strategy_context
5086
+ });
5115
5087
  this.logInfo("computeProductQueryResult 开始", {
5116
5088
  menuListIdsCount: (menu_list_ids == null ? void 0 : menu_list_ids.length) ?? 0,
5117
5089
  ids: queryIds,
@@ -5123,16 +5095,6 @@ var Server = class {
5123
5095
  strategyContextKeys: strategy_context ? Object.keys(strategy_context) : [],
5124
5096
  changedIds: options == null ? void 0 : options.changedIds
5125
5097
  });
5126
- const startupPreloadTask = this.startupModulePreloadInFlight;
5127
- if (startupPreloadTask) {
5128
- await startupPreloadTask;
5129
- }
5130
- const formatterContext = this.buildProductFormatterContext({
5131
- schedule_date,
5132
- schedule_datetime,
5133
- customer_id,
5134
- strategy_context
5135
- });
5136
5098
  if (!this.products) {
5137
5099
  this.logError("computeProductQueryResult: Products 模块未注册");
5138
5100
  return { message: "Products 模块未注册", data: this.buildProductQueryResultPayload([], 0) };
@@ -10,7 +10,6 @@ export declare class FloorPlanModule extends BaseModule implements Module {
10
10
  private store;
11
11
  private request;
12
12
  private logger;
13
- private dbManager;
14
13
  private floorPlanDataSource;
15
14
  private pendingSyncMessages;
16
15
  private syncTimer?;
@@ -29,9 +28,6 @@ export declare class FloorPlanModule extends BaseModule implements Module {
29
28
  private mergeItems;
30
29
  private removeByIds;
31
30
  private loadListFromServer;
32
- private loadListFromSQLite;
33
- private saveListToSQLite;
34
- private refreshListFromServer;
35
31
  fetchByIdFromServer(id: number | string): Promise<FloorPlanItem | null>;
36
32
  fetchByCodeFromServer(code: string): Promise<FloorPlanItem | null>;
37
33
  preload(): Promise<void>;
@@ -25,7 +25,6 @@ module.exports = __toCommonJS(floor_plan_exports);
25
25
  var import_BaseModule = require("../../../modules/BaseModule");
26
26
  var import_types = require("./types");
27
27
  var FLOOR_PLAN_SYNC_DEBOUNCE_MS = 3e3;
28
- var FLOOR_PLAN_STORE_NAME = "floor_plans";
29
28
  var FloorPlanModule = class extends import_BaseModule.BaseModule {
30
29
  constructor(name, version) {
31
30
  super(name, version);
@@ -51,7 +50,6 @@ var FloorPlanModule = class extends import_BaseModule.BaseModule {
51
50
  if (appPlugin) {
52
51
  const app = appPlugin.getApp();
53
52
  this.logger = app.logger;
54
- this.dbManager = app.sqlite || app.dbManager;
55
53
  }
56
54
  this.initFloorPlanDataSource();
57
55
  this.setupFloorPlanSync();
@@ -161,45 +159,6 @@ var FloorPlanModule = class extends import_BaseModule.BaseModule {
161
159
  return [];
162
160
  }
163
161
  }
164
- async loadListFromSQLite() {
165
- if (!this.dbManager)
166
- return [];
167
- try {
168
- const list = await this.dbManager.getAll(FLOOR_PLAN_STORE_NAME);
169
- return Array.isArray(list) ? list : [];
170
- } catch (error) {
171
- this.logWarning("从 SQLite 读取平面图失败", {
172
- error: error instanceof Error ? error.message : String(error)
173
- });
174
- return [];
175
- }
176
- }
177
- async saveListToSQLite(list) {
178
- if (!this.dbManager)
179
- return;
180
- try {
181
- await this.dbManager.clear(FLOOR_PLAN_STORE_NAME);
182
- if (list.length > 0) {
183
- await this.dbManager.bulkAdd(FLOOR_PLAN_STORE_NAME, list);
184
- }
185
- } catch (error) {
186
- this.logWarning("保存平面图到 SQLite 失败", {
187
- count: list.length,
188
- error: error instanceof Error ? error.message : String(error)
189
- });
190
- }
191
- }
192
- async refreshListFromServer() {
193
- const list = await this.loadListFromServer();
194
- if (list.length === 0) {
195
- this.logWarning("远端平面图刷新完成但列表为空");
196
- return;
197
- }
198
- this.replaceStore(list);
199
- await this.saveListToSQLite(list);
200
- this.core.effects.emit(import_types.FloorPlanHooks.onFloorPlansChanged, this.getSortedList());
201
- this.logInfo("远端平面图刷新完成", { count: list.length });
202
- }
203
162
  async fetchByIdFromServer(id) {
204
163
  try {
205
164
  const res = await this.request.get(
@@ -231,19 +190,14 @@ var FloorPlanModule = class extends import_BaseModule.BaseModule {
231
190
  }
232
191
  async preload() {
233
192
  this.logInfo("开始预加载平面图列表");
234
- const cachedList = await this.loadListFromSQLite();
235
- if (cachedList.length > 0) {
236
- this.replaceStore(cachedList);
193
+ const list = await this.loadListFromServer();
194
+ if (list.length > 0) {
195
+ this.replaceStore(list);
237
196
  this.core.effects.emit(import_types.FloorPlanHooks.onFloorPlansChanged, this.getSortedList());
238
- this.logInfo("预加载完成(SQLite)", { count: cachedList.length });
239
- void this.refreshListFromServer().catch((error) => {
240
- this.logWarning("后台刷新平面图失败,继续使用本地数据", {
241
- error: error instanceof Error ? error.message : String(error)
242
- });
243
- });
244
- return;
197
+ this.logInfo("预加载完成", { count: list.length });
198
+ } else {
199
+ this.logWarning("预加载完成但列表为空");
245
200
  }
246
- await this.refreshListFromServer();
247
201
  }
248
202
  initFloorPlanDataSource() {
249
203
  var _a, _b;
@@ -345,7 +299,6 @@ var FloorPlanModule = class extends import_BaseModule.BaseModule {
345
299
  }
346
300
  }
347
301
  if (changed) {
348
- await this.saveListToSQLite(this.store.list);
349
302
  this.core.effects.emit(import_types.FloorPlanHooks.onFloorPlansChanged, this.getSortedList());
350
303
  this.core.effects.emit(import_types.FloorPlanHooks.onFloorPlanSyncCompleted, null);
351
304
  }
@@ -354,7 +307,6 @@ var FloorPlanModule = class extends import_BaseModule.BaseModule {
354
307
  this.store.list = [];
355
308
  this.store.map.clear();
356
309
  this.store.codeMap.clear();
357
- await this.saveListToSQLite([]);
358
310
  }
359
311
  destroy() {
360
312
  var _a;
@@ -185,21 +185,16 @@ var MenuModule = class extends import_BaseModule.BaseModule {
185
185
  this.logWarning("loadMenuFromIndexDB: dbManager 不可用");
186
186
  return [];
187
187
  }
188
- const startedAt = performance.now();
189
188
  try {
190
189
  const menuList = await this.dbManager.getAll(INDEXDB_STORE_NAME);
191
190
  this.logInfo("从 IndexDB 加载餐牌数据", {
192
- menuCount: (menuList == null ? void 0 : menuList.length) ?? 0,
193
- durationMs: +(performance.now() - startedAt).toFixed(2)
191
+ menuCount: (menuList == null ? void 0 : menuList.length) ?? 0
194
192
  });
195
193
  return menuList || [];
196
194
  } catch (error) {
197
195
  const errorMessage = error instanceof Error ? error.message : String(error);
198
196
  console.error("[Menu] 从 IndexDB 读取数据失败:", error);
199
- this.logError("从 IndexDB 读取数据失败", {
200
- durationMs: +(performance.now() - startedAt).toFixed(2),
201
- error: errorMessage
202
- });
197
+ this.logError("从 IndexDB 读取数据失败", { error: errorMessage });
203
198
  return [];
204
199
  }
205
200
  }
@@ -212,41 +207,20 @@ var MenuModule = class extends import_BaseModule.BaseModule {
212
207
  this.logWarning("saveMenuToIndexDB: dbManager 不可用");
213
208
  return;
214
209
  }
215
- const startedAt = performance.now();
216
- let clearDurationMs = 0;
217
- let writeDurationMs = 0;
218
210
  this.logInfo("开始保存餐牌数据到 IndexDB", { menuCount: menuList.length });
219
211
  try {
220
- const clearStartedAt = performance.now();
221
- try {
222
- await this.dbManager.clear(INDEXDB_STORE_NAME);
223
- } finally {
224
- clearDurationMs = +(performance.now() - clearStartedAt).toFixed(2);
225
- }
226
- const writeStartedAt = performance.now();
212
+ await this.dbManager.clear(INDEXDB_STORE_NAME);
227
213
  const savePromises = menuList.map(
228
214
  (menu) => this.dbManager.add(INDEXDB_STORE_NAME, menu)
229
215
  );
230
- try {
231
- await Promise.all(savePromises);
232
- } finally {
233
- writeDurationMs = +(performance.now() - writeStartedAt).toFixed(2);
234
- }
216
+ await Promise.all(savePromises);
235
217
  console.log(`[Menu] 已将 ${menuList.length} 条餐牌数据保存到 IndexDB`);
236
- this.logInfo("餐牌数据已保存到 IndexDB", {
237
- menuCount: menuList.length,
238
- clearDurationMs,
239
- writeDurationMs,
240
- totalDurationMs: +(performance.now() - startedAt).toFixed(2)
241
- });
218
+ this.logInfo("餐牌数据已保存到 IndexDB", { menuCount: menuList.length });
242
219
  } catch (error) {
243
220
  const errorMessage = error instanceof Error ? error.message : String(error);
244
221
  console.error("[Menu] 保存数据到 IndexDB 失败:", error);
245
222
  this.logError("保存数据到 IndexDB 失败", {
246
223
  menuCount: menuList.length,
247
- clearDurationMs,
248
- writeDurationMs,
249
- totalDurationMs: +(performance.now() - startedAt).toFixed(2),
250
224
  error: errorMessage
251
225
  });
252
226
  }