@pisell/pisellos 2.3.29 → 2.3.30

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 (98) hide show
  1. package/dist/model/strategy/adapter/index.d.ts +0 -4
  2. package/dist/model/strategy/adapter/index.js +1 -5
  3. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  4. package/dist/modules/Discount/index.d.ts +2 -5
  5. package/dist/modules/Discount/index.js +7 -30
  6. package/dist/modules/Discount/types.d.ts +0 -4
  7. package/dist/modules/Order/index.d.ts +28 -10
  8. package/dist/modules/Order/index.js +747 -498
  9. package/dist/modules/Order/payment-utils.d.ts +23 -0
  10. package/dist/modules/Order/payment-utils.js +203 -0
  11. package/dist/modules/Order/types.d.ts +33 -3
  12. package/dist/modules/Order/utils.js +4 -4
  13. package/dist/modules/Payment/index.d.ts +2 -0
  14. package/dist/modules/Payment/index.js +78 -49
  15. package/dist/modules/Payment/types.d.ts +26 -24
  16. package/dist/modules/Payment/types.js +2 -0
  17. package/dist/modules/Product/index.d.ts +1 -1
  18. package/dist/modules/Product/types.d.ts +0 -22
  19. package/dist/modules/ProductList/index.d.ts +1 -1
  20. package/dist/modules/ProductList/index.js +2 -4
  21. package/dist/modules/ProductList/types.d.ts +0 -2
  22. package/dist/server/index.d.ts +14 -50
  23. package/dist/server/index.js +1975 -1395
  24. package/dist/server/modules/order/index.d.ts +40 -3
  25. package/dist/server/modules/order/index.js +1200 -501
  26. package/dist/server/modules/order/types.d.ts +11 -3
  27. package/dist/server/modules/order/types.js +1 -1
  28. package/dist/server/modules/products/index.d.ts +7 -26
  29. package/dist/server/modules/products/index.js +76 -167
  30. package/dist/server/modules/products/types.d.ts +0 -14
  31. package/dist/solution/BaseSales/index.d.ts +33 -5
  32. package/dist/solution/BaseSales/index.js +622 -345
  33. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
  34. package/dist/solution/BookingByStep/index.d.ts +1 -1
  35. package/dist/solution/BookingTicket/index.d.ts +1 -1
  36. package/dist/solution/BookingTicket/index.js +2 -1
  37. package/dist/solution/BookingTicket/types.d.ts +0 -2
  38. package/dist/solution/ShopDiscount/index.js +14 -15
  39. package/dist/utils/payment-number.d.ts +9 -0
  40. package/dist/utils/payment-number.js +69 -0
  41. package/lib/model/strategy/adapter/index.d.ts +0 -4
  42. package/lib/model/strategy/adapter/index.js +2 -13
  43. package/lib/modules/Discount/index.d.ts +2 -5
  44. package/lib/modules/Discount/index.js +3 -23
  45. package/lib/modules/Discount/types.d.ts +0 -4
  46. package/lib/modules/Order/index.d.ts +28 -10
  47. package/lib/modules/Order/index.js +181 -73
  48. package/lib/modules/Order/payment-utils.d.ts +23 -0
  49. package/lib/modules/Order/payment-utils.js +193 -0
  50. package/lib/modules/Order/types.d.ts +33 -3
  51. package/lib/modules/Order/utils.js +2 -3
  52. package/lib/modules/Payment/index.d.ts +2 -0
  53. package/lib/modules/Payment/index.js +33 -12
  54. package/lib/modules/Payment/types.d.ts +26 -24
  55. package/lib/modules/Product/index.d.ts +1 -1
  56. package/lib/modules/Product/types.d.ts +0 -22
  57. package/lib/modules/ProductList/index.d.ts +1 -1
  58. package/lib/modules/ProductList/index.js +2 -4
  59. package/lib/modules/ProductList/types.d.ts +0 -2
  60. package/lib/server/index.d.ts +14 -50
  61. package/lib/server/index.js +633 -214
  62. package/lib/server/modules/order/index.d.ts +40 -3
  63. package/lib/server/modules/order/index.js +434 -31
  64. package/lib/server/modules/order/types.d.ts +11 -3
  65. package/lib/server/modules/products/index.d.ts +7 -26
  66. package/lib/server/modules/products/index.js +35 -114
  67. package/lib/server/modules/products/types.d.ts +0 -14
  68. package/lib/solution/BaseSales/index.d.ts +33 -5
  69. package/lib/solution/BaseSales/index.js +170 -19
  70. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
  71. package/lib/solution/BookingByStep/index.d.ts +1 -1
  72. package/lib/solution/BookingTicket/index.d.ts +1 -1
  73. package/lib/solution/BookingTicket/index.js +2 -1
  74. package/lib/solution/BookingTicket/types.d.ts +0 -2
  75. package/lib/solution/ShopDiscount/index.js +1 -2
  76. package/lib/utils/payment-number.d.ts +9 -0
  77. package/lib/utils/payment-number.js +64 -0
  78. package/package.json +1 -1
  79. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  80. package/dist/model/strategy/adapter/dataVariant/adapter.js +0 -167
  81. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
  82. package/dist/model/strategy/adapter/dataVariant/evaluator.js +0 -780
  83. package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  84. package/dist/model/strategy/adapter/dataVariant/examples.js +0 -277
  85. package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  86. package/dist/model/strategy/adapter/dataVariant/index.js +0 -4
  87. package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -148
  88. package/dist/model/strategy/adapter/dataVariant/type.js +0 -54
  89. package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  90. package/lib/model/strategy/adapter/dataVariant/adapter.js +0 -149
  91. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
  92. package/lib/model/strategy/adapter/dataVariant/evaluator.js +0 -583
  93. package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  94. package/lib/model/strategy/adapter/dataVariant/examples.js +0 -293
  95. package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  96. package/lib/model/strategy/adapter/dataVariant/index.js +0 -38
  97. package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -148
  98. package/lib/model/strategy/adapter/dataVariant/type.js +0 -31
@@ -1,12 +1,12 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
4
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
5
2
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
6
3
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
4
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
5
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
9
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
6
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
9
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
10
10
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
11
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
12
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
@@ -32,6 +32,7 @@ import { BaseModule } from "../../../modules/BaseModule";
32
32
  import { QuotationModule as ClientQuotationModule } from "../../../modules/Quotation";
33
33
  import { ProductsHooks } from "./types";
34
34
  import { applyDetailValueToProducts, applyPriceDataToProducts, applyI18nToProducts, perfMark } from "../../utils/product";
35
+
35
36
  /**
36
37
  * IndexDB 存储名称
37
38
  */
@@ -68,10 +69,8 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
68
69
  // 最多缓存7天
69
70
  // 商品格式化器列表
70
71
  _defineProperty(_assertThisInitialized(_this), "formatters", []);
71
- // 是否已注册内置商品格式化器
72
- _defineProperty(_assertThisInitialized(_this), "isBuiltinFormatterRegistered", false);
73
- // 旧报价单格式化器默认关闭,仅显式开启时作为兼容兜底注册
74
- _defineProperty(_assertThisInitialized(_this), "isLegacyPriceFormatterEnabled", false);
72
+ // 是否已注册内置价格格式化器
73
+ _defineProperty(_assertThisInitialized(_this), "isPriceFormatterRegistered", false);
75
74
  // 普通层 QuotationModule 桥接器:本地计算报价单价格,替代 /product/query/price
76
75
  _defineProperty(_assertThisInitialized(_this), "quotationPriceBridge", void 0);
77
76
  _defineProperty(_assertThisInitialized(_this), "quotationBridgeChannel", void 0);
@@ -91,8 +90,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
91
90
  _defineProperty(_assertThisInitialized(_this), "lastPreloadCompletedAtMs", 0);
92
91
  /** IndexDB 写入串行队列,避免快照与 patch 并发交错 */
93
92
  _defineProperty(_assertThisInitialized(_this), "productIndexDBSaveQueue", Promise.resolve());
94
- /** 最近一次智能定价评估提取的 schedule 变价时间点(HH:mm),供 Server 订阅定时刷新使用 */
95
- _defineProperty(_assertThisInitialized(_this), "lastScheduleTimePoints", []);
96
93
  return _this;
97
94
  }
98
95
  _createClass(ProductsModule, [{
@@ -131,8 +128,8 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
131
128
  }
132
129
  }
133
130
 
134
- // 注册内置商品格式化器;智能定价默认替代报价单价格逻辑
135
- this.registerBuiltinProductFormatters();
131
+ // 注册内置的价格格式化器(作为第一个格式化器)
132
+ this.registerBuiltinPriceFormatter();
136
133
 
137
134
  // 初始化 ProductDataSource 实例
138
135
  this.initProductDataSource();
@@ -746,7 +743,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
746
743
  key: "prepareProductsWithPrice",
747
744
  value: (function () {
748
745
  var _prepareProductsWithPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(schedule_date, extraContext, options) {
749
- var tTotal, targetIds, isIncremental, _this$core, _this$core2, products, ids, tIds, i, priceData, _priceData$length, _priceData, tPrice, context, tFormat, processedProducts, errorMessage;
746
+ var tTotal, targetIds, isIncremental, _priceData$length, _this$core, products, ids, tIds, i, tPrice, priceData, context, tFormat, processedProducts, errorMessage;
750
747
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
751
748
  while (1) switch (_context7.prev = _context7.next) {
752
749
  case 0:
@@ -781,44 +778,34 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
781
778
  productCount: products.length
782
779
  });
783
780
 
784
- // 2. 仅在 legacy 报价单 formatter 启用时加载报价单价格;默认由智能定价覆盖商品价格。
785
- priceData = [];
786
- if (!this.isLegacyPriceFormatterEnabled) {
787
- _context7.next = 15;
788
- break;
789
- }
781
+ // 2. 获取价格数据(网络请求)
790
782
  tPrice = performance.now();
791
- _context7.next = 12;
783
+ _context7.next = 10;
792
784
  return this.loadProductsPrice({
793
785
  ids: ids,
794
786
  schedule_date: schedule_date,
795
787
  schedule_datetime: extraContext === null || extraContext === void 0 ? void 0 : extraContext.schedule_datetime,
796
788
  customer_id: extraContext === null || extraContext === void 0 ? void 0 : extraContext.customer_id
797
789
  });
798
- case 12:
790
+ case 10:
799
791
  priceData = _context7.sent;
800
792
  perfMark('prepareProducts.loadPrice', performance.now() - tPrice, {
801
793
  count: ids.length
802
794
  });
803
795
  this.logInfo('获取商品报价单价格成功', {
804
- priceDataCount: (_priceData$length = (_priceData = priceData) === null || _priceData === void 0 ? void 0 : _priceData.length) !== null && _priceData$length !== void 0 ? _priceData$length : 0
796
+ priceDataCount: (_priceData$length = priceData === null || priceData === void 0 ? void 0 : priceData.length) !== null && _priceData$length !== void 0 ? _priceData$length : 0
805
797
  });
806
- case 15:
807
798
  context = _objectSpread({
808
799
  schedule_date: schedule_date,
809
800
  schedule_datetime: extraContext === null || extraContext === void 0 ? void 0 : extraContext.schedule_datetime,
810
801
  customer_id: extraContext === null || extraContext === void 0 ? void 0 : extraContext.customer_id,
811
802
  priceData: priceData,
812
- locale: (_this$core = this.core) === null || _this$core === void 0 || (_this$core = _this$core.context) === null || _this$core === void 0 ? void 0 : _this$core.locale,
813
- dataVariantEvaluator: (extraContext === null || extraContext === void 0 ? void 0 : extraContext.dataVariantEvaluator) || ((_this$core2 = this.core) === null || _this$core2 === void 0 || (_this$core2 = _this$core2.context) === null || _this$core2 === void 0 ? void 0 : _this$core2.dataVariantEvaluator),
814
- menuList: (extraContext === null || extraContext === void 0 ? void 0 : extraContext.menuList) || [],
815
- scheduleList: (extraContext === null || extraContext === void 0 ? void 0 : extraContext.scheduleList) || [],
816
- strategy_context: extraContext === null || extraContext === void 0 ? void 0 : extraContext.strategy_context
803
+ locale: (_this$core = this.core) === null || _this$core === void 0 || (_this$core = _this$core.context) === null || _this$core === void 0 ? void 0 : _this$core.locale
817
804
  }, extraContext); // 3. 通过格式化器流程处理商品
818
805
  tFormat = performance.now();
819
- _context7.next = 19;
806
+ _context7.next = 17;
820
807
  return this.applyFormatters(products, context);
821
- case 19:
808
+ case 17:
822
809
  processedProducts = _context7.sent;
823
810
  perfMark('prepareProducts.applyFormatters', performance.now() - tFormat, {
824
811
  count: products.length,
@@ -831,20 +818,20 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
831
818
  formatterCount: this.formatters.length
832
819
  });
833
820
  if (isIncremental) {
834
- _context7.next = 25;
821
+ _context7.next = 23;
835
822
  break;
836
823
  }
837
- _context7.next = 25;
824
+ _context7.next = 23;
838
825
  return this.core.effects.emit(ProductsHooks.onProductsPriceApplied, processedProducts);
839
- case 25:
826
+ case 23:
840
827
  perfMark('prepareProductsWithPrice', performance.now() - tTotal, {
841
828
  productCount: products.length,
842
829
  formatterCount: this.formatters.length,
843
830
  mode: isIncremental ? 'incremental' : 'full'
844
831
  });
845
832
  return _context7.abrupt("return", processedProducts);
846
- case 29:
847
- _context7.prev = 29;
833
+ case 27:
834
+ _context7.prev = 27;
848
835
  _context7.t0 = _context7["catch"](4);
849
836
  errorMessage = _context7.t0 instanceof Error ? _context7.t0.message : String(_context7.t0);
850
837
  console.log("[ProductsModule] \uD83C\uDF10 ERROR", _context7.t0);
@@ -852,13 +839,13 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
852
839
  schedule_date: schedule_date,
853
840
  error: errorMessage
854
841
  });
855
- case 34:
842
+ case 32:
856
843
  return _context7.abrupt("return", []);
857
- case 35:
844
+ case 33:
858
845
  case "end":
859
846
  return _context7.stop();
860
847
  }
861
- }, _callee7, this, [[4, 29]]);
848
+ }, _callee7, this, [[4, 27]]);
862
849
  }));
863
850
  function prepareProductsWithPrice(_x10, _x11, _x12) {
864
851
  return _prepareProductsWithPrice.apply(this, arguments);
@@ -871,27 +858,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
871
858
  var _extraContext$custome;
872
859
  var datetime = (extraContext === null || extraContext === void 0 ? void 0 : extraContext.schedule_datetime) || schedule_date;
873
860
  var productScope = productIds ? ":products:".concat(productIds.join(',')) : '';
874
- var strategyScope = this.stringifyStable((extraContext === null || extraContext === void 0 ? void 0 : extraContext.strategy_context) || {});
875
- return "".concat(datetime, ":customer:").concat((_extraContext$custome = extraContext === null || extraContext === void 0 ? void 0 : extraContext.customer_id) !== null && _extraContext$custome !== void 0 ? _extraContext$custome : '', ":strategy:").concat(strategyScope).concat(productScope);
876
- }
877
-
878
- /**
879
- * 稳定序列化策略上下文,避免对象 key 顺序不同导致缓存 key 抖动。
880
- */
881
- }, {
882
- key: "stringifyStable",
883
- value: function stringifyStable(value) {
884
- var _this7 = this;
885
- if (value == null) return '';
886
- if (Array.isArray(value)) return "[".concat(value.map(function (item) {
887
- return _this7.stringifyStable(item);
888
- }).join(','), "]");
889
- if (_typeof(value) === 'object') {
890
- return "{".concat(Object.keys(value).sort().map(function (key) {
891
- return "".concat(key, ":").concat(_this7.stringifyStable(value[key]));
892
- }).join(','), "}");
893
- }
894
- return String(value);
861
+ 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);
895
862
  }
896
863
  }, {
897
864
  key: "normalizeProductIds",
@@ -1037,56 +1004,26 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1037
1004
  return applyFormatters;
1038
1005
  }()
1039
1006
  /**
1040
- * 注册内置商品格式化器。
1041
- *
1042
- * 智能定价默认替代报价单逻辑;报价单 formatter 仅在 enableLegacyPriceFormatter=true 时启用。
1007
+ * 注册内置的价格格式化器
1008
+ * 这个格式化器负责将价格数据应用到商品上
1043
1009
  * @private
1044
1010
  */
1045
1011
  )
1046
1012
  }, {
1047
- key: "registerBuiltinProductFormatters",
1048
- value: function registerBuiltinProductFormatters() {
1049
- var _this8 = this;
1050
- if (this.isBuiltinFormatterRegistered) {
1051
- console.warn('[ProductsModule] 内置商品格式化器已注册,跳过');
1013
+ key: "registerBuiltinPriceFormatter",
1014
+ value: function registerBuiltinPriceFormatter() {
1015
+ if (this.isPriceFormatterRegistered) {
1016
+ console.warn('[ProductsModule] 内置价格格式化器已注册,跳过');
1052
1017
  return;
1053
1018
  }
1054
- this.isLegacyPriceFormatterEnabled = this.shouldEnableLegacyPriceFormatter();
1055
- var dataVariantFormatter = function dataVariantFormatter(products, context) {
1056
- var _this8$core, _strategyContext$busi;
1057
- var evaluator = context.dataVariantEvaluator || ((_this8$core = _this8.core) === null || _this8$core === void 0 || (_this8$core = _this8$core.context) === null || _this8$core === void 0 ? void 0 : _this8$core.dataVariantEvaluator);
1058
- if (!evaluator || typeof evaluator.resolveProducts !== 'function') {
1059
- _this8.lastScheduleTimePoints = [];
1060
- _this8.logWarning('智能定价评估器未注入,跳过 DataVariant 格式化', {
1061
- productCount: products.length
1062
- });
1063
- return products;
1064
- }
1065
- var strategyContext = context.strategy_context || {};
1066
- var businessData = {
1067
- products: products,
1068
- scheduleDateTime: context.schedule_datetime || context.schedule_date,
1069
- scheduleList: context.scheduleList || [],
1070
- menuList: context.menuList || [],
1071
- customerId: context.customer_id,
1072
- channel: strategyContext.channel,
1073
- orderType: strategyContext.orderType || strategyContext.order_type,
1074
- businessCode: (_strategyContext$busi = strategyContext.business_code) !== null && _strategyContext$busi !== void 0 ? _strategyContext$busi : strategyContext.businessCode,
1075
- availableWalletIds: strategyContext.available_wallet_ids,
1076
- custom: strategyContext
1077
- };
1078
- var result = evaluator.resolveProducts(businessData);
1079
- _this8.lastScheduleTimePoints = Array.isArray(result === null || result === void 0 ? void 0 : result.scheduleTimePoints) ? _toConsumableArray(result.scheduleTimePoints) : [];
1080
- return Array.isArray(result === null || result === void 0 ? void 0 : result.products) ? result.products : products;
1081
- };
1082
1019
 
1083
- // 创建 legacy 报价单格式化器
1084
- var legacyPriceFormatter = function legacyPriceFormatter(products, context) {
1020
+ // 创建价格格式化器
1021
+ var priceFormatter = function priceFormatter(products, context) {
1085
1022
  if (!context.priceData || context.priceData.length === 0) {
1086
- console.log('[ProductsModule] 💰 没有价格数据,跳过 legacy 报价单价格应用');
1023
+ console.log('[ProductsModule] 💰 没有价格数据,跳过价格应用');
1087
1024
  return products;
1088
1025
  }
1089
- console.log("[ProductsModule] \uD83D\uDCB0 \u5E94\u7528 legacy \u62A5\u4EF7\u5355\u4EF7\u683C\u5230 ".concat(products.length, " \u4E2A\u5546\u54C1"));
1026
+ console.log("[ProductsModule] \uD83D\uDCB0 \u5E94\u7528\u4EF7\u683C\u6570\u636E\u5230 ".concat(products.length, " \u4E2A\u5546\u54C1"));
1090
1027
  return applyPriceDataToProducts(products, context.priceData);
1091
1028
  };
1092
1029
  var i18nFormatter = function i18nFormatter(products, context) {
@@ -1095,41 +1032,18 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1095
1032
  var detailValueFormatter = function detailValueFormatter(products, context) {
1096
1033
  return applyDetailValueToProducts(products, context);
1097
1034
  };
1098
- if (this.isLegacyPriceFormatterEnabled) {
1099
- this.formatters.push(legacyPriceFormatter);
1100
- }
1101
- this.formatters.push(dataVariantFormatter);
1035
+
1036
+ // 将价格格式化器注册为第一个格式化器
1037
+ this.formatters.unshift(priceFormatter);
1102
1038
  this.formatters.push(i18nFormatter);
1103
1039
  this.formatters.push(detailValueFormatter);
1104
- this.isBuiltinFormatterRegistered = true;
1105
- console.log('[ProductsModule] ✅ 内置商品格式化器已注册(智能定价优先)');
1106
- }
1107
-
1108
- /**
1109
- * 是否启用旧报价单价格 formatter。
1110
- *
1111
- * 默认关闭,避免报价单逻辑覆盖智能定价结果。
1112
- */
1113
- }, {
1114
- key: "shouldEnableLegacyPriceFormatter",
1115
- value: function shouldEnableLegacyPriceFormatter() {
1116
- var _this$otherParams3, _this$core3;
1117
- return ((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.enableLegacyPriceFormatter) === true || ((_this$core3 = this.core) === null || _this$core3 === void 0 || (_this$core3 = _this$core3.context) === null || _this$core3 === void 0 ? void 0 : _this$core3.enableLegacyPriceFormatter) === true;
1118
- }
1119
-
1120
- /**
1121
- * 返回最近一次 prepareProductsWithPrice / DataVariant 评估提取的变价时间点(HH:mm)。
1122
- * 供 OS Server 商品 query 订阅定时刷新使用。
1123
- */
1124
- }, {
1125
- key: "getLastScheduleTimePoints",
1126
- value: function getLastScheduleTimePoints() {
1127
- return _toConsumableArray(this.lastScheduleTimePoints);
1040
+ this.isPriceFormatterRegistered = true;
1041
+ console.log('[ProductsModule] ✅ 内置价格格式化器已注册(第 1 个)');
1128
1042
  }
1129
1043
 
1130
1044
  /**
1131
1045
  * 注册商品格式化器
1132
- * 格式化器会按注册顺序依次执行;legacy 启用时先兜底报价,再由智能定价覆盖。
1046
+ * 格式化器会按注册顺序依次执行(内置价格格式化器始终是第一个)
1133
1047
  * @param formatter 格式化函数
1134
1048
  * @param prepend 是否插入到队列开头(默认 false,追加到末尾)
1135
1049
  * @example
@@ -1147,8 +1061,8 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1147
1061
  value: function registerFormatter(formatter) {
1148
1062
  var prepend = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1149
1063
  if (prepend) {
1150
- // 插入到内置智能定价格式化器之后;legacy 报价单启用时需跳过它。
1151
- var insertIndex = this.isBuiltinFormatterRegistered ? this.isLegacyPriceFormatterEnabled ? 2 : 1 : 0;
1064
+ // 插入到价格格式化器之后(索引 1 的位置)
1065
+ var insertIndex = this.isPriceFormatterRegistered ? 1 : 0;
1152
1066
  this.formatters.splice(insertIndex, 0, formatter);
1153
1067
  console.log("[ProductsModule] \uD83D\uDCCC \u5DF2\u5728\u4F4D\u7F6E ".concat(insertIndex + 1, " \u63D2\u5165\u683C\u5F0F\u5316\u5668\uFF0C\u5F53\u524D\u5171 ").concat(this.formatters.length, " \u4E2A"));
1154
1068
  } else {
@@ -1159,21 +1073,20 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1159
1073
  }
1160
1074
 
1161
1075
  /**
1162
- * 清空所有格式化器(包括内置智能定价格式化器)
1163
- * @param keepBuiltin 是否保留内置智能定价格式化器(默认 true)
1076
+ * 清空所有格式化器(包括内置价格格式化器)
1077
+ * @param keepBuiltin 是否保留内置价格格式化器(默认 true)
1164
1078
  */
1165
1079
  }, {
1166
1080
  key: "clearFormatters",
1167
1081
  value: function clearFormatters() {
1168
1082
  var keepBuiltin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
1169
- if (keepBuiltin && this.isBuiltinFormatterRegistered) {
1170
- // 保留 legacy 兜底(如果启用)和智能定价格式化器。
1171
- var builtinCount = this.isLegacyPriceFormatterEnabled ? 2 : 1;
1172
- this.formatters = this.formatters.slice(0, builtinCount);
1173
- console.log('[ProductsModule] 🧹 已清空自定义格式化器,保留内置智能定价格式化器');
1083
+ if (keepBuiltin && this.isPriceFormatterRegistered) {
1084
+ // 只保留第一个格式化器(内置价格格式化器)
1085
+ this.formatters = [this.formatters[0]];
1086
+ console.log('[ProductsModule] 🧹 已清空自定义格式化器,保留内置价格格式化器');
1174
1087
  } else {
1175
1088
  this.formatters = [];
1176
- this.isBuiltinFormatterRegistered = false;
1089
+ this.isPriceFormatterRegistered = false;
1177
1090
  console.log('[ProductsModule] 🧹 已清空所有格式化器');
1178
1091
  }
1179
1092
  }
@@ -1284,7 +1197,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1284
1197
  key: "fetchProductsByHttp",
1285
1198
  value: (function () {
1286
1199
  var _fetchProductsByHttp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
1287
- var _ref13, _ref13$category_ids, category_ids, _ref13$product_ids, product_ids, _ref13$collection, collection, customer_id, cacheId, startTime, _this$otherParams4, _productsData$data, productsData, productList, duration, _duration2, errorMessage;
1200
+ 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;
1288
1201
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1289
1202
  while (1) switch (_context10.prev = _context10.next) {
1290
1203
  case 0:
@@ -1302,7 +1215,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1302
1215
  open_bundle: 1,
1303
1216
  exclude_extension_type: ['product_party', 'product_event', 'product_series_event', 'product_package_ticket', 'ticket', 'event_item'],
1304
1217
  force_ignore_cache_flag: 1,
1305
- with: ['category', 'collection', 'resourceRelation', 'bundleGroup.bundleItem', 'optionGroup.optionItem', 'variantGroup.variantItem', 'dataVariants'],
1218
+ with: ['category', 'collection', 'resourceRelation', 'bundleGroup.bundleItem', 'optionGroup.optionItem', 'variantGroup.variantItem'],
1306
1219
  open_deposit: 1,
1307
1220
  is_append_product_description: 1,
1308
1221
  with_count: ['bundleGroup', 'optionGroup'],
@@ -1314,7 +1227,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1314
1227
  ids: product_ids,
1315
1228
  collection: collection,
1316
1229
  front_end_cache_id: cacheId,
1317
- application_code: (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.channel
1230
+ application_code: (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.channel
1318
1231
  }, {
1319
1232
  cache: undefined
1320
1233
  });
@@ -1846,7 +1759,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1846
1759
  key: "replaceProductsSnapshotInIndexDB",
1847
1760
  value: (function () {
1848
1761
  var _replaceProductsSnapshotInIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(products, source) {
1849
- var _this9 = this;
1762
+ var _this7 = this;
1850
1763
  var errorMessage;
1851
1764
  return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1852
1765
  while (1) switch (_context21.prev = _context21.next) {
@@ -1865,25 +1778,25 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1865
1778
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1866
1779
  while (1) switch (_context20.prev = _context20.next) {
1867
1780
  case 0:
1868
- _this9.logInfo('replaceProductsSnapshotInIndexDB 开始', {
1781
+ _this7.logInfo('replaceProductsSnapshotInIndexDB 开始', {
1869
1782
  source: source,
1870
1783
  productCount: products.length
1871
1784
  });
1872
1785
  t0 = performance.now();
1873
1786
  _context20.next = 4;
1874
- return _this9.dbManager.clear(INDEXDB_STORE_NAME);
1787
+ return _this7.dbManager.clear(INDEXDB_STORE_NAME);
1875
1788
  case 4:
1876
1789
  if (!(products.length > 0)) {
1877
1790
  _context20.next = 7;
1878
1791
  break;
1879
1792
  }
1880
1793
  _context20.next = 7;
1881
- return _this9.dbManager.bulkUpdate(INDEXDB_STORE_NAME, products);
1794
+ return _this7.dbManager.bulkUpdate(INDEXDB_STORE_NAME, products);
1882
1795
  case 7:
1883
1796
  perfMark('replaceProductsSnapshotInIndexDB', performance.now() - t0, {
1884
1797
  count: products.length
1885
1798
  });
1886
- _this9.logInfo('replaceProductsSnapshotInIndexDB 完成', {
1799
+ _this7.logInfo('replaceProductsSnapshotInIndexDB 完成', {
1887
1800
  source: source,
1888
1801
  productCount: products.length
1889
1802
  });
@@ -1927,7 +1840,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1927
1840
  key: "patchProductsInIndexDB",
1928
1841
  value: (function () {
1929
1842
  var _patchProductsInIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(products, source) {
1930
- var _this10 = this;
1843
+ var _this8 = this;
1931
1844
  var mergeActions,
1932
1845
  validProducts,
1933
1846
  errorMessage,
@@ -1958,22 +1871,22 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1958
1871
  return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1959
1872
  while (1) switch (_context22.prev = _context22.next) {
1960
1873
  case 0:
1961
- _this10.logInfo('patchProductsInIndexDB 开始', {
1874
+ _this8.logInfo('patchProductsInIndexDB 开始', {
1962
1875
  source: source,
1963
1876
  count: validProducts.length
1964
1877
  });
1965
1878
  t0 = performance.now();
1966
- if (!(typeof _this10.dbManager.bulkUpdate === 'function')) {
1879
+ if (!(typeof _this8.dbManager.bulkUpdate === 'function')) {
1967
1880
  _context22.next = 7;
1968
1881
  break;
1969
1882
  }
1970
1883
  _context22.next = 5;
1971
- return _this10.dbManager.bulkUpdate(INDEXDB_STORE_NAME, validProducts);
1884
+ return _this8.dbManager.bulkUpdate(INDEXDB_STORE_NAME, validProducts);
1972
1885
  case 5:
1973
1886
  _context22.next = 25;
1974
1887
  break;
1975
1888
  case 7:
1976
- if (!(typeof _this10.dbManager.update === 'function')) {
1889
+ if (!(typeof _this8.dbManager.update === 'function')) {
1977
1890
  _context22.next = 25;
1978
1891
  break;
1979
1892
  }
@@ -1987,7 +1900,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1987
1900
  }
1988
1901
  product = _step11.value;
1989
1902
  _context22.next = 15;
1990
- return _this10.dbManager.update(INDEXDB_STORE_NAME, product);
1903
+ return _this8.dbManager.update(INDEXDB_STORE_NAME, product);
1991
1904
  case 15:
1992
1905
  _context22.next = 11;
1993
1906
  break;
@@ -2006,7 +1919,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2006
1919
  perfMark('patchProductsInIndexDB', performance.now() - t0, {
2007
1920
  count: validProducts.length
2008
1921
  });
2009
- _this10.logInfo('patchProductsInIndexDB 完成', {
1922
+ _this8.logInfo('patchProductsInIndexDB 完成', {
2010
1923
  source: source,
2011
1924
  count: validProducts.length
2012
1925
  });
@@ -2204,7 +2117,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2204
2117
  }, {
2205
2118
  key: "setupProductSync",
2206
2119
  value: function setupProductSync() {
2207
- var _this11 = this;
2120
+ var _this9 = this;
2208
2121
  if (!this.productDataSource) {
2209
2122
  this.logWarning('setupProductSync: ProductDataSource 不可用,跳过同步初始化');
2210
2123
  return;
@@ -2214,20 +2127,20 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2214
2127
  var data = (message === null || message === void 0 ? void 0 : message.data) || message;
2215
2128
  if (!data) return;
2216
2129
  console.log("[ProductsModule] \u6536\u5230\u540C\u6B65\u6D88\u606F [".concat(channelKey, "]:"), data);
2217
- _this11.logInfo('收到同步消息', {
2130
+ _this9.logInfo('收到同步消息', {
2218
2131
  channelKey: channelKey,
2219
2132
  action: data.action,
2220
2133
  id: data.id,
2221
2134
  action_filed: data.action_filed
2222
2135
  });
2223
- _this11.pendingSyncMessages.push(_objectSpread(_objectSpread({}, data), {}, {
2136
+ _this9.pendingSyncMessages.push(_objectSpread(_objectSpread({}, data), {}, {
2224
2137
  _channelKey: channelKey
2225
2138
  }));
2226
- if (_this11.syncTimer) {
2227
- clearTimeout(_this11.syncTimer);
2139
+ if (_this9.syncTimer) {
2140
+ clearTimeout(_this9.syncTimer);
2228
2141
  }
2229
- _this11.syncTimer = setTimeout(function () {
2230
- _this11.processProductSyncMessages();
2142
+ _this9.syncTimer = setTimeout(function () {
2143
+ _this9.processProductSyncMessages();
2231
2144
  }, PRODUCT_SYNC_DEBOUNCE_MS);
2232
2145
  };
2233
2146
  };
@@ -2245,7 +2158,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2245
2158
  }
2246
2159
  }
2247
2160
  }).catch(function (err) {
2248
- _this11.logError('setupProductSync: DataSource run 出错', {
2161
+ _this9.logError('setupProductSync: DataSource run 出错', {
2249
2162
  error: err instanceof Error ? err.message : String(err)
2250
2163
  });
2251
2164
  });
@@ -2274,7 +2187,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2274
2187
  key: "processProductSyncMessages",
2275
2188
  value: (function () {
2276
2189
  var _processProductSyncMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2277
- var messages, deleteIds, bodyUpdates, sseRefreshIds, priceRefreshIds, shouldClearPriceCache, _iterator13, _step13, msg, channelKey, _msg$relation_product, _msg$change_types, _msg$ids2, _msg$ids, ids, bodyId, _bodyId, _msg$relation_product2, _msg$relation_product3, _msg$product_ids, uniqueDeleteIds, uniqueSSEIds, uniquePriceIds, patchProductMap, patchMergeActions, storeMutated, bodyResult, _iterator14, _step14, product, freshProducts, mergeResult, _iterator15, _step15, _product, patchProducts, allChangedIds, hasChanges, errorMessage;
2190
+ var messages, deleteIds, bodyUpdates, sseRefreshIds, priceRefreshIds, shouldClearPriceCache, _iterator13, _step13, msg, channelKey, _msg$relation_product, _msg$change_types, _msg$ids2, _msg$ids, ids, bodyId, _bodyId, _msg$relation_product2, _msg$relation_product3, uniqueDeleteIds, uniqueSSEIds, uniquePriceIds, patchProductMap, patchMergeActions, storeMutated, bodyResult, _iterator14, _step14, product, freshProducts, mergeResult, _iterator15, _step15, _product, patchProducts, allChangedIds, hasChanges, errorMessage;
2278
2191
  return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2279
2192
  while (1) switch (_context25.prev = _context25.next) {
2280
2193
  case 0:
@@ -2358,10 +2271,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2358
2271
  if ((_msg$relation_product3 = msg.relation_product_ids) !== null && _msg$relation_product3 !== void 0 && _msg$relation_product3.length) {
2359
2272
  sseRefreshIds.push.apply(sseRefreshIds, _toConsumableArray(msg.relation_product_ids));
2360
2273
  }
2361
- } else if (['product_data_variant'].includes(channelKey)) {
2362
- if ((_msg$product_ids = msg.product_ids) !== null && _msg$product_ids !== void 0 && _msg$product_ids.length) {
2363
- sseRefreshIds.push.apply(sseRefreshIds, _toConsumableArray(msg.product_ids));
2364
- }
2365
2274
  }
2366
2275
  case 34:
2367
2276
  _context25.next = 13;
@@ -114,8 +114,6 @@ export interface ProductSyncMessage {
114
114
  change_types?: string[];
115
115
  /** 关联商品 ID(product_collection / product_category / product_quotation 变更时携带) */
116
116
  relation_product_ids?: number[];
117
- /** 关联商品 ID(product_data_variant 变更时携带) */
118
- product_ids?: number[];
119
117
  message_uuid?: string;
120
118
  timestamp?: string;
121
119
  /** 内部标记:来源频道 key */
@@ -130,18 +128,6 @@ export interface ProductFormatterContext {
130
128
  customer_id?: number | string;
131
129
  priceData?: LoadProductsPriceData[];
132
130
  scheduleModule?: any;
133
- /** 全量餐牌列表,供智能定价 menu_match 等条件判断使用 */
134
- menuList?: any[];
135
- /** 全量日程列表,供智能定价 schedule_match 等条件判断使用 */
136
- scheduleList?: any[];
137
- /** 外部传入的策略上下文,仅承载定价条件,不参与商品集合筛选 */
138
- strategy_context?: Record<string, any>;
139
- /** 智能定价评估器,由宿主统一注入到 PisellOS context */
140
- dataVariantEvaluator?: {
141
- resolveProducts: (businessData: any) => {
142
- products: ProductData[];
143
- };
144
- };
145
131
  locale?: string;
146
132
  }
147
133
  /**