@pisell/pisellos 2.2.264 → 2.2.265

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 (152) hide show
  1. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +50 -0
  2. package/dist/model/strategy/adapter/dataVariant/adapter.js +167 -0
  3. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +89 -0
  4. package/dist/model/strategy/adapter/dataVariant/evaluator.js +780 -0
  5. package/dist/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
  6. package/dist/model/strategy/adapter/dataVariant/examples.js +277 -0
  7. package/dist/model/strategy/adapter/dataVariant/index.d.ts +4 -0
  8. package/dist/model/strategy/adapter/dataVariant/index.js +4 -0
  9. package/dist/model/strategy/adapter/dataVariant/type.d.ts +148 -0
  10. package/dist/model/strategy/adapter/dataVariant/type.js +54 -0
  11. package/dist/model/strategy/adapter/index.d.ts +4 -0
  12. package/dist/model/strategy/adapter/index.js +5 -1
  13. package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  14. package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
  15. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  16. package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
  17. package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
  18. package/dist/model/strategy/adapter/promotion/examples.js +0 -99
  19. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  20. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  21. package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
  22. package/dist/model/strategy/adapter/promotion/type.js +0 -45
  23. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +16 -10
  24. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
  25. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
  26. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +32 -1
  27. package/dist/modules/Discount/index.d.ts +5 -2
  28. package/dist/modules/Discount/index.js +30 -7
  29. package/dist/modules/Discount/types.d.ts +4 -0
  30. package/dist/modules/Order/index.d.ts +41 -10
  31. package/dist/modules/Order/index.js +1370 -808
  32. package/dist/modules/Order/payment-utils.d.ts +26 -0
  33. package/dist/modules/Order/payment-utils.js +225 -0
  34. package/dist/modules/Order/types.d.ts +49 -1
  35. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
  36. package/dist/modules/Order/utils/orderCollectionIdentity.js +410 -0
  37. package/dist/modules/Order/utils.d.ts +4 -3
  38. package/dist/modules/Order/utils.js +62 -66
  39. package/dist/modules/Payment/index.d.ts +2 -0
  40. package/dist/modules/Payment/index.js +78 -49
  41. package/dist/modules/Payment/types.d.ts +26 -24
  42. package/dist/modules/Payment/types.js +2 -0
  43. package/dist/modules/Product/types.d.ts +22 -0
  44. package/dist/modules/ProductList/index.d.ts +1 -1
  45. package/dist/modules/ProductList/index.js +4 -2
  46. package/dist/modules/ProductList/types.d.ts +2 -0
  47. package/dist/modules/Rules/index.d.ts +2 -9
  48. package/dist/modules/Rules/index.js +69 -43
  49. package/dist/modules/Rules/types.d.ts +10 -1
  50. package/dist/server/index.d.ts +71 -0
  51. package/dist/server/index.js +2504 -1187
  52. package/dist/server/modules/order/index.d.ts +56 -5
  53. package/dist/server/modules/order/index.js +1718 -834
  54. package/dist/server/modules/order/types.d.ts +15 -3
  55. package/dist/server/modules/order/types.js +1 -1
  56. package/dist/server/modules/products/index.d.ts +31 -8
  57. package/dist/server/modules/products/index.js +549 -390
  58. package/dist/server/modules/products/types.d.ts +18 -0
  59. package/dist/solution/BaseSales/index.d.ts +54 -4
  60. package/dist/solution/BaseSales/index.js +1448 -788
  61. package/dist/solution/BaseSales/types.d.ts +6 -1
  62. package/dist/solution/BaseSales/types.js +1 -1
  63. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  64. package/dist/solution/BaseSales/utils/cartPromotion.js +50 -97
  65. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +9 -4
  66. package/dist/solution/BaseSales/utils/parseSalesResponse.js +6 -8
  67. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +14 -1
  68. package/dist/solution/BookingByStep/index.d.ts +1 -1
  69. package/dist/solution/BookingTicket/index.js +61 -26
  70. package/dist/solution/BookingTicket/types.d.ts +2 -0
  71. package/dist/solution/Sales/index.d.ts +1 -0
  72. package/dist/solution/Sales/index.js +10 -2
  73. package/dist/solution/ScanOrder/index.js +20 -31
  74. package/dist/solution/ShopDiscount/index.js +15 -14
  75. package/dist/solution/VenueBooking/index.js +19 -30
  76. package/dist/utils/payment-number.d.ts +9 -0
  77. package/dist/utils/payment-number.js +69 -0
  78. package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +50 -0
  79. package/lib/model/strategy/adapter/dataVariant/adapter.js +149 -0
  80. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +89 -0
  81. package/lib/model/strategy/adapter/dataVariant/evaluator.js +583 -0
  82. package/lib/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
  83. package/lib/model/strategy/adapter/dataVariant/examples.js +293 -0
  84. package/lib/model/strategy/adapter/dataVariant/index.d.ts +4 -0
  85. package/lib/model/strategy/adapter/dataVariant/index.js +38 -0
  86. package/lib/model/strategy/adapter/dataVariant/type.d.ts +148 -0
  87. package/lib/model/strategy/adapter/dataVariant/type.js +31 -0
  88. package/lib/model/strategy/adapter/index.d.ts +4 -0
  89. package/lib/model/strategy/adapter/index.js +13 -2
  90. package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  91. package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
  92. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  93. package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
  94. package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
  95. package/lib/model/strategy/adapter/promotion/examples.js +0 -91
  96. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  97. package/lib/model/strategy/adapter/promotion/index.js +0 -2
  98. package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
  99. package/lib/model/strategy/adapter/promotion/type.js +0 -2
  100. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -0
  101. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -0
  102. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
  103. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +23 -2
  104. package/lib/modules/Discount/index.d.ts +5 -2
  105. package/lib/modules/Discount/index.js +23 -3
  106. package/lib/modules/Discount/types.d.ts +4 -0
  107. package/lib/modules/Order/index.d.ts +41 -10
  108. package/lib/modules/Order/index.js +505 -119
  109. package/lib/modules/Order/payment-utils.d.ts +26 -0
  110. package/lib/modules/Order/payment-utils.js +224 -0
  111. package/lib/modules/Order/types.d.ts +49 -1
  112. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
  113. package/lib/modules/Order/utils/orderCollectionIdentity.js +418 -0
  114. package/lib/modules/Order/utils.d.ts +4 -3
  115. package/lib/modules/Order/utils.js +27 -26
  116. package/lib/modules/Payment/index.d.ts +2 -0
  117. package/lib/modules/Payment/index.js +33 -12
  118. package/lib/modules/Payment/types.d.ts +26 -24
  119. package/lib/modules/Product/types.d.ts +22 -0
  120. package/lib/modules/ProductList/index.d.ts +1 -1
  121. package/lib/modules/ProductList/index.js +4 -2
  122. package/lib/modules/ProductList/types.d.ts +2 -0
  123. package/lib/modules/Rules/index.d.ts +2 -9
  124. package/lib/modules/Rules/index.js +61 -29
  125. package/lib/modules/Rules/types.d.ts +10 -1
  126. package/lib/server/index.d.ts +71 -0
  127. package/lib/server/index.js +1002 -52
  128. package/lib/server/modules/order/index.d.ts +56 -5
  129. package/lib/server/modules/order/index.js +798 -148
  130. package/lib/server/modules/order/types.d.ts +15 -3
  131. package/lib/server/modules/products/index.d.ts +31 -8
  132. package/lib/server/modules/products/index.js +134 -35
  133. package/lib/server/modules/products/types.d.ts +18 -0
  134. package/lib/solution/BaseSales/index.d.ts +54 -4
  135. package/lib/solution/BaseSales/index.js +475 -50
  136. package/lib/solution/BaseSales/types.d.ts +6 -1
  137. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  138. package/lib/solution/BaseSales/utils/cartPromotion.js +25 -64
  139. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +9 -4
  140. package/lib/solution/BaseSales/utils/parseSalesResponse.js +4 -5
  141. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +8 -0
  142. package/lib/solution/BookingByStep/index.d.ts +1 -1
  143. package/lib/solution/BookingTicket/index.js +35 -9
  144. package/lib/solution/BookingTicket/types.d.ts +2 -0
  145. package/lib/solution/Sales/index.d.ts +1 -0
  146. package/lib/solution/Sales/index.js +5 -3
  147. package/lib/solution/ScanOrder/index.js +0 -8
  148. package/lib/solution/ShopDiscount/index.js +2 -1
  149. package/lib/solution/VenueBooking/index.js +0 -8
  150. package/lib/utils/payment-number.d.ts +9 -0
  151. package/lib/utils/payment-number.js +64 -0
  152. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import type { Discount } from '../../modules/Discount/types';
1
2
  import { OrderModule, ProductList, QuotationModule, SalesSummaryModule, ScanOrderLoggerModule as BaseSalesLoggerModule, ScheduleModule } from '../../modules';
2
3
  import type { ScanOrderLogInput as BaseSalesLogInput, ScanOrderLoggerProviderConfig as BaseSalesLoggerProviderConfig, ScanOrderLoggerProviderType as BaseSalesLoggerProviderType } from '../../modules/ScanOrderLogger/types';
3
4
  import type { QuantityCheckResult, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
@@ -85,6 +86,8 @@ export interface BaseSalesOrderProduct extends BaseSalesOrderProductIdentity {
85
86
  booking_uid?: string;
86
87
  /** 多语言商品标题快照,随 tempOrder 提交到 checkout。 */
87
88
  product_title?: BaseSalesLocalizedText;
89
+ /** 商品封面图快照,随 tempOrder 提交到 checkout。 */
90
+ product_cover?: string;
88
91
  /**
89
92
  * 行级扩展 metadata。价格相关的权威字段:
90
93
  *
@@ -381,9 +384,11 @@ export interface BaseSalesLoggerRuntimeConfig {
381
384
  }
382
385
  export interface BaseSalesAddLogParams extends BaseSalesLogInput {
383
386
  }
384
- /** BaseSales.scanPromotionCode 对外的轻量结果(不含 discountList,UI resolve 后调 getDiscountList) */
387
+ /** BaseSales.scanPromotionCode 对外的轻量结果(UI 可用 getDiscountList scannedDiscountList 补 Holder) */
385
388
  export interface BaseSalesScanCodeResult {
386
389
  isAvailable: boolean;
387
390
  type?: 'server' | string;
388
391
  unavailableReason?: 'time_limit' | string;
392
+ /** batchSearch 原始结果;isAvailable=false 时 discountList 可能未写入 store,Holder 补全需读此字段 */
393
+ scannedDiscountList?: Discount[];
389
394
  }
@@ -37,4 +37,4 @@ export function createBaseSalesHook(moduleName, hookName) {
37
37
 
38
38
  /** `/order/resource/occupy-detail` 单条 `occupy_details[i]` */
39
39
 
40
- /** BaseSales.scanPromotionCode 对外的轻量结果(不含 discountList,UI resolve 后调 getDiscountList) */
40
+ /** BaseSales.scanPromotionCode 对外的轻量结果(UI 可用 getDiscountList scannedDiscountList 补 Holder) */
@@ -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);
@@ -287,9 +245,10 @@ export function mergeIdenticalPromotionCartLines(products) {
287
245
  var unitPrice = String((_ref2 = (_line$metadata$source = (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.source_product_price) !== null && _line$metadata$source !== void 0 ? _line$metadata$source : line.selling_price) !== null && _ref2 !== void 0 ? _ref2 : '');
288
246
  var promoUnitPrice = String((_ref3 = (_promotion$finalPrice = promotion.finalPrice) !== null && _promotion$finalPrice !== void 0 ? _promotion$finalPrice : (_line$metadata3 = line.metadata) === null || _line$metadata3 === void 0 ? void 0 : _line$metadata3.main_product_selling_price) !== null && _ref3 !== void 0 ? _ref3 : '');
289
247
  var noteSignature = getProductLineNoteSignature(line);
248
+ var lineMergeBoundary = getPromotionLineMergeBoundary(line);
290
249
  var bookingUid = (_line$booking_uid = line === null || line === void 0 ? void 0 : line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : line === null || line === void 0 || (_line$metadata4 = line.metadata) === null || _line$metadata4 === void 0 ? void 0 : _line$metadata4.booking_uid;
291
250
  var orderDetailId = (_line$order_detail_id = line === null || line === void 0 ? void 0 : line.order_detail_id) !== null && _line$order_detail_id !== void 0 ? _line$order_detail_id : line === null || line === void 0 ? void 0 : line.orderDetailId;
292
- var mergeKey = [line.product_id, (_line$product_variant = line.product_variant_id) !== null && _line$product_variant !== void 0 ? _line$product_variant : 0, fingerprint, noteSignature, bookingUid ? String(bookingUid) : '', orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '' ? String(orderDetailId) : '', promotion.strategyId, unitPrice, promoUnitPrice].join('#');
251
+ var mergeKey = [line.product_id, (_line$product_variant = line.product_variant_id) !== null && _line$product_variant !== void 0 ? _line$product_variant : 0, fingerprint, noteSignature, lineMergeBoundary, bookingUid ? String(bookingUid) : '', orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '' ? String(orderDetailId) : '', promotion.strategyId, unitPrice, promoUnitPrice].join('#');
293
252
  var hitIndex = indexByKey.get(mergeKey);
294
253
  if (hitIndex === undefined) {
295
254
  indexByKey.set(mergeKey, merged.length);
@@ -465,6 +424,16 @@ function getProductLineNoteSignature(product) {
465
424
  var uid = getOrderProductUid(product);
466
425
  return uid ? "note:".concat(uid) : "note:".concat(normalizedNote);
467
426
  }
427
+
428
+ /**
429
+ * 编辑订单时,历史行仍参与整车促销评估,但不能与本次新增行合并。
430
+ * 以历史行 uid 作为促销前后的行边界;新增行返回空边界,仍保留原有合并语义。
431
+ */
432
+ function getPromotionLineMergeBoundary(product) {
433
+ var _product$metadata3;
434
+ 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 '';
435
+ return "edit:".concat(getOrderProductUid(product));
436
+ }
468
437
  function isPersistedGeneratedVoucher(product) {
469
438
  var _product$order_detail;
470
439
  var orderDetailId = (_product$order_detail = product === null || product === void 0 ? void 0 : product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : product === null || product === void 0 ? void 0 : product.orderDetailId;
@@ -502,20 +471,21 @@ function getProductBundleForEvaluator(product) {
502
471
  * // => 单行 num=4,清除 _promotion 后重新评估
503
472
  */
504
473
  export function buildConsolidateKeyForPromotion(item) {
505
- var _item$booking_uid, _item$metadata4, _item$order_detail_id, _item$product_variant3;
474
+ var _item$booking_uid, _item$metadata, _item$order_detail_id, _item$product_variant3;
506
475
  var fingerprint = buildProductLineFingerprint(getProductSkuOptions(item), item.product_bundle);
507
476
  var noteSignature = getProductLineNoteSignature(item);
508
- 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;
477
+ var lineMergeBoundary = getPromotionLineMergeBoundary(item);
478
+ 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;
509
479
  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;
510
480
  if (orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '') {
511
481
  var _item$product_variant;
512
- return [item.product_id, (_item$product_variant = item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0, fingerprint, noteSignature, String(orderDetailId)].join('#');
482
+ return [item.product_id, (_item$product_variant = item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0, fingerprint, noteSignature, lineMergeBoundary, String(orderDetailId)].join('#');
513
483
  }
514
484
  if (bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '') {
515
485
  var _item$product_variant2;
516
- return [item.product_id, (_item$product_variant2 = item.product_variant_id) !== null && _item$product_variant2 !== void 0 ? _item$product_variant2 : 0, fingerprint, noteSignature, String(bookingUid)].join('#');
486
+ return [item.product_id, (_item$product_variant2 = item.product_variant_id) !== null && _item$product_variant2 !== void 0 ? _item$product_variant2 : 0, fingerprint, noteSignature, lineMergeBoundary, String(bookingUid)].join('#');
517
487
  }
518
- return [item.product_id, (_item$product_variant3 = item.product_variant_id) !== null && _item$product_variant3 !== void 0 ? _item$product_variant3 : 0, fingerprint, noteSignature].join('#');
488
+ return [item.product_id, (_item$product_variant3 = item.product_variant_id) !== null && _item$product_variant3 !== void 0 ? _item$product_variant3 : 0, fingerprint, noteSignature, lineMergeBoundary].join('#');
519
489
  }
520
490
  function consolidateMainProductsForPromotion(entries) {
521
491
  if (!Array.isArray(entries) || entries.length <= 1) {
@@ -526,11 +496,12 @@ function consolidateMainProductsForPromotion(entries) {
526
496
  _step5;
527
497
  try {
528
498
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
499
+ var _item$metadata2;
529
500
  var _step5$value = _step5.value,
530
501
  item = _step5$value.item,
531
502
  originalListIndex = _step5$value.originalListIndex;
532
503
  var key = buildConsolidateKeyForPromotion(item);
533
- var wasInPromotion = wasInPromotionBeforeEvaluation(item);
504
+ 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;
534
505
  var existing = groups.get(key);
535
506
  if (!existing) {
536
507
  var mergedItem = cloneDeep(item);
@@ -627,9 +598,6 @@ function splitXItemsPromoLinesByGroup(lines, strategyActionMap) {
627
598
  function generateNumericId() {
628
599
  return Math.floor(Math.random() * 1000000000) + Date.now();
629
600
  }
630
- function isBookingEditProductLine(product) {
631
- 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';
632
- }
633
601
 
634
602
  /**
635
603
  * 把 OrderProduct 转成 evaluator 的 PromotionProduct(仅评估期使用)。
@@ -650,7 +618,6 @@ function convertToPromotionProduct(product, index) {
650
618
  price: getOrderProductOriginalPriceForPromotion(product),
651
619
  quantity: Number((_product$num = product === null || product === void 0 ? void 0 : product.num) !== null && _product$num !== void 0 ? _product$num : 1) || 1,
652
620
  bundle: getProductBundleForEvaluator(product),
653
- _promotionOnlyForItemReward: isBookingEditProductLine(product),
654
621
  _originalItem: originalItem,
655
622
  _originalId: getOrderProductUid(product),
656
623
  _originalIndex: index
@@ -858,9 +825,6 @@ export function resolveStrategyRequiredQuantity(matched) {
858
825
  if (matched.actionType === 'BUY_X_GET_Y_FREE') {
859
826
  return Number(detail.buyQuantity) || 1;
860
827
  }
861
- if (matched.actionType === 'ITEM_REWARD') {
862
- return Number(detail.triggerQuantity) || 1;
863
- }
864
828
  return 1;
865
829
  }
866
830
 
@@ -886,13 +850,13 @@ export function resolveStrategyEligibleProducts(matched) {
886
850
  export function calculateUnfulfilledPromotions(processedProducts, applicableStrategiesResult, mainProducts) {
887
851
  var unfulfilledMap = new Map();
888
852
  var _loop2 = function _loop2() {
889
- var _product$metadata3, _ref13, _product$_originalPro, _product$metadata4, _product$num2;
853
+ var _product$metadata4, _ref13, _product$_originalPro, _product$metadata5, _product$num2;
890
854
  var product = processedProducts[i];
891
- var promotion = product === null || product === void 0 || (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3._promotion;
855
+ var promotion = product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4._promotion;
892
856
  if (!promotion || promotion.inPromotion !== false) return 0; // continue
893
857
  var strategyId = promotion.strategyId;
894
858
  if (!strategyId) return 0; // continue
895
- var lookupUid = String((_ref13 = (_product$_originalPro = product === null || product === void 0 ? void 0 : product._originalProductUid) !== null && _product$_originalPro !== void 0 ? _product$_originalPro : product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.unique_identification_number) !== null && _ref13 !== void 0 ? _ref13 : '');
859
+ var lookupUid = String((_ref13 = (_product$_originalPro = product === null || product === void 0 ? void 0 : product._originalProductUid) !== null && _product$_originalPro !== void 0 ? _product$_originalPro : product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number) !== null && _ref13 !== void 0 ? _ref13 : '');
896
860
  var originalIndex = mainProducts.findIndex(function (item) {
897
861
  return getOrderProductUid(item) === lookupUid;
898
862
  });
@@ -1020,8 +984,7 @@ export function appendPromotionTags(products, evaluator) {
1020
984
  * 处理购物车的促销计算与赠品差异化。
1021
985
  *
1022
986
  * 流程:
1023
- * 1. 分离 main / gift / edit-product 三类(普通促销下带 `booking_id` 的编辑态商品不参与;
1024
- * 配置 ITEM_REWARD 时,编辑态商品也参与商品奖励重算)
987
+ * 1. 分离 main / gift / edit-product 三类(带 `booking_id` 的编辑态商品不参与促销)
1025
988
  * 2. 转 PromotionProduct 喂评估器 → 拿到 `evaluateCartWithPricing` 与 `getProductsApplicableStrategies`
1026
989
  * 3. 把 PricedProduct 映射回 OrderProduct 形态:
1027
990
  * - 参与促销的,写 `metadata._promotion` + 调整 `selling_price` / `main_product_selling_price`
@@ -1051,7 +1014,6 @@ export function processCartPromotion(list, evaluator, options) {
1051
1014
  if (!list || list.length === 0 || !evaluator) return empty;
1052
1015
 
1053
1016
  // 0. 分类
1054
- var shouldIncludeEditProductsForItemReward = evaluatorHasActionType(evaluator, ITEM_REWARD);
1055
1017
  var mainProductsWithIndex = [];
1056
1018
  var existingGiftsWithIndex = [];
1057
1019
  var editProductsWithIndex = [];
@@ -1068,18 +1030,11 @@ export function processCartPromotion(list, evaluator, options) {
1068
1030
  item: item,
1069
1031
  originalListIndex: i
1070
1032
  });
1071
- } else if (isBookingEditProductLine(item)) {
1072
- if (shouldIncludeEditProductsForItemReward) {
1073
- mainProductsWithIndex.push({
1074
- item: item,
1075
- originalListIndex: i
1076
- });
1077
- } else {
1078
- editProductsWithIndex.push({
1079
- item: item,
1080
- originalListIndex: i
1081
- });
1082
- }
1033
+ } 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') {
1034
+ editProductsWithIndex.push({
1035
+ item: item,
1036
+ originalListIndex: i
1037
+ });
1083
1038
  } else {
1084
1039
  mainProductsWithIndex.push({
1085
1040
  item: item,
@@ -1134,17 +1089,16 @@ export function processCartPromotion(list, evaluator, options) {
1134
1089
  var promotionProducts = [];
1135
1090
  var originalItemMap = new Map();
1136
1091
  var productsForStrategies = consolidatedMainProductsWithIndex.map(function (_ref16, i) {
1137
- var _item$product_id, _item$product_variant5, _item$metadata5, _item$num;
1092
+ var _item$product_id, _item$product_variant5, _item$metadata3, _item$num;
1138
1093
  var item = _ref16.item;
1139
1094
  return {
1140
1095
  id: i,
1141
1096
  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,
1142
1097
  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,
1143
- 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) || '',
1098
+ 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) || '',
1144
1099
  price: getOrderProductBasePrice(item),
1145
1100
  quantity: Number((_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : 1) || 1,
1146
- bundle: getProductBundleForEvaluator(item),
1147
- _promotionOnlyForItemReward: isBookingEditProductLine(item)
1101
+ bundle: getProductBundleForEvaluator(item)
1148
1102
  };
1149
1103
  });
1150
1104
  for (var _i = 0; _i < consolidatedMainProductsWithIndex.length; _i++) {
@@ -1252,7 +1206,7 @@ export function processCartPromotion(list, evaluator, options) {
1252
1206
  _step20;
1253
1207
  try {
1254
1208
  for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
1255
- var _priced$originalId2, _priced$product_id, _originalItem$product;
1209
+ var _priced$originalId2, _priced$product_id, _originalItem$product, _metadata$_promotion2;
1256
1210
  var _priced = _step20.value;
1257
1211
  var rawSourceId = (_priced$originalId2 = _priced.originalId) !== null && _priced$originalId2 !== void 0 ? _priced$originalId2 : _priced.id;
1258
1212
  var _sourceId = Number(rawSourceId);
@@ -1271,7 +1225,7 @@ export function processCartPromotion(list, evaluator, options) {
1271
1225
  newItem._sourceCartNum = sourceCartNum;
1272
1226
 
1273
1227
  // 清掉历史促销字段
1274
- var wasInPromotion = wasInPromotionBeforeEvaluation(originalItem) || originalItem._wasInPromotionBeforeConsolidate === true;
1228
+ var wasInPromotion = ((_metadata$_promotion2 = metadata._promotion) === null || _metadata$_promotion2 === void 0 ? void 0 : _metadata$_promotion2.inPromotion) === true || originalItem._wasInPromotionBeforeConsolidate === true;
1275
1229
  delete metadata._promotion;
1276
1230
  if (Array.isArray(newItem.product_bundle)) {
1277
1231
  var _iterator23 = _createForOfIteratorHelper(newItem.product_bundle),
@@ -1292,13 +1246,12 @@ export function processCartPromotion(list, evaluator, options) {
1292
1246
  var priceUnchangedPromo = _priced.inPromotion && Number(_priced.finalPrice) === Number(originalBasePrice);
1293
1247
  if (shouldModifyPrice) {
1294
1248
  if (_priced.inPromotion && !priceUnchangedPromo) {
1295
- var _priced$strategyMetad, _strategyActionMap$ge;
1249
+ var _priced$strategyMetad;
1296
1250
  var promoUnitPrice = new Decimal(_priced.finalPrice).toDecimalPlaces(2).toFixed(2);
1297
1251
  applyPromoUnitPriceToLine(newItem, {
1298
1252
  promoUnitPrice: promoUnitPrice,
1299
1253
  originalBasePrice: originalBasePrice,
1300
- strategyTitle: (_priced$strategyMetad = _priced.strategyMetadata) === null || _priced$strategyMetad === void 0 ? void 0 : _priced$strategyMetad.name,
1301
- actionType: _priced.strategyId ? (_strategyActionMap$ge = strategyActionMap.get(_priced.strategyId)) === null || _strategyActionMap$ge === void 0 ? void 0 : _strategyActionMap$ge.actionType : undefined
1254
+ strategyTitle: (_priced$strategyMetad = _priced.strategyMetadata) === null || _priced$strategyMetad === void 0 ? void 0 : _priced$strategyMetad.name
1302
1255
  });
1303
1256
  } else {
1304
1257
  // 撤销上一轮促销:还原 selling_price 到 main_product_original_price 派生值
@@ -2,7 +2,7 @@
2
2
  * 把 `/order/sales/{id}` 响应(OrderData)解析为 ISalesDetail。
3
3
  *
4
4
  * - 纯函数:不依赖任何运行时模块/插件,便于单测与 view-model 适配
5
- * - products 保留 tempOrder / 后端详情原字段,仅做浅拷贝,避免丢失 product_sku 等协议字段
5
+ * - products 保留 tempOrder / 后端详情原字段,仅规范化集合身份并浅拷贝,避免丢失 product_sku 等协议字段
6
6
  * - bookings 平铺保留服务端原顺序,同时输出 byProductUid 反查表与 rootBooking
7
7
  * - header 收敛"非数组顶层字段",便于 ticketBooking view-model 直接消费
8
8
  *
@@ -82,8 +82,13 @@ 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
+ }
85
89
  export interface ISalesPayment {
86
90
  order_payment_id?: number | null;
91
+ payment_number?: string;
87
92
  custom_payment_id?: number;
88
93
  code?: string;
89
94
  name?: string;
@@ -95,7 +100,7 @@ export interface ISalesPayment {
95
100
  status?: string;
96
101
  payment_time?: string | null;
97
102
  service_charge?: Record<string, any> | null;
98
- metadata?: Record<string, any> | null;
103
+ metadata?: ISalesPaymentMetadata | null;
99
104
  [key: string]: any;
100
105
  }
101
106
  export interface ISalesSurcharge {
@@ -130,7 +135,7 @@ export interface ISalesDetail {
130
135
  customer: ISalesDetailCustomer | null;
131
136
  /** 服务端 summary(仅输出) */
132
137
  summary: Record<string, any>;
133
- /** 原始响应快照,方便 UI 兜底使用 */
138
+ /** 规范化后的响应快照,方便 UI 兜底使用 */
134
139
  raw: Record<string, any>;
135
140
  }
136
141
  /**
@@ -138,7 +143,7 @@ export interface ISalesDetail {
138
143
  *
139
144
  * 注意:
140
145
  * - 入参允许是 `{ data: OrderData }` 或直接 `OrderData`,自动识别。
141
- * - products 保留原字段;字段补齐由 OrderModule hydrate 负责。
146
+ * - products/bookings/payments 在此补齐集合身份;其余 runtime 字段由 OrderModule hydrate 负责。
142
147
  * - 不做远程请求;不修改入参;返回新对象。
143
148
  */
144
149
  export declare function parseSalesResponse(input: Record<string, any> | null | undefined): ISalesDetail;
@@ -11,7 +11,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
11
11
  * 把 `/order/sales/{id}` 响应(OrderData)解析为 ISalesDetail。
12
12
  *
13
13
  * - 纯函数:不依赖任何运行时模块/插件,便于单测与 view-model 适配
14
- * - products 保留 tempOrder / 后端详情原字段,仅做浅拷贝,避免丢失 product_sku 等协议字段
14
+ * - products 保留 tempOrder / 后端详情原字段,仅规范化集合身份并浅拷贝,避免丢失 product_sku 等协议字段
15
15
  * - bookings 平铺保留服务端原顺序,同时输出 byProductUid 反查表与 rootBooking
16
16
  * - header 收敛"非数组顶层字段",便于 ticketBooking view-model 直接消费
17
17
  *
@@ -23,6 +23,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
23
23
  * - 不在此处发明等价关系;UI 侧(ticketBooking)若需要别的字段,由 view-model 适配层做转换
24
24
  */
25
25
 
26
+ import { normalizeOrderCollections } from "../../../modules/Order/utils/orderCollectionIdentity";
26
27
  /** OrderData 中除大数组外的"顶层 header 字段"白名单,按需扩展。 */
27
28
  var HEADER_KEYS = ['order_id', 'order_number', 'shop_order_number', 'shop_full_order_number', 'type', 'business_code', 'platform', 'sales_channel', 'order_sales_channel', 'vouchers', 'status', 'payment_status', 'shipping_status', 'customer_id', 'customer_name', 'country_calling_code', 'phone', 'email', 'is_price_include_tax', 'tax_title', 'tax_country_code', 'currency_code', 'currency_symbol', 'currency_format', 'is_deposit', 'deposit_amount', 'shop_discount', 'surcharge_fee', 'note', 'schedule_date', 'created_at', 'updated_at', 'metadata', 'total_amount', 'shop_id', 'create_date', 'holder', 'relation_forms', 'contacts', 'contacts_info'];
28
29
  function pickHeader(raw) {
@@ -108,19 +109,16 @@ function indexBookingsByProductUid(bookings) {
108
109
  *
109
110
  * 注意:
110
111
  * - 入参允许是 `{ data: OrderData }` 或直接 `OrderData`,自动识别。
111
- * - products 保留原字段;字段补齐由 OrderModule hydrate 负责。
112
+ * - products/bookings/payments 在此补齐集合身份;其余 runtime 字段由 OrderModule hydrate 负责。
112
113
  * - 不做远程请求;不修改入参;返回新对象。
113
114
  */
114
115
  export function parseSalesResponse(input) {
115
- var raw = input && _typeof(input) === 'object' && input.data && input.order_id == null ? input.data : input || {};
116
+ var sourceRaw = input && _typeof(input) === 'object' && input.data && input.order_id == null ? input.data : input || {};
117
+ var raw = normalizeOrderCollections(sourceRaw).order;
116
118
  var productsRaw = Array.isArray(raw === null || raw === void 0 ? void 0 : raw.products) ? raw.products : [];
117
- var products = productsRaw.map(function (p, index) {
119
+ var products = productsRaw.map(function (p) {
118
120
  var row = _objectSpread({}, p || {});
119
121
  var metadata = row.metadata && _typeof(row.metadata) === 'object' ? _objectSpread({}, row.metadata) : {};
120
- if (!metadata.unique_identification_number) {
121
- var _row$product_id, _row$product_variant_;
122
- metadata.unique_identification_number = "sales-product-".concat((_row$product_id = row.product_id) !== null && _row$product_id !== void 0 ? _row$product_id : 'unknown', "-").concat((_row$product_variant_ = row.product_variant_id) !== null && _row$product_variant_ !== void 0 ? _row$product_variant_ : 0, "-").concat(index);
123
- }
124
122
  delete metadata.price_schema_version;
125
123
  delete row.identity_key;
126
124
  return _objectSpread(_objectSpread({}, row), {}, {
@@ -30,6 +30,17 @@ function toPriceString(value) {
30
30
  if (!Number.isFinite(parsedValue)) return fallback;
31
31
  return parsedValue.toFixed(2);
32
32
  }
33
+ function isBlankValue(value) {
34
+ return value === undefined || value === null || typeof value === 'string' && value.trim() === '';
35
+ }
36
+ function firstNonBlank() {
37
+ for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
38
+ values[_key] = arguments[_key];
39
+ }
40
+ return values.find(function (value) {
41
+ return !isBlankValue(value);
42
+ });
43
+ }
33
44
  function normalizeOptionItems(optionItems) {
34
45
  if (!Array.isArray(optionItems)) return [];
35
46
  return optionItems.map(function (optionItem) {
@@ -166,7 +177,8 @@ export function transformBaseProductToOrderProduct(params) {
166
177
  source_product_price: sourceProductPrice,
167
178
  main_product_selling_price: mainProductSellingPrice,
168
179
  main_product_original_price: mainProductOriginalPrice,
169
- price_schema_version: 2
180
+ price_schema_version: 2,
181
+ holder_config: sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.holder_config
170
182
  }, hasPriceOverride ? {
171
183
  price_override: String(payload.price_override),
172
184
  is_manual_discount: 1
@@ -198,6 +210,7 @@ export function transformBaseProductToOrderProduct(params) {
198
210
  metadata: metadata,
199
211
  note: payload.note != null ? String(payload.note) : '',
200
212
  product_title: productTitle,
213
+ product_cover: firstNonBlank(matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.cover, sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.cover),
201
214
  _origin: _objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
202
215
  callbackData: payload
203
216
  })
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
314
+ weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;