@pisell/pisellos 2.3.43 → 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 (160) hide show
  1. package/dist/modules/Discount/index.d.ts +0 -1
  2. package/dist/modules/Discount/index.js +11 -40
  3. package/dist/modules/Discount/types.d.ts +0 -1
  4. package/dist/modules/OpenData/index.js +2 -2
  5. package/dist/modules/Order/index.d.ts +2 -3
  6. package/dist/modules/Order/index.js +98 -82
  7. package/dist/modules/Order/types.d.ts +2 -9
  8. package/dist/modules/Order/utils.d.ts +0 -10
  9. package/dist/modules/Order/utils.js +3 -35
  10. package/dist/modules/Payment/walletpass.d.ts +10 -3
  11. package/dist/modules/Payment/walletpass.js +425 -282
  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.d.ts +2 -0
  17. package/dist/modules/Rules/index.js +72 -102
  18. package/dist/modules/SalesSummary/index.js +13 -12
  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 +657 -772
  31. package/dist/solution/BaseSales/index.d.ts +0 -7
  32. package/dist/solution/BaseSales/index.js +48 -67
  33. package/dist/solution/BaseSales/types.d.ts +3 -1
  34. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
  35. package/dist/solution/BookingByStep/index.d.ts +1 -16
  36. package/dist/solution/BookingByStep/index.js +215 -294
  37. package/dist/solution/BookingByStep/types.d.ts +1 -2
  38. package/dist/solution/BookingByStep/types.js +1 -3
  39. package/dist/solution/BookingByStep/utils/capacity.js +1 -17
  40. package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  41. package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
  42. package/dist/solution/BookingTicket/index.d.ts +1 -13
  43. package/dist/solution/BookingTicket/index.js +8 -5
  44. package/dist/solution/BookingTicket/types.d.ts +1 -0
  45. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +3 -3
  46. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
  47. package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
  48. package/dist/solution/ScanOrder/index.d.ts +14 -26
  49. package/dist/solution/ScanOrder/index.js +739 -1142
  50. package/dist/solution/ScanOrder/types.d.ts +1 -21
  51. package/dist/solution/ScanOrder/utils.d.ts +0 -8
  52. package/dist/solution/ScanOrder/utils.js +25 -66
  53. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  54. package/dist/solution/ShopDiscount/index.js +87 -125
  55. package/dist/solution/VenueBooking/index.d.ts +12 -39
  56. package/dist/solution/VenueBooking/index.js +841 -1167
  57. package/dist/solution/VenueBooking/types.d.ts +0 -3
  58. package/dist/solution/VenueBooking/utils/resource.js +0 -1
  59. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  60. package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
  61. package/dist/solution/index.d.ts +0 -1
  62. package/dist/solution/index.js +1 -2
  63. package/dist/types/index.d.ts +0 -1
  64. package/lib/model/strategy/adapter/promotion/index.js +51 -0
  65. package/lib/modules/Discount/index.d.ts +0 -1
  66. package/lib/modules/Discount/index.js +0 -9
  67. package/lib/modules/Discount/types.d.ts +0 -1
  68. package/lib/modules/OpenData/index.js +1 -1
  69. package/lib/modules/Order/index.d.ts +2 -3
  70. package/lib/modules/Order/index.js +56 -33
  71. package/lib/modules/Order/types.d.ts +2 -9
  72. package/lib/modules/Order/utils.d.ts +0 -10
  73. package/lib/modules/Order/utils.js +5 -36
  74. package/lib/modules/Payment/walletpass.d.ts +10 -3
  75. package/lib/modules/Payment/walletpass.js +218 -56
  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.d.ts +2 -0
  81. package/lib/modules/Rules/index.js +24 -36
  82. package/lib/modules/SalesSummary/index.js +7 -6
  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 +5 -65
  95. package/lib/solution/BaseSales/index.d.ts +0 -7
  96. package/lib/solution/BaseSales/index.js +9 -24
  97. package/lib/solution/BaseSales/types.d.ts +3 -1
  98. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
  99. package/lib/solution/BookingByStep/index.d.ts +1 -16
  100. package/lib/solution/BookingByStep/index.js +18 -60
  101. package/lib/solution/BookingByStep/types.d.ts +1 -2
  102. package/lib/solution/BookingByStep/types.js +0 -5
  103. package/lib/solution/BookingByStep/utils/capacity.js +1 -20
  104. package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  105. package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
  106. package/lib/solution/BookingTicket/index.d.ts +1 -13
  107. package/lib/solution/BookingTicket/index.js +3 -10
  108. package/lib/solution/BookingTicket/types.d.ts +1 -0
  109. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +2 -2
  110. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
  111. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
  112. package/lib/solution/ScanOrder/index.d.ts +14 -26
  113. package/lib/solution/ScanOrder/index.js +182 -449
  114. package/lib/solution/ScanOrder/types.d.ts +1 -21
  115. package/lib/solution/ScanOrder/utils.d.ts +0 -8
  116. package/lib/solution/ScanOrder/utils.js +0 -31
  117. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  118. package/lib/solution/ShopDiscount/index.js +0 -14
  119. package/lib/solution/VenueBooking/index.d.ts +12 -39
  120. package/lib/solution/VenueBooking/index.js +110 -322
  121. package/lib/solution/VenueBooking/types.d.ts +0 -3
  122. package/lib/solution/VenueBooking/utils/resource.js +0 -1
  123. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  124. package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
  125. package/lib/solution/index.d.ts +0 -1
  126. package/lib/solution/index.js +1 -3
  127. package/lib/types/index.d.ts +0 -1
  128. package/package.json +1 -1
  129. package/dist/modules/Holder/index.d.ts +0 -48
  130. package/dist/modules/Holder/index.js +0 -640
  131. package/dist/modules/Holder/types.d.ts +0 -123
  132. package/dist/modules/Holder/types.js +0 -1
  133. package/dist/modules/Holder/utils.d.ts +0 -13
  134. package/dist/modules/Holder/utils.js +0 -34
  135. package/dist/modules/ResourcePlanner/index.d.ts +0 -24
  136. package/dist/modules/ResourcePlanner/index.js +0 -181
  137. package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
  138. package/dist/modules/ResourcePlanner/planner.js +0 -1069
  139. package/dist/modules/ResourcePlanner/types.d.ts +0 -227
  140. package/dist/modules/ResourcePlanner/types.js +0 -1
  141. package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
  142. package/dist/solution/UnifiedBookingSales/index.js +0 -1891
  143. package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
  144. package/dist/solution/UnifiedBookingSales/types.js +0 -11
  145. package/lib/modules/Holder/index.d.ts +0 -48
  146. package/lib/modules/Holder/index.js +0 -402
  147. package/lib/modules/Holder/types.d.ts +0 -123
  148. package/lib/modules/Holder/types.js +0 -17
  149. package/lib/modules/Holder/utils.d.ts +0 -13
  150. package/lib/modules/Holder/utils.js +0 -71
  151. package/lib/modules/ResourcePlanner/index.d.ts +0 -24
  152. package/lib/modules/ResourcePlanner/index.js +0 -148
  153. package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
  154. package/lib/modules/ResourcePlanner/planner.js +0 -933
  155. package/lib/modules/ResourcePlanner/types.d.ts +0 -227
  156. package/lib/modules/ResourcePlanner/types.js +0 -17
  157. package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
  158. package/lib/solution/UnifiedBookingSales/index.js +0 -1084
  159. package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
  160. 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
  }
@@ -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
  /**
@@ -368,6 +368,7 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
368
368
  }
369
369
  return {
370
370
  isAvailable: raw.isAvailable,
371
+ ...raw.isAccepted !== void 0 ? { isAccepted: raw.isAccepted } : {},
371
372
  type: raw.type,
372
373
  unavailableReason: raw.unavailableReason,
373
374
  scannedDiscountList: raw.scannedDiscountList
@@ -1092,11 +1093,7 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
1092
1093
  */
1093
1094
  scanGlobalListener(callback) {
1094
1095
  const localSearch = (v) => this.store.products.findProductsByCodeOrBarcode(v);
1095
- const scanCallback = (0, import_handleScan.handleGlobalScan)(
1096
- this.request,
1097
- localSearch,
1098
- this.getSubmitOrderSalesChannel()
1099
- );
1096
+ const scanCallback = (0, import_handleScan.handleGlobalScan)(this.request, localSearch);
1100
1097
  const safeCallback = (d) => {
1101
1098
  try {
1102
1099
  callback(d);
@@ -1425,11 +1422,7 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
1425
1422
  }
1426
1423
  try {
1427
1424
  const localSearch = (v) => this.store.products.findProductsByCodeOrBarcode(v);
1428
- const scanCallback = (0, import_handleScan.handleGlobalScan)(
1429
- this.request,
1430
- localSearch,
1431
- this.getSubmitOrderSalesChannel()
1432
- );
1425
+ const scanCallback = (0, import_handleScan.handleGlobalScan)(this.request, localSearch);
1433
1426
  const raw = await scanCallback({ type: "nativeScanner", value: trimmed });
1434
1427
  const formatted = (0, import_formatGlobalScan.formatGlobalScanResult)(raw, trimmed);
1435
1428
  if (!formatted) {
@@ -229,6 +229,7 @@ export interface GlobalScanHostBridge {
229
229
  */
230
230
  applyPromotionCode?: (code: string, customerId?: number) => Promise<{
231
231
  isAvailable?: boolean;
232
+ isAccepted?: boolean;
232
233
  type?: string;
233
234
  unavailableReason?: string;
234
235
  }>;
@@ -131,7 +131,7 @@ async function applyGlobalScan(host, formatted, bridge) {
131
131
  return { status: "failed", reason: "no_bridge" };
132
132
  }
133
133
  const result = await bridge.applyPromotionCode(scanCode);
134
- if (result == null ? void 0 : result.isAvailable) {
134
+ if ((result == null ? void 0 : result.isAccepted) ?? (result == null ? void 0 : result.isAvailable)) {
135
135
  return { status: "success", kind: "promotion" };
136
136
  }
137
137
  return { status: "failed", reason: "invalid_data" };
@@ -146,7 +146,7 @@ async function applyGlobalScan(host, formatted, bridge) {
146
146
  scanCode,
147
147
  Number((data == null ? void 0 : data.id) ?? (data == null ? void 0 : data.customer_id)) || void 0
148
148
  );
149
- if (promotionResult == null ? void 0 : promotionResult.isAvailable) {
149
+ if ((promotionResult == null ? void 0 : promotionResult.isAccepted) ?? (promotionResult == null ? void 0 : promotionResult.isAvailable)) {
150
150
  return { status: "success", kind: "promotion" };
151
151
  }
152
152
  }
@@ -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)
@@ -1,9 +1,8 @@
1
1
  import { Module, ModuleOptions, PisellCore } from '../../types';
2
- import { BaseSalesImpl } from '../BaseSales';
3
- import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderAllowAddItemsInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderReservationResourceSelectInfo, ScanOrderState, ScanOrderScanCodeResult, ScanOrderSyncAdditionalOrderResult } from './types';
2
+ import { BaseModule } from '../../modules/BaseModule';
3
+ import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderScanCodeResult } 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';
7
6
  import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
8
7
  import type { StrategyConfig } from '../../model/strategy/type';
9
8
  import type { ProductData } from '../../modules/Product/types';
@@ -16,16 +15,16 @@ interface ScanOrderItemRuleRuntimeConfig {
16
15
  submissionIndex?: number;
17
16
  custom?: Record<string, any>;
18
17
  }
19
- export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
18
+ export declare class ScanOrderImpl extends BaseModule implements Module {
20
19
  protected defaultName: string;
21
20
  protected defaultVersion: string;
22
21
  isSolution: boolean;
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;
22
+ private initializeOptions;
23
+ private store;
24
+ private otherParams;
25
+ private cacheId;
26
+ private window;
27
+ private request;
29
28
  private itemRuleEvaluator;
30
29
  private itemRuleConfigs;
31
30
  private itemRuleConfigsPromise;
@@ -54,10 +53,9 @@ export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
54
53
  private registerCustomerLoginListeners;
55
54
  private refreshOrderMarketingAfterLogin;
56
55
  constructor(name?: string, version?: string);
57
- protected getRegisteredModuleNames(): readonly string[];
58
- protected createSubModule(moduleName: string): Module | null;
59
56
  /** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
60
57
  getCacheId(): string | undefined;
58
+ private destroyRegisteredChildModules;
61
59
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
62
60
  destroy(): Promise<void>;
63
61
  retryInit(): Promise<void>;
@@ -73,14 +71,12 @@ export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
73
71
  };
74
72
  getTempOrder(): import("../../modules/Order/types").OrderTempOrder | null;
75
73
  updateTempOrderNote(note: string): string;
76
- updateTempOrderNote(note: string, sync: true): Promise<string>;
77
- updateTempOrderNote(note: string, sync: boolean): string | Promise<string>;
78
74
  setPickupReferenceMode(mode: 'counter_pickup' | 'table_service'): {
79
- service_type: 'dine_in' | '';
75
+ service_type: 'dine_in';
80
76
  pickup_reference_mode: 'counter_pickup' | 'table_service';
81
77
  };
82
78
  setPickupRef(buzzer: string): string;
83
- private ensureScanOrderTempOrder;
79
+ private ensureTempOrder;
84
80
  addNewOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
85
81
  restoreOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
86
82
  getOrderProducts(): import("../../modules/Order/types").OrderProduct[];
@@ -96,10 +92,7 @@ export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
96
92
  }): Promise<void>;
97
93
  private findReservationRuleResource;
98
94
  private buildScanOrderResourceMetadata;
99
- private prepareRetailAvailability;
100
95
  private buildSubmitPayloadEnhancer;
101
- private isScanOrderMoreMode;
102
- private submitScanOrderMore;
103
96
  submitScanOrder<T = any>(): Promise<T>;
104
97
  addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<import("../../modules/Order/types").OrderProduct[]>;
105
98
  updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
@@ -124,10 +117,8 @@ export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
124
117
  setItemRuleRuntimeConfig(config?: ScanOrderItemRuleRuntimeConfig): Promise<void>;
125
118
  private normalizeResourceState;
126
119
  private resolveResourceSelectType;
127
- private fetchResourceOccupyDetailsByResourceId;
128
- private resolveAdditionalOrderFromOccupyDetail;
129
- checkResourceAvailable(resourceId?: string | null, hasOrderId?: boolean): Promise<ScanOrderAvailabilityInfo>;
130
- restorePreviousOrderData(): Promise<void>;
120
+ private fetchResourceOccupyDetailByResourceId;
121
+ checkResourceAvailable(resourceId: string, hasOrderId: boolean): Promise<ScanOrderAvailabilityInfo>;
131
122
  getAdditionalOrderInfo(): Promise<{
132
123
  orderId: string;
133
124
  orderStatus: 'pending' | 'processing' | 'completed' | 'cancelled';
@@ -150,9 +141,6 @@ export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
150
141
  clearUIState(): void;
151
142
  setEntryPaxNumber(number: number): Promise<void>;
152
143
  getEntryPaxNumber(): number | null;
153
- syncAdditionalOrderFromResource(resourceId?: string | null): Promise<ScanOrderSyncAdditionalOrderResult>;
154
- getReservationResourceSelectType(): ScanOrderReservationResourceSelectInfo;
155
- checkAllowAddItems(): ScanOrderAllowAddItemsInfo;
156
144
  getFulfillmentModes(): {
157
145
  enablePickup: boolean;
158
146
  enableTableService: boolean;