@pisell/pisellos 2.2.266 → 2.2.267

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 (93) hide show
  1. package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  2. package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
  3. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  4. package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
  5. package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
  6. package/dist/model/strategy/adapter/promotion/examples.js +0 -99
  7. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  8. package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
  9. package/dist/model/strategy/adapter/promotion/type.js +0 -45
  10. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
  11. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
  12. package/dist/modules/Order/index.d.ts +8 -27
  13. package/dist/modules/Order/index.js +493 -753
  14. package/dist/modules/Order/types.d.ts +1 -33
  15. package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
  16. package/dist/modules/Order/utils.js +6 -10
  17. package/dist/modules/Payment/index.d.ts +0 -2
  18. package/dist/modules/Payment/index.js +50 -79
  19. package/dist/modules/Payment/types.d.ts +27 -29
  20. package/dist/modules/Payment/types.js +3 -5
  21. package/dist/modules/Rules/index.d.ts +0 -1
  22. package/dist/modules/Rules/index.js +14 -34
  23. package/dist/server/index.d.ts +0 -16
  24. package/dist/server/index.js +1036 -1933
  25. package/dist/server/modules/order/index.d.ts +4 -49
  26. package/dist/server/modules/order/index.js +695 -1574
  27. package/dist/server/modules/order/types.d.ts +3 -11
  28. package/dist/server/modules/order/types.js +1 -1
  29. package/dist/solution/BaseSales/index.d.ts +11 -55
  30. package/dist/solution/BaseSales/index.js +396 -711
  31. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  32. package/dist/solution/BaseSales/utils/cartPromotion.js +36 -93
  33. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  34. package/dist/solution/BookingTicket/index.d.ts +1 -1
  35. package/dist/solution/BookingTicket/index.js +29 -35
  36. package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
  37. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  38. package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
  39. package/dist/solution/Sales/index.d.ts +0 -1
  40. package/dist/solution/Sales/index.js +2 -10
  41. package/dist/solution/ScanOrder/index.js +20 -31
  42. package/dist/solution/VenueBooking/index.js +19 -30
  43. package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  44. package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
  45. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  46. package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
  47. package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
  48. package/lib/model/strategy/adapter/promotion/examples.js +0 -91
  49. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  50. package/lib/model/strategy/adapter/promotion/index.js +0 -51
  51. package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
  52. package/lib/model/strategy/adapter/promotion/type.js +0 -2
  53. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
  54. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
  55. package/lib/modules/Order/index.d.ts +8 -27
  56. package/lib/modules/Order/index.js +72 -193
  57. package/lib/modules/Order/types.d.ts +1 -33
  58. package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
  59. package/lib/modules/Order/utils.js +4 -11
  60. package/lib/modules/Payment/index.d.ts +0 -2
  61. package/lib/modules/Payment/index.js +13 -34
  62. package/lib/modules/Payment/types.d.ts +27 -29
  63. package/lib/modules/Payment/types.js +3 -3
  64. package/lib/modules/Rules/index.d.ts +0 -1
  65. package/lib/modules/Rules/index.js +4 -23
  66. package/lib/server/index.d.ts +0 -16
  67. package/lib/server/index.js +18 -670
  68. package/lib/server/modules/order/index.d.ts +4 -49
  69. package/lib/server/modules/order/index.js +66 -657
  70. package/lib/server/modules/order/types.d.ts +3 -11
  71. package/lib/solution/BaseSales/index.d.ts +11 -55
  72. package/lib/solution/BaseSales/index.js +35 -235
  73. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  74. package/lib/solution/BaseSales/utils/cartPromotion.js +17 -65
  75. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  76. package/lib/solution/BookingTicket/index.d.ts +1 -1
  77. package/lib/solution/BookingTicket/index.js +3 -6
  78. package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
  79. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  80. package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
  81. package/lib/solution/Sales/index.d.ts +0 -1
  82. package/lib/solution/Sales/index.js +3 -5
  83. package/lib/solution/ScanOrder/index.js +0 -8
  84. package/lib/solution/VenueBooking/index.js +0 -8
  85. package/package.json +2 -2
  86. package/dist/modules/Order/payment-utils.d.ts +0 -26
  87. package/dist/modules/Order/payment-utils.js +0 -225
  88. package/dist/utils/payment-number.d.ts +0 -9
  89. package/dist/utils/payment-number.js +0 -69
  90. package/lib/modules/Order/payment-utils.d.ts +0 -26
  91. package/lib/modules/Order/payment-utils.js +0 -224
  92. package/lib/utils/payment-number.d.ts +0 -9
  93. package/lib/utils/payment-number.js +0 -64
@@ -78,7 +78,6 @@ export interface CartPromotionEvaluator {
78
78
  }>;
79
79
  hasApplicableStrategy: boolean;
80
80
  }>;
81
- getStrategyConfigs?: () => unknown[];
82
81
  }
83
82
  /** 单个赠品减量项 */
84
83
  export interface GiftReduceItem {
@@ -268,8 +267,7 @@ export declare function appendPromotionTags<T extends Record<string, any>>(produ
268
267
  * 处理购物车的促销计算与赠品差异化。
269
268
  *
270
269
  * 流程:
271
- * 1. 分离 main / gift / edit-product 三类(普通促销下带 `booking_id` 的编辑态商品不参与;
272
- * 配置 ITEM_REWARD 时,编辑态商品也参与商品奖励重算)
270
+ * 1. 分离 main / gift / edit-product 三类(带 `booking_id` 的编辑态商品不参与促销)
273
271
  * 2. 转 PromotionProduct 喂评估器 → 拿到 `evaluateCartWithPricing` 与 `getProductsApplicableStrategies`
274
272
  * 3. 把 PricedProduct 映射回 OrderProduct 形态:
275
273
  * - 参与促销的,写 `metadata._promotion` + 调整 `selling_price` / `main_product_selling_price`
@@ -1,17 +1,17 @@
1
1
  var _excluded = ["_promotionTags"];
2
2
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
3
3
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
+ 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; }
5
+ 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; }
6
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
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); }
5
10
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
11
  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."); }
7
12
  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; } }
8
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
14
  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; } } }; }
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
- 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
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
14
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
15
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
16
16
  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."); }
17
17
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -116,50 +116,24 @@ export function getOrderProductOriginalPriceForPromotion(product) {
116
116
  }
117
117
  return getOrderProductBasePrice(product);
118
118
  }
119
- var X_ITEMS_FOR_Y_PRICE = 'X_ITEMS_FOR_Y_PRICE';
120
- var BUY_X_GET_Y_FREE = 'BUY_X_GET_Y_FREE';
121
- var ITEM_REWARD = 'ITEM_REWARD';
122
- function isItemRewardPromotionDiscountItem(item) {
123
- var _item$metadata, _item$metadata2;
124
- return (item === null || item === void 0 ? void 0 : item.type) === 'product' && (item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.source) === 'promotion' && (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.actionType) === ITEM_REWARD;
125
- }
126
- function isManagedPromotionDiscountItem(item) {
127
- if ((item === null || item === void 0 ? void 0 : item.type) === 'promotion') return true;
128
- return isItemRewardPromotionDiscountItem(item);
129
- }
130
-
131
- /**
132
- * 判断商品行在本轮评估前是否已享受促销。
133
- *
134
- * `_promotion` 仅存在于当前运行时;订单保存后会被裁剪,因此编辑态需通过
135
- * ITEM_REWARD 写入的受管商品折扣恢复上一轮状态。
136
- */
137
- function wasInPromotionBeforeEvaluation(item) {
138
- var _item$metadata3;
139
- if ((item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 || (_item$metadata3 = _item$metadata3._promotion) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.inPromotion) === true) return true;
140
- return Array.isArray(item === null || item === void 0 ? void 0 : item.discount_list) && item.discount_list.some(isItemRewardPromotionDiscountItem);
141
- }
142
119
 
143
120
  /**
144
- * 写入/清除促销 discount_list
121
+ * 写入/清除促销 discount_list(type=promotion)。
145
122
  *
146
123
  * applyDiscount → applyProductDiscountPrices 会从 source_product_price 减去 discount_list 合计
147
124
  * 重算 main_product_selling_price;保留券前 source 时必须同步写入促销差额,否则会还原成原价。
148
125
  *
149
- * ITEM_REWARD 使用 type=product,复用商品级折扣排他规则,避免客户折扣继续叠加到奖励商品行。
150
- *
151
126
  * @example
152
127
  * updatePromotionDiscountList(line, { title: '2 items for $10', amount: '17.00', original_amount: '22.00', fixed_amount: '17.00' });
153
128
  */
154
- function updatePromotionDiscountList(item, promotionDiscount, options) {
129
+ function updatePromotionDiscountList(item, promotionDiscount) {
155
130
  var discountList = Array.isArray(item.discount_list) ? _toConsumableArray(item.discount_list) : [];
156
131
  discountList = discountList.filter(function (d) {
157
- return !isManagedPromotionDiscountItem(d);
132
+ return (d === null || d === void 0 ? void 0 : d.type) !== 'promotion';
158
133
  });
159
134
  if (promotionDiscount) {
160
- var discountType = (options === null || options === void 0 ? void 0 : options.discountType) || 'promotion';
161
- discountList.push(_objectSpread({
162
- type: discountType,
135
+ discountList.push({
136
+ type: 'promotion',
163
137
  amount: promotionDiscount.amount,
164
138
  discount: {
165
139
  original_amount: promotionDiscount.original_amount,
@@ -167,12 +141,7 @@ function updatePromotionDiscountList(item, promotionDiscount, options) {
167
141
  title: promotionDiscount.title,
168
142
  resource_id: ''
169
143
  }
170
- }, discountType === 'product' ? {
171
- metadata: {
172
- source: 'promotion',
173
- actionType: (options === null || options === void 0 ? void 0 : options.actionType) || ITEM_REWARD
174
- }
175
- } : {}));
144
+ });
176
145
  }
177
146
  if (discountList.length > 0) {
178
147
  item.discount_list = discountList;
@@ -180,19 +149,11 @@ function updatePromotionDiscountList(item, promotionDiscount, options) {
180
149
  delete item.discount_list;
181
150
  }
182
151
  }
183
- function evaluatorHasActionType(evaluator, actionType) {
184
- var _evaluator$getStrateg;
185
- var configs = evaluator === null || evaluator === void 0 || (_evaluator$getStrateg = evaluator.getStrategyConfigs) === null || _evaluator$getStrateg === void 0 ? void 0 : _evaluator$getStrateg.call(evaluator);
186
- if (!Array.isArray(configs)) return false;
187
- return configs.some(function (config) {
188
- return ((config === null || config === void 0 ? void 0 : config.actions) || []).some(function (action) {
189
- return (action === null || action === void 0 ? void 0 : action.type) === actionType;
190
- });
191
- });
192
- }
152
+ var X_ITEMS_FOR_Y_PRICE = 'X_ITEMS_FOR_Y_PRICE';
153
+ var BUY_X_GET_Y_FREE = 'BUY_X_GET_Y_FREE';
193
154
 
194
155
  /**
195
- * 将促销单价写入 OrderProduct(含 metadata 三字段 + 行内折扣)。
156
+ * 将促销单价写入 OrderProduct(含 metadata 三字段 + promotion discount_list)。
196
157
  *
197
158
  * @example
198
159
  * applyPromoUnitPriceToLine(newItem, { promoUnitPrice: '5.00', originalBasePrice: 1, strategyTitle: '2 for 10' });
@@ -223,9 +184,6 @@ function applyPromoUnitPriceToLine(item, input) {
223
184
  amount: discountAmount,
224
185
  original_amount: catalogSource,
225
186
  fixed_amount: discountAmount
226
- }, {
227
- actionType: input.actionType,
228
- discountType: input.actionType === ITEM_REWARD ? 'product' : 'promotion'
229
187
  });
230
188
  } else {
231
189
  updatePromotionDiscountList(item, null);
@@ -468,11 +426,13 @@ function getProductLineNoteSignature(product) {
468
426
  }
469
427
 
470
428
  /**
471
- * 编辑订单时,历史行仍参与整车促销评估,但不能与本次新增行合并。
472
- * 以历史行 uid 作为促销前后的行边界;新增行返回空边界,仍保留原有合并语义。
429
+ * 称重行以及编辑订单历史行都有各自的促销合并边界。
473
430
  */
474
431
  function getPromotionLineMergeBoundary(product) {
475
- var _product$metadata3;
432
+ var _product$product_sku, _product$metadata3;
433
+ if (Number((product === null || product === void 0 || (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.open_sold_weight) || 0) === 1) {
434
+ return "weighing:".concat(getOrderProductUid(product));
435
+ }
476
436
  if ((product === null || product === void 0 || (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.is_edit_for_runtime) !== true) return '';
477
437
  return "edit:".concat(getOrderProductUid(product));
478
438
  }
@@ -513,11 +473,11 @@ function getProductBundleForEvaluator(product) {
513
473
  * // => 单行 num=4,清除 _promotion 后重新评估
514
474
  */
515
475
  export function buildConsolidateKeyForPromotion(item) {
516
- var _item$booking_uid, _item$metadata4, _item$order_detail_id, _item$product_variant3;
476
+ var _item$booking_uid, _item$metadata, _item$order_detail_id, _item$product_variant3;
517
477
  var fingerprint = buildProductLineFingerprint(getProductSkuOptions(item), item.product_bundle);
518
478
  var noteSignature = getProductLineNoteSignature(item);
519
479
  var lineMergeBoundary = getPromotionLineMergeBoundary(item);
520
- var bookingUid = (_item$booking_uid = item === null || item === void 0 ? void 0 : item.booking_uid) !== null && _item$booking_uid !== void 0 ? _item$booking_uid : item === null || item === void 0 || (_item$metadata4 = item.metadata) === null || _item$metadata4 === void 0 ? void 0 : _item$metadata4.booking_uid;
480
+ var bookingUid = (_item$booking_uid = item === null || item === void 0 ? void 0 : item.booking_uid) !== null && _item$booking_uid !== void 0 ? _item$booking_uid : item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.booking_uid;
521
481
  var orderDetailId = (_item$order_detail_id = item === null || item === void 0 ? void 0 : item.order_detail_id) !== null && _item$order_detail_id !== void 0 ? _item$order_detail_id : item === null || item === void 0 ? void 0 : item.orderDetailId;
522
482
  if (orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '') {
523
483
  var _item$product_variant;
@@ -538,11 +498,12 @@ function consolidateMainProductsForPromotion(entries) {
538
498
  _step5;
539
499
  try {
540
500
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
501
+ var _item$metadata2;
541
502
  var _step5$value = _step5.value,
542
503
  item = _step5$value.item,
543
504
  originalListIndex = _step5$value.originalListIndex;
544
505
  var key = buildConsolidateKeyForPromotion(item);
545
- var wasInPromotion = wasInPromotionBeforeEvaluation(item);
506
+ var wasInPromotion = (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 || (_item$metadata2 = _item$metadata2._promotion) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.inPromotion) === true;
546
507
  var existing = groups.get(key);
547
508
  if (!existing) {
548
509
  var mergedItem = cloneDeep(item);
@@ -639,9 +600,6 @@ function splitXItemsPromoLinesByGroup(lines, strategyActionMap) {
639
600
  function generateNumericId() {
640
601
  return Math.floor(Math.random() * 1000000000) + Date.now();
641
602
  }
642
- function isBookingEditProductLine(product) {
643
- return (product === null || product === void 0 ? void 0 : product.booking_id) !== undefined && (product === null || product === void 0 ? void 0 : product.booking_id) !== null && product.booking_id !== 0 && product.booking_id !== '0';
644
- }
645
603
 
646
604
  /**
647
605
  * 把 OrderProduct 转成 evaluator 的 PromotionProduct(仅评估期使用)。
@@ -662,7 +620,6 @@ function convertToPromotionProduct(product, index) {
662
620
  price: getOrderProductOriginalPriceForPromotion(product),
663
621
  quantity: Number((_product$num = product === null || product === void 0 ? void 0 : product.num) !== null && _product$num !== void 0 ? _product$num : 1) || 1,
664
622
  bundle: getProductBundleForEvaluator(product),
665
- _promotionOnlyForItemReward: isBookingEditProductLine(product),
666
623
  _originalItem: originalItem,
667
624
  _originalId: getOrderProductUid(product),
668
625
  _originalIndex: index
@@ -870,9 +827,6 @@ export function resolveStrategyRequiredQuantity(matched) {
870
827
  if (matched.actionType === 'BUY_X_GET_Y_FREE') {
871
828
  return Number(detail.buyQuantity) || 1;
872
829
  }
873
- if (matched.actionType === 'ITEM_REWARD') {
874
- return Number(detail.triggerQuantity) || 1;
875
- }
876
830
  return 1;
877
831
  }
878
832
 
@@ -1032,8 +986,7 @@ export function appendPromotionTags(products, evaluator) {
1032
986
  * 处理购物车的促销计算与赠品差异化。
1033
987
  *
1034
988
  * 流程:
1035
- * 1. 分离 main / gift / edit-product 三类(普通促销下带 `booking_id` 的编辑态商品不参与;
1036
- * 配置 ITEM_REWARD 时,编辑态商品也参与商品奖励重算)
989
+ * 1. 分离 main / gift / edit-product 三类(带 `booking_id` 的编辑态商品不参与促销)
1037
990
  * 2. 转 PromotionProduct 喂评估器 → 拿到 `evaluateCartWithPricing` 与 `getProductsApplicableStrategies`
1038
991
  * 3. 把 PricedProduct 映射回 OrderProduct 形态:
1039
992
  * - 参与促销的,写 `metadata._promotion` + 调整 `selling_price` / `main_product_selling_price`
@@ -1063,7 +1016,6 @@ export function processCartPromotion(list, evaluator, options) {
1063
1016
  if (!list || list.length === 0 || !evaluator) return empty;
1064
1017
 
1065
1018
  // 0. 分类
1066
- var shouldIncludeEditProductsForItemReward = evaluatorHasActionType(evaluator, ITEM_REWARD);
1067
1019
  var mainProductsWithIndex = [];
1068
1020
  var existingGiftsWithIndex = [];
1069
1021
  var editProductsWithIndex = [];
@@ -1080,18 +1032,11 @@ export function processCartPromotion(list, evaluator, options) {
1080
1032
  item: item,
1081
1033
  originalListIndex: i
1082
1034
  });
1083
- } else if (isBookingEditProductLine(item)) {
1084
- if (shouldIncludeEditProductsForItemReward) {
1085
- mainProductsWithIndex.push({
1086
- item: item,
1087
- originalListIndex: i
1088
- });
1089
- } else {
1090
- editProductsWithIndex.push({
1091
- item: item,
1092
- originalListIndex: i
1093
- });
1094
- }
1035
+ } else if ((item === null || item === void 0 ? void 0 : item.booking_id) !== undefined && (item === null || item === void 0 ? void 0 : item.booking_id) !== null && item.booking_id !== 0 && item.booking_id !== '0') {
1036
+ editProductsWithIndex.push({
1037
+ item: item,
1038
+ originalListIndex: i
1039
+ });
1095
1040
  } else {
1096
1041
  mainProductsWithIndex.push({
1097
1042
  item: item,
@@ -1146,17 +1091,16 @@ export function processCartPromotion(list, evaluator, options) {
1146
1091
  var promotionProducts = [];
1147
1092
  var originalItemMap = new Map();
1148
1093
  var productsForStrategies = consolidatedMainProductsWithIndex.map(function (_ref16, i) {
1149
- var _item$product_id, _item$product_variant5, _item$metadata5, _item$num;
1094
+ var _item$product_id, _item$product_variant5, _item$metadata3, _item$num;
1150
1095
  var item = _ref16.item;
1151
1096
  return {
1152
1097
  id: i,
1153
1098
  product_id: Number((_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : 0) || 0,
1154
1099
  product_variant_id: Number((_item$product_variant5 = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant5 !== void 0 ? _item$product_variant5 : 0) || 0,
1155
- name: (item === null || item === void 0 || (_item$metadata5 = item.metadata) === null || _item$metadata5 === void 0 ? void 0 : _item$metadata5.product_name) || (item === null || item === void 0 ? void 0 : item.title) || '',
1100
+ name: (item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.product_name) || (item === null || item === void 0 ? void 0 : item.title) || '',
1156
1101
  price: getOrderProductBasePrice(item),
1157
1102
  quantity: Number((_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : 1) || 1,
1158
- bundle: getProductBundleForEvaluator(item),
1159
- _promotionOnlyForItemReward: isBookingEditProductLine(item)
1103
+ bundle: getProductBundleForEvaluator(item)
1160
1104
  };
1161
1105
  });
1162
1106
  for (var _i = 0; _i < consolidatedMainProductsWithIndex.length; _i++) {
@@ -1264,7 +1208,7 @@ export function processCartPromotion(list, evaluator, options) {
1264
1208
  _step20;
1265
1209
  try {
1266
1210
  for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
1267
- var _priced$originalId2, _priced$product_id, _originalItem$product;
1211
+ var _priced$originalId2, _priced$product_id, _originalItem$product, _metadata$_promotion2;
1268
1212
  var _priced = _step20.value;
1269
1213
  var rawSourceId = (_priced$originalId2 = _priced.originalId) !== null && _priced$originalId2 !== void 0 ? _priced$originalId2 : _priced.id;
1270
1214
  var _sourceId = Number(rawSourceId);
@@ -1283,7 +1227,7 @@ export function processCartPromotion(list, evaluator, options) {
1283
1227
  newItem._sourceCartNum = sourceCartNum;
1284
1228
 
1285
1229
  // 清掉历史促销字段
1286
- var wasInPromotion = wasInPromotionBeforeEvaluation(originalItem) || originalItem._wasInPromotionBeforeConsolidate === true;
1230
+ var wasInPromotion = ((_metadata$_promotion2 = metadata._promotion) === null || _metadata$_promotion2 === void 0 ? void 0 : _metadata$_promotion2.inPromotion) === true || originalItem._wasInPromotionBeforeConsolidate === true;
1287
1231
  delete metadata._promotion;
1288
1232
  if (Array.isArray(newItem.product_bundle)) {
1289
1233
  var _iterator23 = _createForOfIteratorHelper(newItem.product_bundle),
@@ -1304,13 +1248,12 @@ export function processCartPromotion(list, evaluator, options) {
1304
1248
  var priceUnchangedPromo = _priced.inPromotion && Number(_priced.finalPrice) === Number(originalBasePrice);
1305
1249
  if (shouldModifyPrice) {
1306
1250
  if (_priced.inPromotion && !priceUnchangedPromo) {
1307
- var _priced$strategyMetad, _strategyActionMap$ge;
1251
+ var _priced$strategyMetad;
1308
1252
  var promoUnitPrice = new Decimal(_priced.finalPrice).toDecimalPlaces(2).toFixed(2);
1309
1253
  applyPromoUnitPriceToLine(newItem, {
1310
1254
  promoUnitPrice: promoUnitPrice,
1311
1255
  originalBasePrice: originalBasePrice,
1312
- strategyTitle: (_priced$strategyMetad = _priced.strategyMetadata) === null || _priced$strategyMetad === void 0 ? void 0 : _priced$strategyMetad.name,
1313
- actionType: _priced.strategyId ? (_strategyActionMap$ge = strategyActionMap.get(_priced.strategyId)) === null || _strategyActionMap$ge === void 0 ? void 0 : _strategyActionMap$ge.actionType : undefined
1256
+ strategyTitle: (_priced$strategyMetad = _priced.strategyMetadata) === null || _priced$strategyMetad === void 0 ? void 0 : _priced$strategyMetad.name
1314
1257
  });
1315
1258
  } else {
1316
1259
  // 撤销上一轮促销:还原 selling_price 到 main_product_original_price 派生值
@@ -82,13 +82,8 @@ export interface ISalesBooking {
82
82
  metadata?: Record<string, any> | null;
83
83
  [key: string]: any;
84
84
  }
85
- export interface ISalesPaymentMetadata extends Record<string, any> {
86
- /** 刷卡机设备快照;OS 不解析内部字段 */
87
- card_reader_snapshot?: Record<string, unknown>;
88
- }
89
85
  export interface ISalesPayment {
90
86
  order_payment_id?: number | null;
91
- payment_number?: string;
92
87
  custom_payment_id?: number;
93
88
  code?: string;
94
89
  name?: string;
@@ -100,7 +95,7 @@ export interface ISalesPayment {
100
95
  status?: string;
101
96
  payment_time?: string | null;
102
97
  service_charge?: Record<string, any> | null;
103
- metadata?: ISalesPaymentMetadata | null;
98
+ metadata?: Record<string, any> | null;
104
99
  [key: string]: any;
105
100
  }
106
101
  export interface ISalesSurcharge {
@@ -322,7 +322,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
322
322
  * 获取当前的客户搜索条件
323
323
  * @returns 当前搜索条件
324
324
  */
325
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
325
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
326
326
  /**
327
327
  * 获取客户列表状态(包含滚动加载相关状态)
328
328
  * @returns 客户状态
@@ -397,52 +397,49 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
397
397
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
398
398
  while (1) switch (_context5.prev = _context5.next) {
399
399
  case 0:
400
- // 业务码切换或配置失败时不能复用上一次初始化的短号。
401
- this.setPaymentNumberDevicePrefix(null);
402
400
  openDataConfig = null;
403
- _context5.prev = 2;
404
- _context5.next = 5;
401
+ _context5.prev = 1;
402
+ _context5.next = 4;
405
403
  return this.loadOpenDataConfig();
406
- case 5:
404
+ case 4:
407
405
  openDataConfig = _context5.sent;
408
- _context5.next = 12;
406
+ _context5.next = 11;
409
407
  break;
410
- case 8:
411
- _context5.prev = 8;
412
- _context5.t0 = _context5["catch"](2);
408
+ case 7:
409
+ _context5.prev = 7;
410
+ _context5.t0 = _context5["catch"](1);
413
411
  console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context5.t0);
414
412
  return _context5.abrupt("return");
415
- case 12:
413
+ case 11:
416
414
  // if (!openDataConfig) return;
417
415
  idGenerator = this.getIdGeneratorPlugin();
418
416
  if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
419
- _context5.next = 16;
417
+ _context5.next = 15;
420
418
  break;
421
419
  }
422
420
  console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
423
421
  return _context5.abrupt("return");
424
- case 16:
422
+ case 15:
425
423
  receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
426
424
  receiptSequenceStart = this.normalizePositiveInteger((_openDataConfig2 = openDataConfig) === null || _openDataConfig2 === void 0 ? void 0 : _openDataConfig2['sale.short_number_start_number'], 1);
427
425
  prefix = this.normalizeIdPrefix((_openDataConfig3 = openDataConfig) === null || _openDataConfig3 === void 0 ? void 0 : _openDataConfig3['sale.short_number_prefix'], '');
428
426
  shopOrderPrefix = this.normalizeIdPrefix((_openDataConfig4 = openDataConfig) === null || _openDataConfig4 === void 0 ? void 0 : _openDataConfig4['sale.sale_number_prefix'], '');
429
427
  resetReceiptSequenceDaily = typeof ((_openDataConfig5 = openDataConfig) === null || _openDataConfig5 === void 0 ? void 0 : _openDataConfig5['sale.short_number_daily_reset']) === 'boolean' ? (_openDataConfig6 = openDataConfig) === null || _openDataConfig6 === void 0 ? void 0 : _openDataConfig6['sale.short_number_daily_reset'] : false;
430
428
  operatingDayBoundary = this.getAppData('operating_day_boundary');
431
- _context5.next = 24;
429
+ _context5.next = 23;
432
430
  return this.getShortNumberOrDeviceId();
433
- case 24:
431
+ case 23:
434
432
  deviceId = _context5.sent;
435
- this.setPaymentNumberDevicePrefix(deviceId);
436
433
  businessCode = this.getBookingTicketBusinessCode();
437
434
  if (businessCode) {
438
- _context5.next = 30;
435
+ _context5.next = 28;
439
436
  break;
440
437
  }
441
438
  console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
442
439
  return _context5.abrupt("return");
443
- case 30:
444
- _context5.prev = 30;
445
- _context5.next = 33;
440
+ case 28:
441
+ _context5.prev = 28;
442
+ _context5.next = 31;
446
443
  return idGenerator.configure({
447
444
  biz: businessCode,
448
445
  config: {
@@ -457,18 +454,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
457
454
  shopOrderPrefix: shopOrderPrefix
458
455
  }
459
456
  });
460
- case 33:
461
- _context5.next = 38;
457
+ case 31:
458
+ _context5.next = 36;
462
459
  break;
463
- case 35:
464
- _context5.prev = 35;
465
- _context5.t1 = _context5["catch"](30);
460
+ case 33:
461
+ _context5.prev = 33;
462
+ _context5.t1 = _context5["catch"](28);
466
463
  console.warn('[BookingTicket] idGenerator 配置失败', _context5.t1);
467
- case 38:
464
+ case 36:
468
465
  case "end":
469
466
  return _context5.stop();
470
467
  }
471
- }, _callee5, this, [[2, 8], [30, 35]]);
468
+ }, _callee5, this, [[1, 7], [28, 33]]);
472
469
  }));
473
470
  function configureIdGeneratorFromOpenData() {
474
471
  return _configureIdGeneratorFromOpenData.apply(this, arguments);
@@ -1996,8 +1993,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1996
1993
  }, {
1997
1994
  key: "getBookingConfig",
1998
1995
  value: function getBookingConfig() {
1999
- var _this$store$bookingCo;
2000
- return (_this$store$bookingCo = this.store.bookingContext) === null || _this$store$bookingCo === void 0 ? void 0 : _this$store$bookingCo.getBookingConfig();
1996
+ return this.store.bookingContext.getBookingConfig();
2001
1997
  }
2002
1998
 
2003
1999
  /** 写入资源全集(来源:`/form/schedule`),同步派生 resourcesOriginMap。 */
@@ -2605,18 +2601,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2605
2601
  while (1) switch (_context31.prev = _context31.next) {
2606
2602
  case 0:
2607
2603
  _ref19 = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
2608
- _context31.next = 3;
2609
- return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
2604
+ _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
2610
2605
  cover: cover
2611
2606
  });
2612
- case 3:
2613
- if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
2614
- _context31.next = 6;
2607
+ if (!(params !== null && params !== void 0 && params.businessCode)) {
2608
+ _context31.next = 5;
2615
2609
  break;
2616
2610
  }
2617
- _context31.next = 6;
2611
+ _context31.next = 5;
2618
2612
  return this.configureIdGeneratorFromOpenData();
2619
- case 6:
2613
+ case 5:
2620
2614
  case "end":
2621
2615
  return _context31.stop();
2622
2616
  }
@@ -7,6 +7,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
7
7
  import dayjs from 'dayjs';
8
8
  import { cacheItemToBookingInput, derivePresetStartTimeFromDate, getProductExtend, getIsAutoClose, isSessionProduct, isBookingProduct, applySessionTimesToExtend, hasActualResourceSelection, productNeedsResourceExtend } from "../../../modules/BookingContext";
9
9
  import { transformBaseProductToOrderProduct } from "../../BaseSales/utils/transformBaseProductToOrderProduct";
10
+ import { buildProductSkuFromCacheItem } from "./weighingProductSku";
10
11
 
11
12
  /**
12
13
  * cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
@@ -322,11 +323,16 @@ function buildBasePayloadFromCacheItem(cacheItem, ctx) {
322
323
  var quantity = (ctx === null || ctx === void 0 ? void 0 : ctx.quantity) != null && ctx.quantity > 0 ? ctx.quantity : (_cacheItem$_extend$qu = cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.quantity) !== null && _cacheItem$_extend$qu !== void 0 ? _cacheItem$_extend$qu : 1;
323
324
  var resolvedPid = (_cacheItem$product_id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id) !== null && _cacheItem$product_id !== void 0 ? _cacheItem$product_id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id;
324
325
  var extend = (cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem._extend) || {};
326
+ var productSku = buildProductSkuFromCacheItem(cacheItem);
325
327
  return {
326
328
  id: (_cacheItem$id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id) !== null && _cacheItem$id !== void 0 ? _cacheItem$id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id,
327
329
  product_id: resolvedPid,
328
330
  variant_id: (_ref5 = (_other$product_varian = other === null || other === void 0 ? void 0 : other.product_variant_id) !== null && _other$product_varian !== void 0 ? _other$product_varian : other === null || other === void 0 ? void 0 : other.variant_id) !== null && _ref5 !== void 0 ? _ref5 : 0,
329
331
  quantity: quantity,
332
+ // 规格弹窗本次选择是 option 权威源,避免目录/旧订单里的空 option 覆盖它。
333
+ product_sku: productSku ? _objectSpread(_objectSpread({}, productSku), {}, {
334
+ option: (other === null || other === void 0 ? void 0 : other.option) || []
335
+ }) : undefined,
330
336
  option: (other === null || other === void 0 ? void 0 : other.option) || [],
331
337
  bundle: (other === null || other === void 0 ? void 0 : other.bundle) || (extend === null || extend === void 0 || (_extend$skuValue = extend.skuValue) === null || _extend$skuValue === void 0 ? void 0 : _extend$skuValue.bundle) || (extend === null || extend === void 0 || (_extend$_skuValue = extend._skuValue) === null || _extend$_skuValue === void 0 ? void 0 : _extend$_skuValue.bundle) || [],
332
338
  unique: other === null || other === void 0 ? void 0 : other.unique,
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 将规格弹窗的称重结果写入订单行权威字段 product_sku。
3
+ * 商品目录已有的 SKU 字段会保留,本次称重结果只覆盖运行态称重字段。
4
+ */
5
+ export declare function buildProductSkuFromCacheItem(cacheItem: Record<string, any> | null | undefined): Record<string, any> | undefined;
@@ -0,0 +1,45 @@
1
+ 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; }
2
+ 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; }
3
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
5
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
+ 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); }
7
+ var WEIGHT_UNIT_MAP = {
8
+ KILOGRAMS: 'kg',
9
+ GRAMS: 'g',
10
+ POUNDS: 'lb',
11
+ OUNCES: 'oz'
12
+ };
13
+ function isRecord(value) {
14
+ return Boolean(value) && _typeof(value) === 'object' && !Array.isArray(value);
15
+ }
16
+
17
+ /**
18
+ * 将规格弹窗的称重结果写入订单行权威字段 product_sku。
19
+ * 商品目录已有的 SKU 字段会保留,本次称重结果只覆盖运行态称重字段。
20
+ */
21
+ export function buildProductSkuFromCacheItem(cacheItem) {
22
+ var _cacheItem$_extend, _cacheItem$_extend2, _weighing$unit_weight, _weighing$tare$label, _weighing$tare, _weighing$tare$value, _weighing$tare2, _weighing$weight, _weighing$net_weight;
23
+ var currentSku = isRecord(cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_sku) ? cacheItem.product_sku : undefined;
24
+ var weighing = isRecord(cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.weighing) ? cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.weighing : undefined;
25
+ var hasRuntimeWeighingSku = Number((currentSku === null || currentSku === void 0 ? void 0 : currentSku.open_sold_weight) || 0) === 1 && ((currentSku === null || currentSku === void 0 ? void 0 : currentSku.weight) !== undefined || (currentSku === null || currentSku === void 0 ? void 0 : currentSku.net_weight) !== undefined || (currentSku === null || currentSku === void 0 ? void 0 : currentSku.weight_source) !== undefined);
26
+ var isWeighingSku = Number((currentSku === null || currentSku === void 0 ? void 0 : currentSku.open_sold_weight) || 0) === 1;
27
+
28
+ // 普通商品维持旧转换行为,不把目录侧完整 SKU 引入订单行。
29
+ if (!isWeighingSku && !weighing) return undefined;
30
+ // 新版 SkuDetailModal 已直接生成 product_sku;_extend.weighing 只作为旧调用方回退。
31
+ if (hasRuntimeWeighingSku) return _objectSpread({}, currentSku);
32
+ if (!weighing) return currentSku ? _objectSpread({}, currentSku) : undefined;
33
+ return _objectSpread(_objectSpread({}, currentSku || {}), {}, {
34
+ open_sold_weight: 1,
35
+ unit_data_snapshot: weighing.scalePriceProduct,
36
+ unit: WEIGHT_UNIT_MAP[String(weighing.unit)] || weighing.unit,
37
+ unit_weight: (_weighing$unit_weight = weighing.unit_weight) !== null && _weighing$unit_weight !== void 0 ? _weighing$unit_weight : '1.000',
38
+ unit_price: weighing.unit_price,
39
+ weight_source: weighing.mode,
40
+ tare_name: (_weighing$tare$label = (_weighing$tare = weighing.tare) === null || _weighing$tare === void 0 ? void 0 : _weighing$tare.label) !== null && _weighing$tare$label !== void 0 ? _weighing$tare$label : '',
41
+ tare_weight: (_weighing$tare$value = (_weighing$tare2 = weighing.tare) === null || _weighing$tare2 === void 0 ? void 0 : _weighing$tare2.value) !== null && _weighing$tare$value !== void 0 ? _weighing$tare$value : 0,
42
+ weight: (_weighing$weight = weighing.weight) !== null && _weighing$weight !== void 0 ? _weighing$weight : 0,
43
+ net_weight: (_weighing$net_weight = weighing.net_weight) !== null && _weighing$net_weight !== void 0 ? _weighing$net_weight : 0
44
+ });
45
+ }
@@ -83,7 +83,6 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
83
83
  private getBookingAppointmentStatus;
84
84
  private isBookingIncludedInStats;
85
85
  private getBookingOrderPaymentStatus;
86
- private isUnpaidBooking;
87
86
  private countBookingOrders;
88
87
  private countCompletedBookings;
89
88
  private groupBookingsByResource;
@@ -29,7 +29,6 @@ import dayjs from 'dayjs';
29
29
  import { BaseModule } from "../../modules/BaseModule";
30
30
  import { SalesHooks } from "./types";
31
31
  export * from "./types";
32
- var UNPAID_PAYMENT_STATUSES = new Set(['unpaid', 'partially_paid', 'payment_processing']);
33
32
 
34
33
  /**
35
34
  * Sales 解决方案基础骨架
@@ -416,11 +415,6 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
416
415
  var _booking$order$paymen, _booking$order;
417
416
  return String((_booking$order$paymen = (_booking$order = booking.order) === null || _booking$order === void 0 ? void 0 : _booking$order.payment_status) !== null && _booking$order$paymen !== void 0 ? _booking$order$paymen : '');
418
417
  }
419
- }, {
420
- key: "isUnpaidBooking",
421
- value: function isUnpaidBooking(booking) {
422
- return UNPAID_PAYMENT_STATUSES.has(this.getBookingOrderPaymentStatus(booking));
423
- }
424
418
  }, {
425
419
  key: "countBookingOrders",
426
420
  value: function countBookingOrders(bookings) {
@@ -901,11 +895,9 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
901
895
  });
902
896
  completedBookingList = matchedBookingList.filter(function (booking) {
903
897
  return _this7.getBookingAppointmentStatus(booking) === 'completed';
904
- }); // const unpaidBookingList = matchedBookingList.filter(
905
- // (booking) => this.getBookingOrderPaymentStatus(booking) === 'unpaid' || this.getBookingOrderPaymentStatus(booking) === 'payment_processing',
906
- // );
898
+ });
907
899
  unpaidBookingList = matchedBookingList.filter(function (booking) {
908
- return _this7.isUnpaidBooking(booking);
900
+ return _this7.getBookingOrderPaymentStatus(booking) === 'unpaid' || _this7.getBookingOrderPaymentStatus(booking) === 'payment_processing';
909
901
  });
910
902
  bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList));
911
903
  completedBookings = completedBookingList.map(function (booking) {