@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
@@ -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) {
@@ -118,12 +118,15 @@ export interface BookingTicketCartBookingView extends ISalesBooking {
118
118
  canAddTime: boolean;
119
119
  };
120
120
  }
121
+ export type BookingTicketCartLineView = BookingTicketCartBookingView | BookingTicketCartItemView;
121
122
  /**
122
123
  * BookingTicket 面向 UI 的购物车视图。
123
124
  */
124
125
  export interface BookingTicketCartView {
125
126
  bookings: BookingTicketCartBookingView[];
126
127
  items: BookingTicketCartItemView[];
128
+ /** 以 tempOrder.products 为唯一顺序真源的统一购物车行(旧到新)。 */
129
+ lines: BookingTicketCartLineView[];
127
130
  }
128
131
  /**
129
132
  * BookingTicket 面向 UI 的客户展示视图。
@@ -86,29 +86,27 @@ function isGiftProductLine(line) {
86
86
  function buildCartView(lines, bookings, options = {}) {
87
87
  const productLines = Array.isArray(lines) ? lines : [];
88
88
  const bookingList = Array.isArray(bookings) ? bookings : [];
89
+ const childBookings = bookingList.filter((booking) => booking.parent_id !== 0);
90
+ const bookingsByProductUid = indexBookingsByProductUid(childBookings);
89
91
  const linesByUid = indexProductsByUid(productLines);
90
92
  const addTimeLinesByBookingUid = indexAddTimeProductsByBookingUid(productLines);
91
- const claimedUids = /* @__PURE__ */ new Set();
92
93
  const claimedAddTimeLines = /* @__PURE__ */ new Set();
93
- const cartBookings = bookingList.filter((booking) => booking.parent_id !== 0).reduce((acc, booking) => {
94
- const uid = booking == null ? void 0 : booking.product_uid;
94
+ childBookings.forEach((booking) => {
95
+ const bookingUid = getBookingUid(booking);
96
+ if (!bookingUid)
97
+ return;
98
+ (addTimeLinesByBookingUid[bookingUid] || []).forEach((line) => {
99
+ claimedAddTimeLines.add(line);
100
+ });
101
+ });
102
+ const claimedBookings = /* @__PURE__ */ new Set();
103
+ const cartBookings = [];
104
+ const items = [];
105
+ const orderedLines = [];
106
+ const buildBookingView = (booking, product) => {
95
107
  const bookingUid = getBookingUid(booking);
96
- let product = null;
97
- if (uid !== void 0 && uid !== null && uid !== "") {
98
- const key = String(uid);
99
- if (!claimedUids.has(key)) {
100
- const line = linesByUid[key];
101
- if (isGiftProductLine(line))
102
- return acc;
103
- if (line) {
104
- claimedUids.add(key);
105
- product = line;
106
- }
107
- }
108
- }
109
108
  const addTimeProduct = bookingUid ? addTimeLinesByBookingUid[bookingUid] || [] : [];
110
- addTimeProduct.forEach((line) => claimedAddTimeLines.add(line));
111
- acc.push({
109
+ return {
112
110
  ...booking,
113
111
  _extend: {
114
112
  product,
@@ -122,21 +120,36 @@ function buildCartView(lines, bookings, options = {}) {
122
120
  shopOpeningHours: options.shopOpeningHours
123
121
  })
124
122
  }
125
- });
126
- return acc;
127
- }, []);
128
- const items = productLines.filter((line) => {
123
+ };
124
+ };
125
+ productLines.forEach((line) => {
129
126
  var _a;
130
- if (isGiftProductLine(line))
131
- return false;
132
- if (claimedAddTimeLines.has(line))
133
- return false;
127
+ if (isGiftProductLine(line) || claimedAddTimeLines.has(line))
128
+ return;
134
129
  const uid = (_a = line.metadata) == null ? void 0 : _a.unique_identification_number;
135
- if (uid === void 0 || uid === null || uid === "")
136
- return true;
137
- return !claimedUids.has(String(uid));
130
+ const matchedBooking = uid === void 0 || uid === null || uid === "" ? void 0 : (bookingsByProductUid[String(uid)] || []).find(
131
+ (booking) => !claimedBookings.has(booking)
132
+ );
133
+ if (matchedBooking) {
134
+ claimedBookings.add(matchedBooking);
135
+ const bookingView = buildBookingView(matchedBooking, line);
136
+ cartBookings.push(bookingView);
137
+ orderedLines.push(bookingView);
138
+ return;
139
+ }
140
+ items.push(line);
141
+ orderedLines.push(line);
142
+ });
143
+ childBookings.forEach((booking) => {
144
+ if (claimedBookings.has(booking))
145
+ return;
146
+ const uid = booking == null ? void 0 : booking.product_uid;
147
+ const linkedProduct = uid === void 0 || uid === null || uid === "" ? null : linesByUid[String(uid)] || null;
148
+ if (isGiftProductLine(linkedProduct))
149
+ return;
150
+ cartBookings.push(buildBookingView(booking, null));
138
151
  });
139
- return { bookings: cartBookings, items };
152
+ return { bookings: cartBookings, items, lines: orderedLines };
140
153
  }
141
154
  function isWalkInCustomer(customer) {
142
155
  if (!customer)
@@ -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)
@@ -95,6 +95,7 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
95
95
  * 2) 若无 active,返回已超时且仍占用中的预约(允许并发多条)
96
96
  * 3) 若仍无,返回最近一组未来预约(同 start_time 的并发预约全部返回)
97
97
  * 4) 最后兜底返回一条(避免资源有历史预约时完全无反馈)
98
+ * - includeAllFuture 时,保留选中预约并返回当天全部后续预约;仅详情接口启用。
98
99
  */
99
100
  private pickBookingsForCurrentPoint;
100
101
  /**
@@ -316,8 +316,9 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
316
316
  * 2) 若无 active,返回已超时且仍占用中的预约(允许并发多条)
317
317
  * 3) 若仍无,返回最近一组未来预约(同 start_time 的并发预约全部返回)
318
318
  * 4) 最后兜底返回一条(避免资源有历史预约时完全无反馈)
319
+ * - includeAllFuture 时,保留选中预约并返回当天全部后续预约;仅详情接口启用。
319
320
  */
320
- pickBookingsForCurrentPoint(current, bookings) {
321
+ pickBookingsForCurrentPoint(current, bookings, options = {}) {
321
322
  if (bookings.length === 0)
322
323
  return [];
323
324
  const currentDayStart = current.startOf("day");
@@ -334,6 +335,13 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
334
335
  const appendNextStartGroupIfNeeded = (selectedBookings) => {
335
336
  if (selectedBookings.length === 0)
336
337
  return selectedBookings;
338
+ if (options.includeAllFuture) {
339
+ const allFutureBookings = dayScopedBookings.filter((booking) => {
340
+ const startAt = this.toBookingDateTime(booking.start_date, booking.start_time);
341
+ return startAt.isValid() && startAt.isAfter(current);
342
+ });
343
+ return [...selectedBookings, ...allFutureBookings];
344
+ }
337
345
  const shouldAppendNextGroup = selectedBookings.some(
338
346
  (booking) => booking.status === "reserved" || booking.status === "occupied"
339
347
  );
@@ -384,6 +392,8 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
384
392
  return startAt.isValid() && startAt.isAfter(current) && startAt.isSame(current, "day");
385
393
  });
386
394
  if (upcoming.length > 0) {
395
+ if (options.includeAllFuture)
396
+ return upcoming;
387
397
  const firstStartAt = this.toBookingDateTime(upcoming[0].start_date, upcoming[0].start_time).valueOf();
388
398
  const upcomingStartGroup = upcoming.filter((booking) => {
389
399
  const startAt = this.toBookingDateTime(booking.start_date, booking.start_time);
@@ -638,7 +648,8 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
638
648
  const unpaidBookingList = matchedBookingList.filter((booking) => this.isUnpaidBooking(booking));
639
649
  const bookings = this.pickBookingsForCurrentPoint(
640
650
  current,
641
- this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList)
651
+ this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList),
652
+ { includeAllFuture: true }
642
653
  );
643
654
  const completedBookings = completedBookingList.map((booking) => {
644
655
  return {
@@ -654,7 +665,8 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
654
665
  });
655
666
  const unpaidBookings = this.pickBookingsForCurrentPoint(
656
667
  current,
657
- this.normalizeResourceBookings(current, deviceCurrent, unpaidBookingList)
668
+ this.normalizeResourceBookings(current, deviceCurrent, unpaidBookingList),
669
+ { includeAllFuture: true }
658
670
  );
659
671
  const orderCount = this.countBookingOrders(statsBookingList);
660
672
  const bookingCount = statsBookingList.length;