@pisell/pisellos 2.2.153 → 2.2.154

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 (80) hide show
  1. package/dist/core/index.js +1 -0
  2. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  3. package/dist/modules/Cart/utils/cartProduct.js +1 -1
  4. package/dist/modules/Order/index.d.ts +2 -0
  5. package/dist/modules/Order/index.js +231 -160
  6. package/dist/modules/Order/types.d.ts +19 -0
  7. package/dist/modules/Order/utils.js +7 -6
  8. package/dist/modules/Payment/index.d.ts +4 -0
  9. package/dist/modules/Payment/index.js +567 -505
  10. package/dist/modules/Payment/types.d.ts +29 -9
  11. package/dist/modules/SalesSummary/index.d.ts +7 -5
  12. package/dist/modules/SalesSummary/index.js +35 -11
  13. package/dist/plugins/app.d.ts +2 -0
  14. package/dist/server/index.d.ts +2 -5
  15. package/dist/server/index.js +58 -66
  16. package/dist/server/modules/index.d.ts +1 -1
  17. package/dist/server/modules/products/index.d.ts +12 -1
  18. package/dist/server/modules/products/index.js +169 -78
  19. package/dist/server/modules/products/types.d.ts +11 -0
  20. package/dist/server/modules/products/types.js +4 -0
  21. package/dist/server/utils/product.js +2 -2
  22. package/dist/solution/BaseSales/index.d.ts +26 -2
  23. package/dist/solution/BaseSales/index.js +342 -112
  24. package/dist/solution/BaseSales/types.d.ts +4 -4
  25. package/dist/solution/BaseSales/types.js +4 -4
  26. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +62 -0
  27. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +116 -0
  28. package/dist/solution/BaseSales/utils.js +3 -3
  29. package/dist/solution/BookingTicket/index.d.ts +11 -13
  30. package/dist/solution/BookingTicket/index.js +23 -37
  31. package/dist/solution/BookingTicket/types.d.ts +9 -6
  32. package/dist/solution/BookingTicket/types.js +6 -3
  33. package/dist/solution/BookingTicket/utils/cartView.d.ts +7 -12
  34. package/dist/solution/BookingTicket/utils/cartView.js +52 -14
  35. package/dist/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
  36. package/dist/solution/BookingTicket/utils/orderCustomer.js +31 -0
  37. package/dist/solution/Sales/index.d.ts +3 -0
  38. package/dist/solution/Sales/index.js +85 -43
  39. package/dist/solution/Sales/types.d.ts +3 -0
  40. package/dist/solution/ScanOrder/types.d.ts +4 -4
  41. package/dist/solution/ScanOrder/types.js +4 -4
  42. package/dist/solution/ScanOrder/utils.js +3 -3
  43. package/lib/core/index.js +1 -0
  44. package/lib/modules/Cart/utils/cartProduct.js +1 -1
  45. package/lib/modules/Order/index.d.ts +2 -0
  46. package/lib/modules/Order/index.js +39 -7
  47. package/lib/modules/Order/types.d.ts +19 -0
  48. package/lib/modules/Order/utils.js +4 -2
  49. package/lib/modules/Payment/index.d.ts +4 -0
  50. package/lib/modules/Payment/index.js +26 -2
  51. package/lib/modules/Payment/types.d.ts +29 -9
  52. package/lib/modules/SalesSummary/index.d.ts +7 -5
  53. package/lib/modules/SalesSummary/index.js +29 -9
  54. package/lib/plugins/app.d.ts +2 -0
  55. package/lib/server/index.d.ts +2 -5
  56. package/lib/server/index.js +38 -58
  57. package/lib/server/modules/index.d.ts +1 -1
  58. package/lib/server/modules/products/index.d.ts +12 -1
  59. package/lib/server/modules/products/index.js +69 -9
  60. package/lib/server/modules/products/types.d.ts +11 -0
  61. package/lib/server/utils/product.js +2 -2
  62. package/lib/solution/BaseSales/index.d.ts +26 -2
  63. package/lib/solution/BaseSales/index.js +169 -3
  64. package/lib/solution/BaseSales/types.d.ts +4 -4
  65. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +62 -0
  66. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +155 -0
  67. package/lib/solution/BaseSales/utils.js +3 -3
  68. package/lib/solution/BookingTicket/index.d.ts +11 -13
  69. package/lib/solution/BookingTicket/index.js +17 -27
  70. package/lib/solution/BookingTicket/types.d.ts +9 -6
  71. package/lib/solution/BookingTicket/utils/cartView.d.ts +7 -12
  72. package/lib/solution/BookingTicket/utils/cartView.js +44 -18
  73. package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
  74. package/lib/solution/BookingTicket/utils/orderCustomer.js +58 -0
  75. package/lib/solution/Sales/index.d.ts +3 -0
  76. package/lib/solution/Sales/index.js +50 -15
  77. package/lib/solution/Sales/types.d.ts +3 -0
  78. package/lib/solution/ScanOrder/types.d.ts +4 -4
  79. package/lib/solution/ScanOrder/utils.js +3 -3
  80. package/package.json +1 -1
@@ -523,26 +523,32 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
523
523
  * @param extraContext 额外的上下文数据(可选,由 Server 层传入)
524
524
  * @param options 可选参数
525
525
  * @param options.changedIds 变更的商品 IDs,非空时仅对这些商品增量执行 prepare 并更新缓存
526
+ * @param options.productIds 指定商品 IDs,仅对这些商品执行价格计算;不传则处理全量
526
527
  * @returns 应用了价格的商品列表
527
528
  */
528
529
  }, {
529
530
  key: "getProductsWithPrice",
530
531
  value: (function () {
531
532
  var _getProductsWithPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(schedule_date, extraContext, options) {
532
- var t0, cacheKey, changedIds, cachedProducts, updatedProducts, updatedMap, mergedCache, _iterator, _step, p, _iterator2, _step2, _p, errorMessage, result;
533
+ var _options$changedIds;
534
+ var t0, scopedProductIds, cacheKey, scopedProductIdSet, changedIds, cachedProducts, updatedProducts, updatedMap, mergedCache, _iterator, _step, p, _iterator2, _step2, _p, errorMessage, result;
533
535
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
534
536
  while (1) switch (_context6.prev = _context6.next) {
535
537
  case 0:
536
538
  t0 = performance.now();
537
- cacheKey = this.getProductsPriceCacheKey(schedule_date, extraContext);
538
- changedIds = options === null || options === void 0 ? void 0 : options.changedIds;
539
+ scopedProductIds = this.normalizeProductIds(options === null || options === void 0 ? void 0 : options.productIds);
540
+ cacheKey = this.getProductsPriceCacheKey(schedule_date, extraContext, scopedProductIds);
541
+ scopedProductIdSet = scopedProductIds ? new Set(scopedProductIds) : undefined;
542
+ changedIds = scopedProductIdSet ? options === null || options === void 0 || (_options$changedIds = options.changedIds) === null || _options$changedIds === void 0 ? void 0 : _options$changedIds.filter(function (id) {
543
+ return scopedProductIdSet.has(id);
544
+ }) : options === null || options === void 0 ? void 0 : options.changedIds;
539
545
  if (!this.productsPriceCache.has(cacheKey)) {
540
- _context6.next = 33;
546
+ _context6.next = 35;
541
547
  break;
542
548
  }
543
549
  cachedProducts = this.productsPriceCache.get(cacheKey); // 有变更的商品 → 增量 prepare 后 merge 回缓存
544
550
  if (!(changedIds && changedIds.length > 0)) {
545
- _context6.next = 30;
551
+ _context6.next = 32;
546
552
  break;
547
553
  }
548
554
  this.logInfo('商品价格缓存命中,增量更新变更商品', {
@@ -550,15 +556,15 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
550
556
  changedIds: changedIds,
551
557
  cachedProductCount: cachedProducts.length
552
558
  });
553
- _context6.prev = 7;
554
- _context6.next = 10;
559
+ _context6.prev = 9;
560
+ _context6.next = 12;
555
561
  return this.prepareProductsWithPrice(schedule_date, extraContext, {
556
562
  productIds: changedIds
557
563
  });
558
- case 10:
564
+ case 12:
559
565
  updatedProducts = _context6.sent;
560
566
  if (!(updatedProducts.length > 0)) {
561
- _context6.next = 22;
567
+ _context6.next = 24;
562
568
  break;
563
569
  }
564
570
  // merge:用更新结果替换缓存中对应的商品,新增的追加
@@ -606,26 +612,26 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
606
612
  count: mergedCache.length
607
613
  });
608
614
  return _context6.abrupt("return", mergedCache);
609
- case 22:
610
- _context6.next = 28;
611
- break;
612
615
  case 24:
613
- _context6.prev = 24;
614
- _context6.t0 = _context6["catch"](7);
616
+ _context6.next = 30;
617
+ break;
618
+ case 26:
619
+ _context6.prev = 26;
620
+ _context6.t0 = _context6["catch"](9);
615
621
  errorMessage = _context6.t0 instanceof Error ? _context6.t0.message : String(_context6.t0);
616
622
  this.logError('增量更新失败,返回现有缓存', {
617
623
  cacheKey: cacheKey,
618
624
  changedIds: changedIds,
619
625
  error: errorMessage
620
626
  });
621
- case 28:
627
+ case 30:
622
628
  perfMark('getProductsWithPrice(incrementalUpdate)', performance.now() - t0, {
623
629
  cacheKey: cacheKey,
624
630
  changedCount: changedIds.length,
625
631
  count: cachedProducts.length
626
632
  });
627
633
  return _context6.abrupt("return", cachedProducts);
628
- case 30:
634
+ case 32:
629
635
  perfMark('getProductsWithPrice(cacheHit)', performance.now() - t0, {
630
636
  cacheKey: cacheKey,
631
637
  count: cachedProducts.length
@@ -635,13 +641,16 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
635
641
  productCount: cachedProducts.length
636
642
  });
637
643
  return _context6.abrupt("return", cachedProducts);
638
- case 33:
644
+ case 35:
639
645
  this.logInfo('商品价格缓存未命中,准备获取', {
640
- cacheKey: cacheKey
646
+ cacheKey: cacheKey,
647
+ scopedProductCount: scopedProductIds === null || scopedProductIds === void 0 ? void 0 : scopedProductIds.length
641
648
  });
642
- _context6.next = 36;
643
- return this.prepareProductsWithPrice(schedule_date, extraContext);
644
- case 36:
649
+ _context6.next = 38;
650
+ return this.prepareProductsWithPrice(schedule_date, extraContext, scopedProductIds ? {
651
+ productIds: scopedProductIds
652
+ } : undefined);
653
+ case 38:
645
654
  result = _context6.sent;
646
655
  this.productsPriceCache.set(cacheKey, result);
647
656
  this.logInfo('商品价格已缓存', {
@@ -654,11 +663,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
654
663
  count: result.length
655
664
  });
656
665
  return _context6.abrupt("return", result);
657
- case 42:
666
+ case 44:
658
667
  case "end":
659
668
  return _context6.stop();
660
669
  }
661
- }, _callee6, this, [[7, 24]]);
670
+ }, _callee6, this, [[9, 26]]);
662
671
  }));
663
672
  function getProductsWithPrice(_x7, _x8, _x9) {
664
673
  return _getProductsWithPrice.apply(this, arguments);
@@ -679,13 +688,13 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
679
688
  key: "prepareProductsWithPrice",
680
689
  value: (function () {
681
690
  var _prepareProductsWithPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(schedule_date, extraContext, options) {
682
- var tTotal, targetIds, isIncremental, _priceData$length, _this$core, products, ids, idSet, tIds, i, tPrice, priceData, context, tFormat, processedProducts, errorMessage;
691
+ var tTotal, targetIds, isIncremental, _priceData$length, _this$core, products, ids, tIds, i, tPrice, priceData, context, tFormat, processedProducts, errorMessage;
683
692
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
684
693
  while (1) switch (_context7.prev = _context7.next) {
685
694
  case 0:
686
695
  tTotal = performance.now();
687
696
  targetIds = options === null || options === void 0 ? void 0 : options.productIds;
688
- isIncremental = targetIds && targetIds.length > 0;
697
+ isIncremental = Array.isArray(targetIds);
689
698
  this.logInfo('prepareProductsWithPrice 开始处理', {
690
699
  schedule_date: schedule_date,
691
700
  mode: isIncremental ? 'incremental' : 'full',
@@ -695,10 +704,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
695
704
  // 1. 获取商品列表:指定 IDs 时从 store 取子集,否则取全量
696
705
 
697
706
  if (isIncremental) {
698
- idSet = new Set(targetIds);
699
- products = this.getProductsRef().filter(function (p) {
700
- return idSet.has(p.id);
701
- });
707
+ products = this.getProductsRefByIds(targetIds);
702
708
  ids = products.map(function (p) {
703
709
  return p.id;
704
710
  });
@@ -793,10 +799,72 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
793
799
  }())
794
800
  }, {
795
801
  key: "getProductsPriceCacheKey",
796
- value: function getProductsPriceCacheKey(schedule_date, extraContext) {
802
+ value: function getProductsPriceCacheKey(schedule_date, extraContext, productIds) {
797
803
  var _extraContext$custome;
798
804
  var datetime = (extraContext === null || extraContext === void 0 ? void 0 : extraContext.schedule_datetime) || schedule_date;
799
- return "".concat(datetime, ":customer:").concat((_extraContext$custome = extraContext === null || extraContext === void 0 ? void 0 : extraContext.customer_id) !== null && _extraContext$custome !== void 0 ? _extraContext$custome : '');
805
+ var productScope = productIds ? ":products:".concat(productIds.join(',')) : '';
806
+ return "".concat(datetime, ":customer:").concat((_extraContext$custome = extraContext === null || extraContext === void 0 ? void 0 : extraContext.customer_id) !== null && _extraContext$custome !== void 0 ? _extraContext$custome : '').concat(productScope);
807
+ }
808
+ }, {
809
+ key: "normalizeProductIds",
810
+ value: function normalizeProductIds(productIds) {
811
+ if (!Array.isArray(productIds)) return undefined;
812
+ return Array.from(new Set(productIds.map(function (id) {
813
+ return Number(id);
814
+ }).filter(function (id) {
815
+ return Number.isFinite(id);
816
+ }))).sort(function (a, b) {
817
+ return a - b;
818
+ });
819
+ }
820
+
821
+ /**
822
+ * 按轻量范围返回商品 ID,不做 structuredClone。
823
+ */
824
+ }, {
825
+ key: "getProductIdsByScope",
826
+ value: function getProductIdsByScope(scope) {
827
+ var productIds = this.normalizeProductIds(scope.productIds) || [];
828
+ var collectionIds = this.normalizeProductIds(scope.collectionIds) || [];
829
+ if (scope.isAllProducts) {
830
+ return this.getProductsRef().map(function (product) {
831
+ return product.id;
832
+ });
833
+ }
834
+ if (productIds.length === 0 && collectionIds.length === 0) return [];
835
+ var result = new Set();
836
+ var _iterator3 = _createForOfIteratorHelper(productIds),
837
+ _step3;
838
+ try {
839
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
840
+ var id = _step3.value;
841
+ if (this.store.map.has(id)) result.add(id);
842
+ }
843
+ } catch (err) {
844
+ _iterator3.e(err);
845
+ } finally {
846
+ _iterator3.f();
847
+ }
848
+ if (collectionIds.length === 0) return Array.from(result);
849
+ var collectionIdSet = new Set(collectionIds);
850
+ var _iterator4 = _createForOfIteratorHelper(this.getProductsRef()),
851
+ _step4;
852
+ try {
853
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
854
+ var product = _step4.value;
855
+ if (result.has(product.id)) continue;
856
+ if (!Array.isArray(product.collection)) continue;
857
+ var isInCollection = product.collection.some(function (collection) {
858
+ return collectionIdSet.has(collection.id);
859
+ });
860
+ if (isInCollection) result.add(product.id);
861
+ }
862
+ } catch (err) {
863
+ _iterator4.e(err);
864
+ } finally {
865
+ _iterator4.f();
866
+ }
867
+ return Array.from(result);
800
868
  }
801
869
 
802
870
  /**
@@ -1218,6 +1286,29 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1218
1286
  return this.store.list;
1219
1287
  }
1220
1288
 
1289
+ /**
1290
+ * 按 ID 从 Map 取商品引用,供内部 formatter 流程使用。
1291
+ */
1292
+ }, {
1293
+ key: "getProductsRefByIds",
1294
+ value: function getProductsRefByIds(ids) {
1295
+ var products = [];
1296
+ var _iterator5 = _createForOfIteratorHelper(ids),
1297
+ _step5;
1298
+ try {
1299
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1300
+ var id = _step5.value;
1301
+ var product = this.store.map.get(id);
1302
+ if (product) products.push(product);
1303
+ }
1304
+ } catch (err) {
1305
+ _iterator5.e(err);
1306
+ } finally {
1307
+ _iterator5.f();
1308
+ }
1309
+ return products;
1310
+ }
1311
+
1221
1312
  /**
1222
1313
  * 根据ID获取单个商品(从内存缓存)
1223
1314
  * 使用 Map 快速查询,时间复杂度 O(1)
@@ -1252,7 +1343,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1252
1343
  key: "removeProductsByIds",
1253
1344
  value: (function () {
1254
1345
  var _removeProductsByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(ids) {
1255
- var idSet, _iterator3, _step3, _id, _iterator4, _step4, id, errorMessage, _iterator5, _step5, _step5$value, dateKey, cachedProducts;
1346
+ var idSet, _iterator6, _step6, _id, _iterator7, _step7, id, errorMessage, _iterator8, _step8, _step8$value, dateKey, cachedProducts;
1256
1347
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1257
1348
  while (1) switch (_context14.prev = _context14.next) {
1258
1349
  case 0:
@@ -1264,31 +1355,31 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1264
1355
  this.store.list = this.store.list.filter(function (p) {
1265
1356
  return !idSet.has(p.id);
1266
1357
  });
1267
- _iterator3 = _createForOfIteratorHelper(ids);
1358
+ _iterator6 = _createForOfIteratorHelper(ids);
1268
1359
  try {
1269
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1270
- _id = _step3.value;
1360
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1361
+ _id = _step6.value;
1271
1362
  this.store.map.delete(_id);
1272
1363
  }
1273
1364
  } catch (err) {
1274
- _iterator3.e(err);
1365
+ _iterator6.e(err);
1275
1366
  } finally {
1276
- _iterator3.f();
1367
+ _iterator6.f();
1277
1368
  }
1278
1369
  if (!this.dbManager) {
1279
1370
  _context14.next = 30;
1280
1371
  break;
1281
1372
  }
1282
1373
  _context14.prev = 6;
1283
- _iterator4 = _createForOfIteratorHelper(ids);
1374
+ _iterator7 = _createForOfIteratorHelper(ids);
1284
1375
  _context14.prev = 8;
1285
- _iterator4.s();
1376
+ _iterator7.s();
1286
1377
  case 10:
1287
- if ((_step4 = _iterator4.n()).done) {
1378
+ if ((_step7 = _iterator7.n()).done) {
1288
1379
  _context14.next = 16;
1289
1380
  break;
1290
1381
  }
1291
- id = _step4.value;
1382
+ id = _step7.value;
1292
1383
  _context14.next = 14;
1293
1384
  return this.dbManager.delete(INDEXDB_STORE_NAME, id);
1294
1385
  case 14:
@@ -1300,10 +1391,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1300
1391
  case 18:
1301
1392
  _context14.prev = 18;
1302
1393
  _context14.t0 = _context14["catch"](8);
1303
- _iterator4.e(_context14.t0);
1394
+ _iterator7.e(_context14.t0);
1304
1395
  case 21:
1305
1396
  _context14.prev = 21;
1306
- _iterator4.f();
1397
+ _iterator7.f();
1307
1398
  return _context14.finish(21);
1308
1399
  case 24:
1309
1400
  _context14.next = 30;
@@ -1317,18 +1408,18 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1317
1408
  error: errorMessage
1318
1409
  });
1319
1410
  case 30:
1320
- _iterator5 = _createForOfIteratorHelper(this.productsPriceCache.entries());
1411
+ _iterator8 = _createForOfIteratorHelper(this.productsPriceCache.entries());
1321
1412
  try {
1322
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1323
- _step5$value = _slicedToArray(_step5.value, 2), dateKey = _step5$value[0], cachedProducts = _step5$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];
1324
1415
  this.productsPriceCache.set(dateKey, cachedProducts.filter(function (p) {
1325
1416
  return !idSet.has(p.id);
1326
1417
  }));
1327
1418
  }
1328
1419
  } catch (err) {
1329
- _iterator5.e(err);
1420
+ _iterator8.e(err);
1330
1421
  } finally {
1331
- _iterator5.f();
1422
+ _iterator8.f();
1332
1423
  }
1333
1424
  this.core.effects.emit(ProductsHooks.onProductsChanged, this.store.list);
1334
1425
  this.logInfo('removeProductsByIds 完成', {
@@ -1568,17 +1659,17 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1568
1659
  value: function syncProductsMap() {
1569
1660
  var t0 = performance.now();
1570
1661
  this.store.map.clear();
1571
- var _iterator6 = _createForOfIteratorHelper(this.store.list),
1572
- _step6;
1662
+ var _iterator9 = _createForOfIteratorHelper(this.store.list),
1663
+ _step9;
1573
1664
  try {
1574
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1575
- var product = _step6.value;
1665
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1666
+ var product = _step9.value;
1576
1667
  this.store.map.set(product.id, product);
1577
1668
  }
1578
1669
  } catch (err) {
1579
- _iterator6.e(err);
1670
+ _iterator9.e(err);
1580
1671
  } finally {
1581
- _iterator6.f();
1672
+ _iterator9.f();
1582
1673
  }
1583
1674
  perfMark('syncProductsMap', performance.now() - t0, {
1584
1675
  count: this.store.map.size
@@ -1790,7 +1881,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1790
1881
  key: "processProductSyncMessages",
1791
1882
  value: (function () {
1792
1883
  var _processProductSyncMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1793
- var messages, deleteIds, bodyUpdates, sseRefreshIds, priceRefreshIds, shouldClearPriceCache, _iterator7, _step7, 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;
1794
1885
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1795
1886
  while (1) switch (_context20.prev = _context20.next) {
1796
1887
  case 0:
@@ -1810,15 +1901,15 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1810
1901
  sseRefreshIds = [];
1811
1902
  priceRefreshIds = [];
1812
1903
  shouldClearPriceCache = false;
1813
- _iterator7 = _createForOfIteratorHelper(messages);
1904
+ _iterator10 = _createForOfIteratorHelper(messages);
1814
1905
  _context20.prev = 11;
1815
- _iterator7.s();
1906
+ _iterator10.s();
1816
1907
  case 13:
1817
- if ((_step7 = _iterator7.n()).done) {
1908
+ if ((_step10 = _iterator10.n()).done) {
1818
1909
  _context20.next = 36;
1819
1910
  break;
1820
1911
  }
1821
- msg = _step7.value;
1912
+ msg = _step10.value;
1822
1913
  channelKey = msg._channelKey || msg.module || 'product';
1823
1914
  if (!(channelKey === 'product')) {
1824
1915
  _context20.next = 33;
@@ -1884,10 +1975,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1884
1975
  case 38:
1885
1976
  _context20.prev = 38;
1886
1977
  _context20.t0 = _context20["catch"](11);
1887
- _iterator7.e(_context20.t0);
1978
+ _iterator10.e(_context20.t0);
1888
1979
  case 41:
1889
1980
  _context20.prev = 41;
1890
- _iterator7.f();
1981
+ _iterator10.f();
1891
1982
  return _context20.finish(41);
1892
1983
  case 44:
1893
1984
  uniqueDeleteIds = _toConsumableArray(new Set(deleteIds));
@@ -2058,7 +2149,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2058
2149
  key: "applyBodyUpdatesToStore",
2059
2150
  value: (function () {
2060
2151
  var _applyBodyUpdatesToStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(bodyUpdates) {
2061
- var updatedCount, newCount, appliedIds, _iterator8, _step8, _step8$value, id, body;
2152
+ var updatedCount, newCount, appliedIds, _iterator11, _step11, _step11$value, id, body;
2062
2153
  return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2063
2154
  while (1) switch (_context22.prev = _context22.next) {
2064
2155
  case 0:
@@ -2076,19 +2167,19 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2076
2167
  }
2077
2168
  return p;
2078
2169
  });
2079
- _iterator8 = _createForOfIteratorHelper(bodyUpdates);
2170
+ _iterator11 = _createForOfIteratorHelper(bodyUpdates);
2080
2171
  try {
2081
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
2082
- _step8$value = _slicedToArray(_step8.value, 2), id = _step8$value[0], body = _step8$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];
2083
2174
  if (!appliedIds.has(id)) {
2084
2175
  this.store.list.push(body);
2085
2176
  newCount++;
2086
2177
  }
2087
2178
  }
2088
2179
  } catch (err) {
2089
- _iterator8.e(err);
2180
+ _iterator11.e(err);
2090
2181
  } finally {
2091
- _iterator8.f();
2182
+ _iterator11.f();
2092
2183
  }
2093
2184
  this.syncProductsMap();
2094
2185
  _context22.next = 10;
@@ -2121,21 +2212,21 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2121
2212
  key: "mergeProductsToStore",
2122
2213
  value: (function () {
2123
2214
  var _mergeProductsToStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(freshProducts) {
2124
- var freshMap, _iterator9, _step9, p, updatedList, newCount, _iterator10, _step10, _p2, updatedCount;
2215
+ var freshMap, _iterator12, _step12, p, updatedList, newCount, _iterator13, _step13, _p2, updatedCount;
2125
2216
  return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2126
2217
  while (1) switch (_context23.prev = _context23.next) {
2127
2218
  case 0:
2128
2219
  freshMap = new Map();
2129
- _iterator9 = _createForOfIteratorHelper(freshProducts);
2220
+ _iterator12 = _createForOfIteratorHelper(freshProducts);
2130
2221
  try {
2131
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
2132
- p = _step9.value;
2222
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
2223
+ p = _step12.value;
2133
2224
  freshMap.set(p.id, p);
2134
2225
  }
2135
2226
  } catch (err) {
2136
- _iterator9.e(err);
2227
+ _iterator12.e(err);
2137
2228
  } finally {
2138
- _iterator9.f();
2229
+ _iterator12.f();
2139
2230
  }
2140
2231
  updatedList = this.store.list.map(function (p) {
2141
2232
  if (freshMap.has(p.id)) {
@@ -2146,16 +2237,16 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2146
2237
  return p;
2147
2238
  }); // freshMap 中剩余的是新商品(create 场景)
2148
2239
  newCount = freshMap.size;
2149
- _iterator10 = _createForOfIteratorHelper(freshMap.values());
2240
+ _iterator13 = _createForOfIteratorHelper(freshMap.values());
2150
2241
  try {
2151
- for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
2152
- _p2 = _step10.value;
2242
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
2243
+ _p2 = _step13.value;
2153
2244
  updatedList.push(_p2);
2154
2245
  }
2155
2246
  } catch (err) {
2156
- _iterator10.e(err);
2247
+ _iterator13.e(err);
2157
2248
  } finally {
2158
- _iterator10.f();
2249
+ _iterator13.f();
2159
2250
  }
2160
2251
  updatedCount = freshProducts.length - newCount;
2161
2252
  this.store.list = updatedList;
@@ -17,6 +17,17 @@ export interface FormattedProductData extends ProductData {
17
17
  /** 购物车详情值 */
18
18
  cartDetailValue?: any;
19
19
  }
20
+ /**
21
+ * 商品轻量查询范围
22
+ */
23
+ export interface ProductIdScope {
24
+ /** 是否返回全部商品 ID */
25
+ isAllProducts?: boolean;
26
+ /** 指定商品 ID */
27
+ productIds?: number[];
28
+ /** 指定商品集合 ID */
29
+ collectionIds?: number[];
30
+ }
20
31
  /**
21
32
  * 加载报价单商品价格参数
22
33
  */
@@ -6,6 +6,10 @@
6
6
  * 商品格式化后数据
7
7
  */
8
8
 
9
+ /**
10
+ * 商品轻量查询范围
11
+ */
12
+
9
13
  /**
10
14
  * 加载报价单商品价格参数
11
15
  */
@@ -240,7 +240,7 @@ var formatDataKey = function formatDataKey(data) {
240
240
  try {
241
241
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
242
242
  var item = _step.value;
243
- var _str = "_".concat(item.option_group_id, "_").concat(item.product_option_item_id);
243
+ var _str = "_".concat(item.option_group_id, "_").concat(item.option_group_item_id);
244
244
  key += _str;
245
245
  rowKey += "".concat(_str, "_").concat(item.quantity || item.num);
246
246
  }
@@ -268,7 +268,7 @@ var formatDataKey = function formatDataKey(data) {
268
268
  try {
269
269
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
270
270
  var opt = _step3.value;
271
- var _str3 = "_".concat(opt.option_group_id, "_").concat(opt.product_option_item_id);
271
+ var _str3 = "_".concat(opt.option_group_id, "_").concat(opt.option_group_item_id);
272
272
  key += _str3;
273
273
  rowKey += "".concat(_str3, "_").concat(opt.quantity || opt.num);
274
274
  }
@@ -8,12 +8,15 @@ import type { Discount } from '../../modules/Discount/types';
8
8
  import { RequestPlugin, WindowPlugin } from '../../plugins';
9
9
  export * from './types';
10
10
  import { ProductList } from '../../modules/ProductList';
11
+ import { PaymentModule } from '../../modules/Payment';
11
12
  import type { SalesSummaryModule } from '../../modules/SalesSummary';
12
13
  import type { ScheduleModule } from '../../modules/Schedule';
13
14
  import type { ISalesDetail, ISalesDetailHeader, ISalesBooking, ISalesPayment, ISalesSurcharge } from './utils/parseSalesResponse';
15
+ import { type TransformBaseProductToOrderProductParams } from './utils/transformBaseProductToOrderProduct';
14
16
  export interface BaseSalesState {
15
17
  order?: OrderModule;
16
18
  products?: ProductList;
19
+ payment?: PaymentModule;
17
20
  salesSummary?: SalesSummaryModule;
18
21
  schedule?: ScheduleModule;
19
22
  }
@@ -22,6 +25,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
22
25
  protected defaultVersion: string;
23
26
  isSolution: boolean;
24
27
  protected initializeOptions: ModuleOptions;
28
+ private logger;
25
29
  protected store: BaseSalesState;
26
30
  protected otherParams: Record<string, any>;
27
31
  protected cacheId: string | undefined;
@@ -35,15 +39,29 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
35
39
  constructor(name?: string, version?: string);
36
40
  /**
37
41
  * 子类可覆盖此方法以追加/收敛要注册的子模块。
38
- * 默认包含通用销售模块:products / order / salesSummary / schedule。
42
+ * 默认包含通用销售模块:products / order / salesSummary / schedule / payment
39
43
  */
40
44
  protected getRegisteredModuleNames(): readonly string[];
45
+ /**
46
+ * 记录信息日志
47
+ */
48
+ private logInfo;
49
+ /**
50
+ * 记录警告日志
51
+ */
52
+ private logWarning;
53
+ /**
54
+ * 记录错误日志
55
+ */
56
+ private logError;
57
+ get payment(): PaymentModule | undefined;
41
58
  /**
42
59
  * 工厂入口:根据子模块名实例化对应模块。
43
60
  * 默认使用 BookingByStep 公共 `createModule`。子类若需引入额外类型(如 customer),
44
61
  * 可覆盖此方法并把未识别的 name 委托给 `super.createSubModule(name)`。
45
62
  */
46
63
  protected createSubModule(moduleName: string): Module | null;
64
+ protected getSubModuleHooks(moduleName: string): any;
47
65
  /**
48
66
  * 读取 sessionStorage[this.name][cacheId],作为子模块 initialState 的来源。
49
67
  * sessionStorage 损坏时静默忽略,按空状态注册。
@@ -80,7 +98,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
80
98
  getOrderAmountSnapshot(): import("../../modules/Order/types").OrderAmountSnapshot | null;
81
99
  getTempOrderNote(): string;
82
100
  updateTempOrderNote(note: string): string;
83
- updateOrderShopDiscount(amount: string | number): string;
101
+ updateTempOrderShopDiscount(amount: string | number): string;
102
+ updateTempOrderContactsInfo(contactsInfo: Record<string, any> | null): Record<string, any> | null;
84
103
  private ensureTempOrder;
85
104
  addNewOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
86
105
  saveDraft(): Promise<void>;
@@ -124,6 +143,10 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
124
143
  deleteOrderPayment(paymentIdentity: string | number): OrderPaymentData[];
125
144
  /** 覆盖 wallet pass 支付项,同时保留普通支付项。 */
126
145
  updateVoucherOrderPayments(payments: OrderPaymentSource[]): OrderPaymentData[];
146
+ private getWalletProductList;
147
+ initWalletData(params?: {
148
+ order_wait_pay_amount?: number;
149
+ }): Promise<import("../../modules/Payment").WalletInitializationResult>;
127
150
  /**
128
151
  * 更新当前订单客户字段。
129
152
  *
@@ -159,6 +182,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
159
182
  order_ids?: Array<number | string>;
160
183
  submitBeforeSend?: boolean;
161
184
  }): Promise<T>;
185
+ transformBaseProductToOrderProduct(params: TransformBaseProductToOrderProductParams): import("./utils/transformBaseProductToOrderProduct").BaseProductOrderProductInput | null;
162
186
  addProductToOrder(product: Partial<BaseSalesOrderProduct> & BaseSalesOrderProductIdentity, booking?: AddProductBookingInput): Promise<import("../../modules/Order/types").OrderProduct[]>;
163
187
  updateProductInOrder(params: UpdateProductInOrderParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
164
188
  /**