@pisell/pisellos 2.3.44 → 2.3.45

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 (146) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  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 +2 -4
  7. package/dist/modules/Order/index.js +25 -54
  8. package/dist/modules/Order/types.d.ts +0 -9
  9. package/dist/modules/Order/utils.d.ts +0 -10
  10. package/dist/modules/Order/utils.js +3 -35
  11. package/dist/modules/Product/types.d.ts +0 -1
  12. package/dist/modules/ProductList/index.js +14 -33
  13. package/dist/modules/Quotation/index.d.ts +1 -1
  14. package/dist/modules/Quotation/index.js +2 -2
  15. package/dist/modules/Rules/index.js +13 -47
  16. package/dist/modules/SalesSummary/index.js +13 -12
  17. package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
  18. package/dist/modules/ScanOrderLogger/index.js +2 -15
  19. package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
  20. package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
  21. package/dist/modules/Schedule/index.d.ts +1 -3
  22. package/dist/modules/Schedule/index.js +16 -21
  23. package/dist/modules/Summary/utils.js +13 -38
  24. package/dist/modules/index.d.ts +0 -2
  25. package/dist/modules/index.js +1 -3
  26. package/dist/plugins/window.d.ts +0 -1
  27. package/dist/server/index.d.ts +0 -14
  28. package/dist/server/index.js +657 -772
  29. package/dist/solution/BaseSales/index.d.ts +0 -7
  30. package/dist/solution/BaseSales/index.js +42 -64
  31. package/dist/solution/BookingByStep/index.d.ts +1 -16
  32. package/dist/solution/BookingByStep/index.js +215 -294
  33. package/dist/solution/BookingByStep/types.d.ts +1 -2
  34. package/dist/solution/BookingByStep/types.js +1 -3
  35. package/dist/solution/BookingByStep/utils/capacity.js +1 -17
  36. package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  37. package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
  38. package/dist/solution/BookingTicket/index.d.ts +2 -14
  39. package/dist/solution/BookingTicket/index.js +2 -2
  40. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
  41. package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
  42. package/dist/solution/ScanOrder/index.d.ts +14 -26
  43. package/dist/solution/ScanOrder/index.js +739 -1142
  44. package/dist/solution/ScanOrder/types.d.ts +1 -21
  45. package/dist/solution/ScanOrder/utils.d.ts +0 -8
  46. package/dist/solution/ScanOrder/utils.js +25 -66
  47. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  48. package/dist/solution/ShopDiscount/index.js +87 -125
  49. package/dist/solution/VenueBooking/index.d.ts +11 -39
  50. package/dist/solution/VenueBooking/index.js +841 -1167
  51. package/dist/solution/VenueBooking/types.d.ts +0 -3
  52. package/dist/solution/VenueBooking/utils/resource.js +0 -1
  53. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  54. package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
  55. package/dist/solution/index.d.ts +0 -1
  56. package/dist/solution/index.js +1 -2
  57. package/dist/types/index.d.ts +0 -1
  58. package/lib/modules/Discount/index.d.ts +0 -1
  59. package/lib/modules/Discount/index.js +0 -9
  60. package/lib/modules/Discount/types.d.ts +0 -1
  61. package/lib/modules/OpenData/index.js +1 -1
  62. package/lib/modules/Order/index.d.ts +2 -4
  63. package/lib/modules/Order/index.js +10 -26
  64. package/lib/modules/Order/types.d.ts +0 -9
  65. package/lib/modules/Order/utils.d.ts +0 -10
  66. package/lib/modules/Order/utils.js +5 -36
  67. package/lib/modules/Product/types.d.ts +0 -1
  68. package/lib/modules/ProductList/index.js +31 -40
  69. package/lib/modules/Quotation/index.d.ts +1 -1
  70. package/lib/modules/Quotation/index.js +2 -2
  71. package/lib/modules/Rules/index.js +16 -33
  72. package/lib/modules/SalesSummary/index.js +7 -6
  73. package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
  74. package/lib/modules/ScanOrderLogger/index.js +1 -13
  75. package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
  76. package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
  77. package/lib/modules/Schedule/index.d.ts +1 -3
  78. package/lib/modules/Schedule/index.js +8 -10
  79. package/lib/modules/Summary/utils.js +1 -21
  80. package/lib/modules/index.d.ts +0 -2
  81. package/lib/modules/index.js +1 -5
  82. package/lib/plugins/window.d.ts +0 -1
  83. package/lib/server/index.d.ts +0 -14
  84. package/lib/server/index.js +5 -65
  85. package/lib/solution/BaseSales/index.d.ts +0 -7
  86. package/lib/solution/BaseSales/index.js +8 -24
  87. package/lib/solution/BookingByStep/index.d.ts +1 -16
  88. package/lib/solution/BookingByStep/index.js +18 -60
  89. package/lib/solution/BookingByStep/types.d.ts +1 -2
  90. package/lib/solution/BookingByStep/types.js +0 -5
  91. package/lib/solution/BookingByStep/utils/capacity.js +1 -20
  92. package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  93. package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
  94. package/lib/solution/BookingTicket/index.d.ts +2 -14
  95. package/lib/solution/BookingTicket/index.js +2 -10
  96. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
  97. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
  98. package/lib/solution/ScanOrder/index.d.ts +14 -26
  99. package/lib/solution/ScanOrder/index.js +182 -449
  100. package/lib/solution/ScanOrder/types.d.ts +1 -21
  101. package/lib/solution/ScanOrder/utils.d.ts +0 -8
  102. package/lib/solution/ScanOrder/utils.js +0 -31
  103. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  104. package/lib/solution/ShopDiscount/index.js +0 -14
  105. package/lib/solution/VenueBooking/index.d.ts +11 -39
  106. package/lib/solution/VenueBooking/index.js +110 -322
  107. package/lib/solution/VenueBooking/types.d.ts +0 -3
  108. package/lib/solution/VenueBooking/utils/resource.js +0 -1
  109. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  110. package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
  111. package/lib/solution/index.d.ts +0 -1
  112. package/lib/solution/index.js +1 -3
  113. package/lib/types/index.d.ts +0 -1
  114. package/package.json +1 -1
  115. package/dist/modules/Holder/index.d.ts +0 -48
  116. package/dist/modules/Holder/index.js +0 -640
  117. package/dist/modules/Holder/types.d.ts +0 -123
  118. package/dist/modules/Holder/types.js +0 -1
  119. package/dist/modules/Holder/utils.d.ts +0 -13
  120. package/dist/modules/Holder/utils.js +0 -34
  121. package/dist/modules/ResourcePlanner/index.d.ts +0 -24
  122. package/dist/modules/ResourcePlanner/index.js +0 -181
  123. package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
  124. package/dist/modules/ResourcePlanner/planner.js +0 -1069
  125. package/dist/modules/ResourcePlanner/types.d.ts +0 -227
  126. package/dist/modules/ResourcePlanner/types.js +0 -1
  127. package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
  128. package/dist/solution/UnifiedBookingSales/index.js +0 -1891
  129. package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
  130. package/dist/solution/UnifiedBookingSales/types.js +0 -11
  131. package/lib/modules/Holder/index.d.ts +0 -48
  132. package/lib/modules/Holder/index.js +0 -402
  133. package/lib/modules/Holder/types.d.ts +0 -123
  134. package/lib/modules/Holder/types.js +0 -17
  135. package/lib/modules/Holder/utils.d.ts +0 -13
  136. package/lib/modules/Holder/utils.js +0 -71
  137. package/lib/modules/ResourcePlanner/index.d.ts +0 -24
  138. package/lib/modules/ResourcePlanner/index.js +0 -148
  139. package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
  140. package/lib/modules/ResourcePlanner/planner.js +0 -933
  141. package/lib/modules/ResourcePlanner/types.d.ts +0 -227
  142. package/lib/modules/ResourcePlanner/types.js +0 -17
  143. package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
  144. package/lib/solution/UnifiedBookingSales/index.js +0 -1084
  145. package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
  146. package/lib/solution/UnifiedBookingSales/types.js +0 -33
@@ -1008,7 +1008,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1008
1008
  return isChanged;
1009
1009
  }
1010
1010
  async initialize(core, options = {}) {
1011
- var _a, _b, _c, _d;
1011
+ var _a, _b;
1012
1012
  this.core = core;
1013
1013
  this.initializeOptions = options || {};
1014
1014
  this.paymentNumberDevicePrefix = null;
@@ -1019,9 +1019,10 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1019
1019
  this.request = core.getPlugin("request");
1020
1020
  this.appPlugin = core.getPlugin("app");
1021
1021
  if (!this.appPlugin) {
1022
+ throw new Error("Checkout 解决方案需要 app 插件支持");
1022
1023
  }
1023
- const app = (_c = (_b = this.appPlugin) == null ? void 0 : _b.getApp) == null ? void 0 : _c.call(_b);
1024
- this.logger = app == null ? void 0 : app.logger;
1024
+ const app = this.appPlugin.getApp();
1025
+ this.logger = app.logger;
1025
1026
  const targetCacheData = this.readSessionCacheData();
1026
1027
  const moduleNames = this.getRegisteredModuleNames();
1027
1028
  moduleNames.forEach((step) => {
@@ -1046,7 +1047,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1046
1047
  if (this.store.schedule && !this.isScheduleListLoaded(this.store.schedule)) {
1047
1048
  await this.store.schedule.loadAllSchedule();
1048
1049
  }
1049
- if (this.store.order && typeof ((_d = this.otherParams) == null ? void 0 : _d.enableTempOrderPersist) === "boolean") {
1050
+ if (this.store.order && typeof ((_b = this.otherParams) == null ? void 0 : _b.enableTempOrderPersist) === "boolean") {
1050
1051
  this.store.order.setEnableTempOrderPersist(
1051
1052
  this.otherParams.enableTempOrderPersist
1052
1053
  );
@@ -1900,7 +1901,6 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1900
1901
  throw new Error("BaseSales 解决方案需要 order 模块支持");
1901
1902
  }
1902
1903
  const inferredPaymentStatus = this.getSubmitPaymentStatus(params == null ? void 0 : params.paymentStatus);
1903
- const smallTicketDataFlag = (params == null ? void 0 : params.smallTicketDataFlag) ?? this.getDefaultCheckoutSmallTicketDataFlag();
1904
1904
  const submitParams = {
1905
1905
  cacheId: this.cacheId,
1906
1906
  platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
@@ -1910,11 +1910,11 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1910
1910
  request_unique_idempotency_token: this.store.order.generateIdempotencyToken(),
1911
1911
  ...(params == null ? void 0 : params.payments) !== void 0 ? { payments: params.payments } : {},
1912
1912
  ...inferredPaymentStatus !== void 0 ? { paymentStatus: inferredPaymentStatus } : {},
1913
- ...smallTicketDataFlag !== void 0 ? { smallTicketDataFlag } : {},
1913
+ ...(params == null ? void 0 : params.smallTicketDataFlag) !== void 0 ? { smallTicketDataFlag: params.smallTicketDataFlag } : {},
1914
1914
  ...(params == null ? void 0 : params.confirmPendingVoucherPayments) !== void 0 ? { confirmPendingVoucherPayments: params.confirmPendingVoucherPayments } : {},
1915
1915
  ...(params == null ? void 0 : params.enhancePayload) !== void 0 ? { enhancePayload: params.enhancePayload } : {}
1916
1916
  };
1917
- return this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams);
1917
+ return this.store.order.submitTempOrder(submitParams);
1918
1918
  }
1919
1919
  async saveSalesOrderDraft(params) {
1920
1920
  var _a, _b, _c, _d;
@@ -1936,35 +1936,20 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1936
1936
  throw new Error("BaseSales 解决方案需要 order 模块支持");
1937
1937
  }
1938
1938
  const inferredPaymentStatus = this.getSubmitPaymentStatus(params == null ? void 0 : params.paymentStatus);
1939
- const smallTicketDataFlag = (params == null ? void 0 : params.smallTicketDataFlag) ?? this.getDefaultCheckoutSmallTicketDataFlag();
1940
1939
  const submitParams = {
1941
1940
  cacheId: this.cacheId,
1942
1941
  platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
1943
1942
  businessCode: ((_b = this.otherParams) == null ? void 0 : _b.businessCode) || ((_c = this.otherParams) == null ? void 0 : _c.business_code),
1944
1943
  channel: this.getSubmitOrderSalesChannel(),
1945
1944
  type: (_d = this.otherParams) == null ? void 0 : _d.type,
1946
- request_unique_idempotency_token: this.store.order.generateIdempotencyToken(),
1947
1945
  ...(params == null ? void 0 : params.payments) !== void 0 ? { payments: params.payments } : {},
1948
1946
  ...inferredPaymentStatus !== void 0 ? { paymentStatus: inferredPaymentStatus } : {},
1949
- ...smallTicketDataFlag !== void 0 ? { smallTicketDataFlag } : {},
1947
+ ...(params == null ? void 0 : params.smallTicketDataFlag) !== void 0 ? { smallTicketDataFlag: params.smallTicketDataFlag } : {},
1950
1948
  ...(params == null ? void 0 : params.confirmPendingVoucherPayments) !== void 0 ? { confirmPendingVoucherPayments: params.confirmPendingVoucherPayments } : {},
1951
1949
  ...(params == null ? void 0 : params.enhancePayload) !== void 0 ? { enhancePayload: params.enhancePayload } : {}
1952
1950
  };
1953
1951
  return this.store.order.submitTempOrderAsync(submitParams);
1954
1952
  }
1955
- /**
1956
- * 默认保持 WebPOS 的本地待同步订单模式;需要云端确认后才算成功的渠道可覆盖此策略。
1957
- * otherParams.checkoutSyncTaskEnabled 优先,便于同一 solution 按入口恢复旧行为。
1958
- */
1959
- shouldUseCheckoutSyncTask() {
1960
- var _a;
1961
- const configured = (_a = this.otherParams) == null ? void 0 : _a.checkoutSyncTaskEnabled;
1962
- return typeof configured === "boolean" ? configured : true;
1963
- }
1964
- /** 可由特定 solution 为真实 checkout 补充默认收据数据请求。 */
1965
- getDefaultCheckoutSmallTicketDataFlag() {
1966
- return void 0;
1967
- }
1968
1953
  async printLocalOrderReceipt(lookup) {
1969
1954
  var _a, _b, _c, _d, _e, _f, _g;
1970
1955
  if (!this.store.order) {
@@ -2024,7 +2009,6 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
2024
2009
  const channel = params.channel ?? this.getSubmitOrderSalesChannel();
2025
2010
  const syncParams = {
2026
2011
  ...params,
2027
- checkoutSyncTaskEnabled: this.shouldUseCheckoutSyncTask(),
2028
2012
  ...businessCode !== void 0 ? { businessCode } : {},
2029
2013
  ...channel !== void 0 ? { channel } : {}
2030
2014
  };
@@ -10,7 +10,6 @@ import { ITime } from '../../modules/Date/types';
10
10
  import dayjs from 'dayjs';
11
11
  import { LoadScheduleAvailableDateParams } from '../../modules/Schedule/types';
12
12
  import { IHolder, IFetchHolderAccountsParams } from '../../modules/AccountList/types';
13
- import { IAppendFormRecordParams } from '../../modules/Holder/types';
14
13
  export declare class BookingByStepImpl extends BaseModule implements Module {
15
14
  protected defaultName: string;
16
15
  protected defaultVersion: string;
@@ -127,20 +126,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
127
126
  * @param params
128
127
  */
129
128
  fetchHolderAccountsAsync(params: IFetchHolderAccountsParams): Promise<void>;
130
- /**
131
- * 获取 holder 表单 map
132
- */
133
- getHolderFormMap(): import("../../modules").HolderFormMap;
134
- /**
135
- * 登录后或外部触发时,按当前 holderMap 批量刷新所有表单的 records
136
- */
137
- refreshAllHolderFormRecords(params?: {
138
- customer_id?: number;
139
- }): Promise<import("../../modules").HolderFormMap>;
140
- /**
141
- * 添加表单记录
142
- */
143
- appendFormRecord(params: IAppendFormRecordParams): import("../../modules").IFormRecord;
144
129
  setDateRange(dateRange: ITime[]): Promise<void>;
145
130
  clearDateRange(): void;
146
131
  getDateRange(): Promise<ITime[]>;
@@ -317,7 +302,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
317
302
  autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
318
303
  errorList: any[];
319
304
  };
320
- getTimeSlotByAllResources(resources_code: string, split?: number): any[];
305
+ getTimeSlotByAllResources(resources_code: string): any[];
321
306
  getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
322
307
  resources_code: string;
323
308
  startDate: string;
@@ -89,7 +89,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
89
89
  }
90
90
  const moduleArr = [
91
91
  "accountList",
92
- "holder",
93
92
  "cart",
94
93
  "schedule",
95
94
  "summary",
@@ -380,27 +379,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
380
379
  }
381
380
  return this.store.accountList.fetchHolderAccounts(params);
382
381
  }
383
- /**
384
- * 获取 holder 表单 map
385
- */
386
- getHolderFormMap() {
387
- return this.store.holder.getHolderFormMap();
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
- }
398
- /**
399
- * 添加表单记录
400
- */
401
- appendFormRecord(params) {
402
- return this.store.holder.appendFormRecord(params);
403
- }
404
382
  // 设置日期范围,注入到日期模块中
405
383
  async setDateRange(dateRange) {
406
384
  this.store.date.setDateRange(dateRange);
@@ -508,14 +486,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
508
486
  date = (normalProductCartItem == null ? void 0 : normalProductCartItem.start_date) || "";
509
487
  }
510
488
  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
- }
519
489
  }
520
490
  } else {
521
491
  throw new Error(`没有找到${accountId}账户`);
@@ -542,11 +512,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
542
512
  }
543
513
  // 购物车提交订单
544
514
  async submitOrder(extraData) {
545
- var _a;
546
515
  const cartItems = this.store.cart.getItems();
547
516
  const newCartItems = (0, import_lodash_es.cloneDeep)(cartItems);
548
517
  newCartItems.forEach((item) => {
549
- var _a2;
518
+ var _a;
550
519
  if (item._origin.resources && item._origin.resources.length) {
551
520
  item._origin.resources = item._origin.resources.map((n) => {
552
521
  const newResourcesItem = (0, import_lodash_es.cloneDeep)(n);
@@ -556,7 +525,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
556
525
  return { ...newResourcesItem };
557
526
  });
558
527
  const { currentCapacity, formatCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(item);
559
- if (!((_a2 = item._origin) == null ? void 0 : _a2.metadata)) {
528
+ if (!((_a = item._origin) == null ? void 0 : _a.metadata)) {
560
529
  item._origin.metadata = {};
561
530
  }
562
531
  item._origin.metadata.capacity = formatCapacity;
@@ -574,7 +543,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
574
543
  cartItems: newCartItems,
575
544
  type,
576
545
  platform: this.platform,
577
- business_code: (_a = this.otherParams) == null ? void 0 : _a.business_code,
578
546
  extraData
579
547
  }
580
548
  });
@@ -660,15 +628,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
660
628
  account = activeAccount;
661
629
  }
662
630
  }
663
- try {
664
- this.store.holder.ensureFormByProduct({
665
- product: productData,
666
- shop_id: (productData == null ? void 0 : productData.shop_id) || "",
667
- useCache: true
668
- });
669
- } catch (error) {
670
- console.error("[BookingByStep] 加载 holder 表单失败", error);
671
- }
672
631
  const flag = this.store.cart.mergeCartItemByRowKey({
673
632
  rowKey,
674
633
  quantity,
@@ -1191,7 +1150,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1191
1150
  }
1192
1151
  const totalCapacity = (countMap[n.id] || []).reduce(
1193
1152
  (sum, item) => {
1194
- const hasOverlap = (0, import_dayjs.default)(item.time.start_at).isBefore((0, import_dayjs.default)(timeSlots.end_at)) && (0, import_dayjs.default)(item.time.end_at).isAfter((0, import_dayjs.default)(timeSlots.start_at));
1153
+ const hasOverlap = !(0, import_dayjs.default)(item.time.start_at).isAfter((0, import_dayjs.default)(timeSlots.start_at)) && !(0, import_dayjs.default)(item.time.end_at).isBefore((0, import_dayjs.default)(timeSlots.end_at));
1195
1154
  return hasOverlap ? sum + item.pax : sum;
1196
1155
  },
1197
1156
  0
@@ -1273,10 +1232,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1273
1232
  }
1274
1233
  );
1275
1234
  cartItems2.forEach((item, index) => {
1276
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
1235
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1277
1236
  const { currentCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(item);
1278
- const hasOriginTimeSlot = Boolean(item._origin.start_time) && Boolean(item._origin.end_time) && !(timeSlots == null ? void 0 : timeSlots.start_time);
1279
- if (hasOriginTimeSlot) {
1237
+ if (item._origin.start_time && !(timeSlots == null ? void 0 : timeSlots.start_time)) {
1280
1238
  recordTimeSlots = {
1281
1239
  start_time: item._origin.start_time,
1282
1240
  end_time: item._origin.end_time,
@@ -1288,13 +1246,15 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1288
1246
  const currentResourceConfig = (_c = (_b = (_a2 = item._productOrigin) == null ? void 0 : _a2.product_resource) == null ? void 0 : _b.resources) == null ? void 0 : _c.find(
1289
1247
  (n) => n.code === resources_code
1290
1248
  );
1291
- if (index !== 0 && recordTimeSlots && (currentResourceConfig == null ? void 0 : currentResourceConfig.type) === "single" && ((_d = item._productOrigin) == null ? void 0 : _d.duration) && !hasFlexibleProduct && !hasOriginTimeSlot) {
1292
- const recordEndAt = recordTimeSlots.end_at ? (0, import_dayjs.default)(recordTimeSlots.end_at) : (0, import_dayjs.default)(`${item.start_date} ${recordTimeSlots.end_time}`);
1293
- let start_at = recordEndAt;
1294
- let end_at = start_at.add(
1249
+ if (index !== 0 && recordTimeSlots && (currentResourceConfig == null ? void 0 : currentResourceConfig.type) === "single" && ((_d = item._productOrigin) == null ? void 0 : _d.duration) && !hasFlexibleProduct) {
1250
+ let start_at = (0, import_dayjs.default)(recordTimeSlots.end_time).add(
1295
1251
  ((_f = (_e = item._productOrigin) == null ? void 0 : _e.duration) == null ? void 0 : _f.value) || 10,
1296
1252
  "minutes"
1297
1253
  );
1254
+ let end_at = start_at.add(
1255
+ ((_h = (_g = item._productOrigin) == null ? void 0 : _g.duration) == null ? void 0 : _h.value) || 10,
1256
+ "minutes"
1257
+ );
1298
1258
  recordTimeSlots = {
1299
1259
  start_time: start_at.format("HH:mm"),
1300
1260
  end_time: end_at.format("HH:mm"),
@@ -1346,7 +1306,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1346
1306
  const allCartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
1347
1307
  let selectedResources = [];
1348
1308
  const resources2 = (0, import_lodash_es.cloneDeep)(
1349
- ((_h = (_g = item._productOrigin) == null ? void 0 : _g.product_resource) == null ? void 0 : _h.resources) || []
1309
+ ((_j = (_i = item._productOrigin) == null ? void 0 : _i.product_resource) == null ? void 0 : _j.resources) || []
1350
1310
  );
1351
1311
  const currentResourcesRenderList = [];
1352
1312
  resources2.forEach((n) => {
@@ -1394,11 +1354,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1394
1354
  return recordCount >= currentCapacity;
1395
1355
  });
1396
1356
  });
1397
- const targetRenderList = (_i = productResources.find(
1357
+ const targetRenderList = (_k = productResources.find(
1398
1358
  (n) => n.code === resources_code
1399
- )) == null ? void 0 : _i.renderList;
1359
+ )) == null ? void 0 : _k.renderList;
1400
1360
  if (targetRenderList && targetRenderList.length > 0) {
1401
- if ((_j = item._origin.resources) == null ? void 0 : _j.some(
1361
+ if ((_l = item._origin.resources) == null ? void 0 : _l.some(
1402
1362
  (n) => n.form_id === targetRenderList[0].form_id
1403
1363
  )) {
1404
1364
  return;
@@ -1406,9 +1366,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1406
1366
  const fastestResource = (0, import_timeslots.findFastestAvailableResource)({
1407
1367
  resources: targetRenderList,
1408
1368
  currentCapacity,
1409
- countMap: selectResourcesMap,
1410
- targetDate: (_k = dateRange == null ? void 0 : dateRange[0]) == null ? void 0 : _k.date,
1411
- durationMinutes: ((_l = item == null ? void 0 : item.duration) == null ? void 0 : _l.value) || ((_n = (_m = item == null ? void 0 : item._productOrigin) == null ? void 0 : _m.duration) == null ? void 0 : _n.value) || 10
1369
+ countMap: selectResourcesMap
1412
1370
  });
1413
1371
  const targetResource = fastestResource || targetRenderList[0];
1414
1372
  targetResource.capacity = currentCapacity;
@@ -1445,7 +1403,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1445
1403
  return { errorList };
1446
1404
  }
1447
1405
  // 从购物车中获取已经分配好第一步资源的所有时间片
1448
- getTimeSlotByAllResources(resources_code, split = 10) {
1406
+ getTimeSlotByAllResources(resources_code) {
1449
1407
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
1450
1408
  let dateRange = this.store.date.getDateRange();
1451
1409
  const resources = [];
@@ -1603,7 +1561,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1603
1561
  resourcesMap,
1604
1562
  duration,
1605
1563
  currentDate: dateRange[0].date,
1606
- split,
1564
+ split: 10,
1607
1565
  resourcesUseableMap,
1608
1566
  capacity: maxCapacity,
1609
1567
  cut_off_time: maxCutOffTime,
@@ -1,4 +1,4 @@
1
- import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule, HolderModule } from '../../modules';
1
+ import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule } from '../../modules';
2
2
  export interface BookingByStepState {
3
3
  cart: CartModule;
4
4
  summary: SummaryModule;
@@ -16,7 +16,6 @@ export interface BookingByStepState {
16
16
  schedule: ScheduleModule;
17
17
  salesSummary?: SalesSummaryModule;
18
18
  scanOrderLogger?: ScanOrderLoggerModule;
19
- holder: HolderModule;
20
19
  }
21
20
  export declare function createModule<T extends keyof BookingByStepState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingByStepState[T];
22
21
  export declare enum BookingByStepHooks {
@@ -81,11 +81,6 @@ function createModule(moduleName, solutionName, name, version) {
81
81
  `${solutionName}_${name || moduleName}`,
82
82
  version
83
83
  );
84
- case "holder":
85
- return new import_modules.HolderModule(
86
- `${solutionName}_${name || moduleName}`,
87
- version
88
- );
89
84
  default:
90
85
  throw new Error(`Unknown module type: ${moduleName}`);
91
86
  }
@@ -49,27 +49,8 @@ var formatDefaultCapacitys = ({
49
49
  const id = d.bundle_product_id;
50
50
  const variantId = d.bundle_variant_id;
51
51
  const item = ((capacity == null ? void 0 : capacity.package) || []).find(
52
- (item2) => item2.product_id == id || item2.product_id == variantId
52
+ (item2) => item2.product_id === id || item2.product_id === variantId
53
53
  );
54
- if (!item && (window == null ? void 0 : window.sendWarningLog)) {
55
- window.sendWarningLog({
56
- title: "未找到套餐 capacity 配置",
57
- content: [
58
- {
59
- key: "product_id",
60
- value: id
61
- },
62
- {
63
- key: "variant_id",
64
- value: variantId
65
- },
66
- {
67
- key: "package",
68
- value: JSON.stringify((capacity == null ? void 0 : capacity.package) || [])
69
- }
70
- ]
71
- });
72
- }
73
54
  return {
74
55
  id,
75
56
  value: item ? d.num || 0 : 0,
@@ -19,12 +19,10 @@ export declare function calculateResourceAvailableTime({ resource, timeSlots, cu
19
19
  * @param countMap 已预约数量映射
20
20
  * @returns 最快可用的资源
21
21
  */
22
- export declare function findFastestAvailableResource({ resources, currentCapacity, countMap, targetDate, durationMinutes, }: {
22
+ export declare function findFastestAvailableResource({ resources, currentCapacity, countMap, }: {
23
23
  resources: ResourceItem[];
24
24
  currentCapacity?: number;
25
25
  countMap?: Record<number, number>;
26
- targetDate?: string | Dayjs;
27
- durationMinutes?: number;
28
26
  }): ResourceItem | null;
29
27
  /**
30
28
  * 给定一个时间列表,通过开始和结束时间过滤出符合条件的时间段
@@ -77,15 +77,10 @@ function calculateResourceAvailableTime({
77
77
  function findFastestAvailableResource({
78
78
  resources,
79
79
  currentCapacity = 1,
80
- countMap = {},
81
- targetDate,
82
- durationMinutes = 30
80
+ countMap = {}
83
81
  }) {
84
82
  var _a, _b, _c;
85
83
  const currentTime = (0, import_dayjs.default)();
86
- const resolvedDuration = durationMinutes > 0 ? durationMinutes : 30;
87
- const targetDay = targetDate ? (0, import_dayjs.default)(targetDate) : currentTime;
88
- const isTargetDayToday = targetDay.isSame(currentTime, "day");
89
84
  let fastestTime = null;
90
85
  let fastestResources = [];
91
86
  console.log("[TimeslotUtils] 查找最快可用资源:", {
@@ -95,22 +90,19 @@ function findFastestAvailableResource({
95
90
  countMap
96
91
  });
97
92
  for (const resource of resources) {
98
- const targetDayTimes = resource.times.filter((time) => {
99
- const isSameTargetDay = (0, import_dayjs.default)(time.start_at).isSame(targetDay, "day");
100
- if (!isSameTargetDay)
101
- return false;
102
- if (!isTargetDayToday)
103
- return true;
104
- return (0, import_dayjs.default)(time.end_at).isAfter(currentTime);
93
+ const todayTimes = resource.times.filter((time) => {
94
+ const isToday = (0, import_dayjs.default)(time.start_at).isSame(currentTime, "day");
95
+ const isStillWorking = (0, import_dayjs.default)(time.end_at).isAfter(currentTime);
96
+ return isToday && isStillWorking;
105
97
  });
106
- if (targetDayTimes.length === 0) {
98
+ if (todayTimes.length === 0) {
107
99
  console.log(`[TimeslotUtils] 资源 ${resource.id}(${resource.main_field}) 今日无可用时间段`);
108
100
  continue;
109
101
  }
110
- for (const time of targetDayTimes) {
102
+ for (const time of todayTimes) {
111
103
  const workStartTime = (0, import_dayjs.default)(time.start_at);
112
104
  const workEndTime = (0, import_dayjs.default)(time.end_at);
113
- let nextAvailableTime = isTargetDayToday && currentTime.isAfter(workStartTime) ? currentTime : workStartTime;
105
+ let nextAvailableTime = currentTime.isBefore(workStartTime) ? workStartTime : currentTime;
114
106
  console.log(`[TimeslotUtils] 检查资源 ${resource.id}(${resource.main_field}):`, {
115
107
  workTime: `${workStartTime.format("HH:mm")}-${workEndTime.format("HH:mm")}`,
116
108
  checkStartTime: nextAvailableTime.format("HH:mm:ss"),
@@ -134,7 +126,7 @@ function findFastestAvailableResource({
134
126
  pax: event.pax || 1
135
127
  });
136
128
  if (resource.resourceType === "single" || (resource.capacity || 1) === 1) {
137
- if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(resolvedDuration, "minute"))) {
129
+ if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(30, "minute"))) {
138
130
  finalAvailableTime = eventEnd;
139
131
  console.log(`[TimeslotUtils] 发现时间冲突,调整到: ${finalAvailableTime.format("HH:mm:ss")}`);
140
132
  }
@@ -142,7 +134,7 @@ function findFastestAvailableResource({
142
134
  const totalCapacity = resource.capacity || 0;
143
135
  const currentUsedCapacity = countMap[resource.id] || 0;
144
136
  const eventUsedCapacity = event.pax || 1;
145
- if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(resolvedDuration, "minute"))) {
137
+ if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(30, "minute"))) {
146
138
  const totalRequiredCapacity = currentUsedCapacity + currentCapacity + eventUsedCapacity;
147
139
  if (totalRequiredCapacity > totalCapacity) {
148
140
  finalAvailableTime = eventEnd;
@@ -151,7 +143,7 @@ function findFastestAvailableResource({
151
143
  }
152
144
  }
153
145
  }
154
- if (finalAvailableTime.add(resolvedDuration, "minute").isAfter(workEndTime)) {
146
+ if (finalAvailableTime.isAfter(workEndTime)) {
155
147
  console.log(`[TimeslotUtils] 资源 ${resource.id} 可用时间超出工作时间,跳过`);
156
148
  continue;
157
149
  }
@@ -326,7 +326,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
326
326
  * 获取当前的客户搜索条件
327
327
  * @returns 当前搜索条件
328
328
  */
329
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
329
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
330
330
  /**
331
331
  * 获取客户列表状态(包含滚动加载相关状态)
332
332
  * @returns 客户状态
@@ -445,19 +445,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
445
445
  * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
446
446
  * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
447
447
  */
448
- decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
449
- action: "reloadCatalog";
450
- } | {
451
- action: "add";
452
- cacheItem: any;
453
- } | {
454
- action: "requiresDetail";
455
- payload: AddProductRequiresDetailPayload;
456
- } | {
457
- action: "requiresBookingEdit";
458
- cacheItem: any;
459
- payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
460
- };
448
+ decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
461
449
  /** 规格弹窗 callback 后的第二段决策。 */
462
450
  decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
463
451
  /**
@@ -1093,11 +1093,7 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
1093
1093
  */
1094
1094
  scanGlobalListener(callback) {
1095
1095
  const localSearch = (v) => this.store.products.findProductsByCodeOrBarcode(v);
1096
- const scanCallback = (0, import_handleScan.handleGlobalScan)(
1097
- this.request,
1098
- localSearch,
1099
- this.getSubmitOrderSalesChannel()
1100
- );
1096
+ const scanCallback = (0, import_handleScan.handleGlobalScan)(this.request, localSearch);
1101
1097
  const safeCallback = (d) => {
1102
1098
  try {
1103
1099
  callback(d);
@@ -1426,11 +1422,7 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
1426
1422
  }
1427
1423
  try {
1428
1424
  const localSearch = (v) => this.store.products.findProductsByCodeOrBarcode(v);
1429
- const scanCallback = (0, import_handleScan.handleGlobalScan)(
1430
- this.request,
1431
- localSearch,
1432
- this.getSubmitOrderSalesChannel()
1433
- );
1425
+ const scanCallback = (0, import_handleScan.handleGlobalScan)(this.request, localSearch);
1434
1426
  const raw = await scanCallback({ type: "nativeScanner", value: trimmed });
1435
1427
  const formatted = (0, import_formatGlobalScan.formatGlobalScanResult)(raw, trimmed);
1436
1428
  if (!formatted) {
@@ -2,11 +2,9 @@ import { RequestPlugin } from '../../../../plugins';
2
2
  /**
3
3
  * 处理全局扫码
4
4
  * @param request 请求插件
5
- * @param localSearch 本地商品搜索
6
- * @param channel 当前销售渠道
7
5
  * @returns 处理结果
8
6
  */
9
- export declare const handleGlobalScan: (request: RequestPlugin, localSearch: (v: string) => any[], channel?: string) => (scanResult: {
7
+ export declare const handleGlobalScan: (request: RequestPlugin, localSearch: (v: string) => any[]) => (scanResult: {
10
8
  type: string;
11
9
  value: string;
12
10
  }) => Promise<any>;
@@ -102,14 +102,14 @@ var handleScanFn = (getRequestList, localSearch) => {
102
102
  }
103
103
  };
104
104
  };
105
- var handleGlobalScan = (request, localSearch, channel) => {
105
+ var handleGlobalScan = (request, localSearch) => {
106
106
  const getRequestList = (value) => {
107
107
  let requestList = [];
108
108
  if (value.startsWith("WL")) {
109
109
  requestList = [(0, import_cloudSearch.searchWallet)(request, value)];
110
110
  } else {
111
111
  requestList = [
112
- ...channel === "kiosk" ? [] : [(0, import_cloudSearch.searchOrder)(request, value)],
112
+ (0, import_cloudSearch.searchOrder)(request, value),
113
113
  (0, import_cloudSearch.searchWalletPass)(request, value),
114
114
  (0, import_cloudSearch.searchWallet)(request, value),
115
115
  (0, import_cloudSearch.searchProduct)(request, value)