@pisell/pisellos 2.2.172 → 2.2.174

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 (34) hide show
  1. package/dist/modules/Order/index.d.ts +6 -21
  2. package/dist/modules/Order/index.js +56 -103
  3. package/dist/modules/Order/types.d.ts +3 -2
  4. package/dist/modules/Order/utils.d.ts +16 -0
  5. package/dist/modules/Order/utils.js +82 -2
  6. package/dist/modules/Quotation/index.d.ts +0 -1
  7. package/dist/modules/Quotation/index.js +8 -17
  8. package/dist/server/modules/products/index.d.ts +1 -1
  9. package/dist/server/modules/products/index.js +128 -112
  10. package/dist/solution/BaseSales/index.d.ts +4 -16
  11. package/dist/solution/BaseSales/index.js +178 -104
  12. package/dist/solution/BaseSales/types.d.ts +14 -0
  13. package/dist/solution/BaseSales/utils/quotationPrice.js +95 -17
  14. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +4 -2
  15. package/dist/solution/BookingByStep/index.d.ts +1 -1
  16. package/dist/solution/BookingTicket/index.js +10 -2
  17. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  18. package/lib/modules/Order/index.d.ts +6 -21
  19. package/lib/modules/Order/index.js +55 -100
  20. package/lib/modules/Order/types.d.ts +3 -2
  21. package/lib/modules/Order/utils.d.ts +16 -0
  22. package/lib/modules/Order/utils.js +54 -2
  23. package/lib/modules/Quotation/index.d.ts +0 -1
  24. package/lib/modules/Quotation/index.js +1 -9
  25. package/lib/server/modules/products/index.d.ts +1 -1
  26. package/lib/server/modules/products/index.js +26 -15
  27. package/lib/solution/BaseSales/index.d.ts +4 -16
  28. package/lib/solution/BaseSales/index.js +71 -35
  29. package/lib/solution/BaseSales/types.d.ts +14 -0
  30. package/lib/solution/BaseSales/utils/quotationPrice.js +90 -14
  31. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
  32. package/lib/solution/BookingByStep/index.d.ts +1 -1
  33. package/lib/solution/BookingTicket/index.js +8 -0
  34. package/package.json +1 -1
@@ -73,7 +73,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
73
73
  // 普通层 QuotationModule 桥接器:本地计算报价单价格,替代 /product/query/price
74
74
  _defineProperty(_assertThisInitialized(_this), "quotationPriceBridge", void 0);
75
75
  _defineProperty(_assertThisInitialized(_this), "quotationBridgeChannel", void 0);
76
- _defineProperty(_assertThisInitialized(_this), "quotationBridgeCustomerId", void 0);
76
+ _defineProperty(_assertThisInitialized(_this), "quotationBridgeLoadedKey", '');
77
77
  _defineProperty(_assertThisInitialized(_this), "quotationBridgeRefreshPromise", void 0);
78
78
  _defineProperty(_assertThisInitialized(_this), "quotationBridgeRefreshKey", void 0);
79
79
  // ---- 商品数据同步相关 ----
@@ -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;
280
+ var channel, quotation, scheduleCache, hasLoadedScheduleList;
281
281
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
282
282
  while (1) switch (_context3.prev = _context3.next) {
283
283
  case 0:
@@ -301,15 +301,32 @@ 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
306
  this.quotationPriceBridge.setScheduleResolver(function (id) {
305
- var _params$scheduleModul, _params$scheduleModul2, _params$scheduleModul3, _params$scheduleModul4, _params$scheduleModul5, _params$scheduleModul6;
307
+ var _params$scheduleModul3, _params$scheduleModul4, _params$scheduleModul5, _params$scheduleModul6;
306
308
  var scheduleId = String(id);
307
- var scheduleList = ((_params$scheduleModul = (_params$scheduleModul2 = params.scheduleModule).getScheduleList) === null || _params$scheduleModul === void 0 ? void 0 : _params$scheduleModul.call(_params$scheduleModul2)) || [];
308
- var schedule = scheduleList.find(function (item) {
309
- return String(item.id) === scheduleId;
310
- });
311
- if (schedule) return schedule;
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);
312
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]);
313
330
  return schedules[0];
314
331
  });
315
332
  }
@@ -337,7 +354,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
337
354
  value: (function () {
338
355
  var _refreshQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
339
356
  var _this3 = this;
340
- var customerId, refreshKey;
357
+ var refreshKey;
341
358
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
342
359
  while (1) switch (_context4.prev = _context4.next) {
343
360
  case 0:
@@ -347,37 +364,35 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
347
364
  }
348
365
  return _context4.abrupt("return");
349
366
  case 2:
350
- customerId = params && 'customer_id' in params ? params.customer_id : this.quotationBridgeCustomerId;
351
- refreshKey = this.getQuotationBridgeScopeKey(customerId);
367
+ refreshKey = this.getQuotationBridgeScopeKey();
352
368
  if (!(this.quotationBridgeRefreshPromise && this.quotationBridgeRefreshKey === refreshKey)) {
353
- _context4.next = 8;
369
+ _context4.next = 7;
354
370
  break;
355
371
  }
356
- _context4.next = 7;
372
+ _context4.next = 6;
357
373
  return this.quotationBridgeRefreshPromise;
358
- case 7:
374
+ case 6:
359
375
  return _context4.abrupt("return");
360
- case 8:
376
+ case 7:
361
377
  if (!this.quotationBridgeRefreshPromise) {
362
- _context4.next = 11;
378
+ _context4.next = 10;
363
379
  break;
364
380
  }
365
- _context4.next = 11;
381
+ _context4.next = 10;
366
382
  return this.quotationBridgeRefreshPromise;
367
- case 11:
383
+ case 10:
368
384
  this.quotationBridgeRefreshKey = refreshKey;
369
385
  this.quotationBridgeRefreshPromise = this.quotationPriceBridge.loadQuotations({
370
- channel: this.quotationBridgeChannel,
371
- customer_id: customerId
386
+ channel: this.quotationBridgeChannel
372
387
  }).then(function () {
373
- _this3.quotationBridgeCustomerId = customerId;
388
+ _this3.quotationBridgeLoadedKey = refreshKey;
374
389
  }).finally(function () {
375
390
  _this3.quotationBridgeRefreshPromise = undefined;
376
391
  _this3.quotationBridgeRefreshKey = undefined;
377
392
  });
378
- _context4.next = 15;
393
+ _context4.next = 14;
379
394
  return this.quotationBridgeRefreshPromise;
380
- case 15:
395
+ case 14:
381
396
  case "end":
382
397
  return _context4.stop();
383
398
  }
@@ -415,7 +430,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
415
430
  _context5.next = 7;
416
431
  return this.quotationBridgeRefreshPromise;
417
432
  case 7:
418
- if (!(this.getQuotationBridgeScopeKey(customerId) !== this.getQuotationBridgeScopeKey(this.quotationBridgeCustomerId))) {
433
+ if (!(this.getQuotationBridgeScopeKey() !== this.quotationBridgeLoadedKey)) {
419
434
  _context5.next = 10;
420
435
  break;
421
436
  }
@@ -436,23 +451,24 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
436
451
  }()
437
452
  }, {
438
453
  key: "getQuotationBridgeScopeKey",
439
- value: function getQuotationBridgeScopeKey(customerId) {
440
- return "".concat(this.quotationBridgeChannel || '', ":").concat(customerId !== null && customerId !== void 0 ? customerId : '');
454
+ value: function getQuotationBridgeScopeKey() {
455
+ return this.quotationBridgeChannel || '';
441
456
  }
442
457
  }, {
443
458
  key: "buildPriceDataFromQuotation",
444
459
  value: function buildPriceDataFromQuotation(product, datetime, customerId) {
445
- var _this$quotationPriceB, _ref2, _product$base_price;
460
+ var _this$quotationPriceB, _ref2, _ref3;
446
461
  var quotedPrice = (_this$quotationPriceB = this.quotationPriceBridge) === null || _this$quotationPriceB === void 0 ? void 0 : _this$quotationPriceB.getPriceForProduct({
447
462
  productId: product.id,
448
463
  datetime: datetime,
449
464
  customer_id: customerId
450
465
  });
451
466
  var productPrice = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : product.price;
467
+ 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;
452
468
  return {
453
469
  id: product.id,
454
470
  price: String(productPrice !== null && productPrice !== void 0 ? productPrice : 0),
455
- 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),
471
+ base_price: String(productBasePrice),
456
472
  variant: this.buildVariantPriceData(product, datetime, customerId),
457
473
  bundle_group: this.buildBundleGroupPriceData(product, datetime, customerId)
458
474
  };
@@ -463,15 +479,15 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
463
479
  var _this4 = this;
464
480
  if (!Array.isArray(product.variant)) return [];
465
481
  return product.variant.map(function (variant) {
466
- var _this4$quotationPrice, _ref3, _ref4, _ref5, _ref6, _ref7, _variant$base_price, _variant$product_id;
482
+ var _this4$quotationPrice, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _variant$product_id;
467
483
  var quotedPrice = (_this4$quotationPrice = _this4.quotationPriceBridge) === null || _this4$quotationPrice === void 0 ? void 0 : _this4$quotationPrice.getPriceForProduct({
468
484
  productId: product.id,
469
485
  variantId: Number(variant.id),
470
486
  datetime: datetime,
471
487
  customer_id: customerId
472
488
  });
473
- 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;
474
- 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;
489
+ 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;
490
+ 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;
475
491
  return {
476
492
  id: Number(variant.id),
477
493
  product_id: Number((_variant$product_id = variant.product_id) !== null && _variant$product_id !== void 0 ? _variant$product_id : product.id),
@@ -489,7 +505,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
489
505
  return {
490
506
  id: Number(group.id),
491
507
  bundle_item: (group.bundle_item || []).map(function (item) {
492
- var _this5$quotationPrice, _ref8, _ref9, _item$base_price, _item$product_id, _item$group_id;
508
+ var _this5$quotationPrice, _ref10, _ref11, _ref12, _item$product_id, _item$group_id;
493
509
  var bundleProductId = Number(item.bundle_product_id);
494
510
  var bundleVariantId = Number(item.bundle_variant_id || 0);
495
511
  var quotedPrice = (_this5$quotationPrice = _this5.quotationPriceBridge) === null || _this5$quotationPrice === void 0 ? void 0 : _this5$quotationPrice.getPriceForProduct({
@@ -498,8 +514,8 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
498
514
  datetime: datetime,
499
515
  customer_id: customerId
500
516
  });
501
- var price = (_ref8 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : item.price) !== null && _ref8 !== void 0 ? _ref8 : 0;
502
- 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;
517
+ var price = (_ref10 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : item.price) !== null && _ref10 !== void 0 ? _ref10 : 0;
518
+ 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;
503
519
  return {
504
520
  id: Number(item.id),
505
521
  product_id: Number((_item$product_id = item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : product.id),
@@ -532,7 +548,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
532
548
  value: (function () {
533
549
  var _getProductsWithPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(schedule_date, extraContext, options) {
534
550
  var _options$changedIds;
535
- var t0, scopedProductIds, cacheKey, scopedProductIdSet, changedIds, cachedProducts, updatedProducts, updatedMap, mergedCache, _iterator, _step, p, _iterator2, _step2, _p, errorMessage, result;
551
+ var t0, scopedProductIds, cacheKey, scopedProductIdSet, changedIds, cachedProducts, updatedProducts, updatedMap, mergedCache, _iterator2, _step2, p, _iterator3, _step3, _p, errorMessage, result;
536
552
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
537
553
  while (1) switch (_context6.prev = _context6.next) {
538
554
  case 0:
@@ -573,10 +589,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
573
589
  return [p.id, p];
574
590
  }));
575
591
  mergedCache = [];
576
- _iterator = _createForOfIteratorHelper(cachedProducts);
592
+ _iterator2 = _createForOfIteratorHelper(cachedProducts);
577
593
  try {
578
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
579
- p = _step.value;
594
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
595
+ p = _step2.value;
580
596
  if (updatedMap.has(p.id)) {
581
597
  mergedCache.push(updatedMap.get(p.id));
582
598
  updatedMap.delete(p.id);
@@ -586,20 +602,20 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
586
602
  }
587
603
  // 剩余的是新增商品(create 场景)
588
604
  } catch (err) {
589
- _iterator.e(err);
605
+ _iterator2.e(err);
590
606
  } finally {
591
- _iterator.f();
607
+ _iterator2.f();
592
608
  }
593
- _iterator2 = _createForOfIteratorHelper(updatedMap.values());
609
+ _iterator3 = _createForOfIteratorHelper(updatedMap.values());
594
610
  try {
595
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
596
- _p = _step2.value;
611
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
612
+ _p = _step3.value;
597
613
  mergedCache.push(_p);
598
614
  }
599
615
  } catch (err) {
600
- _iterator2.e(err);
616
+ _iterator3.e(err);
601
617
  } finally {
602
- _iterator2.f();
618
+ _iterator3.f();
603
619
  }
604
620
  this.productsPriceCache.set(cacheKey, mergedCache);
605
621
  this.logInfo('增量更新完成', {
@@ -834,25 +850,25 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
834
850
  }
835
851
  if (productIds.length === 0 && collectionIds.length === 0) return [];
836
852
  var result = new Set();
837
- var _iterator3 = _createForOfIteratorHelper(productIds),
838
- _step3;
853
+ var _iterator4 = _createForOfIteratorHelper(productIds),
854
+ _step4;
839
855
  try {
840
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
841
- var id = _step3.value;
856
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
857
+ var id = _step4.value;
842
858
  if (this.store.map.has(id)) result.add(id);
843
859
  }
844
860
  } catch (err) {
845
- _iterator3.e(err);
861
+ _iterator4.e(err);
846
862
  } finally {
847
- _iterator3.f();
863
+ _iterator4.f();
848
864
  }
849
865
  if (collectionIds.length === 0) return Array.from(result);
850
866
  var collectionIdSet = new Set(collectionIds);
851
- var _iterator4 = _createForOfIteratorHelper(this.getProductsRef()),
852
- _step4;
867
+ var _iterator5 = _createForOfIteratorHelper(this.getProductsRef()),
868
+ _step5;
853
869
  try {
854
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
855
- var product = _step4.value;
870
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
871
+ var product = _step5.value;
856
872
  if (result.has(product.id)) continue;
857
873
  if (!Array.isArray(product.collection)) continue;
858
874
  var isInCollection = product.collection.some(function (collection) {
@@ -861,9 +877,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
861
877
  if (isInCollection) result.add(product.id);
862
878
  }
863
879
  } catch (err) {
864
- _iterator4.e(err);
880
+ _iterator5.e(err);
865
881
  } finally {
866
- _iterator4.f();
882
+ _iterator5.f();
867
883
  }
868
884
  return Array.from(result);
869
885
  }
@@ -1142,11 +1158,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1142
1158
  key: "fetchProductsByHttp",
1143
1159
  value: (function () {
1144
1160
  var _fetchProductsByHttp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
1145
- 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;
1161
+ 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;
1146
1162
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1147
1163
  while (1) switch (_context10.prev = _context10.next) {
1148
1164
  case 0:
1149
- _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;
1165
+ _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;
1150
1166
  this.logInfo('fetchProductsByHttp: 开始请求', {
1151
1167
  categoryIdsCount: category_ids.length,
1152
1168
  productIdsCount: product_ids.length,
@@ -1294,18 +1310,18 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1294
1310
  key: "getProductsRefByIds",
1295
1311
  value: function getProductsRefByIds(ids) {
1296
1312
  var products = [];
1297
- var _iterator5 = _createForOfIteratorHelper(ids),
1298
- _step5;
1313
+ var _iterator6 = _createForOfIteratorHelper(ids),
1314
+ _step6;
1299
1315
  try {
1300
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1301
- var id = _step5.value;
1316
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1317
+ var id = _step6.value;
1302
1318
  var product = this.store.map.get(id);
1303
1319
  if (product) products.push(product);
1304
1320
  }
1305
1321
  } catch (err) {
1306
- _iterator5.e(err);
1322
+ _iterator6.e(err);
1307
1323
  } finally {
1308
- _iterator5.f();
1324
+ _iterator6.f();
1309
1325
  }
1310
1326
  return products;
1311
1327
  }
@@ -1344,7 +1360,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1344
1360
  key: "removeProductsByIds",
1345
1361
  value: (function () {
1346
1362
  var _removeProductsByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(ids) {
1347
- var idSet, _iterator6, _step6, _id, _iterator7, _step7, id, errorMessage, _iterator8, _step8, _step8$value, dateKey, cachedProducts;
1363
+ var idSet, _iterator7, _step7, _id, _iterator8, _step8, id, errorMessage, _iterator9, _step9, _step9$value, dateKey, cachedProducts;
1348
1364
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1349
1365
  while (1) switch (_context14.prev = _context14.next) {
1350
1366
  case 0:
@@ -1356,31 +1372,31 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1356
1372
  this.store.list = this.store.list.filter(function (p) {
1357
1373
  return !idSet.has(p.id);
1358
1374
  });
1359
- _iterator6 = _createForOfIteratorHelper(ids);
1375
+ _iterator7 = _createForOfIteratorHelper(ids);
1360
1376
  try {
1361
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1362
- _id = _step6.value;
1377
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1378
+ _id = _step7.value;
1363
1379
  this.store.map.delete(_id);
1364
1380
  }
1365
1381
  } catch (err) {
1366
- _iterator6.e(err);
1382
+ _iterator7.e(err);
1367
1383
  } finally {
1368
- _iterator6.f();
1384
+ _iterator7.f();
1369
1385
  }
1370
1386
  if (!this.dbManager) {
1371
1387
  _context14.next = 30;
1372
1388
  break;
1373
1389
  }
1374
1390
  _context14.prev = 6;
1375
- _iterator7 = _createForOfIteratorHelper(ids);
1391
+ _iterator8 = _createForOfIteratorHelper(ids);
1376
1392
  _context14.prev = 8;
1377
- _iterator7.s();
1393
+ _iterator8.s();
1378
1394
  case 10:
1379
- if ((_step7 = _iterator7.n()).done) {
1395
+ if ((_step8 = _iterator8.n()).done) {
1380
1396
  _context14.next = 16;
1381
1397
  break;
1382
1398
  }
1383
- id = _step7.value;
1399
+ id = _step8.value;
1384
1400
  _context14.next = 14;
1385
1401
  return this.dbManager.delete(INDEXDB_STORE_NAME, id);
1386
1402
  case 14:
@@ -1392,10 +1408,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1392
1408
  case 18:
1393
1409
  _context14.prev = 18;
1394
1410
  _context14.t0 = _context14["catch"](8);
1395
- _iterator7.e(_context14.t0);
1411
+ _iterator8.e(_context14.t0);
1396
1412
  case 21:
1397
1413
  _context14.prev = 21;
1398
- _iterator7.f();
1414
+ _iterator8.f();
1399
1415
  return _context14.finish(21);
1400
1416
  case 24:
1401
1417
  _context14.next = 30;
@@ -1409,18 +1425,18 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1409
1425
  error: errorMessage
1410
1426
  });
1411
1427
  case 30:
1412
- _iterator8 = _createForOfIteratorHelper(this.productsPriceCache.entries());
1428
+ _iterator9 = _createForOfIteratorHelper(this.productsPriceCache.entries());
1413
1429
  try {
1414
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
1415
- _step8$value = _slicedToArray(_step8.value, 2), dateKey = _step8$value[0], cachedProducts = _step8$value[1];
1430
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1431
+ _step9$value = _slicedToArray(_step9.value, 2), dateKey = _step9$value[0], cachedProducts = _step9$value[1];
1416
1432
  this.productsPriceCache.set(dateKey, cachedProducts.filter(function (p) {
1417
1433
  return !idSet.has(p.id);
1418
1434
  }));
1419
1435
  }
1420
1436
  } catch (err) {
1421
- _iterator8.e(err);
1437
+ _iterator9.e(err);
1422
1438
  } finally {
1423
- _iterator8.f();
1439
+ _iterator9.f();
1424
1440
  }
1425
1441
  this.core.effects.emit(ProductsHooks.onProductsChanged, this.store.list);
1426
1442
  this.logInfo('removeProductsByIds 完成', {
@@ -1660,17 +1676,17 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1660
1676
  value: function syncProductsMap() {
1661
1677
  var t0 = performance.now();
1662
1678
  this.store.map.clear();
1663
- var _iterator9 = _createForOfIteratorHelper(this.store.list),
1664
- _step9;
1679
+ var _iterator10 = _createForOfIteratorHelper(this.store.list),
1680
+ _step10;
1665
1681
  try {
1666
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1667
- var product = _step9.value;
1682
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
1683
+ var product = _step10.value;
1668
1684
  this.store.map.set(product.id, product);
1669
1685
  }
1670
1686
  } catch (err) {
1671
- _iterator9.e(err);
1687
+ _iterator10.e(err);
1672
1688
  } finally {
1673
- _iterator9.f();
1689
+ _iterator10.f();
1674
1690
  }
1675
1691
  perfMark('syncProductsMap', performance.now() - t0, {
1676
1692
  count: this.store.map.size
@@ -1882,7 +1898,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1882
1898
  key: "processProductSyncMessages",
1883
1899
  value: (function () {
1884
1900
  var _processProductSyncMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1885
- 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;
1901
+ 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;
1886
1902
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1887
1903
  while (1) switch (_context20.prev = _context20.next) {
1888
1904
  case 0:
@@ -1902,15 +1918,15 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1902
1918
  sseRefreshIds = [];
1903
1919
  priceRefreshIds = [];
1904
1920
  shouldClearPriceCache = false;
1905
- _iterator10 = _createForOfIteratorHelper(messages);
1921
+ _iterator11 = _createForOfIteratorHelper(messages);
1906
1922
  _context20.prev = 11;
1907
- _iterator10.s();
1923
+ _iterator11.s();
1908
1924
  case 13:
1909
- if ((_step10 = _iterator10.n()).done) {
1925
+ if ((_step11 = _iterator11.n()).done) {
1910
1926
  _context20.next = 36;
1911
1927
  break;
1912
1928
  }
1913
- msg = _step10.value;
1929
+ msg = _step11.value;
1914
1930
  channelKey = msg._channelKey || msg.module || 'product';
1915
1931
  if (!(channelKey === 'product')) {
1916
1932
  _context20.next = 33;
@@ -1976,10 +1992,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1976
1992
  case 38:
1977
1993
  _context20.prev = 38;
1978
1994
  _context20.t0 = _context20["catch"](11);
1979
- _iterator10.e(_context20.t0);
1995
+ _iterator11.e(_context20.t0);
1980
1996
  case 41:
1981
1997
  _context20.prev = 41;
1982
- _iterator10.f();
1998
+ _iterator11.f();
1983
1999
  return _context20.finish(41);
1984
2000
  case 44:
1985
2001
  uniqueDeleteIds = _toConsumableArray(new Set(deleteIds));
@@ -2150,7 +2166,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2150
2166
  key: "applyBodyUpdatesToStore",
2151
2167
  value: (function () {
2152
2168
  var _applyBodyUpdatesToStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(bodyUpdates) {
2153
- var updatedCount, newCount, appliedIds, _iterator11, _step11, _step11$value, id, body;
2169
+ var updatedCount, newCount, appliedIds, _iterator12, _step12, _step12$value, id, body;
2154
2170
  return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2155
2171
  while (1) switch (_context22.prev = _context22.next) {
2156
2172
  case 0:
@@ -2168,19 +2184,19 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2168
2184
  }
2169
2185
  return p;
2170
2186
  });
2171
- _iterator11 = _createForOfIteratorHelper(bodyUpdates);
2187
+ _iterator12 = _createForOfIteratorHelper(bodyUpdates);
2172
2188
  try {
2173
- for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
2174
- _step11$value = _slicedToArray(_step11.value, 2), id = _step11$value[0], body = _step11$value[1];
2189
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
2190
+ _step12$value = _slicedToArray(_step12.value, 2), id = _step12$value[0], body = _step12$value[1];
2175
2191
  if (!appliedIds.has(id)) {
2176
2192
  this.store.list.push(body);
2177
2193
  newCount++;
2178
2194
  }
2179
2195
  }
2180
2196
  } catch (err) {
2181
- _iterator11.e(err);
2197
+ _iterator12.e(err);
2182
2198
  } finally {
2183
- _iterator11.f();
2199
+ _iterator12.f();
2184
2200
  }
2185
2201
  this.syncProductsMap();
2186
2202
  _context22.next = 10;
@@ -2213,21 +2229,21 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2213
2229
  key: "mergeProductsToStore",
2214
2230
  value: (function () {
2215
2231
  var _mergeProductsToStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(freshProducts) {
2216
- var freshMap, _iterator12, _step12, p, updatedList, newCount, _iterator13, _step13, _p2, updatedCount;
2232
+ var freshMap, _iterator13, _step13, p, updatedList, newCount, _iterator14, _step14, _p2, updatedCount;
2217
2233
  return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2218
2234
  while (1) switch (_context23.prev = _context23.next) {
2219
2235
  case 0:
2220
2236
  freshMap = new Map();
2221
- _iterator12 = _createForOfIteratorHelper(freshProducts);
2237
+ _iterator13 = _createForOfIteratorHelper(freshProducts);
2222
2238
  try {
2223
- for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
2224
- p = _step12.value;
2239
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
2240
+ p = _step13.value;
2225
2241
  freshMap.set(p.id, p);
2226
2242
  }
2227
2243
  } catch (err) {
2228
- _iterator12.e(err);
2244
+ _iterator13.e(err);
2229
2245
  } finally {
2230
- _iterator12.f();
2246
+ _iterator13.f();
2231
2247
  }
2232
2248
  updatedList = this.store.list.map(function (p) {
2233
2249
  if (freshMap.has(p.id)) {
@@ -2238,16 +2254,16 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2238
2254
  return p;
2239
2255
  }); // freshMap 中剩余的是新商品(create 场景)
2240
2256
  newCount = freshMap.size;
2241
- _iterator13 = _createForOfIteratorHelper(freshMap.values());
2257
+ _iterator14 = _createForOfIteratorHelper(freshMap.values());
2242
2258
  try {
2243
- for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
2244
- _p2 = _step13.value;
2259
+ for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
2260
+ _p2 = _step14.value;
2245
2261
  updatedList.push(_p2);
2246
2262
  }
2247
2263
  } catch (err) {
2248
- _iterator13.e(err);
2264
+ _iterator14.e(err);
2249
2265
  } finally {
2250
- _iterator13.f();
2266
+ _iterator14.f();
2251
2267
  }
2252
2268
  updatedCount = freshProducts.length - newCount;
2253
2269
  this.store.list = updatedList;
@@ -39,6 +39,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
39
39
  window: WindowPlugin;
40
40
  request: RequestPlugin;
41
41
  protected currentSalesDetail: ISalesDetail | null;
42
+ protected discountConfigCacheKey: string | null;
43
+ protected hasManualDiscountSelection: boolean;
42
44
  constructor(name?: string, version?: string);
43
45
  /**
44
46
  * 子类可覆盖此方法以追加/收敛要注册的子模块。
@@ -113,23 +115,9 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
113
115
  updateRemoteOrderNote(orderId: number | string, note: string): void;
114
116
  updateTempOrderShopDiscount(amount: string | number): string;
115
117
  updateTempOrderContactsInfo(contactsInfo: Record<string, any> | null): Record<string, any> | null;
116
- /**
117
- * 运行时切换 tempOrder 是否写入 localStorage(委托 OrderModule)。
118
- * SalesSdk 等内存态场景可在挂载后设为 false,避免污染本地缓存。
119
- *
120
- * @example
121
- * bookingTicket.setEnableTempOrderPersist(false);
122
- * await bookingTicket.addProductToOrder(product);
123
- */
118
+ /** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
124
119
  setEnableTempOrderPersist(enabled: boolean): void;
125
- /**
126
- * 读取当前 tempOrder localStorage 持久化开关(委托 OrderModule)。
127
- *
128
- * @example
129
- * if (bookingTicket.isTempOrderPersistEnabled()) {
130
- * bookingTicket.restoreOrder();
131
- * }
132
- */
120
+ /** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
133
121
  isTempOrderPersistEnabled(): boolean;
134
122
  private ensureTempOrder;
135
123
  addNewOrder(): Promise<OrderTempOrder>;