@pisell/pisellos 2.2.173 → 2.2.175

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 (159) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/Customer/index.d.ts +0 -6
  3. package/dist/modules/Customer/index.js +83 -129
  4. package/dist/modules/Customer/types.d.ts +0 -2
  5. package/dist/modules/Discount/index.d.ts +4 -2
  6. package/dist/modules/Discount/index.js +93 -8
  7. package/dist/modules/Discount/types.d.ts +7 -1
  8. package/dist/modules/Order/index.d.ts +17 -33
  9. package/dist/modules/Order/index.js +395 -757
  10. package/dist/modules/Order/types.d.ts +17 -58
  11. package/dist/modules/Order/types.js +0 -2
  12. package/dist/modules/Order/utils.d.ts +1 -39
  13. package/dist/modules/Order/utils.js +31 -219
  14. package/dist/modules/Quotation/index.js +5 -16
  15. package/dist/modules/Rules/index.d.ts +0 -4
  16. package/dist/modules/Rules/index.js +10 -26
  17. package/dist/modules/SalesSummary/index.js +2 -4
  18. package/dist/modules/Schedule/index.js +2 -6
  19. package/dist/modules/index.d.ts +0 -1
  20. package/dist/modules/index.js +1 -2
  21. package/dist/server/index.js +6 -10
  22. package/dist/server/modules/order/utils/filterOrders.js +6 -20
  23. package/dist/server/modules/products/index.js +94 -113
  24. package/dist/server/modules/schedule/index.js +6 -13
  25. package/dist/solution/BaseSales/index.d.ts +7 -53
  26. package/dist/solution/BaseSales/index.js +339 -1160
  27. package/dist/solution/BaseSales/types.d.ts +1 -67
  28. package/dist/solution/BaseSales/types.js +1 -3
  29. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +15 -65
  30. package/dist/solution/BaseSales/utils.js +8 -46
  31. package/dist/solution/BookingByStep/index.d.ts +1 -1
  32. package/dist/solution/BookingTicket/index.d.ts +1 -133
  33. package/dist/solution/BookingTicket/index.js +175 -776
  34. package/dist/solution/BookingTicket/types.d.ts +0 -2
  35. package/dist/solution/BookingTicket/types.js +0 -3
  36. package/dist/solution/ScanOrder/index.d.ts +3 -9
  37. package/dist/solution/ScanOrder/index.js +128 -231
  38. package/dist/solution/ScanOrder/utils.js +8 -46
  39. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  40. package/dist/solution/ShopDiscount/index.js +23 -18
  41. package/dist/solution/VenueBooking/index.d.ts +9 -5
  42. package/dist/solution/VenueBooking/index.js +55 -103
  43. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
  44. package/dist/solution/VenueBooking/utils/slotMerge.js +0 -10
  45. package/lib/modules/Customer/index.d.ts +0 -6
  46. package/lib/modules/Customer/index.js +11 -26
  47. package/lib/modules/Customer/types.d.ts +0 -2
  48. package/lib/modules/Discount/index.d.ts +4 -2
  49. package/lib/modules/Discount/index.js +63 -8
  50. package/lib/modules/Discount/types.d.ts +7 -1
  51. package/lib/modules/Order/index.d.ts +17 -33
  52. package/lib/modules/Order/index.js +148 -402
  53. package/lib/modules/Order/types.d.ts +17 -58
  54. package/lib/modules/Order/utils.d.ts +1 -39
  55. package/lib/modules/Order/utils.js +22 -197
  56. package/lib/modules/Quotation/index.js +6 -17
  57. package/lib/modules/Rules/index.d.ts +0 -4
  58. package/lib/modules/Rules/index.js +14 -22
  59. package/lib/modules/SalesSummary/index.js +2 -4
  60. package/lib/modules/Schedule/index.js +1 -3
  61. package/lib/modules/index.d.ts +0 -1
  62. package/lib/modules/index.js +1 -3
  63. package/lib/server/index.js +0 -2
  64. package/lib/server/modules/order/utils/filterOrders.js +4 -12
  65. package/lib/server/modules/products/index.js +12 -23
  66. package/lib/server/modules/schedule/index.js +1 -2
  67. package/lib/solution/BaseSales/index.d.ts +7 -53
  68. package/lib/solution/BaseSales/index.js +20 -527
  69. package/lib/solution/BaseSales/types.d.ts +1 -67
  70. package/lib/solution/BaseSales/types.js +1 -3
  71. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +11 -70
  72. package/lib/solution/BaseSales/utils.js +6 -46
  73. package/lib/solution/BookingByStep/index.d.ts +1 -1
  74. package/lib/solution/BookingTicket/index.d.ts +1 -133
  75. package/lib/solution/BookingTicket/index.js +8 -349
  76. package/lib/solution/BookingTicket/types.d.ts +0 -2
  77. package/lib/solution/BookingTicket/types.js +0 -6
  78. package/lib/solution/ScanOrder/index.d.ts +3 -9
  79. package/lib/solution/ScanOrder/index.js +66 -147
  80. package/lib/solution/ScanOrder/utils.js +6 -46
  81. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  82. package/lib/solution/ShopDiscount/index.js +4 -2
  83. package/lib/solution/VenueBooking/index.d.ts +9 -5
  84. package/lib/solution/VenueBooking/index.js +14 -50
  85. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
  86. package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
  87. package/package.json +2 -2
  88. package/dist/modules/BookingContext/index.d.ts +0 -37
  89. package/dist/modules/BookingContext/index.js +0 -436
  90. package/dist/modules/BookingContext/types.d.ts +0 -102
  91. package/dist/modules/BookingContext/types.js +0 -51
  92. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
  93. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -193
  94. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
  95. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -137
  96. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
  97. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -215
  98. package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
  99. package/dist/modules/BookingContext/utils/flexible.js +0 -56
  100. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  101. package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
  102. package/dist/modules/BookingContext/utils/index.d.ts +0 -11
  103. package/dist/modules/BookingContext/utils/index.js +0 -11
  104. package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
  105. package/dist/modules/BookingContext/utils/noResource.js +0 -77
  106. package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
  107. package/dist/modules/BookingContext/utils/productExtend.js +0 -339
  108. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  109. package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
  110. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  111. package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
  112. package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
  113. package/dist/modules/BookingContext/utils/resources.js +0 -486
  114. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  115. package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
  116. package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  117. package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
  118. package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  119. package/dist/modules/Order/utils/manualProductDiscount.js +0 -212
  120. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
  121. package/dist/solution/BaseSales/utils/quotationPrice.js +0 -237
  122. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
  123. package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
  124. package/lib/modules/BookingContext/index.d.ts +0 -37
  125. package/lib/modules/BookingContext/index.js +0 -297
  126. package/lib/modules/BookingContext/types.d.ts +0 -102
  127. package/lib/modules/BookingContext/types.js +0 -34
  128. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
  129. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -207
  130. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
  131. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -141
  132. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
  133. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -198
  134. package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
  135. package/lib/modules/BookingContext/utils/flexible.js +0 -80
  136. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  137. package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
  138. package/lib/modules/BookingContext/utils/index.d.ts +0 -11
  139. package/lib/modules/BookingContext/utils/index.js +0 -43
  140. package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
  141. package/lib/modules/BookingContext/utils/noResource.js +0 -90
  142. package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
  143. package/lib/modules/BookingContext/utils/productExtend.js +0 -283
  144. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  145. package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
  146. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  147. package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
  148. package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
  149. package/lib/modules/BookingContext/utils/resources.js +0 -377
  150. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  151. package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
  152. package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  153. package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
  154. package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  155. package/lib/modules/Order/utils/manualProductDiscount.js +0 -207
  156. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
  157. package/lib/solution/BaseSales/utils/quotationPrice.js +0 -277
  158. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
  159. package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
@@ -277,7 +277,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
277
277
  value: (function () {
278
278
  var _setupQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
279
279
  var _this$otherParams;
280
- var channel, quotation, scheduleCache, hasLoadedScheduleList;
280
+ var channel, quotation, _params$scheduleModul, _params$scheduleModul2, scheduleList, scheduleMap;
281
281
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
282
282
  while (1) switch (_context3.prev = _context3.next) {
283
283
  case 0:
@@ -301,32 +301,14 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
301
301
  this.quotationPriceBridge = quotation;
302
302
  case 10:
303
303
  if (params.scheduleModule) {
304
- scheduleCache = new Map();
305
- hasLoadedScheduleList = false;
304
+ scheduleList = ((_params$scheduleModul = (_params$scheduleModul2 = params.scheduleModule).getScheduleList) === null || _params$scheduleModul === void 0 ? void 0 : _params$scheduleModul.call(_params$scheduleModul2)) || [];
305
+ scheduleMap = new Map(scheduleList.map(function (schedule) {
306
+ return [schedule.id, schedule];
307
+ }));
306
308
  this.quotationPriceBridge.setScheduleResolver(function (id) {
307
- var _params$scheduleModul3, _params$scheduleModul4, _params$scheduleModul5, _params$scheduleModul6;
308
- var scheduleId = String(id);
309
- if (scheduleCache.has(scheduleId)) return scheduleCache.get(scheduleId);
310
- if (!hasLoadedScheduleList) {
311
- var _params$scheduleModul, _params$scheduleModul2;
312
- var scheduleList = ((_params$scheduleModul = (_params$scheduleModul2 = params.scheduleModule).getScheduleList) === null || _params$scheduleModul === void 0 ? void 0 : _params$scheduleModul.call(_params$scheduleModul2)) || [];
313
- var _iterator = _createForOfIteratorHelper(scheduleList),
314
- _step;
315
- try {
316
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
317
- var schedule = _step.value;
318
- scheduleCache.set(String(schedule.id), schedule);
319
- }
320
- } catch (err) {
321
- _iterator.e(err);
322
- } finally {
323
- _iterator.f();
324
- }
325
- hasLoadedScheduleList = true;
326
- }
327
- if (scheduleCache.has(scheduleId)) return scheduleCache.get(scheduleId);
328
- var schedules = ((_params$scheduleModul3 = (_params$scheduleModul4 = params.scheduleModule).getScheduleListByIds) === null || _params$scheduleModul3 === void 0 ? void 0 : _params$scheduleModul3.call(_params$scheduleModul4, [id])) || ((_params$scheduleModul5 = (_params$scheduleModul6 = params.scheduleModule).getScheduleByIds) === null || _params$scheduleModul5 === void 0 ? void 0 : _params$scheduleModul5.call(_params$scheduleModul6, [id])) || [];
329
- if (schedules[0]) scheduleCache.set(scheduleId, schedules[0]);
309
+ var _params$scheduleModul3, _params$scheduleModul4;
310
+ if (scheduleMap.has(id)) return scheduleMap.get(id);
311
+ var schedules = ((_params$scheduleModul3 = (_params$scheduleModul4 = params.scheduleModule).getScheduleByIds) === null || _params$scheduleModul3 === void 0 ? void 0 : _params$scheduleModul3.call(_params$scheduleModul4, [id])) || [];
330
312
  return schedules[0];
331
313
  });
332
314
  }
@@ -459,18 +441,17 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
459
441
  }, {
460
442
  key: "buildPriceDataFromQuotation",
461
443
  value: function buildPriceDataFromQuotation(product, datetime, customerId) {
462
- var _this$quotationPriceB, _ref2, _ref3;
444
+ var _this$quotationPriceB, _ref2, _product$base_price;
463
445
  var quotedPrice = (_this$quotationPriceB = this.quotationPriceBridge) === null || _this$quotationPriceB === void 0 ? void 0 : _this$quotationPriceB.getPriceForProduct({
464
446
  productId: product.id,
465
447
  datetime: datetime,
466
448
  customer_id: customerId
467
449
  });
468
450
  var productPrice = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : product.price;
469
- var productBasePrice = (_ref2 = (_ref3 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : product.base_price) !== null && _ref3 !== void 0 ? _ref3 : product.price) !== null && _ref2 !== void 0 ? _ref2 : 0;
470
451
  return {
471
452
  id: product.id,
472
453
  price: String(productPrice !== null && productPrice !== void 0 ? productPrice : 0),
473
- base_price: String(productBasePrice),
454
+ base_price: String((_ref2 = (_product$base_price = product.base_price) !== null && _product$base_price !== void 0 ? _product$base_price : product.price) !== null && _ref2 !== void 0 ? _ref2 : 0),
474
455
  variant: this.buildVariantPriceData(product, datetime, customerId),
475
456
  bundle_group: this.buildBundleGroupPriceData(product, datetime, customerId)
476
457
  };
@@ -481,15 +462,15 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
481
462
  var _this4 = this;
482
463
  if (!Array.isArray(product.variant)) return [];
483
464
  return product.variant.map(function (variant) {
484
- var _this4$quotationPrice, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _variant$product_id;
465
+ var _this4$quotationPrice, _ref3, _ref4, _ref5, _ref6, _ref7, _variant$base_price, _variant$product_id;
485
466
  var quotedPrice = (_this4$quotationPrice = _this4.quotationPriceBridge) === null || _this4$quotationPrice === void 0 ? void 0 : _this4$quotationPrice.getPriceForProduct({
486
467
  productId: product.id,
487
468
  variantId: Number(variant.id),
488
469
  datetime: datetime,
489
470
  customer_id: customerId
490
471
  });
491
- var price = (_ref4 = (_ref5 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : variant.price) !== null && _ref5 !== void 0 ? _ref5 : product.price) !== null && _ref4 !== void 0 ? _ref4 : 0;
492
- var basePrice = (_ref6 = (_ref7 = (_ref8 = (_ref9 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : variant.base_price) !== null && _ref9 !== void 0 ? _ref9 : variant.price) !== null && _ref8 !== void 0 ? _ref8 : product.base_price) !== null && _ref7 !== void 0 ? _ref7 : product.price) !== null && _ref6 !== void 0 ? _ref6 : 0;
472
+ var price = (_ref3 = (_ref4 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : variant.price) !== null && _ref4 !== void 0 ? _ref4 : product.price) !== null && _ref3 !== void 0 ? _ref3 : 0;
473
+ var basePrice = (_ref5 = (_ref6 = (_ref7 = (_variant$base_price = variant.base_price) !== null && _variant$base_price !== void 0 ? _variant$base_price : variant.price) !== null && _ref7 !== void 0 ? _ref7 : product.base_price) !== null && _ref6 !== void 0 ? _ref6 : product.price) !== null && _ref5 !== void 0 ? _ref5 : 0;
493
474
  return {
494
475
  id: Number(variant.id),
495
476
  product_id: Number((_variant$product_id = variant.product_id) !== null && _variant$product_id !== void 0 ? _variant$product_id : product.id),
@@ -507,7 +488,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
507
488
  return {
508
489
  id: Number(group.id),
509
490
  bundle_item: (group.bundle_item || []).map(function (item) {
510
- var _this5$quotationPrice, _ref10, _ref11, _ref12, _item$product_id, _item$group_id;
491
+ var _this5$quotationPrice, _ref8, _ref9, _item$base_price, _item$product_id, _item$group_id;
511
492
  var bundleProductId = Number(item.bundle_product_id);
512
493
  var bundleVariantId = Number(item.bundle_variant_id || 0);
513
494
  var quotedPrice = (_this5$quotationPrice = _this5.quotationPriceBridge) === null || _this5$quotationPrice === void 0 ? void 0 : _this5$quotationPrice.getPriceForProduct({
@@ -516,8 +497,8 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
516
497
  datetime: datetime,
517
498
  customer_id: customerId
518
499
  });
519
- var price = (_ref10 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : item.price) !== null && _ref10 !== void 0 ? _ref10 : 0;
520
- var basePrice = (_ref11 = (_ref12 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : item.base_price) !== null && _ref12 !== void 0 ? _ref12 : item.price) !== null && _ref11 !== void 0 ? _ref11 : 0;
500
+ var price = (_ref8 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : item.price) !== null && _ref8 !== void 0 ? _ref8 : 0;
501
+ var basePrice = (_ref9 = (_item$base_price = item.base_price) !== null && _item$base_price !== void 0 ? _item$base_price : item.price) !== null && _ref9 !== void 0 ? _ref9 : 0;
521
502
  return {
522
503
  id: Number(item.id),
523
504
  product_id: Number((_item$product_id = item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : product.id),
@@ -550,7 +531,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
550
531
  value: (function () {
551
532
  var _getProductsWithPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(schedule_date, extraContext, options) {
552
533
  var _options$changedIds;
553
- var t0, scopedProductIds, cacheKey, scopedProductIdSet, changedIds, cachedProducts, updatedProducts, updatedMap, mergedCache, _iterator2, _step2, p, _iterator3, _step3, _p, errorMessage, result;
534
+ var t0, scopedProductIds, cacheKey, scopedProductIdSet, changedIds, cachedProducts, updatedProducts, updatedMap, mergedCache, _iterator, _step, p, _iterator2, _step2, _p, errorMessage, result;
554
535
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
555
536
  while (1) switch (_context6.prev = _context6.next) {
556
537
  case 0:
@@ -591,10 +572,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
591
572
  return [p.id, p];
592
573
  }));
593
574
  mergedCache = [];
594
- _iterator2 = _createForOfIteratorHelper(cachedProducts);
575
+ _iterator = _createForOfIteratorHelper(cachedProducts);
595
576
  try {
596
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
597
- p = _step2.value;
577
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
578
+ p = _step.value;
598
579
  if (updatedMap.has(p.id)) {
599
580
  mergedCache.push(updatedMap.get(p.id));
600
581
  updatedMap.delete(p.id);
@@ -604,20 +585,20 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
604
585
  }
605
586
  // 剩余的是新增商品(create 场景)
606
587
  } catch (err) {
607
- _iterator2.e(err);
588
+ _iterator.e(err);
608
589
  } finally {
609
- _iterator2.f();
590
+ _iterator.f();
610
591
  }
611
- _iterator3 = _createForOfIteratorHelper(updatedMap.values());
592
+ _iterator2 = _createForOfIteratorHelper(updatedMap.values());
612
593
  try {
613
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
614
- _p = _step3.value;
594
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
595
+ _p = _step2.value;
615
596
  mergedCache.push(_p);
616
597
  }
617
598
  } catch (err) {
618
- _iterator3.e(err);
599
+ _iterator2.e(err);
619
600
  } finally {
620
- _iterator3.f();
601
+ _iterator2.f();
621
602
  }
622
603
  this.productsPriceCache.set(cacheKey, mergedCache);
623
604
  this.logInfo('增量更新完成', {
@@ -852,25 +833,25 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
852
833
  }
853
834
  if (productIds.length === 0 && collectionIds.length === 0) return [];
854
835
  var result = new Set();
855
- var _iterator4 = _createForOfIteratorHelper(productIds),
856
- _step4;
836
+ var _iterator3 = _createForOfIteratorHelper(productIds),
837
+ _step3;
857
838
  try {
858
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
859
- var id = _step4.value;
839
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
840
+ var id = _step3.value;
860
841
  if (this.store.map.has(id)) result.add(id);
861
842
  }
862
843
  } catch (err) {
863
- _iterator4.e(err);
844
+ _iterator3.e(err);
864
845
  } finally {
865
- _iterator4.f();
846
+ _iterator3.f();
866
847
  }
867
848
  if (collectionIds.length === 0) return Array.from(result);
868
849
  var collectionIdSet = new Set(collectionIds);
869
- var _iterator5 = _createForOfIteratorHelper(this.getProductsRef()),
870
- _step5;
850
+ var _iterator4 = _createForOfIteratorHelper(this.getProductsRef()),
851
+ _step4;
871
852
  try {
872
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
873
- var product = _step5.value;
853
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
854
+ var product = _step4.value;
874
855
  if (result.has(product.id)) continue;
875
856
  if (!Array.isArray(product.collection)) continue;
876
857
  var isInCollection = product.collection.some(function (collection) {
@@ -879,9 +860,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
879
860
  if (isInCollection) result.add(product.id);
880
861
  }
881
862
  } catch (err) {
882
- _iterator5.e(err);
863
+ _iterator4.e(err);
883
864
  } finally {
884
- _iterator5.f();
865
+ _iterator4.f();
885
866
  }
886
867
  return Array.from(result);
887
868
  }
@@ -1160,11 +1141,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1160
1141
  key: "fetchProductsByHttp",
1161
1142
  value: (function () {
1162
1143
  var _fetchProductsByHttp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
1163
- var _ref13, _ref13$category_ids, category_ids, _ref13$product_ids, product_ids, _ref13$collection, collection, customer_id, cacheId, startTime, _this$otherParams3, _productsData$data, productsData, productList, duration, _duration2, errorMessage;
1144
+ var _ref10, _ref10$category_ids, category_ids, _ref10$product_ids, product_ids, _ref10$collection, collection, customer_id, cacheId, startTime, _this$otherParams3, _productsData$data, productsData, productList, duration, _duration2, errorMessage;
1164
1145
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1165
1146
  while (1) switch (_context10.prev = _context10.next) {
1166
1147
  case 0:
1167
- _ref13 = params || {}, _ref13$category_ids = _ref13.category_ids, category_ids = _ref13$category_ids === void 0 ? [] : _ref13$category_ids, _ref13$product_ids = _ref13.product_ids, product_ids = _ref13$product_ids === void 0 ? [] : _ref13$product_ids, _ref13$collection = _ref13.collection, collection = _ref13$collection === void 0 ? [] : _ref13$collection, customer_id = _ref13.customer_id, cacheId = _ref13.cacheId;
1148
+ _ref10 = params || {}, _ref10$category_ids = _ref10.category_ids, category_ids = _ref10$category_ids === void 0 ? [] : _ref10$category_ids, _ref10$product_ids = _ref10.product_ids, product_ids = _ref10$product_ids === void 0 ? [] : _ref10$product_ids, _ref10$collection = _ref10.collection, collection = _ref10$collection === void 0 ? [] : _ref10$collection, customer_id = _ref10.customer_id, cacheId = _ref10.cacheId;
1168
1149
  this.logInfo('fetchProductsByHttp: 开始请求', {
1169
1150
  categoryIdsCount: category_ids.length,
1170
1151
  productIdsCount: product_ids.length,
@@ -1312,18 +1293,18 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1312
1293
  key: "getProductsRefByIds",
1313
1294
  value: function getProductsRefByIds(ids) {
1314
1295
  var products = [];
1315
- var _iterator6 = _createForOfIteratorHelper(ids),
1316
- _step6;
1296
+ var _iterator5 = _createForOfIteratorHelper(ids),
1297
+ _step5;
1317
1298
  try {
1318
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1319
- var id = _step6.value;
1299
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1300
+ var id = _step5.value;
1320
1301
  var product = this.store.map.get(id);
1321
1302
  if (product) products.push(product);
1322
1303
  }
1323
1304
  } catch (err) {
1324
- _iterator6.e(err);
1305
+ _iterator5.e(err);
1325
1306
  } finally {
1326
- _iterator6.f();
1307
+ _iterator5.f();
1327
1308
  }
1328
1309
  return products;
1329
1310
  }
@@ -1362,7 +1343,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1362
1343
  key: "removeProductsByIds",
1363
1344
  value: (function () {
1364
1345
  var _removeProductsByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(ids) {
1365
- var idSet, _iterator7, _step7, _id, _iterator8, _step8, id, errorMessage, _iterator9, _step9, _step9$value, dateKey, cachedProducts;
1346
+ var idSet, _iterator6, _step6, _id, _iterator7, _step7, id, errorMessage, _iterator8, _step8, _step8$value, dateKey, cachedProducts;
1366
1347
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1367
1348
  while (1) switch (_context14.prev = _context14.next) {
1368
1349
  case 0:
@@ -1374,31 +1355,31 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1374
1355
  this.store.list = this.store.list.filter(function (p) {
1375
1356
  return !idSet.has(p.id);
1376
1357
  });
1377
- _iterator7 = _createForOfIteratorHelper(ids);
1358
+ _iterator6 = _createForOfIteratorHelper(ids);
1378
1359
  try {
1379
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1380
- _id = _step7.value;
1360
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1361
+ _id = _step6.value;
1381
1362
  this.store.map.delete(_id);
1382
1363
  }
1383
1364
  } catch (err) {
1384
- _iterator7.e(err);
1365
+ _iterator6.e(err);
1385
1366
  } finally {
1386
- _iterator7.f();
1367
+ _iterator6.f();
1387
1368
  }
1388
1369
  if (!this.dbManager) {
1389
1370
  _context14.next = 30;
1390
1371
  break;
1391
1372
  }
1392
1373
  _context14.prev = 6;
1393
- _iterator8 = _createForOfIteratorHelper(ids);
1374
+ _iterator7 = _createForOfIteratorHelper(ids);
1394
1375
  _context14.prev = 8;
1395
- _iterator8.s();
1376
+ _iterator7.s();
1396
1377
  case 10:
1397
- if ((_step8 = _iterator8.n()).done) {
1378
+ if ((_step7 = _iterator7.n()).done) {
1398
1379
  _context14.next = 16;
1399
1380
  break;
1400
1381
  }
1401
- id = _step8.value;
1382
+ id = _step7.value;
1402
1383
  _context14.next = 14;
1403
1384
  return this.dbManager.delete(INDEXDB_STORE_NAME, id);
1404
1385
  case 14:
@@ -1410,10 +1391,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1410
1391
  case 18:
1411
1392
  _context14.prev = 18;
1412
1393
  _context14.t0 = _context14["catch"](8);
1413
- _iterator8.e(_context14.t0);
1394
+ _iterator7.e(_context14.t0);
1414
1395
  case 21:
1415
1396
  _context14.prev = 21;
1416
- _iterator8.f();
1397
+ _iterator7.f();
1417
1398
  return _context14.finish(21);
1418
1399
  case 24:
1419
1400
  _context14.next = 30;
@@ -1427,18 +1408,18 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1427
1408
  error: errorMessage
1428
1409
  });
1429
1410
  case 30:
1430
- _iterator9 = _createForOfIteratorHelper(this.productsPriceCache.entries());
1411
+ _iterator8 = _createForOfIteratorHelper(this.productsPriceCache.entries());
1431
1412
  try {
1432
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1433
- _step9$value = _slicedToArray(_step9.value, 2), dateKey = _step9$value[0], cachedProducts = _step9$value[1];
1413
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
1414
+ _step8$value = _slicedToArray(_step8.value, 2), dateKey = _step8$value[0], cachedProducts = _step8$value[1];
1434
1415
  this.productsPriceCache.set(dateKey, cachedProducts.filter(function (p) {
1435
1416
  return !idSet.has(p.id);
1436
1417
  }));
1437
1418
  }
1438
1419
  } catch (err) {
1439
- _iterator9.e(err);
1420
+ _iterator8.e(err);
1440
1421
  } finally {
1441
- _iterator9.f();
1422
+ _iterator8.f();
1442
1423
  }
1443
1424
  this.core.effects.emit(ProductsHooks.onProductsChanged, this.store.list);
1444
1425
  this.logInfo('removeProductsByIds 完成', {
@@ -1678,17 +1659,17 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1678
1659
  value: function syncProductsMap() {
1679
1660
  var t0 = performance.now();
1680
1661
  this.store.map.clear();
1681
- var _iterator10 = _createForOfIteratorHelper(this.store.list),
1682
- _step10;
1662
+ var _iterator9 = _createForOfIteratorHelper(this.store.list),
1663
+ _step9;
1683
1664
  try {
1684
- for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
1685
- var product = _step10.value;
1665
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1666
+ var product = _step9.value;
1686
1667
  this.store.map.set(product.id, product);
1687
1668
  }
1688
1669
  } catch (err) {
1689
- _iterator10.e(err);
1670
+ _iterator9.e(err);
1690
1671
  } finally {
1691
- _iterator10.f();
1672
+ _iterator9.f();
1692
1673
  }
1693
1674
  perfMark('syncProductsMap', performance.now() - t0, {
1694
1675
  count: this.store.map.size
@@ -1900,7 +1881,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1900
1881
  key: "processProductSyncMessages",
1901
1882
  value: (function () {
1902
1883
  var _processProductSyncMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1903
- var messages, deleteIds, bodyUpdates, sseRefreshIds, priceRefreshIds, shouldClearPriceCache, _iterator11, _step11, msg, channelKey, _msg$relation_product, _msg$change_types, _msg$ids2, _msg$ids, ids, bodyId, _bodyId, _msg$relation_product2, _msg$relation_product3, uniqueDeleteIds, uniqueSSEIds, uniquePriceIds, freshProducts, allChangedIds, hasChanges, errorMessage;
1884
+ var messages, deleteIds, bodyUpdates, sseRefreshIds, priceRefreshIds, shouldClearPriceCache, _iterator10, _step10, msg, channelKey, _msg$relation_product, _msg$change_types, _msg$ids2, _msg$ids, ids, bodyId, _bodyId, _msg$relation_product2, _msg$relation_product3, uniqueDeleteIds, uniqueSSEIds, uniquePriceIds, freshProducts, allChangedIds, hasChanges, errorMessage;
1904
1885
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1905
1886
  while (1) switch (_context20.prev = _context20.next) {
1906
1887
  case 0:
@@ -1920,15 +1901,15 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1920
1901
  sseRefreshIds = [];
1921
1902
  priceRefreshIds = [];
1922
1903
  shouldClearPriceCache = false;
1923
- _iterator11 = _createForOfIteratorHelper(messages);
1904
+ _iterator10 = _createForOfIteratorHelper(messages);
1924
1905
  _context20.prev = 11;
1925
- _iterator11.s();
1906
+ _iterator10.s();
1926
1907
  case 13:
1927
- if ((_step11 = _iterator11.n()).done) {
1908
+ if ((_step10 = _iterator10.n()).done) {
1928
1909
  _context20.next = 36;
1929
1910
  break;
1930
1911
  }
1931
- msg = _step11.value;
1912
+ msg = _step10.value;
1932
1913
  channelKey = msg._channelKey || msg.module || 'product';
1933
1914
  if (!(channelKey === 'product')) {
1934
1915
  _context20.next = 33;
@@ -1994,10 +1975,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1994
1975
  case 38:
1995
1976
  _context20.prev = 38;
1996
1977
  _context20.t0 = _context20["catch"](11);
1997
- _iterator11.e(_context20.t0);
1978
+ _iterator10.e(_context20.t0);
1998
1979
  case 41:
1999
1980
  _context20.prev = 41;
2000
- _iterator11.f();
1981
+ _iterator10.f();
2001
1982
  return _context20.finish(41);
2002
1983
  case 44:
2003
1984
  uniqueDeleteIds = _toConsumableArray(new Set(deleteIds));
@@ -2168,7 +2149,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2168
2149
  key: "applyBodyUpdatesToStore",
2169
2150
  value: (function () {
2170
2151
  var _applyBodyUpdatesToStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(bodyUpdates) {
2171
- var updatedCount, newCount, appliedIds, _iterator12, _step12, _step12$value, id, body;
2152
+ var updatedCount, newCount, appliedIds, _iterator11, _step11, _step11$value, id, body;
2172
2153
  return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2173
2154
  while (1) switch (_context22.prev = _context22.next) {
2174
2155
  case 0:
@@ -2186,19 +2167,19 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2186
2167
  }
2187
2168
  return p;
2188
2169
  });
2189
- _iterator12 = _createForOfIteratorHelper(bodyUpdates);
2170
+ _iterator11 = _createForOfIteratorHelper(bodyUpdates);
2190
2171
  try {
2191
- for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
2192
- _step12$value = _slicedToArray(_step12.value, 2), id = _step12$value[0], body = _step12$value[1];
2172
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
2173
+ _step11$value = _slicedToArray(_step11.value, 2), id = _step11$value[0], body = _step11$value[1];
2193
2174
  if (!appliedIds.has(id)) {
2194
2175
  this.store.list.push(body);
2195
2176
  newCount++;
2196
2177
  }
2197
2178
  }
2198
2179
  } catch (err) {
2199
- _iterator12.e(err);
2180
+ _iterator11.e(err);
2200
2181
  } finally {
2201
- _iterator12.f();
2182
+ _iterator11.f();
2202
2183
  }
2203
2184
  this.syncProductsMap();
2204
2185
  _context22.next = 10;
@@ -2231,21 +2212,21 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2231
2212
  key: "mergeProductsToStore",
2232
2213
  value: (function () {
2233
2214
  var _mergeProductsToStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(freshProducts) {
2234
- var freshMap, _iterator13, _step13, p, updatedList, newCount, _iterator14, _step14, _p2, updatedCount;
2215
+ var freshMap, _iterator12, _step12, p, updatedList, newCount, _iterator13, _step13, _p2, updatedCount;
2235
2216
  return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2236
2217
  while (1) switch (_context23.prev = _context23.next) {
2237
2218
  case 0:
2238
2219
  freshMap = new Map();
2239
- _iterator13 = _createForOfIteratorHelper(freshProducts);
2220
+ _iterator12 = _createForOfIteratorHelper(freshProducts);
2240
2221
  try {
2241
- for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
2242
- p = _step13.value;
2222
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
2223
+ p = _step12.value;
2243
2224
  freshMap.set(p.id, p);
2244
2225
  }
2245
2226
  } catch (err) {
2246
- _iterator13.e(err);
2227
+ _iterator12.e(err);
2247
2228
  } finally {
2248
- _iterator13.f();
2229
+ _iterator12.f();
2249
2230
  }
2250
2231
  updatedList = this.store.list.map(function (p) {
2251
2232
  if (freshMap.has(p.id)) {
@@ -2256,16 +2237,16 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2256
2237
  return p;
2257
2238
  }); // freshMap 中剩余的是新商品(create 场景)
2258
2239
  newCount = freshMap.size;
2259
- _iterator14 = _createForOfIteratorHelper(freshMap.values());
2240
+ _iterator13 = _createForOfIteratorHelper(freshMap.values());
2260
2241
  try {
2261
- for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
2262
- _p2 = _step14.value;
2242
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
2243
+ _p2 = _step13.value;
2263
2244
  updatedList.push(_p2);
2264
2245
  }
2265
2246
  } catch (err) {
2266
- _iterator14.e(err);
2247
+ _iterator13.e(err);
2267
2248
  } finally {
2268
- _iterator14.f();
2249
+ _iterator13.f();
2269
2250
  }
2270
2251
  updatedCount = freshProducts.length - newCount;
2271
2252
  this.store.list = updatedList;
@@ -257,7 +257,6 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
257
257
  }, {
258
258
  key: "getScheduleByIds",
259
259
  value: function getScheduleByIds(ids) {
260
- var _this2 = this;
261
260
  if (!ids || ids.length === 0) {
262
261
  this.logInfo('getScheduleByIds: 未提供有效的 ids', {
263
262
  idsCount: 0
@@ -265,21 +264,15 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
265
264
  return [];
266
265
  }
267
266
  var result = [];
268
- var scheduleList = this.store.scheduleList || [];
269
267
  var _iterator = _createForOfIteratorHelper(ids),
270
268
  _step;
271
269
  try {
272
- var _loop = function _loop() {
270
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
273
271
  var id = _step.value;
274
- var schedule = _this2.store.map.get(id) || scheduleList.find(function (item) {
275
- return String(item.id) === String(id);
276
- });
272
+ var schedule = this.store.map.get(id);
277
273
  if (schedule) {
278
274
  result.push(schedule);
279
275
  }
280
- };
281
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
282
- _loop();
283
276
  }
284
277
  } catch (err) {
285
278
  _iterator.e(err);
@@ -378,11 +371,11 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
378
371
  }, {
379
372
  key: "getDateIsInSchedule",
380
373
  value: function getDateIsInSchedule(date, scheduleList) {
381
- var _this3 = this;
374
+ var _this2 = this;
382
375
  var scheduleListData = [];
383
376
  scheduleList.forEach(function (item) {
384
377
  if (typeof item === 'number') {
385
- scheduleListData.push.apply(scheduleListData, _toConsumableArray(_this3.getScheduleByIds([item])));
378
+ scheduleListData.push.apply(scheduleListData, _toConsumableArray(_this2.getScheduleByIds([item])));
386
379
  } else {
387
380
  scheduleListData.push(item);
388
381
  }
@@ -453,7 +446,7 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
453
446
  key: "saveScheduleToIndexDB",
454
447
  value: (function () {
455
448
  var _saveScheduleToIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(scheduleList) {
456
- var _this4 = this;
449
+ var _this3 = this;
457
450
  var savePromises, errorMessage;
458
451
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
459
452
  while (1) switch (_context5.prev = _context5.next) {
@@ -474,7 +467,7 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
474
467
  case 7:
475
468
  // 逐个保存日程(每个日程是独立的记录)
476
469
  savePromises = scheduleList.map(function (schedule) {
477
- return _this4.dbManager.add(INDEXDB_STORE_NAME, schedule);
470
+ return _this3.dbManager.add(INDEXDB_STORE_NAME, schedule);
478
471
  });
479
472
  _context5.next = 10;
480
473
  return Promise.all(savePromises);