@pisell/pisellos 2.3.37 → 2.3.39

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 (169) hide show
  1. package/dist/modules/Discount/index.d.ts +1 -0
  2. package/dist/modules/Discount/index.js +40 -11
  3. package/dist/modules/Discount/types.d.ts +1 -0
  4. package/dist/modules/Holder/index.d.ts +48 -0
  5. package/dist/modules/Holder/index.js +640 -0
  6. package/dist/modules/Holder/types.d.ts +123 -0
  7. package/dist/modules/Holder/types.js +1 -0
  8. package/dist/modules/Holder/utils.d.ts +13 -0
  9. package/dist/modules/Holder/utils.js +34 -0
  10. package/dist/modules/OpenData/index.js +2 -2
  11. package/dist/modules/Order/index.d.ts +11 -28
  12. package/dist/modules/Order/index.js +513 -747
  13. package/dist/modules/Order/types.d.ts +10 -33
  14. package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
  15. package/dist/modules/Order/utils.d.ts +10 -0
  16. package/dist/modules/Order/utils.js +40 -11
  17. package/dist/modules/Payment/index.d.ts +0 -2
  18. package/dist/modules/Payment/index.js +49 -78
  19. package/dist/modules/Payment/types.d.ts +24 -26
  20. package/dist/modules/Payment/types.js +0 -2
  21. package/dist/modules/Product/types.d.ts +1 -0
  22. package/dist/modules/ProductList/index.js +33 -14
  23. package/dist/modules/Quotation/index.d.ts +1 -1
  24. package/dist/modules/Quotation/index.js +2 -2
  25. package/dist/modules/ResourcePlanner/index.d.ts +24 -0
  26. package/dist/modules/ResourcePlanner/index.js +181 -0
  27. package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
  28. package/dist/modules/ResourcePlanner/planner.js +1069 -0
  29. package/dist/modules/ResourcePlanner/types.d.ts +227 -0
  30. package/dist/modules/ResourcePlanner/types.js +1 -0
  31. package/dist/modules/Rules/index.js +48 -15
  32. package/dist/modules/SalesSummary/index.js +12 -13
  33. package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
  34. package/dist/modules/ScanOrderLogger/index.js +15 -2
  35. package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
  36. package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
  37. package/dist/modules/Schedule/index.d.ts +3 -1
  38. package/dist/modules/Schedule/index.js +21 -16
  39. package/dist/modules/Summary/utils.js +38 -13
  40. package/dist/modules/index.d.ts +2 -0
  41. package/dist/modules/index.js +3 -1
  42. package/dist/plugins/window.d.ts +1 -0
  43. package/dist/server/index.d.ts +14 -16
  44. package/dist/server/index.js +1162 -1943
  45. package/dist/server/modules/order/index.d.ts +4 -49
  46. package/dist/server/modules/order/index.js +695 -1574
  47. package/dist/server/modules/order/types.d.ts +3 -11
  48. package/dist/server/modules/order/types.js +1 -1
  49. package/dist/solution/BaseSales/index.d.ts +10 -33
  50. package/dist/solution/BaseSales/index.js +385 -676
  51. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  52. package/dist/solution/BookingByStep/index.d.ts +17 -2
  53. package/dist/solution/BookingByStep/index.js +294 -215
  54. package/dist/solution/BookingByStep/types.d.ts +2 -1
  55. package/dist/solution/BookingByStep/types.js +3 -1
  56. package/dist/solution/BookingByStep/utils/capacity.js +17 -1
  57. package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  58. package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
  59. package/dist/solution/BookingTicket/index.js +1 -2
  60. package/dist/solution/Sales/index.d.ts +0 -1
  61. package/dist/solution/Sales/index.js +2 -10
  62. package/dist/solution/ScanOrder/index.d.ts +26 -14
  63. package/dist/solution/ScanOrder/index.js +1140 -737
  64. package/dist/solution/ScanOrder/types.d.ts +21 -1
  65. package/dist/solution/ScanOrder/utils.d.ts +8 -0
  66. package/dist/solution/ScanOrder/utils.js +66 -25
  67. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  68. package/dist/solution/ShopDiscount/index.js +125 -87
  69. package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
  70. package/dist/solution/UnifiedBookingSales/index.js +1871 -0
  71. package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
  72. package/dist/solution/UnifiedBookingSales/types.js +11 -0
  73. package/dist/solution/VenueBooking/index.d.ts +39 -11
  74. package/dist/solution/VenueBooking/index.js +1177 -850
  75. package/dist/solution/VenueBooking/types.d.ts +3 -0
  76. package/dist/solution/VenueBooking/utils/resource.js +1 -0
  77. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  78. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
  79. package/dist/solution/index.d.ts +1 -0
  80. package/dist/solution/index.js +2 -1
  81. package/dist/types/index.d.ts +1 -0
  82. package/lib/modules/Discount/index.d.ts +1 -0
  83. package/lib/modules/Discount/index.js +9 -0
  84. package/lib/modules/Discount/types.d.ts +1 -0
  85. package/lib/modules/Holder/index.d.ts +48 -0
  86. package/lib/modules/Holder/index.js +402 -0
  87. package/lib/modules/Holder/types.d.ts +123 -0
  88. package/lib/modules/Holder/types.js +17 -0
  89. package/lib/modules/Holder/utils.d.ts +13 -0
  90. package/lib/modules/Holder/utils.js +71 -0
  91. package/lib/modules/OpenData/index.js +1 -1
  92. package/lib/modules/Order/index.d.ts +11 -28
  93. package/lib/modules/Order/index.js +83 -187
  94. package/lib/modules/Order/types.d.ts +10 -33
  95. package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
  96. package/lib/modules/Order/utils.d.ts +10 -0
  97. package/lib/modules/Order/utils.js +39 -10
  98. package/lib/modules/Payment/index.d.ts +0 -2
  99. package/lib/modules/Payment/index.js +12 -33
  100. package/lib/modules/Payment/types.d.ts +24 -26
  101. package/lib/modules/Product/types.d.ts +1 -0
  102. package/lib/modules/ProductList/index.js +40 -31
  103. package/lib/modules/Quotation/index.d.ts +1 -1
  104. package/lib/modules/Quotation/index.js +2 -2
  105. package/lib/modules/ResourcePlanner/index.d.ts +24 -0
  106. package/lib/modules/ResourcePlanner/index.js +148 -0
  107. package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
  108. package/lib/modules/ResourcePlanner/planner.js +933 -0
  109. package/lib/modules/ResourcePlanner/types.d.ts +227 -0
  110. package/lib/modules/ResourcePlanner/types.js +17 -0
  111. package/lib/modules/Rules/index.js +34 -18
  112. package/lib/modules/SalesSummary/index.js +6 -7
  113. package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
  114. package/lib/modules/ScanOrderLogger/index.js +13 -1
  115. package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
  116. package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
  117. package/lib/modules/Schedule/index.d.ts +3 -1
  118. package/lib/modules/Schedule/index.js +10 -8
  119. package/lib/modules/Summary/utils.js +21 -1
  120. package/lib/modules/index.d.ts +2 -0
  121. package/lib/modules/index.js +5 -1
  122. package/lib/plugins/window.d.ts +1 -0
  123. package/lib/server/index.d.ts +14 -16
  124. package/lib/server/index.js +88 -678
  125. package/lib/server/modules/order/index.d.ts +4 -49
  126. package/lib/server/modules/order/index.js +66 -657
  127. package/lib/server/modules/order/types.d.ts +3 -11
  128. package/lib/solution/BaseSales/index.d.ts +10 -33
  129. package/lib/solution/BaseSales/index.js +33 -201
  130. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  131. package/lib/solution/BookingByStep/index.d.ts +17 -2
  132. package/lib/solution/BookingByStep/index.js +60 -18
  133. package/lib/solution/BookingByStep/types.d.ts +2 -1
  134. package/lib/solution/BookingByStep/types.js +5 -0
  135. package/lib/solution/BookingByStep/utils/capacity.js +20 -1
  136. package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  137. package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
  138. package/lib/solution/BookingTicket/index.js +1 -2
  139. package/lib/solution/Sales/index.d.ts +0 -1
  140. package/lib/solution/Sales/index.js +3 -5
  141. package/lib/solution/ScanOrder/index.d.ts +26 -14
  142. package/lib/solution/ScanOrder/index.js +449 -182
  143. package/lib/solution/ScanOrder/types.d.ts +21 -1
  144. package/lib/solution/ScanOrder/utils.d.ts +8 -0
  145. package/lib/solution/ScanOrder/utils.js +31 -0
  146. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  147. package/lib/solution/ShopDiscount/index.js +14 -0
  148. package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
  149. package/lib/solution/UnifiedBookingSales/index.js +1076 -0
  150. package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
  151. package/lib/solution/UnifiedBookingSales/types.js +33 -0
  152. package/lib/solution/VenueBooking/index.d.ts +39 -11
  153. package/lib/solution/VenueBooking/index.js +328 -115
  154. package/lib/solution/VenueBooking/types.d.ts +3 -0
  155. package/lib/solution/VenueBooking/utils/resource.js +1 -0
  156. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  157. package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
  158. package/lib/solution/index.d.ts +1 -0
  159. package/lib/solution/index.js +3 -1
  160. package/lib/types/index.d.ts +1 -0
  161. package/package.json +2 -2
  162. package/dist/modules/Order/payment-utils.d.ts +0 -26
  163. package/dist/modules/Order/payment-utils.js +0 -225
  164. package/dist/utils/payment-number.d.ts +0 -9
  165. package/dist/utils/payment-number.js +0 -69
  166. package/lib/modules/Order/payment-utils.d.ts +0 -26
  167. package/lib/modules/Order/payment-utils.js +0 -224
  168. package/lib/utils/payment-number.d.ts +0 -9
  169. package/lib/utils/payment-number.js +0 -64
@@ -89,6 +89,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
89
89
  }
90
90
  const moduleArr = [
91
91
  "accountList",
92
+ "holder",
92
93
  "cart",
93
94
  "schedule",
94
95
  "summary",
@@ -379,6 +380,27 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
379
380
  }
380
381
  return this.store.accountList.fetchHolderAccounts(params);
381
382
  }
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
+ }
382
404
  // 设置日期范围,注入到日期模块中
383
405
  async setDateRange(dateRange) {
384
406
  this.store.date.setDateRange(dateRange);
@@ -486,6 +508,14 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
486
508
  date = (normalProductCartItem == null ? void 0 : normalProductCartItem.start_date) || "";
487
509
  }
488
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
+ }
489
519
  }
490
520
  } else {
491
521
  throw new Error(`没有找到${accountId}账户`);
@@ -512,10 +542,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
512
542
  }
513
543
  // 购物车提交订单
514
544
  async submitOrder(extraData) {
545
+ var _a;
515
546
  const cartItems = this.store.cart.getItems();
516
547
  const newCartItems = (0, import_lodash_es.cloneDeep)(cartItems);
517
548
  newCartItems.forEach((item) => {
518
- var _a;
549
+ var _a2;
519
550
  if (item._origin.resources && item._origin.resources.length) {
520
551
  item._origin.resources = item._origin.resources.map((n) => {
521
552
  const newResourcesItem = (0, import_lodash_es.cloneDeep)(n);
@@ -525,7 +556,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
525
556
  return { ...newResourcesItem };
526
557
  });
527
558
  const { currentCapacity, formatCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(item);
528
- if (!((_a = item._origin) == null ? void 0 : _a.metadata)) {
559
+ if (!((_a2 = item._origin) == null ? void 0 : _a2.metadata)) {
529
560
  item._origin.metadata = {};
530
561
  }
531
562
  item._origin.metadata.capacity = formatCapacity;
@@ -543,6 +574,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
543
574
  cartItems: newCartItems,
544
575
  type,
545
576
  platform: this.platform,
577
+ business_code: (_a = this.otherParams) == null ? void 0 : _a.business_code,
546
578
  extraData
547
579
  }
548
580
  });
@@ -628,6 +660,15 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
628
660
  account = activeAccount;
629
661
  }
630
662
  }
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
+ }
631
672
  const flag = this.store.cart.mergeCartItemByRowKey({
632
673
  rowKey,
633
674
  quantity,
@@ -1150,7 +1191,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1150
1191
  }
1151
1192
  const totalCapacity = (countMap[n.id] || []).reduce(
1152
1193
  (sum, item) => {
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));
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));
1154
1195
  return hasOverlap ? sum + item.pax : sum;
1155
1196
  },
1156
1197
  0
@@ -1232,9 +1273,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1232
1273
  }
1233
1274
  );
1234
1275
  cartItems2.forEach((item, index) => {
1235
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1276
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
1236
1277
  const { currentCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(item);
1237
- if (item._origin.start_time && !(timeSlots == null ? void 0 : timeSlots.start_time)) {
1278
+ const hasOriginTimeSlot = Boolean(item._origin.start_time) && Boolean(item._origin.end_time) && !(timeSlots == null ? void 0 : timeSlots.start_time);
1279
+ if (hasOriginTimeSlot) {
1238
1280
  recordTimeSlots = {
1239
1281
  start_time: item._origin.start_time,
1240
1282
  end_time: item._origin.end_time,
@@ -1246,13 +1288,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1246
1288
  const currentResourceConfig = (_c = (_b = (_a2 = item._productOrigin) == null ? void 0 : _a2.product_resource) == null ? void 0 : _b.resources) == null ? void 0 : _c.find(
1247
1289
  (n) => n.code === resources_code
1248
1290
  );
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(
1251
- ((_f = (_e = item._productOrigin) == null ? void 0 : _e.duration) == null ? void 0 : _f.value) || 10,
1252
- "minutes"
1253
- );
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;
1254
1294
  let end_at = start_at.add(
1255
- ((_h = (_g = item._productOrigin) == null ? void 0 : _g.duration) == null ? void 0 : _h.value) || 10,
1295
+ ((_f = (_e = item._productOrigin) == null ? void 0 : _e.duration) == null ? void 0 : _f.value) || 10,
1256
1296
  "minutes"
1257
1297
  );
1258
1298
  recordTimeSlots = {
@@ -1306,7 +1346,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1306
1346
  const allCartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
1307
1347
  let selectedResources = [];
1308
1348
  const resources2 = (0, import_lodash_es.cloneDeep)(
1309
- ((_j = (_i = item._productOrigin) == null ? void 0 : _i.product_resource) == null ? void 0 : _j.resources) || []
1349
+ ((_h = (_g = item._productOrigin) == null ? void 0 : _g.product_resource) == null ? void 0 : _h.resources) || []
1310
1350
  );
1311
1351
  const currentResourcesRenderList = [];
1312
1352
  resources2.forEach((n) => {
@@ -1354,11 +1394,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1354
1394
  return recordCount >= currentCapacity;
1355
1395
  });
1356
1396
  });
1357
- const targetRenderList = (_k = productResources.find(
1397
+ const targetRenderList = (_i = productResources.find(
1358
1398
  (n) => n.code === resources_code
1359
- )) == null ? void 0 : _k.renderList;
1399
+ )) == null ? void 0 : _i.renderList;
1360
1400
  if (targetRenderList && targetRenderList.length > 0) {
1361
- if ((_l = item._origin.resources) == null ? void 0 : _l.some(
1401
+ if ((_j = item._origin.resources) == null ? void 0 : _j.some(
1362
1402
  (n) => n.form_id === targetRenderList[0].form_id
1363
1403
  )) {
1364
1404
  return;
@@ -1366,7 +1406,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1366
1406
  const fastestResource = (0, import_timeslots.findFastestAvailableResource)({
1367
1407
  resources: targetRenderList,
1368
1408
  currentCapacity,
1369
- countMap: selectResourcesMap
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
1370
1412
  });
1371
1413
  const targetResource = fastestResource || targetRenderList[0];
1372
1414
  targetResource.capacity = currentCapacity;
@@ -1403,7 +1445,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1403
1445
  return { errorList };
1404
1446
  }
1405
1447
  // 从购物车中获取已经分配好第一步资源的所有时间片
1406
- getTimeSlotByAllResources(resources_code) {
1448
+ getTimeSlotByAllResources(resources_code, split = 10) {
1407
1449
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
1408
1450
  let dateRange = this.store.date.getDateRange();
1409
1451
  const resources = [];
@@ -1561,7 +1603,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1561
1603
  resourcesMap,
1562
1604
  duration,
1563
1605
  currentDate: dateRange[0].date,
1564
- split: 10,
1606
+ split,
1565
1607
  resourcesUseableMap,
1566
1608
  capacity: maxCapacity,
1567
1609
  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 } from '../../modules';
1
+ import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule, HolderModule } from '../../modules';
2
2
  export interface BookingByStepState {
3
3
  cart: CartModule;
4
4
  summary: SummaryModule;
@@ -16,6 +16,7 @@ export interface BookingByStepState {
16
16
  schedule: ScheduleModule;
17
17
  salesSummary?: SalesSummaryModule;
18
18
  scanOrderLogger?: ScanOrderLoggerModule;
19
+ holder: HolderModule;
19
20
  }
20
21
  export declare function createModule<T extends keyof BookingByStepState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingByStepState[T];
21
22
  export declare enum BookingByStepHooks {
@@ -81,6 +81,11 @@ 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
+ );
84
89
  default:
85
90
  throw new Error(`Unknown module type: ${moduleName}`);
86
91
  }
@@ -49,8 +49,27 @@ 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
+ }
54
73
  return {
55
74
  id,
56
75
  value: item ? d.num || 0 : 0,
@@ -19,10 +19,12 @@ export declare function calculateResourceAvailableTime({ resource, timeSlots, cu
19
19
  * @param countMap 已预约数量映射
20
20
  * @returns 最快可用的资源
21
21
  */
22
- export declare function findFastestAvailableResource({ resources, currentCapacity, countMap, }: {
22
+ export declare function findFastestAvailableResource({ resources, currentCapacity, countMap, targetDate, durationMinutes, }: {
23
23
  resources: ResourceItem[];
24
24
  currentCapacity?: number;
25
25
  countMap?: Record<number, number>;
26
+ targetDate?: string | Dayjs;
27
+ durationMinutes?: number;
26
28
  }): ResourceItem | null;
27
29
  /**
28
30
  * 给定一个时间列表,通过开始和结束时间过滤出符合条件的时间段
@@ -77,10 +77,15 @@ function calculateResourceAvailableTime({
77
77
  function findFastestAvailableResource({
78
78
  resources,
79
79
  currentCapacity = 1,
80
- countMap = {}
80
+ countMap = {},
81
+ targetDate,
82
+ durationMinutes = 30
81
83
  }) {
82
84
  var _a, _b, _c;
83
85
  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");
84
89
  let fastestTime = null;
85
90
  let fastestResources = [];
86
91
  console.log("[TimeslotUtils] 查找最快可用资源:", {
@@ -90,19 +95,22 @@ function findFastestAvailableResource({
90
95
  countMap
91
96
  });
92
97
  for (const resource of resources) {
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;
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);
97
105
  });
98
- if (todayTimes.length === 0) {
106
+ if (targetDayTimes.length === 0) {
99
107
  console.log(`[TimeslotUtils] 资源 ${resource.id}(${resource.main_field}) 今日无可用时间段`);
100
108
  continue;
101
109
  }
102
- for (const time of todayTimes) {
110
+ for (const time of targetDayTimes) {
103
111
  const workStartTime = (0, import_dayjs.default)(time.start_at);
104
112
  const workEndTime = (0, import_dayjs.default)(time.end_at);
105
- let nextAvailableTime = currentTime.isBefore(workStartTime) ? workStartTime : currentTime;
113
+ let nextAvailableTime = isTargetDayToday && currentTime.isAfter(workStartTime) ? currentTime : workStartTime;
106
114
  console.log(`[TimeslotUtils] 检查资源 ${resource.id}(${resource.main_field}):`, {
107
115
  workTime: `${workStartTime.format("HH:mm")}-${workEndTime.format("HH:mm")}`,
108
116
  checkStartTime: nextAvailableTime.format("HH:mm:ss"),
@@ -126,7 +134,7 @@ function findFastestAvailableResource({
126
134
  pax: event.pax || 1
127
135
  });
128
136
  if (resource.resourceType === "single" || (resource.capacity || 1) === 1) {
129
- if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(30, "minute"))) {
137
+ if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(resolvedDuration, "minute"))) {
130
138
  finalAvailableTime = eventEnd;
131
139
  console.log(`[TimeslotUtils] 发现时间冲突,调整到: ${finalAvailableTime.format("HH:mm:ss")}`);
132
140
  }
@@ -134,7 +142,7 @@ function findFastestAvailableResource({
134
142
  const totalCapacity = resource.capacity || 0;
135
143
  const currentUsedCapacity = countMap[resource.id] || 0;
136
144
  const eventUsedCapacity = event.pax || 1;
137
- if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(30, "minute"))) {
145
+ if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(resolvedDuration, "minute"))) {
138
146
  const totalRequiredCapacity = currentUsedCapacity + currentCapacity + eventUsedCapacity;
139
147
  if (totalRequiredCapacity > totalCapacity) {
140
148
  finalAvailableTime = eventEnd;
@@ -143,7 +151,7 @@ function findFastestAvailableResource({
143
151
  }
144
152
  }
145
153
  }
146
- if (finalAvailableTime.isAfter(workEndTime)) {
154
+ if (finalAvailableTime.add(resolvedDuration, "minute").isAfter(workEndTime)) {
147
155
  console.log(`[TimeslotUtils] 资源 ${resource.id} 可用时间超出工作时间,跳过`);
148
156
  continue;
149
157
  }
@@ -1153,8 +1153,7 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
1153
1153
  }
1154
1154
  /** 读取当前 booking config。 */
1155
1155
  getBookingConfig() {
1156
- var _a;
1157
- return (_a = this.store.bookingContext) == null ? void 0 : _a.getBookingConfig();
1156
+ return this.store.bookingContext.getBookingConfig();
1158
1157
  }
1159
1158
  /** 写入资源全集(来源:`/form/schedule`),同步派生 resourcesOriginMap。 */
1160
1159
  setResources(resources) {
@@ -83,7 +83,6 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
83
83
  private getBookingAppointmentStatus;
84
84
  private isBookingIncludedInStats;
85
85
  private getBookingOrderPaymentStatus;
86
- private isUnpaidBooking;
87
86
  private countBookingOrders;
88
87
  private countCompletedBookings;
89
88
  private groupBookingsByResource;
@@ -39,7 +39,6 @@ var import_dayjs = __toESM(require("dayjs"));
39
39
  var import_BaseModule = require("../../modules/BaseModule");
40
40
  var import_types = require("./types");
41
41
  __reExport(Sales_exports, require("./types"), module.exports);
42
- var UNPAID_PAYMENT_STATUSES = /* @__PURE__ */ new Set(["unpaid", "partially_paid", "payment_processing"]);
43
42
  var SalesImpl = class extends import_BaseModule.BaseModule {
44
43
  // LoggerManager 实例
45
44
  constructor(name, version) {
@@ -259,9 +258,6 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
259
258
  var _a;
260
259
  return String(((_a = booking.order) == null ? void 0 : _a.payment_status) ?? "");
261
260
  }
262
- isUnpaidBooking(booking) {
263
- return UNPAID_PAYMENT_STATUSES.has(this.getBookingOrderPaymentStatus(booking));
264
- }
265
261
  countBookingOrders(bookings) {
266
262
  const orderIds = /* @__PURE__ */ new Set();
267
263
  bookings.forEach((booking) => {
@@ -635,7 +631,9 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
635
631
  const completedBookingList = matchedBookingList.filter(
636
632
  (booking) => this.getBookingAppointmentStatus(booking) === "completed"
637
633
  );
638
- const unpaidBookingList = matchedBookingList.filter((booking) => this.isUnpaidBooking(booking));
634
+ const unpaidBookingList = matchedBookingList.filter(
635
+ (booking) => this.getBookingOrderPaymentStatus(booking) === "unpaid" || this.getBookingOrderPaymentStatus(booking) === "payment_processing"
636
+ );
639
637
  const bookings = this.pickBookingsForCurrentPoint(
640
638
  current,
641
639
  this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList)
@@ -1,8 +1,9 @@
1
1
  import { Module, ModuleOptions, PisellCore } from '../../types';
2
- import { BaseModule } from '../../modules/BaseModule';
3
- import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderScanCodeResult } from './types';
2
+ import { BaseSalesImpl } from '../BaseSales';
3
+ import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderAllowAddItemsInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderReservationResourceSelectInfo, ScanOrderState, ScanOrderScanCodeResult, ScanOrderSyncAdditionalOrderResult } from './types';
4
4
  import type { UpdateOrderProductParams } from '../../modules/Order/types';
5
5
  import type { Discount } from '../../modules/Discount/types';
6
+ import { RequestPlugin, WindowPlugin } from '../../plugins';
6
7
  import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
7
8
  import type { StrategyConfig } from '../../model/strategy/type';
8
9
  import type { ProductData } from '../../modules/Product/types';
@@ -15,16 +16,16 @@ interface ScanOrderItemRuleRuntimeConfig {
15
16
  submissionIndex?: number;
16
17
  custom?: Record<string, any>;
17
18
  }
18
- export declare class ScanOrderImpl extends BaseModule implements Module {
19
+ export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
19
20
  protected defaultName: string;
20
21
  protected defaultVersion: string;
21
22
  isSolution: boolean;
22
- private initializeOptions;
23
- private store;
24
- private otherParams;
25
- private cacheId;
26
- private window;
27
- private request;
23
+ protected initializeOptions: ModuleOptions;
24
+ protected store: ScanOrderState;
25
+ protected otherParams: Record<string, any>;
26
+ protected cacheId: string | undefined;
27
+ window: WindowPlugin;
28
+ request: RequestPlugin;
28
29
  private itemRuleEvaluator;
29
30
  private itemRuleConfigs;
30
31
  private itemRuleConfigsPromise;
@@ -53,9 +54,10 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
53
54
  private registerCustomerLoginListeners;
54
55
  private refreshOrderMarketingAfterLogin;
55
56
  constructor(name?: string, version?: string);
57
+ protected getRegisteredModuleNames(): readonly string[];
58
+ protected createSubModule(moduleName: string): Module | null;
56
59
  /** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
57
60
  getCacheId(): string | undefined;
58
- private destroyRegisteredChildModules;
59
61
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
60
62
  destroy(): Promise<void>;
61
63
  retryInit(): Promise<void>;
@@ -71,12 +73,14 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
71
73
  };
72
74
  getTempOrder(): import("../../modules/Order/types").OrderTempOrder | null;
73
75
  updateTempOrderNote(note: string): string;
76
+ updateTempOrderNote(note: string, sync: true): Promise<string>;
77
+ updateTempOrderNote(note: string, sync: boolean): string | Promise<string>;
74
78
  setPickupReferenceMode(mode: 'counter_pickup' | 'table_service'): {
75
- service_type: 'dine_in';
79
+ service_type: 'dine_in' | '';
76
80
  pickup_reference_mode: 'counter_pickup' | 'table_service';
77
81
  };
78
82
  setPickupRef(buzzer: string): string;
79
- private ensureTempOrder;
83
+ private ensureScanOrderTempOrder;
80
84
  addNewOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
81
85
  restoreOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
82
86
  getOrderProducts(): import("../../modules/Order/types").OrderProduct[];
@@ -92,7 +96,10 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
92
96
  }): Promise<void>;
93
97
  private findReservationRuleResource;
94
98
  private buildScanOrderResourceMetadata;
99
+ private prepareRetailAvailability;
95
100
  private buildSubmitPayloadEnhancer;
101
+ private isScanOrderMoreMode;
102
+ private submitScanOrderMore;
96
103
  submitScanOrder<T = any>(): Promise<T>;
97
104
  addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<import("../../modules/Order/types").OrderProduct[]>;
98
105
  updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
@@ -117,8 +124,10 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
117
124
  setItemRuleRuntimeConfig(config?: ScanOrderItemRuleRuntimeConfig): Promise<void>;
118
125
  private normalizeResourceState;
119
126
  private resolveResourceSelectType;
120
- private fetchResourceOccupyDetailByResourceId;
121
- checkResourceAvailable(resourceId: string, hasOrderId: boolean): Promise<ScanOrderAvailabilityInfo>;
127
+ private fetchResourceOccupyDetailsByResourceId;
128
+ private resolveAdditionalOrderFromOccupyDetail;
129
+ checkResourceAvailable(resourceId?: string | null, hasOrderId?: boolean): Promise<ScanOrderAvailabilityInfo>;
130
+ restorePreviousOrderData(): Promise<void>;
122
131
  getAdditionalOrderInfo(): Promise<{
123
132
  orderId: string;
124
133
  orderStatus: 'pending' | 'processing' | 'completed' | 'cancelled';
@@ -141,6 +150,9 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
141
150
  clearUIState(): void;
142
151
  setEntryPaxNumber(number: number): Promise<void>;
143
152
  getEntryPaxNumber(): number | null;
153
+ syncAdditionalOrderFromResource(resourceId?: string | null): Promise<ScanOrderSyncAdditionalOrderResult>;
154
+ getReservationResourceSelectType(): ScanOrderReservationResourceSelectInfo;
155
+ checkAllowAddItems(): ScanOrderAllowAddItemsInfo;
144
156
  getFulfillmentModes(): {
145
157
  enablePickup: boolean;
146
158
  enableTableService: boolean;