@pisell/pisellos 2.3.51 → 2.3.53

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 (161) hide show
  1. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +12 -10
  2. package/dist/modules/Discount/index.d.ts +0 -1
  3. package/dist/modules/Discount/index.js +11 -40
  4. package/dist/modules/Discount/types.d.ts +0 -1
  5. package/dist/modules/OpenData/index.js +2 -2
  6. package/dist/modules/Order/index.d.ts +7 -9
  7. package/dist/modules/Order/index.js +165 -140
  8. package/dist/modules/Order/types.d.ts +21 -12
  9. package/dist/modules/Order/types.js +11 -0
  10. package/dist/modules/Order/utils.d.ts +0 -10
  11. package/dist/modules/Order/utils.js +3 -35
  12. package/dist/modules/Product/types.d.ts +0 -1
  13. package/dist/modules/ProductList/index.js +14 -33
  14. package/dist/modules/Quotation/index.d.ts +1 -1
  15. package/dist/modules/Quotation/index.js +2 -2
  16. package/dist/modules/Rules/index.js +32 -56
  17. package/dist/modules/SalesSummary/index.js +13 -12
  18. package/dist/modules/SalesSummary/utils.js +7 -1
  19. package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
  20. package/dist/modules/ScanOrderLogger/index.js +2 -15
  21. package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
  22. package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
  23. package/dist/modules/Schedule/index.d.ts +1 -3
  24. package/dist/modules/Schedule/index.js +16 -21
  25. package/dist/modules/Summary/utils.js +13 -38
  26. package/dist/modules/index.d.ts +0 -2
  27. package/dist/modules/index.js +1 -3
  28. package/dist/plugins/window.d.ts +0 -1
  29. package/dist/server/index.d.ts +0 -14
  30. package/dist/server/index.js +793 -907
  31. package/dist/solution/BaseSales/index.d.ts +15 -12
  32. package/dist/solution/BaseSales/index.js +194 -178
  33. package/dist/solution/BaseSales/utils/cartPromotion.js +5 -3
  34. package/dist/solution/BookingByStep/index.d.ts +1 -16
  35. package/dist/solution/BookingByStep/index.js +215 -294
  36. package/dist/solution/BookingByStep/types.d.ts +1 -2
  37. package/dist/solution/BookingByStep/types.js +1 -3
  38. package/dist/solution/BookingByStep/utils/capacity.js +1 -17
  39. package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  40. package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
  41. package/dist/solution/BookingTicket/index.d.ts +2 -14
  42. package/dist/solution/BookingTicket/index.js +2 -2
  43. package/dist/solution/BookingTicket/types.d.ts +3 -0
  44. package/dist/solution/BookingTicket/utils/cartView.js +44 -32
  45. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
  46. package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
  47. package/dist/solution/Sales/index.d.ts +1 -0
  48. package/dist/solution/Sales/index.js +16 -2
  49. package/dist/solution/ScanOrder/index.d.ts +14 -26
  50. package/dist/solution/ScanOrder/index.js +739 -1142
  51. package/dist/solution/ScanOrder/types.d.ts +1 -21
  52. package/dist/solution/ScanOrder/utils.d.ts +0 -8
  53. package/dist/solution/ScanOrder/utils.js +25 -66
  54. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  55. package/dist/solution/ShopDiscount/index.js +87 -125
  56. package/dist/solution/VenueBooking/index.d.ts +11 -39
  57. package/dist/solution/VenueBooking/index.js +841 -1167
  58. package/dist/solution/VenueBooking/types.d.ts +0 -3
  59. package/dist/solution/VenueBooking/utils/resource.js +0 -1
  60. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  61. package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
  62. package/dist/solution/index.d.ts +0 -1
  63. package/dist/solution/index.js +1 -2
  64. package/dist/types/index.d.ts +0 -1
  65. package/lib/model/strategy/adapter/promotion/index.js +0 -51
  66. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -1
  67. package/lib/modules/Discount/index.d.ts +0 -1
  68. package/lib/modules/Discount/index.js +0 -9
  69. package/lib/modules/Discount/types.d.ts +0 -1
  70. package/lib/modules/OpenData/index.js +1 -1
  71. package/lib/modules/Order/index.d.ts +7 -9
  72. package/lib/modules/Order/index.js +89 -38
  73. package/lib/modules/Order/types.d.ts +21 -12
  74. package/lib/modules/Order/utils.d.ts +0 -10
  75. package/lib/modules/Order/utils.js +5 -36
  76. package/lib/modules/Product/types.d.ts +0 -1
  77. package/lib/modules/ProductList/index.js +31 -40
  78. package/lib/modules/Quotation/index.d.ts +1 -1
  79. package/lib/modules/Quotation/index.js +2 -2
  80. package/lib/modules/Rules/index.js +32 -44
  81. package/lib/modules/SalesSummary/index.js +7 -6
  82. package/lib/modules/SalesSummary/utils.js +5 -1
  83. package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
  84. package/lib/modules/ScanOrderLogger/index.js +1 -13
  85. package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
  86. package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
  87. package/lib/modules/Schedule/index.d.ts +1 -3
  88. package/lib/modules/Schedule/index.js +8 -10
  89. package/lib/modules/Summary/utils.js +1 -21
  90. package/lib/modules/index.d.ts +0 -2
  91. package/lib/modules/index.js +1 -5
  92. package/lib/plugins/window.d.ts +0 -1
  93. package/lib/server/index.d.ts +0 -14
  94. package/lib/server/index.js +15 -72
  95. package/lib/solution/BaseSales/index.d.ts +15 -12
  96. package/lib/solution/BaseSales/index.js +52 -35
  97. package/lib/solution/BaseSales/utils/cartPromotion.js +5 -2
  98. package/lib/solution/BookingByStep/index.d.ts +1 -16
  99. package/lib/solution/BookingByStep/index.js +18 -60
  100. package/lib/solution/BookingByStep/types.d.ts +1 -2
  101. package/lib/solution/BookingByStep/types.js +0 -5
  102. package/lib/solution/BookingByStep/utils/capacity.js +1 -20
  103. package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  104. package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
  105. package/lib/solution/BookingTicket/index.d.ts +2 -14
  106. package/lib/solution/BookingTicket/index.js +2 -10
  107. package/lib/solution/BookingTicket/types.d.ts +3 -0
  108. package/lib/solution/BookingTicket/utils/cartView.js +43 -30
  109. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
  110. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
  111. package/lib/solution/Sales/index.d.ts +1 -0
  112. package/lib/solution/Sales/index.js +15 -3
  113. package/lib/solution/ScanOrder/index.d.ts +14 -26
  114. package/lib/solution/ScanOrder/index.js +182 -449
  115. package/lib/solution/ScanOrder/types.d.ts +1 -21
  116. package/lib/solution/ScanOrder/utils.d.ts +0 -8
  117. package/lib/solution/ScanOrder/utils.js +0 -31
  118. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  119. package/lib/solution/ShopDiscount/index.js +0 -14
  120. package/lib/solution/VenueBooking/index.d.ts +11 -39
  121. package/lib/solution/VenueBooking/index.js +110 -322
  122. package/lib/solution/VenueBooking/types.d.ts +0 -3
  123. package/lib/solution/VenueBooking/utils/resource.js +0 -1
  124. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  125. package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
  126. package/lib/solution/index.d.ts +0 -1
  127. package/lib/solution/index.js +1 -3
  128. package/lib/types/index.d.ts +0 -1
  129. package/package.json +1 -1
  130. package/dist/modules/Holder/index.d.ts +0 -48
  131. package/dist/modules/Holder/index.js +0 -640
  132. package/dist/modules/Holder/types.d.ts +0 -123
  133. package/dist/modules/Holder/types.js +0 -1
  134. package/dist/modules/Holder/utils.d.ts +0 -13
  135. package/dist/modules/Holder/utils.js +0 -34
  136. package/dist/modules/ResourcePlanner/index.d.ts +0 -24
  137. package/dist/modules/ResourcePlanner/index.js +0 -181
  138. package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
  139. package/dist/modules/ResourcePlanner/planner.js +0 -1069
  140. package/dist/modules/ResourcePlanner/types.d.ts +0 -227
  141. package/dist/modules/ResourcePlanner/types.js +0 -1
  142. package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
  143. package/dist/solution/UnifiedBookingSales/index.js +0 -1891
  144. package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
  145. package/dist/solution/UnifiedBookingSales/types.js +0 -11
  146. package/lib/modules/Holder/index.d.ts +0 -48
  147. package/lib/modules/Holder/index.js +0 -402
  148. package/lib/modules/Holder/types.d.ts +0 -123
  149. package/lib/modules/Holder/types.js +0 -17
  150. package/lib/modules/Holder/utils.d.ts +0 -13
  151. package/lib/modules/Holder/utils.js +0 -71
  152. package/lib/modules/ResourcePlanner/index.d.ts +0 -24
  153. package/lib/modules/ResourcePlanner/index.js +0 -148
  154. package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
  155. package/lib/modules/ResourcePlanner/planner.js +0 -933
  156. package/lib/modules/ResourcePlanner/types.d.ts +0 -227
  157. package/lib/modules/ResourcePlanner/types.js +0 -17
  158. package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
  159. package/lib/solution/UnifiedBookingSales/index.js +0 -1084
  160. package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
  161. package/lib/solution/UnifiedBookingSales/types.js +0 -33
@@ -33,7 +33,7 @@ __export(VenueBooking_exports, {
33
33
  VenueBookingImpl: () => VenueBookingImpl
34
34
  });
35
35
  module.exports = __toCommonJS(VenueBooking_exports);
36
- var import_BaseSales = require("../BaseSales");
36
+ var import_BaseModule = require("../../modules/BaseModule");
37
37
  var import_types = require("./types");
38
38
  var import_utils = require("./utils");
39
39
  var import_types2 = require("../BookingByStep/types");
@@ -54,8 +54,6 @@ var import_utils3 = require("../../modules/Order/utils");
54
54
  var import_Order = require("../../modules/Order");
55
55
  var import_types4 = require("../RegisterAndLogin/types");
56
56
  var import_decimal = __toESM(require("decimal.js"));
57
- var import_Holder = require("../../modules/Holder");
58
- var import_utils4 = require("../../modules/Holder/utils");
59
57
  __reExport(VenueBooking_exports, require("./types"), module.exports);
60
58
  var OPEN_DATA_SECTION_CODES = [
61
59
  "basic",
@@ -81,7 +79,7 @@ function cloneCustomDepositData(customDepositData) {
81
79
  deposit_policy_data: Array.isArray(customDepositData.deposit_policy_data) ? [...customDepositData.deposit_policy_data] : []
82
80
  };
83
81
  }
84
- var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
82
+ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
85
83
  constructor(name, version) {
86
84
  super(name, version);
87
85
  this.defaultName = "venueBooking";
@@ -231,79 +229,6 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
231
229
  }
232
230
  });
233
231
  }
234
- getRegisteredModuleNames() {
235
- return [
236
- "scanOrderLogger",
237
- "products",
238
- "order",
239
- "salesSummary",
240
- "venueProducts",
241
- "addonProducts",
242
- "date",
243
- "schedule",
244
- "quotation",
245
- "openData"
246
- ];
247
- }
248
- createSubModule(moduleName) {
249
- switch (moduleName) {
250
- case "scanOrderLogger":
251
- return (0, import_types2.createModule)("scanOrderLogger", this.name);
252
- case "venueProducts":
253
- return new import_ProductList.ProductList(`${this.name}_venueProducts`);
254
- case "addonProducts":
255
- return new import_ProductList.ProductList(`${this.name}_addonProducts`);
256
- case "date":
257
- return new import_Date.DateModule(`${this.name}_date`);
258
- case "openData":
259
- return new import_OpenData.OpenDataModule(`${this.name}_openData`);
260
- default:
261
- return super.createSubModule(moduleName);
262
- }
263
- }
264
- attachProductOriginToTempOrder(tempOrder, productUid, origin) {
265
- var _a, _b, _c;
266
- if (!productUid || !origin)
267
- return;
268
- tempOrder._extend = {
269
- ...tempOrder._extend || {},
270
- productsByUid: {
271
- ...((_a = tempOrder._extend) == null ? void 0 : _a.productsByUid) || {},
272
- [productUid]: {
273
- ...((_c = (_b = tempOrder._extend) == null ? void 0 : _b.productsByUid) == null ? void 0 : _c[productUid]) || {},
274
- origin
275
- }
276
- }
277
- };
278
- }
279
- readProductOriginFromTempOrder(tempOrder, product) {
280
- var _a, _b, _c, _d;
281
- const uid = ((_a = product.metadata) == null ? void 0 : _a.unique_identification_number) || product.identity_key;
282
- if (uid && ((_d = (_c = (_b = tempOrder._extend) == null ? void 0 : _b.productsByUid) == null ? void 0 : _c[uid]) == null ? void 0 : _d.origin)) {
283
- return tempOrder._extend.productsByUid[uid].origin;
284
- }
285
- return product._origin;
286
- }
287
- normalizeVenueProductTitle(value) {
288
- if (typeof value === "string") {
289
- const text = value.trim();
290
- return text ? { auto: text } : void 0;
291
- }
292
- if (!value || typeof value !== "object" || Array.isArray(value))
293
- return void 0;
294
- const source = value;
295
- const normalized = {};
296
- Object.entries(source).forEach(([key, text]) => {
297
- if (typeof text === "string")
298
- normalized[key] = text;
299
- });
300
- if (!normalized.auto) {
301
- const fallback = normalized.original || normalized.en || normalized["zh-CN"] || normalized["zh-HK"];
302
- if (fallback)
303
- normalized.auto = fallback;
304
- }
305
- return Object.values(normalized).some((text) => String(text || "").trim()) ? normalized : void 0;
306
- }
307
232
  normalizeCustomerId(value) {
308
233
  const customerId = Number(value);
309
234
  if (!Number.isFinite(customerId) || customerId <= 0)
@@ -332,42 +257,6 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
332
257
  }
333
258
  return null;
334
259
  }
335
- resolveHolderCustomerId() {
336
- var _a, _b;
337
- const customer = JSON.parse(((_b = (_a = this.window) == null ? void 0 : _a.getLocalStorage) == null ? void 0 : _b.call(_a, "customer")) || "{}");
338
- if (customer == null ? void 0 : customer.id)
339
- return Number(customer.id);
340
- return void 0;
341
- }
342
- /**
343
- * 按商品 holder_config 预加载表单数据到 holderMap。
344
- * appointment_booking 在加购时触发;venueBooking 在商品加载后预加载,避免 getHolderFormMap 为空。
345
- */
346
- async preloadHolderForms(products) {
347
- var _a, _b, _c, _d;
348
- if (!this.store.holder || !products.length)
349
- return;
350
- const seenFormIds = /* @__PURE__ */ new Set();
351
- for (const item of products) {
352
- const holderConfig = (0, import_utils4.getProductHolderConfig)((_a = item == null ? void 0 : item._origin) == null ? void 0 : _a.product);
353
- if (!holderConfig)
354
- continue;
355
- const formId = (0, import_utils4.getFormIdFromHolderConfig)(holderConfig);
356
- if (seenFormIds.has(formId))
357
- continue;
358
- seenFormIds.add(formId);
359
- try {
360
- await this.store.holder.ensureFormByProduct({
361
- product: ((_b = item == null ? void 0 : item._origin) == null ? void 0 : _b.product) || {},
362
- customer_id: this.resolveHolderCustomerId(),
363
- shop_id: (_d = (_c = item == null ? void 0 : item._origin) == null ? void 0 : _c.product) == null ? void 0 : _d.shop_id,
364
- useCache: true
365
- });
366
- } catch (error) {
367
- console.error("[VenueBooking] 预加载 holder 表单失败", { formId, error });
368
- }
369
- }
370
- }
371
260
  clearLoginEffectListeners() {
372
261
  for (const dispose of this.loginEffectDisposers) {
373
262
  dispose();
@@ -414,12 +303,6 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
414
303
  this.customerLoginRefreshIdInFlight = params.customerId;
415
304
  const refreshTask = (async () => {
416
305
  var _a;
417
- if (this.store.holder) {
418
- await this.store.holder.refreshAllFormRecords({
419
- customer_id: params.customerId,
420
- useCache: false
421
- });
422
- }
423
306
  if (this.store.quotation) {
424
307
  await this.store.quotation.loadQuotations({
425
308
  channel: (_a = this.otherParams) == null ? void 0 : _a.channel
@@ -447,8 +330,10 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
447
330
  }
448
331
  }
449
332
  async initialize(core, options = {}) {
450
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
333
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
451
334
  this.logMethodStart("initialize");
335
+ this.core = core;
336
+ this.initializeOptions = options || {};
452
337
  this.store = { ...this.store, ...options.store };
453
338
  this.store.entryContext = ((_a = options.otherParams) == null ? void 0 : _a.entryContext) || this.store.entryContext;
454
339
  this.store.status = "initializing";
@@ -470,20 +355,15 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
470
355
  passed: null,
471
356
  failures: []
472
357
  };
473
- await super.initialize(core, options);
474
- if (this.store.scanOrderLogger) {
475
- this.store.scanOrderLogger.setProvider(
476
- ((_f = this.otherParams) == null ? void 0 : _f.loggerProvider) || "feishu"
477
- );
478
- this.store.scanOrderLogger.setProviderConfig(
479
- ((_g = this.otherParams) == null ? void 0 : _g.loggerConfig) || {
480
- feishu: {
481
- webhook: "https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8",
482
- errorHook: "https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d"
483
- }
484
- }
485
- );
486
- this.store.scanOrderLogger.setContext(this.getLoggerContext());
358
+ this.window = core.getPlugin("window");
359
+ this.request = core.getPlugin("request");
360
+ if (!this.window) {
361
+ this.logMethodError("initialize", "window plugin missing");
362
+ throw new Error("venueBooking解决方案需要 window 插件支持");
363
+ }
364
+ if (!this.request) {
365
+ this.logMethodError("initialize", "request plugin missing");
366
+ throw new Error("venueBooking解决方案需要 request 插件支持");
487
367
  }
488
368
  const baseModules = [
489
369
  "scanOrderLogger",
@@ -501,10 +381,10 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
501
381
  } : {};
502
382
  const loggerProvider = ((_c2 = this.otherParams) == null ? void 0 : _c2.loggerProvider) || "feishu";
503
383
  const loggerConfig = ((_d2 = this.otherParams) == null ? void 0 : _d2.loggerConfig) || {
504
- // feishu: {
505
- // webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
506
- // errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d',
507
- // },
384
+ feishu: {
385
+ webhook: "https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8",
386
+ errorHook: "https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d"
387
+ }
508
388
  };
509
389
  this.core.registerModule(targetModule, {
510
390
  initialState,
@@ -571,43 +451,24 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
571
451
  otherParams: {
572
452
  ...this.otherParams,
573
453
  fatherModule: this.name,
574
- openCache: !!((_h = this.otherParams) == null ? void 0 : _h.cacheId),
575
- cacheId: (_i = this.otherParams) == null ? void 0 : _i.cacheId
454
+ openCache: !!((_f = this.otherParams) == null ? void 0 : _f.cacheId),
455
+ cacheId: (_g = this.otherParams) == null ? void 0 : _g.cacheId
576
456
  }
577
457
  });
578
- let holderCacheState;
579
- if ((_j = this.otherParams) == null ? void 0 : _j.cacheId) {
580
- const sessionData = this.window.sessionStorage.getItem(this.name);
581
- if (sessionData) {
582
- try {
583
- const data = JSON.parse(sessionData);
584
- holderCacheState = (_k = data[this.otherParams.cacheId]) == null ? void 0 : _k[`${this.name}_holder`];
585
- } catch {
586
- }
587
- }
458
+ if (this.store.scanOrderLogger) {
459
+ this.store.scanOrderLogger.setContext(this.getLoggerContext());
588
460
  }
589
- const holderModule = new import_Holder.HolderModule(`${this.name}_holder`);
590
- this.store.holder = holderModule;
591
- this.core.registerModule(holderModule, {
592
- initialState: holderCacheState,
593
- otherParams: {
594
- ...this.otherParams,
595
- fatherModule: this.name,
596
- openCache: !!((_l = this.otherParams) == null ? void 0 : _l.cacheId),
597
- cacheId: (_m = this.otherParams) == null ? void 0 : _m.cacheId
598
- }
599
- });
600
461
  this.registerCustomerLoginListeners();
601
462
  console.log("[VenueBooking] 初始化开始");
602
463
  try {
603
- await ((_n = this.store.order) == null ? void 0 : _n.recalculateSummary({ createIfMissing: false }));
604
- (_o = this.store.order) == null ? void 0 : _o.persistTempOrder();
464
+ await ((_h = this.store.order) == null ? void 0 : _h.recalculateSummary({ createIfMissing: false }));
465
+ (_i = this.store.order) == null ? void 0 : _i.persistTempOrder();
605
466
  await this.loadRuntimeConfigs();
606
467
  if (this.store.schedule) {
607
468
  await this.store.schedule.loadAllSchedule();
608
469
  this.injectScheduleResolverToQuotation();
609
- (_q = this.store.quotation) == null ? void 0 : _q.loadQuotations({
610
- channel: (_p = this.otherParams) == null ? void 0 : _p.channel
470
+ (_k = this.store.quotation) == null ? void 0 : _k.loadQuotations({
471
+ channel: (_j = this.otherParams) == null ? void 0 : _j.channel
611
472
  });
612
473
  }
613
474
  await this.refreshItemRuleQuantityLimits();
@@ -694,7 +555,7 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
694
555
  return this.loadAllProductsInFlight;
695
556
  }
696
557
  async _doLoadAllProducts() {
697
- var _a, _b, _c, _d, _e;
558
+ var _a, _b, _c;
698
559
  this.logMethodStart("loadAllProducts");
699
560
  try {
700
561
  if (!this.store.venueProducts)
@@ -723,10 +584,6 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
723
584
  }
724
585
  this.store.addonProducts.addProduct(addonList);
725
586
  this.resourceProductMap = (0, import_resource.buildResourceProductMap)(venueList);
726
- if (this.store.order) {
727
- const products = ((_e = (_d = this.store.order) == null ? void 0 : _d.getOrderProducts) == null ? void 0 : _e.call(_d)) || [];
728
- await this.preloadHolderForms(products);
729
- }
730
587
  this.productsLoaded = true;
731
588
  this.logMethodSuccess("loadAllProducts", {
732
589
  total: list.length,
@@ -1119,7 +976,6 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
1119
976
  * 同一场地下不同商品互不干扰,各自单独 reconcile。
1120
977
  */
1121
978
  async reconcileOrderForResourceProduct(resourceId, productId, slots) {
1122
- var _a, _b;
1123
979
  const mappings = this.resourceProductMap.get(resourceId);
1124
980
  if (!mappings || !mappings.length || !this.store.order)
1125
981
  return;
@@ -1133,10 +989,10 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
1133
989
  );
1134
990
  tempOrder.bookings = (tempOrder.bookings || []).filter(
1135
991
  (b) => {
1136
- var _a2, _b2, _c, _d;
1137
- if (!((_a2 = b.metadata) == null ? void 0 : _a2.venue_booking))
992
+ var _a, _b, _c, _d;
993
+ if (!((_a = b.metadata) == null ? void 0 : _a.venue_booking))
1138
994
  return true;
1139
- if (String((_b2 = b.metadata) == null ? void 0 : _b2.resource_id) !== String(resourceId))
995
+ if (String((_b = b.metadata) == null ? void 0 : _b.resource_id) !== String(resourceId))
1140
996
  return true;
1141
997
  const bookingProductId = ((_c = b.metadata) == null ? void 0 : _c.product_id) ?? ((_d = b == null ? void 0 : b.product) == null ? void 0 : _d.product_id);
1142
998
  if (bookingProductId == null)
@@ -1165,7 +1021,6 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
1165
1021
  const endMoment = (0, import_dayjs.default)(group.endTime, "YYYY-MM-DD HH:mm");
1166
1022
  const duration = endMoment.diff(startMoment, "minute");
1167
1023
  const customDepositData = cloneCustomDepositData(venueProduct == null ? void 0 : venueProduct.custom_deposit_data);
1168
- const productTitle = this.normalizeVenueProductTitle(venueProduct == null ? void 0 : venueProduct.product_title) || this.normalizeVenueProductTitle(venueProduct == null ? void 0 : venueProduct.title) || this.normalizeVenueProductTitle(mapping.productTitle);
1169
1024
  const resourceEntry = {
1170
1025
  relation_type: "form",
1171
1026
  like_status: "common",
@@ -1188,71 +1043,67 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
1188
1043
  metadata: {}
1189
1044
  }));
1190
1045
  }
1191
- const venueProductOrigin = {
1192
- name: mapping.productTitle,
1193
- product_title: productTitle,
1194
- cover: (venueProduct == null ? void 0 : venueProduct.cover) || "",
1195
- custom_deposit_data: customDepositData,
1196
- id: 0,
1197
- number: 1,
1198
- registration_type: "all",
1199
- relation_products: [],
1200
- is_all: false,
1201
- product: {
1046
+ tempOrder.products.push(
1047
+ (0, import_utils.normalizeOrderProduct)({
1202
1048
  product_id: mapping.productId,
1203
1049
  product_variant_id: 0,
1050
+ identity_key: identityKey,
1204
1051
  num: 1,
1205
- product_bundle: [],
1206
- product_sku: { option: [] },
1207
- discount_list: [],
1208
- custom_deposit_data: customDepositData,
1209
- metadata: {}
1210
- },
1211
- sub_type: "minutes",
1212
- duration,
1213
- like_status: "common",
1214
- resources: [resourceEntry],
1215
- schedule_id: 0,
1216
- select_date: startMoment.format("YYYY-MM-DD"),
1217
- start_date: startMoment.format("YYYY-MM-DD"),
1218
- start_time: startMoment.format("HH:mm"),
1219
- end_date: endMoment.format("YYYY-MM-DD"),
1220
- end_time: endMoment.format("HH:mm"),
1221
- metadata: {
1222
- venue_booking: true,
1223
- slot_count: group.slotCount
1224
- },
1225
- holder: null
1226
- };
1227
- const normalizedVenueOrderProduct = (0, import_utils.normalizeOrderProduct)({
1228
- product_id: mapping.productId,
1229
- product_variant_id: 0,
1230
- identity_key: identityKey,
1231
- num: 1,
1232
- selling_price: group.totalPrice,
1233
- original_price: group.totalPrice,
1234
- is_charge_tax: (venueProduct == null ? void 0 : venueProduct.is_charge_tax) ?? 0,
1235
- metadata: {
1236
- venue_booking: true,
1237
- ...productTitle ? { product_title: productTitle } : {},
1238
- resource_id: resourceId,
1239
- resource_form_id: mapping.formId,
1240
- resource_name: mapping.resourceName,
1241
- start_time: group.startTime,
1242
- end_time: group.endTime,
1243
- slot_count: group.slotCount,
1244
- booking_uid: bookingUuid,
1245
- price_breakdown: (0, import_slotMerge.buildPriceBreakdown)({
1246
- group,
1247
- productId: mapping.productId,
1248
- quotation: this.store.quotation
1249
- })
1250
- },
1251
- _origin: venueProductOrigin
1252
- });
1253
- const venueOrderProduct = productTitle ? { ...normalizedVenueOrderProduct, product_title: productTitle } : normalizedVenueOrderProduct;
1254
- this.attachProductOriginToTempOrder(tempOrder, identityKey, venueProductOrigin);
1255
- tempOrder.products.push(venueOrderProduct);
1052
+ selling_price: group.totalPrice,
1053
+ original_price: group.totalPrice,
1054
+ is_charge_tax: (venueProduct == null ? void 0 : venueProduct.is_charge_tax) ?? 0,
1055
+ metadata: {
1056
+ venue_booking: true,
1057
+ resource_id: resourceId,
1058
+ resource_form_id: mapping.formId,
1059
+ resource_name: mapping.resourceName,
1060
+ start_time: group.startTime,
1061
+ end_time: group.endTime,
1062
+ slot_count: group.slotCount,
1063
+ booking_uid: bookingUuid,
1064
+ price_breakdown: (0, import_slotMerge.buildPriceBreakdown)({
1065
+ group,
1066
+ productId: mapping.productId,
1067
+ quotation: this.store.quotation
1068
+ })
1069
+ },
1070
+ _origin: {
1071
+ name: mapping.productTitle,
1072
+ cover: (venueProduct == null ? void 0 : venueProduct.cover) || "",
1073
+ custom_deposit_data: customDepositData,
1074
+ id: 0,
1075
+ number: 1,
1076
+ registration_type: "all",
1077
+ relation_products: [],
1078
+ is_all: false,
1079
+ product: {
1080
+ product_id: mapping.productId,
1081
+ product_variant_id: 0,
1082
+ num: 1,
1083
+ product_bundle: [],
1084
+ product_sku: { option: [] },
1085
+ discount_list: [],
1086
+ custom_deposit_data: customDepositData,
1087
+ metadata: {}
1088
+ },
1089
+ sub_type: "minutes",
1090
+ duration,
1091
+ like_status: "common",
1092
+ resources: [resourceEntry],
1093
+ schedule_id: 0,
1094
+ select_date: startMoment.format("YYYY-MM-DD"),
1095
+ start_date: startMoment.format("YYYY-MM-DD"),
1096
+ start_time: startMoment.format("HH:mm"),
1097
+ end_date: endMoment.format("YYYY-MM-DD"),
1098
+ end_time: endMoment.format("HH:mm"),
1099
+ metadata: {
1100
+ venue_booking: true,
1101
+ slot_count: group.slotCount
1102
+ },
1103
+ holder: null
1104
+ }
1105
+ })
1106
+ );
1256
1107
  const booking = (0, import_slotMerge.buildVenueBookingEntry)({
1257
1108
  group,
1258
1109
  resourceId,
@@ -1264,8 +1115,6 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
1264
1115
  });
1265
1116
  tempOrder.bookings.push(booking);
1266
1117
  }
1267
- const products = ((_b = (_a = this.store.order) == null ? void 0 : _a.getOrderProducts) == null ? void 0 : _b.call(_a)) || [];
1268
- await this.preloadHolderForms(products);
1269
1118
  this.store.order.applyDiscount();
1270
1119
  await this.store.order.recalculateSummary({ createIfMissing: true });
1271
1120
  this.store.order.persistTempOrder();
@@ -1333,17 +1182,17 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
1333
1182
  const result = ((_a = this.store.order) == null ? void 0 : _a.getTempOrder()) || null;
1334
1183
  return result;
1335
1184
  }
1336
- updateTempOrderNote(note, sync = false) {
1185
+ updateTempOrderNote(note) {
1337
1186
  if (!this.store.order)
1338
1187
  throw new Error("order 模块未初始化");
1339
- return this.store.order.updateTempOrderNote(note, sync);
1188
+ return this.store.order.updateTempOrderNote(note);
1340
1189
  }
1341
1190
  updateTempOrderContactsInfo(contactsInfo) {
1342
1191
  if (!this.store.order)
1343
1192
  throw new Error("order 模块未初始化");
1344
1193
  return this.store.order.updateTempOrderContactsInfo(contactsInfo);
1345
1194
  }
1346
- ensureVenueTempOrder() {
1195
+ ensureTempOrder() {
1347
1196
  if (!this.store.order)
1348
1197
  throw new Error("order 模块未初始化");
1349
1198
  return this.store.order.ensureTempOrder();
@@ -1842,7 +1691,7 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
1842
1691
  return [];
1843
1692
  }
1844
1693
  const businessData = (0, import_utils.buildItemRuleBusinessData)({
1845
- tempOrder: this.ensureVenueTempOrder(),
1694
+ tempOrder: this.ensureTempOrder(),
1846
1695
  runtimeConfig: this.getItemRuleRuntimeConfig(),
1847
1696
  itemRuleConfigs: this.itemRuleConfigs
1848
1697
  });
@@ -1857,7 +1706,7 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
1857
1706
  }
1858
1707
  }
1859
1708
  async applyPrefillByItemRule() {
1860
- var _a, _b;
1709
+ var _a;
1861
1710
  if (this.itemRulePrefillApplied)
1862
1711
  return;
1863
1712
  if (!this.store.order)
@@ -1866,7 +1715,7 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
1866
1715
  if (!strategyConfigs.length)
1867
1716
  return;
1868
1717
  const businessData = (0, import_utils.buildItemRuleBusinessData)({
1869
- tempOrder: this.ensureVenueTempOrder(),
1718
+ tempOrder: this.ensureTempOrder(),
1870
1719
  runtimeConfig: this.getItemRuleRuntimeConfig(),
1871
1720
  itemRuleConfigs: this.itemRuleConfigs
1872
1721
  });
@@ -1876,7 +1725,7 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
1876
1725
  return;
1877
1726
  }
1878
1727
  const productSourceMap = await this.buildPrefillProductSourceMap();
1879
- const tempOrder = this.ensureVenueTempOrder();
1728
+ const tempOrder = this.ensureTempOrder();
1880
1729
  let hasChanges = false;
1881
1730
  for (const prefillItem of prefillItems) {
1882
1731
  const productId = Number(prefillItem.product_id);
@@ -1893,39 +1742,32 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
1893
1742
  });
1894
1743
  if (productIndex === -1) {
1895
1744
  const sellingPrice = (0, import_utils.toPriceString)((sourceItem == null ? void 0 : sourceItem.price) ?? (sourceItem == null ? void 0 : sourceItem.selling_price), "0.00");
1896
- const origin = { ...sourceItem || {}, item_rule_prefill: true, item_rule_id: prefillItem.ruleId };
1897
- const product = (0, import_utils.normalizeOrderProduct)({
1898
- product_id: productId,
1899
- product_variant_id: productVariantId,
1900
- num: targetQuantity,
1901
- selling_price: sellingPrice,
1902
- original_price: sellingPrice,
1903
- metadata: { item_rule_prefill: true, item_rule_id: prefillItem.ruleId },
1904
- _origin: origin
1905
- });
1906
- const productUid = String(((_a = product.metadata) == null ? void 0 : _a.unique_identification_number) || "");
1907
- this.attachProductOriginToTempOrder(tempOrder, productUid, origin);
1908
- tempOrder.products.push(product);
1745
+ tempOrder.products.push(
1746
+ (0, import_utils.normalizeOrderProduct)({
1747
+ product_id: productId,
1748
+ product_variant_id: productVariantId,
1749
+ num: targetQuantity,
1750
+ selling_price: sellingPrice,
1751
+ original_price: sellingPrice,
1752
+ metadata: { item_rule_prefill: true, item_rule_id: prefillItem.ruleId },
1753
+ _origin: { ...sourceItem || {}, item_rule_prefill: true, item_rule_id: prefillItem.ruleId }
1754
+ })
1755
+ );
1909
1756
  hasChanges = true;
1910
1757
  continue;
1911
1758
  }
1912
1759
  const targetProduct = tempOrder.products[productIndex];
1913
- const previousOrigin = this.readProductOriginFromTempOrder(tempOrder, targetProduct);
1914
- const nextOrigin = sourceItem ? { ...previousOrigin || {}, ...sourceItem } : previousOrigin;
1915
1760
  const existedQuantity = (0, import_utils.toNonNegativeInt)(targetProduct.num);
1916
1761
  const delta = targetQuantity - existedQuantity;
1917
1762
  const nextProduct = {
1918
1763
  ...targetProduct,
1919
1764
  ...delta > 0 ? { num: (0, import_utils.getSafeProductNum)(existedQuantity + delta) } : {},
1920
- metadata: { ...targetProduct.metadata || {}, item_rule_prefill: true, item_rule_id: prefillItem.ruleId }
1765
+ metadata: { ...targetProduct.metadata || {}, item_rule_prefill: true, item_rule_id: prefillItem.ruleId },
1766
+ _origin: sourceItem ? { ...targetProduct._origin || {}, ...sourceItem } : targetProduct._origin
1921
1767
  };
1922
1768
  if (delta > 0 || Boolean(
1923
- sourceItem && (!previousOrigin || (previousOrigin == null ? void 0 : previousOrigin.price) !== (sourceItem == null ? void 0 : sourceItem.price))
1769
+ sourceItem && (!targetProduct._origin || ((_a = targetProduct._origin) == null ? void 0 : _a.price) !== (sourceItem == null ? void 0 : sourceItem.price))
1924
1770
  )) {
1925
- const productUid = String(
1926
- ((_b = nextProduct.metadata) == null ? void 0 : _b.unique_identification_number) || ""
1927
- );
1928
- this.attachProductOriginToTempOrder(tempOrder, productUid, nextOrigin);
1929
1771
  tempOrder.products[productIndex] = nextProduct;
1930
1772
  hasChanges = true;
1931
1773
  }
@@ -1953,7 +1795,7 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
1953
1795
  if (!strategyConfigs.length)
1954
1796
  return { passed: true, failures: [] };
1955
1797
  const businessData = (0, import_utils.buildItemRuleBusinessData)({
1956
- tempOrder: this.ensureVenueTempOrder(),
1798
+ tempOrder: this.ensureTempOrder(),
1957
1799
  runtimeConfig: this.getItemRuleRuntimeConfig(),
1958
1800
  itemRuleConfigs: this.itemRuleConfigs
1959
1801
  });
@@ -2065,60 +1907,6 @@ var _VenueBookingImpl = class extends import_BaseSales.BaseSalesImpl {
2065
1907
  this.writeUIStateBucket(bucket);
2066
1908
  }
2067
1909
  }
2068
- setBookingHolder(bookingUid, holder) {
2069
- var _a, _b, _c, _d;
2070
- if (!this.store.order)
2071
- return;
2072
- const tempOrder = this.store.order.ensureTempOrder();
2073
- const booking = (_a = tempOrder.bookings) == null ? void 0 : _a.find(
2074
- (b) => {
2075
- var _a2;
2076
- return ((_a2 = b.metadata) == null ? void 0 : _a2.unique_identification_number) === bookingUid;
2077
- }
2078
- );
2079
- if (booking) {
2080
- booking.holder = holder;
2081
- }
2082
- for (const product of tempOrder.products) {
2083
- const runtimeProduct = product;
2084
- const productBookingUid = ((_b = runtimeProduct.metadata) == null ? void 0 : _b.booking_uid) ?? ((_d = (_c = runtimeProduct._origin) == null ? void 0 : _c.product) == null ? void 0 : _d.bookingUuid);
2085
- if (String(productBookingUid) !== String(bookingUid))
2086
- continue;
2087
- const origin = runtimeProduct._origin && typeof runtimeProduct._origin === "object" ? runtimeProduct._origin : {};
2088
- origin.holder = holder;
2089
- runtimeProduct._origin = origin;
2090
- }
2091
- this.store.order.notifyTempOrderChanged();
2092
- }
2093
- /**
2094
- * 获取 holder 表单 map
2095
- */
2096
- getHolderFormMap() {
2097
- if (!this.store.holder)
2098
- throw new Error("[VenueBooking] holder 模块未初始化");
2099
- return this.store.holder.getHolderFormMap();
2100
- }
2101
- /**
2102
- * UI 层触发:按当前 holderMap 批量刷新所有表单的 records
2103
- */
2104
- async refreshAllHolderFormRecords(params) {
2105
- if (!this.store.holder)
2106
- throw new Error("[VenueBooking] holder 模块未初始化");
2107
- const customer_id = (params == null ? void 0 : params.customer_id) ?? this.resolveHolderCustomerId();
2108
- return this.store.holder.refreshAllFormRecords({
2109
- ...params,
2110
- customer_id,
2111
- useCache: (params == null ? void 0 : params.useCache) ?? false
2112
- });
2113
- }
2114
- /**
2115
- * 添加表单记录
2116
- */
2117
- appendFormRecord(params) {
2118
- if (!this.store.holder)
2119
- throw new Error("[VenueBooking] holder 模块未初始化");
2120
- return this.store.holder.appendFormRecord(params);
2121
- }
2122
1910
  // ─── OpenData 可用性 ───
2123
1911
  async checkOpenDataAvailability() {
2124
1912
  if (!this.store.openData)
@@ -1,6 +1,5 @@
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';
4
3
  export type { ScanOrderOrderProductIdentity, ScanOrderOrderProduct, ScanOrderSubmitProduct, ScanOrderSummary, ScanOrderTempOrder, ScanOrderSubmitPayload, } from '../ScanOrder/types';
5
4
  export declare enum VenueBookingHooks {
6
5
  onInited = "venueBooking:onInited",
@@ -97,7 +96,6 @@ export interface VenueResourceRawData {
97
96
  export interface ResourceProductMapping {
98
97
  productId: number;
99
98
  productTitle: string;
100
- formName?: string;
101
99
  resourceName: string;
102
100
  formId: number | string;
103
101
  price: string;
@@ -146,7 +144,6 @@ export interface VenueBookingState {
146
144
  passed: boolean | null;
147
145
  failures: QuantityCheckResult[];
148
146
  };
149
- holder?: HolderModule;
150
147
  }
151
148
  export interface VenueBookingLoggerRuntimeConfig {
152
149
  provider?: ScanOrderLoggerProviderType;
@@ -69,7 +69,6 @@ function buildResourceProductMap(products) {
69
69
  const mapping = {
70
70
  productId: product.id,
71
71
  productTitle: product.title,
72
- formName: resource.title,
73
72
  resourceName: resource.title,
74
73
  formId: resource.id,
75
74
  price: product.price || "0.00",