@pisell/pisellos 0.0.549 → 0.0.552

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 (38) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/Holder/index.d.ts +7 -1
  3. package/dist/modules/Holder/index.js +153 -14
  4. package/dist/modules/Holder/types.d.ts +9 -1
  5. package/dist/modules/Holder/utils.d.ts +7 -3
  6. package/dist/modules/Holder/utils.js +16 -2
  7. package/dist/modules/Order/index.d.ts +2 -1
  8. package/dist/modules/Order/index.js +18 -1
  9. package/dist/modules/Order/types.d.ts +2 -0
  10. package/dist/modules/Order/utils.d.ts +10 -0
  11. package/dist/modules/Order/utils.js +35 -3
  12. package/dist/plugins/window.d.ts +1 -0
  13. package/dist/solution/BookingByStep/index.d.ts +7 -1
  14. package/dist/solution/BookingByStep/index.js +246 -204
  15. package/dist/solution/ScanOrder/types.d.ts +1 -0
  16. package/dist/solution/VenueBooking/index.d.ts +20 -0
  17. package/dist/solution/VenueBooking/index.js +973 -730
  18. package/dist/solution/VenueBooking/types.d.ts +2 -0
  19. package/dist/types/index.d.ts +1 -0
  20. package/lib/modules/Holder/index.d.ts +7 -1
  21. package/lib/modules/Holder/index.js +75 -3
  22. package/lib/modules/Holder/types.d.ts +9 -1
  23. package/lib/modules/Holder/utils.d.ts +7 -3
  24. package/lib/modules/Holder/utils.js +18 -4
  25. package/lib/modules/Order/index.d.ts +2 -1
  26. package/lib/modules/Order/index.js +14 -0
  27. package/lib/modules/Order/types.d.ts +2 -0
  28. package/lib/modules/Order/utils.d.ts +10 -0
  29. package/lib/modules/Order/utils.js +36 -5
  30. package/lib/plugins/window.d.ts +1 -0
  31. package/lib/solution/BookingByStep/index.d.ts +7 -1
  32. package/lib/solution/BookingByStep/index.js +17 -1
  33. package/lib/solution/ScanOrder/types.d.ts +1 -0
  34. package/lib/solution/VenueBooking/index.d.ts +20 -0
  35. package/lib/solution/VenueBooking/index.js +139 -10
  36. package/lib/solution/VenueBooking/types.d.ts +2 -0
  37. package/lib/types/index.d.ts +1 -0
  38. package/package.json +2 -2
@@ -1,5 +1,6 @@
1
1
  import { OrderModule, ProductList, SalesSummaryModule, ScanOrderLogInput, ScanOrderLoggerModule, ScanOrderLoggerProviderConfig, ScanOrderLoggerProviderType, DateModule, ScheduleModule, QuotationModule, OpenDataModule } from '../../modules';
2
2
  import type { QuantityCheckResult, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
3
+ import { HolderModule } from '../../modules/Holder';
3
4
  export type { ScanOrderOrderProductIdentity, ScanOrderOrderProduct, ScanOrderSubmitProduct, ScanOrderSummary, ScanOrderTempOrder, ScanOrderSubmitPayload, } from '../ScanOrder/types';
4
5
  export declare enum VenueBookingHooks {
5
6
  onInited = "venueBooking:onInited",
@@ -145,6 +146,7 @@ export interface VenueBookingState {
145
146
  passed: boolean | null;
146
147
  failures: QuantityCheckResult[];
147
148
  };
149
+ holder?: HolderModule;
148
150
  }
149
151
  export interface VenueBookingLoggerRuntimeConfig {
150
152
  provider?: ScanOrderLoggerProviderType;
@@ -6,6 +6,7 @@ export interface Plugin {
6
6
  version: string;
7
7
  initialize: () => Promise<void> | void;
8
8
  destroy?: () => Promise<void> | void;
9
+ getLocalStorage?: (key: string) => string | null;
9
10
  }
10
11
  export interface PluginOptions {
11
12
  dependencies?: string[];
@@ -1,6 +1,6 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
- import { IFormInfo, IFormRecord, IFormItemData, IFetchFormInfoParams, IFetchFormRecordsParams, IAddFormRecordParams, IAppendFormRecordParams, IEnsureFormDataParams, IEnsureFormByProductParams, HolderModuleAPI, HolderFormMap } from './types';
3
+ import { IFormInfo, IFormRecord, IFormItemData, IFetchFormInfoParams, IFetchFormRecordsParams, IAddFormRecordParams, IAppendFormRecordParams, IEnsureFormDataParams, IEnsureFormByProductParams, IRefreshAllFormRecordsParams, HolderModuleAPI, HolderFormMap } from './types';
4
4
  export * from './types';
5
5
  export * from './utils';
6
6
  export declare class HolderModule extends BaseModule implements Module, HolderModuleAPI {
@@ -15,6 +15,7 @@ export declare class HolderModule extends BaseModule implements Module, HolderMo
15
15
  private error;
16
16
  /** 已加载过表单数据的 form_id 缓存标记 */
17
17
  private loadedFormIds;
18
+ private window;
18
19
  constructor(name?: string, version?: string);
19
20
  initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
20
21
  /** 统一提交 formMap,仅此处触发 store changed */
@@ -38,5 +39,10 @@ export declare class HolderModule extends BaseModule implements Module, HolderMo
38
39
  appendFormRecord(params: IAppendFormRecordParams): IFormRecord;
39
40
  removeFormRecord(formId: number | string, formRecordId: number): void;
40
41
  clearFormData(formId?: number | string): void;
42
+ /**
43
+ * 登录后按当前 holderMap 批量刷新所有表单的 records。
44
+ * 遍历 holderMap,从 form.form 中读取 form_id、shop_id,结合 customer_id 重新拉取记录。
45
+ */
46
+ refreshAllFormRecords(params?: IRefreshAllFormRecordsParams): Promise<HolderFormMap>;
41
47
  storeChange(path?: string): void;
42
48
  }
@@ -136,18 +136,22 @@ var HolderModule = class extends import_BaseModule.BaseModule {
136
136
  }
137
137
  }
138
138
  async fetchRecords(params) {
139
- var _a;
139
+ var _a, _b, _c;
140
140
  const url = params.url || "/form/data/v1";
141
141
  const { form_id, shop_id, num, skip, customer_id, ...rest } = params.query || {};
142
142
  const formId = (0, import_utils.normalizeFormId)(form_id);
143
143
  const useCache = params.useCache !== false;
144
+ const customer = JSON.parse(((_b = (_a = this.window) == null ? void 0 : _a.getLocalStorage) == null ? void 0 : _b.call(_a, "customer")) || "{}");
145
+ const customerId = customer_id ?? customer.id;
146
+ if (!customerId)
147
+ return [];
144
148
  this.isLoading = true;
145
149
  this.error = null;
146
150
  try {
147
151
  const res = await this.request.get(
148
152
  url,
149
153
  {
150
- customer_id,
154
+ customer_id: customerId,
151
155
  form_id,
152
156
  shop_id,
153
157
  num: num || 100,
@@ -157,7 +161,7 @@ var HolderModule = class extends import_BaseModule.BaseModule {
157
161
  },
158
162
  { useCache }
159
163
  );
160
- const records = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
164
+ const records = ((_c = res == null ? void 0 : res.data) == null ? void 0 : _c.list) || [];
161
165
  const nextFormMap = { ...this.store.holderMap };
162
166
  this.patchFormMap(nextFormMap, formId, { records });
163
167
  this.commitFormMap(nextFormMap);
@@ -306,6 +310,74 @@ var HolderModule = class extends import_BaseModule.BaseModule {
306
310
  this.commitFormMap({});
307
311
  }
308
312
  }
313
+ /**
314
+ * 登录后按当前 holderMap 批量刷新所有表单的 records。
315
+ * 遍历 holderMap,从 form.form 中读取 form_id、shop_id,结合 customer_id 重新拉取记录。
316
+ */
317
+ async refreshAllFormRecords(params = {}) {
318
+ const { customer_id, recordsUrl, num, skip } = params;
319
+ const useCache = params.useCache ?? false;
320
+ if (!customer_id) {
321
+ return this.getHolderFormMap();
322
+ }
323
+ const entries = Object.entries(this.store.holderMap);
324
+ if (!entries.length) {
325
+ return this.getHolderFormMap();
326
+ }
327
+ const url = recordsUrl || "/form/data/v1";
328
+ this.isLoading = true;
329
+ this.error = null;
330
+ try {
331
+ const results = await Promise.all(
332
+ entries.map(async ([mapKey, item]) => {
333
+ var _a;
334
+ const meta = (0, import_utils.resolveFormMetaFromHolderItem)(mapKey, item);
335
+ if (!meta)
336
+ return null;
337
+ try {
338
+ const res = await this.request.get(
339
+ url,
340
+ {
341
+ customer_id,
342
+ form_id: meta.form_id,
343
+ shop_id: meta.shop_id,
344
+ num: num || 100,
345
+ skip: skip || 1,
346
+ front_end_cache_id: useCache && this.cacheId
347
+ },
348
+ { useCache }
349
+ );
350
+ return {
351
+ formId: meta.form_id,
352
+ records: ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || []
353
+ };
354
+ } catch (error) {
355
+ console.error(
356
+ `[HolderModule] refreshAllFormRecords failed for form ${meta.form_id}`,
357
+ error
358
+ );
359
+ return null;
360
+ }
361
+ })
362
+ );
363
+ const nextFormMap = { ...this.store.holderMap };
364
+ results.forEach((result) => {
365
+ if (!result)
366
+ return;
367
+ this.patchFormMap(nextFormMap, result.formId, {
368
+ records: result.records
369
+ });
370
+ this.loadedFormIds.add(result.formId);
371
+ });
372
+ this.commitFormMap(nextFormMap);
373
+ return (0, import_lodash_es.cloneDeep)(nextFormMap);
374
+ } catch (error) {
375
+ this.error = error instanceof Error ? error.message : String(error);
376
+ throw error;
377
+ } finally {
378
+ this.isLoading = false;
379
+ }
380
+ }
309
381
  storeChange(path) {
310
382
  if (path !== "holderMap" && path !== void 0) {
311
383
  return;
@@ -68,7 +68,7 @@ export interface IFetchFormRecordsParams {
68
68
  export interface IAddFormRecordParams {
69
69
  url?: string;
70
70
  body: {
71
- form_id: number | string;
71
+ form_id: number;
72
72
  shop_id: number | string;
73
73
  customer_id?: number;
74
74
  [key: string]: any;
@@ -100,6 +100,13 @@ export interface IEnsureFormByProductParams {
100
100
  shop_id?: number | string;
101
101
  useCache?: boolean;
102
102
  }
103
+ export interface IRefreshAllFormRecordsParams {
104
+ customer_id?: number;
105
+ useCache?: boolean;
106
+ recordsUrl?: string;
107
+ num?: number;
108
+ skip?: number;
109
+ }
103
110
  export interface HolderModuleAPI {
104
111
  getHolderFormMap: () => HolderFormMap;
105
112
  getHolderFormData: (formId: number | string) => IFormItemData | undefined;
@@ -112,4 +119,5 @@ export interface HolderModuleAPI {
112
119
  appendFormRecord: (params: IAppendFormRecordParams) => IFormRecord;
113
120
  removeFormRecord: (formId: number | string, formRecordId: number) => void;
114
121
  clearFormData: (formId?: number | string) => void;
122
+ refreshAllFormRecords: (params?: IRefreshAllFormRecordsParams) => Promise<HolderFormMap>;
115
123
  }
@@ -1,9 +1,13 @@
1
1
  import { ProductData } from '../Product/types';
2
- import { IHolderConfig } from './types';
2
+ import { IFormItemData, IHolderConfig } from './types';
3
3
  export declare function getProductHolderConfig(product?: ProductData | Record<string, any> | null): IHolderConfig | null;
4
- export declare function getFormIdFromHolderConfig(config: IHolderConfig): string;
5
- export declare function normalizeFormId(formId: number | string): string;
4
+ export declare function getFormIdFromHolderConfig(config: IHolderConfig): number;
5
+ export declare function normalizeFormId(formId: number | string): number;
6
6
  export declare function createEmptyFormItemData(): {
7
7
  records: any[];
8
8
  form: Record<string, any>;
9
9
  };
10
+ export declare function resolveFormMetaFromHolderItem(mapKey: string, item: IFormItemData): {
11
+ form_id: string | number;
12
+ shop_id: number | string;
13
+ } | null;
@@ -22,7 +22,8 @@ __export(utils_exports, {
22
22
  createEmptyFormItemData: () => createEmptyFormItemData,
23
23
  getFormIdFromHolderConfig: () => getFormIdFromHolderConfig,
24
24
  getProductHolderConfig: () => getProductHolderConfig,
25
- normalizeFormId: () => normalizeFormId
25
+ normalizeFormId: () => normalizeFormId,
26
+ resolveFormMetaFromHolderItem: () => resolveFormMetaFromHolderItem
26
27
  });
27
28
  module.exports = __toCommonJS(utils_exports);
28
29
  function getProductHolderConfig(product) {
@@ -37,10 +38,10 @@ function getProductHolderConfig(product) {
37
38
  return config;
38
39
  }
39
40
  function getFormIdFromHolderConfig(config) {
40
- return String(config == null ? void 0 : config.resource_id);
41
+ return Number(config == null ? void 0 : config.resource_id);
41
42
  }
42
43
  function normalizeFormId(formId) {
43
- return String(formId);
44
+ return Number(formId);
44
45
  }
45
46
  function createEmptyFormItemData() {
46
47
  return {
@@ -48,10 +49,23 @@ function createEmptyFormItemData() {
48
49
  form: {}
49
50
  };
50
51
  }
52
+ function resolveFormMetaFromHolderItem(mapKey, item) {
53
+ const formInfo = item.form || {};
54
+ const nestedForm = formInfo.form || {};
55
+ const form_id = normalizeFormId(
56
+ nestedForm.id ?? formInfo.form_id ?? formInfo.id ?? mapKey
57
+ );
58
+ const shop_id = nestedForm.shop_id ?? formInfo.shop_id;
59
+ if (shop_id === void 0 || shop_id === null || shop_id === "") {
60
+ return null;
61
+ }
62
+ return { form_id, shop_id };
63
+ }
51
64
  // Annotate the CommonJS export names for ESM import in node:
52
65
  0 && (module.exports = {
53
66
  createEmptyFormItemData,
54
67
  getFormIdFromHolderConfig,
55
68
  getProductHolderConfig,
56
- normalizeFormId
69
+ normalizeFormId,
70
+ resolveFormMetaFromHolderItem
57
71
  });
@@ -57,6 +57,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
57
57
  private getTempOrderStorageKey;
58
58
  private restoreTempOrderFromStorage;
59
59
  persistTempOrder(): void;
60
+ notifyTempOrderChanged(): void;
60
61
  private createDefaultTempOrderInstance;
61
62
  ensureTempOrder(): ScanOrderTempOrder;
62
63
  restoreOrder(): ScanOrderTempOrder;
@@ -83,7 +84,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
83
84
  enhancePayload?: SubmitPayloadEnhancer;
84
85
  }): Promise<T>;
85
86
  createOrder(params: CommitOrderParams['query']): {
86
- type: "virtual" | "appointment_booking";
87
+ type: "appointment_booking" | "virtual";
87
88
  platform: string;
88
89
  sales_channel: string;
89
90
  order_sales_channel: string;
@@ -328,6 +328,16 @@ var OrderModule = class extends import_BaseModule.BaseModule {
328
328
  return;
329
329
  this.window.localStorage.setItem(key, JSON.stringify(this.store.tempOrder));
330
330
  }
331
+ notifyTempOrderChanged() {
332
+ if (!this.store.tempOrder)
333
+ return;
334
+ this.store.tempOrder = {
335
+ ...this.store.tempOrder,
336
+ products: [...this.store.tempOrder.products],
337
+ bookings: this.store.tempOrder.bookings ? [...this.store.tempOrder.bookings] : []
338
+ };
339
+ this.persistTempOrder();
340
+ }
331
341
  // ─── TempOrder: 创建 & 获取 ───
332
342
  createDefaultTempOrderInstance() {
333
343
  return (0, import_utils.createDefaultTempOrder)({
@@ -598,6 +608,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
598
608
  let is_deposit = 0;
599
609
  if (params.cartItems.length > 0) {
600
610
  params.cartItems.forEach((item) => {
611
+ var _a2;
601
612
  if (!item._origin.duration) {
602
613
  const { duration, durationType } = (0, import_utils.generateDuration)(item);
603
614
  item._origin.duration = duration;
@@ -605,6 +616,9 @@ var OrderModule = class extends import_BaseModule.BaseModule {
605
616
  }
606
617
  const discountList = (0, import_utils.getAllDiscountList)(item);
607
618
  item._origin.product.discount_list = discountList;
619
+ if ((_a2 = params == null ? void 0 : params.extraData) == null ? void 0 : _a2.is_add_holder_info) {
620
+ (0, import_utils.ensureCartItemOriginHolder)(item, this.window);
621
+ }
608
622
  if ((0, import_utils2.isNormalProduct)(item._origin)) {
609
623
  order.relation_products.push(item._origin.product);
610
624
  const relationForms = item._origin.relation_forms || [];
@@ -235,6 +235,8 @@ export interface OrderModuleAPI {
235
235
  updateProductInOrder: (params: UpdateProductInOrderParams) => Promise<ScanOrderOrderProduct[]>;
236
236
  removeProductFromOrder: (identity: ScanOrderOrderProductIdentity) => Promise<ScanOrderOrderProduct[]>;
237
237
  persistTempOrder: () => void;
238
+ /** 提交 tempOrder 变更并触发 `{moduleName}:changed` 事件 */
239
+ notifyTempOrderChanged: () => void;
238
240
  submitTempOrder: <T = any>(params?: {
239
241
  cacheId?: string;
240
242
  platform?: string;
@@ -2,6 +2,7 @@ import Decimal from 'decimal.js';
2
2
  import { CartItem } from "../Cart";
3
3
  import type { ScanOrderSubmitPayload, ScanOrderSubmitProduct, ScanOrderSummary, ScanOrderTempOrder } from '../../solution/ScanOrder/types';
4
4
  import type { RulesParamsHooks } from '../Rules/types';
5
+ import type { WindowPlugin } from '../../plugins';
5
6
  /**
6
7
  * 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
7
8
  *
@@ -86,6 +87,15 @@ export declare const mergeRelationForms: (relationForms: {
86
87
  form_id: number;
87
88
  form_record_ids: number[];
88
89
  }[];
90
+ export interface CartOrderHolder {
91
+ customer_id?: number;
92
+ form_id: number | string;
93
+ form_record: (number | string)[] | null;
94
+ }
95
+ /**
96
+ * 为购物车行补齐订单所需的 holder 信息(与 cartAccount 结构保持一致)
97
+ */
98
+ export declare function ensureCartItemOriginHolder(cartItem: CartItem, window?: WindowPlugin): void;
89
99
  export declare const getAllDiscountList: (cartItem: CartItem) => any;
90
100
  export declare function createUuidV4(): string;
91
101
  export declare function isTempOrder(data: any): data is ScanOrderTempOrder;
@@ -33,8 +33,9 @@ __export(utils_exports, {
33
33
  composeLinePrice: () => composeLinePrice,
34
34
  createDefaultOrderRulesHooks: () => createDefaultOrderRulesHooks,
35
35
  createDefaultTempOrder: () => createDefaultTempOrder,
36
- createEmptySummary: () => import_utils2.createEmptySummary,
36
+ createEmptySummary: () => import_utils3.createEmptySummary,
37
37
  createUuidV4: () => createUuidV4,
38
+ ensureCartItemOriginHolder: () => ensureCartItemOriginHolder,
38
39
  filterProductsForScanOrderMore: () => filterProductsForScanOrderMore,
39
40
  formatDateTime: () => formatDateTime,
40
41
  formatV1Product: () => formatV1Product,
@@ -50,8 +51,9 @@ __export(utils_exports, {
50
51
  module.exports = __toCommonJS(utils_exports);
51
52
  var import_dayjs = __toESM(require("dayjs"));
52
53
  var import_decimal = __toESM(require("decimal.js"));
53
- var import_utils = require("../../solution/ScanOrder/utils");
54
+ var import_utils = require("../Holder/utils");
54
55
  var import_utils2 = require("../../solution/ScanOrder/utils");
56
+ var import_utils3 = require("../../solution/ScanOrder/utils");
55
57
  function composeLinePrice(params) {
56
58
  const { mainPrice, bundle, useOriginalBundle } = params;
57
59
  let total = new import_decimal.default(Number(mainPrice) || 0);
@@ -113,7 +115,7 @@ function createDefaultOrderRulesHooks() {
113
115
  // 否则同 SKU 不同小料会在 calcDiscount 重组时互相覆盖。
114
116
  // 不透明 identity 契约下,normalizeOrderProduct / restoreTempOrderFromStorage 已保证 identity_key 必存在;
115
117
  // 留 fingerprint 分支仅作 Rules 单测里直接传裸 product 时的兜底。
116
- _id: product.identity_key ? `${product.product_id}_${product.product_variant_id}_${product.identity_key}` : `${product.product_id}_${product.product_variant_id}_${(0, import_utils.buildProductLineFingerprint)(
118
+ _id: product.identity_key ? `${product.product_id}_${product.product_variant_id}_${product.identity_key}` : `${product.product_id}_${product.product_variant_id}_${(0, import_utils2.buildProductLineFingerprint)(
117
119
  product.product_option_item,
118
120
  product.product_bundle
119
121
  )}`,
@@ -196,6 +198,34 @@ var mergeRelationForms = (relationForms) => {
196
198
  }, {})
197
199
  ).filter((item) => item.form_record_ids.length > 0);
198
200
  };
201
+ function getCustomerIdFromStorage(window) {
202
+ var _a;
203
+ try {
204
+ const customer = JSON.parse(((_a = window == null ? void 0 : window.getLocalStorage) == null ? void 0 : _a.call(window, "customer")) || "{}");
205
+ const customerId = Number(customer == null ? void 0 : customer.id);
206
+ return Number.isFinite(customerId) && customerId > 0 ? customerId : void 0;
207
+ } catch {
208
+ return void 0;
209
+ }
210
+ }
211
+ function ensureCartItemOriginHolder(cartItem, window) {
212
+ var _a;
213
+ if ((_a = cartItem == null ? void 0 : cartItem._origin) == null ? void 0 : _a.holder) {
214
+ return;
215
+ }
216
+ const holderConfig = (0, import_utils.getProductHolderConfig)(
217
+ (cartItem == null ? void 0 : cartItem._productInit) ?? (cartItem == null ? void 0 : cartItem._productOrigin)
218
+ );
219
+ const formRecordId = cartItem == null ? void 0 : cartItem.holder_id;
220
+ if (!(holderConfig == null ? void 0 : holderConfig.resource_id) || formRecordId == null) {
221
+ return;
222
+ }
223
+ cartItem._origin.holder = {
224
+ customer_id: getCustomerIdFromStorage(window),
225
+ form_id: holderConfig.resource_id,
226
+ form_record: [formRecordId]
227
+ };
228
+ }
199
229
  var getAllDiscountList = (cartItem) => {
200
230
  var _a, _b, _c, _d;
201
231
  let discountList = ((_b = (_a = cartItem == null ? void 0 : cartItem._origin) == null ? void 0 : _a.product) == null ? void 0 : _b.discount_list) || [];
@@ -378,7 +408,7 @@ function resolveSubmitCollectPax(tempOrder) {
378
408
  return normalizeSubmitCollectPaxValue((_a = tempOrder.metadata) == null ? void 0 : _a.collect_pax);
379
409
  }
380
410
  function createDefaultTempOrder(params) {
381
- const summary = params.summary || (0, import_utils.createEmptySummary)();
411
+ const summary = params.summary || (0, import_utils2.createEmptySummary)();
382
412
  return {
383
413
  order_id: null,
384
414
  relation_id: void 0,
@@ -437,7 +467,7 @@ function buildSubmitPayload(params) {
437
467
  enhance
438
468
  } = params;
439
469
  const scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
440
- const summary = tempOrder.summary || (0, import_utils.createEmptySummary)();
470
+ const summary = tempOrder.summary || (0, import_utils2.createEmptySummary)();
441
471
  const relationId = tempOrder.relation_id;
442
472
  const tableFormId = tempOrder.table_form_id;
443
473
  const bookingUuid = createUuidV4();
@@ -540,6 +570,7 @@ function formatV1Product(products) {
540
570
  createDefaultTempOrder,
541
571
  createEmptySummary,
542
572
  createUuidV4,
573
+ ensureCartItemOriginHolder,
543
574
  filterProductsForScanOrderMore,
544
575
  formatDateTime,
545
576
  formatV1Product,
@@ -16,6 +16,7 @@ export interface WindowPlugin extends Plugin {
16
16
  history: History;
17
17
  interaction?: any;
18
18
  getWalletPassEvaluator?: () => WalletPassEvaluator;
19
+ getLocalStorage?: (key: string) => string | null;
19
20
  }
20
21
  /**
21
22
  * 简单的 Storage 接口实现
@@ -131,6 +131,12 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
131
131
  * 获取 holder 表单 map
132
132
  */
133
133
  getHolderFormMap(): import("../../modules").HolderFormMap;
134
+ /**
135
+ * 登录后或外部触发时,按当前 holderMap 批量刷新所有表单的 records
136
+ */
137
+ refreshAllHolderFormRecords(params?: {
138
+ customer_id?: number;
139
+ }): Promise<import("../../modules").HolderFormMap>;
134
140
  /**
135
141
  * 添加表单记录
136
142
  */
@@ -320,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
320
326
  date: string;
321
327
  status: string;
322
328
  week: string;
323
- weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
329
+ weekNum: 0 | 5 | 1 | 4 | 2 | 3 | 6;
324
330
  }[]>;
325
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
326
332
  private getScheduleDataByIds;
@@ -386,6 +386,15 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
386
386
  getHolderFormMap() {
387
387
  return this.store.holder.getHolderFormMap();
388
388
  }
389
+ /**
390
+ * 登录后或外部触发时,按当前 holderMap 批量刷新所有表单的 records
391
+ */
392
+ async refreshAllHolderFormRecords(params) {
393
+ return this.store.holder.refreshAllFormRecords({
394
+ customer_id: params == null ? void 0 : params.customer_id,
395
+ useCache: false
396
+ });
397
+ }
389
398
  /**
390
399
  * 添加表单记录
391
400
  */
@@ -499,6 +508,14 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
499
508
  date = (normalProductCartItem == null ? void 0 : normalProductCartItem.start_date) || "";
500
509
  }
501
510
  this.updateQuotationPriceAndCart(date);
511
+ try {
512
+ const customerId = Number(accountInfo.id);
513
+ await this.refreshAllHolderFormRecords({
514
+ customer_id: customerId
515
+ });
516
+ } catch (error) {
517
+ console.error("[BookingByStep] 登录后刷新 holder 表单失败", error);
518
+ }
502
519
  }
503
520
  } else {
504
521
  throw new Error(`没有找到${accountId}账户`);
@@ -646,7 +663,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
646
663
  try {
647
664
  this.store.holder.ensureFormByProduct({
648
665
  product: productData,
649
- customer_id: (account == null ? void 0 : account.id) ? Number(account.id) : 16121,
650
666
  shop_id: (productData == null ? void 0 : productData.shop_id) || "",
651
667
  useCache: true
652
668
  });
@@ -34,6 +34,7 @@ export interface ScanOrderOrderProductIdentity {
34
34
  /** 参与合并/匹配;与 remove 通配语义见 isSkuOnlyDeleteIdentity */
35
35
  product_option_item?: any[];
36
36
  product_bundle?: any[];
37
+ shop_id?: number | string;
37
38
  }
38
39
  export interface ScanOrderOrderProduct extends ScanOrderOrderProductIdentity {
39
40
  order_detail_id: number | null;
@@ -7,6 +7,7 @@ import type { OpenDataAvailabilityResult } from '../../modules/OpenData';
7
7
  import type { ProductData } from '../../modules/Product/types';
8
8
  import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
9
9
  import type { StrategyConfig } from '../../model/strategy/type';
10
+ import type { IAppendFormRecordParams, IRefreshAllFormRecordsParams } from '../../modules/Holder/types';
10
11
  export * from './types';
11
12
  interface VenueBookingItemRuleRuntimeConfig {
12
13
  strategyConfigs?: StrategyConfig[];
@@ -52,6 +53,12 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
52
53
  constructor(name?: string, version?: string);
53
54
  private normalizeCustomerId;
54
55
  private resolveCustomerIdFromLoginPayload;
56
+ private resolveHolderCustomerId;
57
+ /**
58
+ * 按商品 holder_config 预加载表单数据到 holderMap。
59
+ * appointment_booking 在加购时触发;venueBooking 在商品加载后预加载,避免 getHolderFormMap 为空。
60
+ */
61
+ private preloadHolderForms;
55
62
  private clearLoginEffectListeners;
56
63
  private registerLoginEffect;
57
64
  private registerCustomerLoginListeners;
@@ -193,6 +200,19 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
193
200
  setUIState(key: string, value: any): void;
194
201
  getUIState<T = any>(key: string): T | undefined;
195
202
  deleteUIState(key: string): void;
203
+ setBookingHolder(bookingUid: string, holder: any): void;
204
+ /**
205
+ * 获取 holder 表单 map
206
+ */
207
+ getHolderFormMap(): import("../../modules/Holder").HolderFormMap;
208
+ /**
209
+ * UI 层触发:按当前 holderMap 批量刷新所有表单的 records
210
+ */
211
+ refreshAllHolderFormRecords(params?: Pick<IRefreshAllFormRecordsParams, 'customer_id' | 'useCache' | 'recordsUrl' | 'num' | 'skip'>): Promise<import("../../modules/Holder").HolderFormMap>;
212
+ /**
213
+ * 添加表单记录
214
+ */
215
+ appendFormRecord(params: IAppendFormRecordParams): import("../../modules/Holder").IFormRecord;
196
216
  checkOpenDataAvailability(): Promise<OpenDataAvailabilityResult>;
197
217
  setOtherParams(params: Record<string, any>, { cover }?: {
198
218
  cover?: boolean;