@pisell/pisellos 2.2.302 → 2.2.304

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 (157) hide show
  1. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
  2. package/dist/model/strategy/adapter/dataVariant/evaluator.js +287 -101
  3. package/dist/model/strategy/adapter/dataVariant/type.d.ts +25 -0
  4. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
  5. package/dist/model/strategy/adapter/itemRule/adapter.js +135 -35
  6. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
  7. package/dist/model/strategy/adapter/itemRule/evaluator.js +25 -1
  8. package/dist/model/strategy/adapter/itemRule/type.d.ts +44 -0
  9. package/dist/model/strategy/adapter/itemRule/type.js +19 -1
  10. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  11. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +10 -7
  12. package/dist/modules/Discount/index.d.ts +2 -0
  13. package/dist/modules/Discount/index.js +41 -5
  14. package/dist/modules/Discount/types.d.ts +21 -0
  15. package/dist/modules/OpenData/index.d.ts +15 -2
  16. package/dist/modules/OpenData/index.js +307 -19
  17. package/dist/modules/OpenData/types.d.ts +55 -0
  18. package/dist/modules/OpenData/types.js +7 -1
  19. package/dist/modules/OpenData/utils.d.ts +21 -1
  20. package/dist/modules/OpenData/utils.js +138 -0
  21. package/dist/modules/Order/index.d.ts +50 -7
  22. package/dist/modules/Order/index.js +1690 -815
  23. package/dist/modules/Order/salesNotes.d.ts +31 -0
  24. package/dist/modules/Order/salesNotes.js +492 -0
  25. package/dist/modules/Order/types.d.ts +117 -10
  26. package/dist/modules/Order/types.js +6 -1
  27. package/dist/modules/Order/utils/virtualSettlement.d.ts +63 -0
  28. package/dist/modules/Order/utils/virtualSettlement.js +284 -0
  29. package/dist/modules/Order/utils.d.ts +5 -1
  30. package/dist/modules/Order/utils.js +138 -33
  31. package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +4 -5
  32. package/dist/modules/Payment/cashRecommendationAlgorithm.js +17 -367
  33. package/dist/modules/Payment/walletpass.js +20 -21
  34. package/dist/modules/Product/types.d.ts +23 -0
  35. package/dist/modules/ProductList/index.d.ts +2 -1
  36. package/dist/modules/ProductList/index.js +100 -20
  37. package/dist/modules/ProductList/types.d.ts +10 -0
  38. package/dist/modules/Rules/index.d.ts +5 -0
  39. package/dist/modules/Rules/index.js +30 -14
  40. package/dist/modules/SalesSummary/index.d.ts +1 -0
  41. package/dist/modules/SalesSummary/index.js +4 -3
  42. package/dist/modules/SalesSummary/types.d.ts +1 -0
  43. package/dist/modules/SalesSummary/utils.d.ts +1 -0
  44. package/dist/modules/SalesSummary/utils.js +21 -1
  45. package/dist/plugins/request.d.ts +2 -1
  46. package/dist/plugins/request.js +4 -2
  47. package/dist/server/index.d.ts +21 -0
  48. package/dist/server/index.js +1774 -1285
  49. package/dist/server/modules/order/types.d.ts +50 -0
  50. package/dist/server/modules/order/types.js +2 -0
  51. package/dist/server/utils/small-ticket.d.ts +4 -1
  52. package/dist/server/utils/small-ticket.js +461 -96
  53. package/dist/solution/BaseSales/index.d.ts +24 -3
  54. package/dist/solution/BaseSales/index.js +1484 -873
  55. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
  56. package/dist/solution/BaseSales/utils/parseSalesResponse.js +1 -1
  57. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  58. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +72 -9
  59. package/dist/solution/BookingByStep/index.d.ts +1 -1
  60. package/dist/solution/BookingTicket/index.d.ts +22 -5
  61. package/dist/solution/BookingTicket/index.js +558 -443
  62. package/dist/solution/BookingTicket/utils/addProductDecision.js +2 -1
  63. package/dist/solution/BookingTicket/utils/orderCustomer.js +3 -2
  64. package/dist/solution/RegisterAndLogin/config.d.ts +9 -3
  65. package/dist/solution/RegisterAndLogin/config.js +95 -40
  66. package/dist/solution/RegisterAndLogin/index.js +4 -1
  67. package/dist/solution/Sales/index.d.ts +16 -1
  68. package/dist/solution/Sales/index.js +338 -63
  69. package/dist/solution/Sales/types.d.ts +10 -0
  70. package/dist/solution/ScanOrder/index.d.ts +1 -0
  71. package/dist/solution/ScanOrder/index.js +31 -27
  72. package/dist/solution/ScanOrder/utils.d.ts +1 -0
  73. package/dist/solution/ScanOrder/utils.js +2 -0
  74. package/dist/solution/UnifiedBookingSales/index.d.ts +20 -6
  75. package/dist/solution/UnifiedBookingSales/index.js +874 -527
  76. package/dist/solution/UnifiedBookingSales/types.d.ts +21 -2
  77. package/dist/solution/VenueBooking/index.d.ts +1 -0
  78. package/dist/solution/VenueBooking/index.js +8 -4
  79. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
  80. package/lib/model/strategy/adapter/dataVariant/evaluator.js +137 -6
  81. package/lib/model/strategy/adapter/dataVariant/type.d.ts +25 -0
  82. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
  83. package/lib/model/strategy/adapter/itemRule/adapter.js +73 -4
  84. package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
  85. package/lib/model/strategy/adapter/itemRule/evaluator.js +23 -1
  86. package/lib/model/strategy/adapter/itemRule/type.d.ts +44 -0
  87. package/lib/model/strategy/adapter/itemRule/type.js +19 -1
  88. package/lib/model/strategy/adapter/promotion/index.js +1 -46
  89. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +4 -0
  90. package/lib/modules/Discount/index.d.ts +2 -0
  91. package/lib/modules/Discount/index.js +34 -2
  92. package/lib/modules/Discount/types.d.ts +21 -0
  93. package/lib/modules/OpenData/index.d.ts +15 -2
  94. package/lib/modules/OpenData/index.js +230 -3
  95. package/lib/modules/OpenData/types.d.ts +55 -0
  96. package/lib/modules/OpenData/types.js +9 -1
  97. package/lib/modules/OpenData/utils.d.ts +21 -1
  98. package/lib/modules/OpenData/utils.js +126 -0
  99. package/lib/modules/Order/index.d.ts +50 -7
  100. package/lib/modules/Order/index.js +704 -64
  101. package/lib/modules/Order/salesNotes.d.ts +31 -0
  102. package/lib/modules/Order/salesNotes.js +382 -0
  103. package/lib/modules/Order/types.d.ts +117 -10
  104. package/lib/modules/Order/types.js +5 -1
  105. package/lib/modules/Order/utils/virtualSettlement.d.ts +63 -0
  106. package/lib/modules/Order/utils/virtualSettlement.js +262 -0
  107. package/lib/modules/Order/utils.d.ts +5 -1
  108. package/lib/modules/Order/utils.js +127 -21
  109. package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +4 -5
  110. package/lib/modules/Payment/cashRecommendationAlgorithm.js +9 -354
  111. package/lib/modules/Payment/walletpass.js +14 -11
  112. package/lib/modules/Product/types.d.ts +23 -0
  113. package/lib/modules/ProductList/index.d.ts +2 -1
  114. package/lib/modules/ProductList/index.js +47 -2
  115. package/lib/modules/ProductList/types.d.ts +10 -0
  116. package/lib/modules/Rules/index.d.ts +5 -0
  117. package/lib/modules/Rules/index.js +22 -12
  118. package/lib/modules/SalesSummary/index.d.ts +1 -0
  119. package/lib/modules/SalesSummary/index.js +4 -2
  120. package/lib/modules/SalesSummary/types.d.ts +1 -0
  121. package/lib/modules/SalesSummary/utils.d.ts +1 -0
  122. package/lib/modules/SalesSummary/utils.js +17 -1
  123. package/lib/plugins/request.d.ts +2 -1
  124. package/lib/plugins/request.js +3 -2
  125. package/lib/server/index.d.ts +21 -0
  126. package/lib/server/index.js +492 -108
  127. package/lib/server/modules/order/types.d.ts +50 -0
  128. package/lib/server/modules/order/types.js +1 -0
  129. package/lib/server/utils/small-ticket.d.ts +4 -1
  130. package/lib/server/utils/small-ticket.js +427 -72
  131. package/lib/solution/BaseSales/index.d.ts +24 -3
  132. package/lib/solution/BaseSales/index.js +433 -30
  133. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
  134. package/lib/solution/BaseSales/utils/parseSalesResponse.js +1 -1
  135. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  136. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +38 -0
  137. package/lib/solution/BookingByStep/index.d.ts +1 -1
  138. package/lib/solution/BookingTicket/index.d.ts +22 -5
  139. package/lib/solution/BookingTicket/index.js +60 -15
  140. package/lib/solution/BookingTicket/utils/addProductDecision.js +1 -0
  141. package/lib/solution/BookingTicket/utils/orderCustomer.js +2 -1
  142. package/lib/solution/RegisterAndLogin/config.d.ts +9 -3
  143. package/lib/solution/RegisterAndLogin/config.js +49 -8
  144. package/lib/solution/RegisterAndLogin/index.js +4 -1
  145. package/lib/solution/Sales/index.d.ts +16 -1
  146. package/lib/solution/Sales/index.js +168 -1
  147. package/lib/solution/Sales/types.d.ts +10 -0
  148. package/lib/solution/ScanOrder/index.d.ts +1 -0
  149. package/lib/solution/ScanOrder/index.js +5 -1
  150. package/lib/solution/ScanOrder/utils.d.ts +1 -0
  151. package/lib/solution/ScanOrder/utils.js +1 -0
  152. package/lib/solution/UnifiedBookingSales/index.d.ts +20 -6
  153. package/lib/solution/UnifiedBookingSales/index.js +169 -16
  154. package/lib/solution/UnifiedBookingSales/types.d.ts +21 -2
  155. package/lib/solution/VenueBooking/index.d.ts +1 -0
  156. package/lib/solution/VenueBooking/index.js +5 -1
  157. package/package.json +1 -1
@@ -14,6 +14,7 @@
14
14
  * - 不在此处发明等价关系;UI 侧(ticketBooking)若需要别的字段,由 view-model 适配层做转换
15
15
  */
16
16
  import type { BaseSalesOrderProduct } from '../types';
17
+ import type { OrderMetaList } from '../../../modules/Order/types';
17
18
  export interface ISalesDetailHeader {
18
19
  order_id: number | string | null;
19
20
  order_number?: string;
@@ -47,6 +48,7 @@ export interface ISalesDetailHeader {
47
48
  schedule_date?: string;
48
49
  created_at?: string;
49
50
  updated_at?: string | number;
51
+ order_meta_list?: OrderMetaList;
50
52
  metadata?: Record<string, any> | null;
51
53
  total_amount?: string | number;
52
54
  [key: string]: any;
@@ -25,7 +25,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
25
25
 
26
26
  import { normalizeOrderCollections } from "../../../modules/Order/utils/orderCollectionIdentity";
27
27
  /** OrderData 中除大数组外的"顶层 header 字段"白名单,按需扩展。 */
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
+ 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', 'order_meta_list', 'metadata', 'total_amount', 'shop_id', 'create_date', 'holder', 'relation_forms', 'contacts', 'contacts_info'];
29
29
  function pickHeader(raw) {
30
30
  var _raw$order_id;
31
31
  var header = {
@@ -46,6 +46,7 @@ export interface BaseProductDetailPayload {
46
46
  original_price?: number | string;
47
47
  tax_fee?: number | string;
48
48
  is_charge_tax?: number;
49
+ metadata?: Record<string, any>;
49
50
  note?: string;
50
51
  [key: string]: any;
51
52
  }
@@ -4,6 +4,13 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  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; }
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  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); }
7
+ 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; } } }; }
8
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
9
+ 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."); }
10
+ 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); }
11
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
12
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
13
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
14
  import { composeLinePrice, getBundleSellingMagnitude, normalizeProductSkuOptions, sumOptionUnitPrice } from "../../../modules/Order/utils";
8
15
  import { buildManualProductDiscountItem, mergeManualProductDiscountIntoList, resolveManualDiscountOriginTotal, resolveManualDiscountReasonFromSources, shouldBuildManualProductDiscount } from "../../../modules/Order/utils/manualProductDiscount";
9
16
  function toNumber(value) {
@@ -45,6 +52,54 @@ function firstNonBlank() {
45
52
  return !isBlankValue(value);
46
53
  });
47
54
  }
55
+
56
+ /**
57
+ * 取第一份接口权威 Data Variant 命中结果并复制数组。
58
+ * 空数组表示规则已计算但无命中,必须与字段缺失区分。
59
+ */
60
+ function cloneFirstDataVariantIds() {
61
+ for (var _len2 = arguments.length, values = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
62
+ values[_key2] = arguments[_key2];
63
+ }
64
+ var ids = values.find(function (value) {
65
+ return Array.isArray(value);
66
+ });
67
+ return Array.isArray(ids) ? _toConsumableArray(ids) : undefined;
68
+ }
69
+
70
+ /**
71
+ * 在接口权威命中结果后追加本地应用及最终选中的 Data Variant ID。
72
+ * 以字符串身份去重,同时将新增 ID 归一为正整数。
73
+ */
74
+ function appendDataVariantIds(base) {
75
+ var result = Array.isArray(base) ? _toConsumableArray(base) : [];
76
+ var seen = new Set(result.map(function (id) {
77
+ return String(id);
78
+ }));
79
+ for (var _len3 = arguments.length, values = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
80
+ values[_key3 - 1] = arguments[_key3];
81
+ }
82
+ for (var _i = 0, _values = values; _i < _values.length; _i++) {
83
+ var value = _values[_i];
84
+ var candidates = Array.isArray(value) ? value : [value];
85
+ var _iterator = _createForOfIteratorHelper(candidates),
86
+ _step;
87
+ try {
88
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
89
+ var candidate = _step.value;
90
+ var id = Number(candidate);
91
+ if (!Number.isFinite(id) || id <= 0 || seen.has(String(id))) continue;
92
+ result.push(id);
93
+ seen.add(String(id));
94
+ }
95
+ } catch (err) {
96
+ _iterator.e(err);
97
+ } finally {
98
+ _iterator.f();
99
+ }
100
+ }
101
+ return Array.isArray(base) || result.length ? result : undefined;
102
+ }
48
103
  function normalizeOptionItems(optionItems) {
49
104
  if (!Array.isArray(optionItems)) return [];
50
105
  return optionItems.map(function (optionItem) {
@@ -108,7 +163,7 @@ function findVariantById(origin, variantId) {
108
163
  * 注意:这里不生成 identity,缺省时由 OrderModule 自动补齐。
109
164
  */
110
165
  export function transformBaseProductToOrderProduct(params) {
111
- var _ref10, _ref11, _ref12, _payload$product_id, _ref13, _ref14, _payload$product_vari, _payload$_origin, _payload$_origin2, _ref15, _findVariantById, _origin$production_co, _ref16, _ref17, _ref18, _ref19, _ref20, _matchedVariant$price, _ref21, _ref22, _payload$price, _ref23, _payload$line_total, _payload$_extend, _ref24, _ref25, _payload$product_sku$, _payload$product_sku, _payload$bundle, _payload$quantity, _payload$_extend2, _extend, _extend2, _ref26, _ref27, _origin$base_price, _ref28, _ref29, _payload$line_total2, _payload$_extend3, _payload$_extend4, _extend3, _payload$_extend5, _payload$_extend6, _ref30, _ref31, _payload$tax_fee, _ref32, _ref33, _payload$is_charge_ta;
166
+ var _ref10, _ref11, _ref12, _payload$product_id, _ref13, _ref14, _payload$product_vari, _payload$_origin, _payload$_origin2, _payload$metadata, _sourceProduct$metada, _callbackOrigin$metad, _origin$metadata, _payload$metadata2, _payload$_extend, _sourceProduct$metada2, _sourceProduct$_exten, _callbackOrigin$metad2, _callbackOrigin$_exte, _payload$_dataVariant, _sourceProduct$_dataV, _callbackOrigin$_data, _origin$_dataVariant, _ref15, _findVariantById, _origin$production_co, _ref16, _ref17, _ref18, _ref19, _ref20, _matchedVariant$price, _ref21, _ref22, _payload$price, _ref23, _payload$line_total, _payload$_extend2, _ref24, _ref25, _payload$product_sku$, _payload$product_sku, _payload$bundle, _payload$quantity, _payload$_extend3, _extend, _extend2, _ref26, _ref27, _origin$base_price, _ref28, _ref29, _payload$line_total2, _payload$_extend4, _payload$_extend5, _extend3, _payload$_extend6, _payload$_extend7, _ref30, _ref31, _payload$tax_fee, _ref32, _ref33, _payload$is_charge_ta;
112
167
  var payload = params.payload,
113
168
  _params$fallbackProdu = params.fallbackProductId,
114
169
  fallbackProductId = _params$fallbackProdu === void 0 ? null : _params$fallbackProdu;
@@ -119,6 +174,10 @@ export function transformBaseProductToOrderProduct(params) {
119
174
  var productVariantId = toNumber((_ref13 = (_ref14 = (_payload$product_vari = payload.product_variant_id) !== null && _payload$product_vari !== void 0 ? _payload$product_vari : payload.variant_id) !== null && _ref14 !== void 0 ? _ref14 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.product_variant_id) !== null && _ref13 !== void 0 ? _ref13 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.variant_id, 0);
120
175
  var callbackOrigin = payload.origin || ((_payload$_origin = payload._origin) === null || _payload$_origin === void 0 ? void 0 : _payload$_origin.sourceProduct) || ((_payload$_origin2 = payload._origin) === null || _payload$_origin2 === void 0 ? void 0 : _payload$_origin2.sourceItem) || payload._origin || {};
121
176
  var origin = _objectSpread(_objectSpread({}, sourceProduct || {}), callbackOrigin || {});
177
+ var authoritativeDataVariantIds = cloneFirstDataVariantIds((_payload$metadata = payload.metadata) === null || _payload$metadata === void 0 ? void 0 : _payload$metadata.data_variant_ids, sourceProduct === null || sourceProduct === void 0 || (_sourceProduct$metada = sourceProduct.metadata) === null || _sourceProduct$metada === void 0 ? void 0 : _sourceProduct$metada.data_variant_ids, callbackOrigin === null || callbackOrigin === void 0 || (_callbackOrigin$metad = callbackOrigin.metadata) === null || _callbackOrigin$metad === void 0 ? void 0 : _callbackOrigin$metad.data_variant_ids, origin === null || origin === void 0 || (_origin$metadata = origin.metadata) === null || _origin$metadata === void 0 ? void 0 : _origin$metadata.data_variant_ids);
178
+ var selectedSettlementSnapshot = firstNonBlank(payload.selected_settlement_snapshot, (_payload$metadata2 = payload.metadata) === null || _payload$metadata2 === void 0 ? void 0 : _payload$metadata2.selected_settlement_snapshot, (_payload$_extend = payload._extend) === null || _payload$_extend === void 0 || (_payload$_extend = _payload$_extend.metadata) === null || _payload$_extend === void 0 ? void 0 : _payload$_extend.selected_settlement_snapshot, sourceProduct === null || sourceProduct === void 0 || (_sourceProduct$metada2 = sourceProduct.metadata) === null || _sourceProduct$metada2 === void 0 ? void 0 : _sourceProduct$metada2.selected_settlement_snapshot, sourceProduct === null || sourceProduct === void 0 || (_sourceProduct$_exten = sourceProduct._extend) === null || _sourceProduct$_exten === void 0 || (_sourceProduct$_exten = _sourceProduct$_exten.metadata) === null || _sourceProduct$_exten === void 0 ? void 0 : _sourceProduct$_exten.selected_settlement_snapshot, callbackOrigin === null || callbackOrigin === void 0 || (_callbackOrigin$metad2 = callbackOrigin.metadata) === null || _callbackOrigin$metad2 === void 0 ? void 0 : _callbackOrigin$metad2.selected_settlement_snapshot, callbackOrigin === null || callbackOrigin === void 0 || (_callbackOrigin$_exte = callbackOrigin._extend) === null || _callbackOrigin$_exte === void 0 || (_callbackOrigin$_exte = _callbackOrigin$_exte.metadata) === null || _callbackOrigin$_exte === void 0 ? void 0 : _callbackOrigin$_exte.selected_settlement_snapshot);
179
+ var locallyAppliedVariantIds = authoritativeDataVariantIds === undefined ? cloneFirstDataVariantIds((_payload$_dataVariant = payload._dataVariant) === null || _payload$_dataVariant === void 0 ? void 0 : _payload$_dataVariant.appliedVariantIds, sourceProduct === null || sourceProduct === void 0 || (_sourceProduct$_dataV = sourceProduct._dataVariant) === null || _sourceProduct$_dataV === void 0 ? void 0 : _sourceProduct$_dataV.appliedVariantIds, callbackOrigin === null || callbackOrigin === void 0 || (_callbackOrigin$_data = callbackOrigin._dataVariant) === null || _callbackOrigin$_data === void 0 ? void 0 : _callbackOrigin$_data.appliedVariantIds, origin === null || origin === void 0 || (_origin$_dataVariant = origin._dataVariant) === null || _origin$_dataVariant === void 0 ? void 0 : _origin$_dataVariant.appliedVariantIds) : undefined;
180
+ var dataVariantIds = appendDataVariantIds(authoritativeDataVariantIds, locallyAppliedVariantIds, selectedSettlementSnapshot === null || selectedSettlementSnapshot === void 0 ? void 0 : selectedSettlementSnapshot.data_variant_id);
122
181
  var matchedVariant = (_ref15 = (_findVariantById = findVariantById(callbackOrigin, productVariantId)) !== null && _findVariantById !== void 0 ? _findVariantById : findVariantById(sourceProduct, productVariantId)) !== null && _ref15 !== void 0 ? _ref15 : findVariantById(origin, productVariantId);
123
182
  var productionCode = normalizeProductionCode(Object.prototype.hasOwnProperty.call(payload, 'production_code') ? payload.production_code : productVariantId > 0 ? matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.production_code : (_origin$production_co = origin === null || origin === void 0 ? void 0 : origin.production_code) !== null && _origin$production_co !== void 0 ? _origin$production_co : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.production_code);
124
183
  var hasPriceOverride = payload.price_override !== undefined && payload.price_override !== null && payload.price_override !== '';
@@ -126,7 +185,7 @@ export function transformBaseProductToOrderProduct(params) {
126
185
  // 此时优先从商品/variant 快照读取目录价;售价仍由 line_total - bundle 推导。
127
186
  var catalogSourcePrice = (_ref16 = (_ref17 = (_ref18 = (_ref19 = (_ref20 = (_matchedVariant$price = matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.price) !== null && _matchedVariant$price !== void 0 ? _matchedVariant$price : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.base_price) !== null && _ref20 !== void 0 ? _ref20 : origin === null || origin === void 0 ? void 0 : origin.price) !== null && _ref19 !== void 0 ? _ref19 : origin === null || origin === void 0 ? void 0 : origin.base_price) !== null && _ref18 !== void 0 ? _ref18 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _ref17 !== void 0 ? _ref17 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.selling_price) !== null && _ref16 !== void 0 ? _ref16 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price;
128
187
  var sourceProductPrice = toPriceString(hasPriceOverride ? (_ref21 = catalogSourcePrice !== null && catalogSourcePrice !== void 0 ? catalogSourcePrice : payload.price) !== null && _ref21 !== void 0 ? _ref21 : payload.selling_price : (_ref22 = (_payload$price = payload.price) !== null && _payload$price !== void 0 ? _payload$price : payload.selling_price) !== null && _ref22 !== void 0 ? _ref22 : catalogSourcePrice, '0.00');
129
- var explicitLineTotal = (_ref23 = (_payload$line_total = payload.line_total) !== null && _payload$line_total !== void 0 ? _payload$line_total : payload.total) !== null && _ref23 !== void 0 ? _ref23 : (_payload$_extend = payload._extend) === null || _payload$_extend === void 0 ? void 0 : _payload$_extend.total;
188
+ var explicitLineTotal = (_ref23 = (_payload$line_total = payload.line_total) !== null && _payload$line_total !== void 0 ? _payload$line_total : payload.total) !== null && _ref23 !== void 0 ? _ref23 : (_payload$_extend2 = payload._extend) === null || _payload$_extend2 === void 0 ? void 0 : _payload$_extend2.total;
130
189
  var hasExplicitLineTotal = Number.isFinite(Number(explicitLineTotal));
131
190
  var lineCompositeTotal = toPriceString(explicitLineTotal, sourceProductPrice);
132
191
  var productOptionItem = normalizeProductSkuOptions(normalizeOptionItems((_ref24 = (_ref25 = (_payload$product_sku$ = (_payload$product_sku = payload.product_sku) === null || _payload$product_sku === void 0 ? void 0 : _payload$product_sku.option) !== null && _payload$product_sku$ !== void 0 ? _payload$product_sku$ : payload.option) !== null && _ref25 !== void 0 ? _ref25 : payload.options) !== null && _ref24 !== void 0 ? _ref24 : payload.product_option_item));
@@ -137,16 +196,16 @@ export function transformBaseProductToOrderProduct(params) {
137
196
  var resolvedQuantity = toSafePositiveInt((_payload$quantity = payload.quantity) !== null && _payload$quantity !== void 0 ? _payload$quantity : payload.num, 1);
138
197
  var originTotal = resolveManualDiscountOriginTotal({
139
198
  originTotal: payload.origin_total,
140
- extendOriginTotal: (_payload$_extend2 = payload._extend) === null || _payload$_extend2 === void 0 ? void 0 : _payload$_extend2.origin_total,
199
+ extendOriginTotal: (_payload$_extend3 = payload._extend) === null || _payload$_extend3 === void 0 ? void 0 : _payload$_extend3.origin_total,
141
200
  originExtendOriginTotal: origin === null || origin === void 0 || (_extend = origin._extend) === null || _extend === void 0 ? void 0 : _extend.origin_total,
142
201
  sourceExtendOriginTotal: sourceProduct === null || sourceProduct === void 0 || (_extend2 = sourceProduct._extend) === null || _extend2 === void 0 ? void 0 : _extend2.origin_total,
143
202
  catalogUnitPrice: (_ref26 = (_ref27 = (_origin$base_price = origin === null || origin === void 0 ? void 0 : origin.base_price) !== null && _origin$base_price !== void 0 ? _origin$base_price : origin === null || origin === void 0 ? void 0 : origin.price) !== null && _ref27 !== void 0 ? _ref27 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price) !== null && _ref26 !== void 0 ? _ref26 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price,
144
203
  quantity: resolvedQuantity
145
204
  });
146
- var sellingTotal = Number((_ref28 = (_ref29 = (_payload$line_total2 = payload.line_total) !== null && _payload$line_total2 !== void 0 ? _payload$line_total2 : payload.total) !== null && _ref29 !== void 0 ? _ref29 : (_payload$_extend3 = payload._extend) === null || _payload$_extend3 === void 0 ? void 0 : _payload$_extend3.total) !== null && _ref28 !== void 0 ? _ref28 : lineCompositeTotal);
205
+ var sellingTotal = Number((_ref28 = (_ref29 = (_payload$line_total2 = payload.line_total) !== null && _payload$line_total2 !== void 0 ? _payload$line_total2 : payload.total) !== null && _ref29 !== void 0 ? _ref29 : (_payload$_extend4 = payload._extend) === null || _payload$_extend4 === void 0 ? void 0 : _payload$_extend4.total) !== null && _ref28 !== void 0 ? _ref28 : lineCompositeTotal);
147
206
  var discountReason = resolveManualDiscountReasonFromSources({
148
207
  discountReason: payload.discount_reason,
149
- extendDiscountReason: (_payload$_extend4 = payload._extend) === null || _payload$_extend4 === void 0 ? void 0 : _payload$_extend4.discount_reason,
208
+ extendDiscountReason: (_payload$_extend5 = payload._extend) === null || _payload$_extend5 === void 0 ? void 0 : _payload$_extend5.discount_reason,
150
209
  originExtendDiscountReason: origin === null || origin === void 0 || (_extend3 = origin._extend) === null || _extend3 === void 0 ? void 0 : _extend3.discount_reason
151
210
  });
152
211
  var lineOriginalPrice = hasPriceOverride && Number.isFinite(originTotal) ? toPriceString(originTotal) : lineCompositeTotal;
@@ -159,8 +218,8 @@ export function transformBaseProductToOrderProduct(params) {
159
218
  sellingTotal: Number.isFinite(sellingTotal) ? sellingTotal : Number(lineCompositeTotal),
160
219
  quantity: resolvedQuantity,
161
220
  message: discountReason,
162
- discountway: (_payload$_extend5 = payload._extend) === null || _payload$_extend5 === void 0 ? void 0 : _payload$_extend5.discountway,
163
- discount_per: (_payload$_extend6 = payload._extend) === null || _payload$_extend6 === void 0 ? void 0 : _payload$_extend6.discount_per
221
+ discountway: (_payload$_extend6 = payload._extend) === null || _payload$_extend6 === void 0 ? void 0 : _payload$_extend6.discountway,
222
+ discount_per: (_payload$_extend7 = payload._extend) === null || _payload$_extend7 === void 0 ? void 0 : _payload$_extend7.discount_per
164
223
  })) : payload.discount_list || [];
165
224
 
166
225
  // v2:source 不含 option;main_product_* 含 option(与 normalizeOrderProduct 一致)
@@ -172,7 +231,7 @@ export function transformBaseProductToOrderProduct(params) {
172
231
  });
173
232
  var derivedMainSelling = hasExplicitLineTotal ? Number(lineCompositeTotal) - Number(bundleOnlyComposite) : Number(mainProductOriginalPrice);
174
233
  var mainProductSellingPrice = toPriceString(Number.isFinite(derivedMainSelling) && derivedMainSelling >= 0 ? derivedMainSelling : Number(mainProductOriginalPrice));
175
- var metadata = _objectSpread(_objectSpread({
234
+ var metadata = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
176
235
  unique: payload.unique,
177
236
  session: payload.session,
178
237
  form: payload.form,
@@ -187,7 +246,11 @@ export function transformBaseProductToOrderProduct(params) {
187
246
  main_product_original_price: mainProductOriginalPrice,
188
247
  price_schema_version: 2,
189
248
  holder_config: sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.holder_config
190
- }, hasPriceOverride ? {
249
+ }, dataVariantIds !== undefined ? {
250
+ data_variant_ids: dataVariantIds
251
+ } : {}), selectedSettlementSnapshot ? {
252
+ selected_settlement_snapshot: selectedSettlementSnapshot
253
+ } : {}), hasPriceOverride ? {
191
254
  price_override: String(payload.price_override),
192
255
  is_manual_discount: 1
193
256
  } : {}), payload.bundle_edit !== undefined ? {
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
329
+ weekNum: 0 | 5 | 3 | 1 | 2 | 4 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -1,7 +1,7 @@
1
1
  import { Module, ModuleOptions, PisellCore } from '../../types';
2
2
  import { BookingTicketCartView, BookingTicketProductCatalogView, BookingTicketState, IGetCustomerListParams, ICustomer, ILoadProductsParams, ILoadProductDetailParams, IScanResult } from './types';
3
3
  import type { ProductData } from '../../modules';
4
- import type { OpenDataConfig } from '../../modules/OpenData';
4
+ import { type InvoiceLayoutConfig, type InvoiceTemplateSettings, type OpenDataConfig } from '../../modules/OpenData';
5
5
  import { type BookingContextConfig, type BookingContextDateInput, type BookingContextResource, type BookingContextResourceMap, type BookingContextState, type InitBookingContextParams, type LoadBookingConfigParams, type LoadBookingResourcesParams, type ResourceError, type BookingCalcContext } from '../../modules/BookingContext';
6
6
  import type { OrderCustomerView, OrderCustomerChangePayload } from '../../modules/Order/types';
7
7
  import { BaseSalesImpl } from '../BaseSales';
@@ -30,7 +30,9 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
30
30
  private orderCustomerDiscountRefreshInFlight;
31
31
  private orderCustomerDiscountRefreshCustomerId;
32
32
  private orderCustomerPromotionRefreshInFlight;
33
- private loadOpenDataConfigInFlight;
33
+ protected loadOpenDataInFlight: Promise<OpenDataConfig> | null;
34
+ protected loadOpenDataInFlightTarget: string | null;
35
+ protected openDataTarget: string | null;
34
36
  /**
35
37
  * 在 BaseSales 默认模块清单(products/order/salesSummary/schedule)基础上追加 customer + bookingContext。
36
38
  * bookingContext 是 SalesSdk 加车下沉所需的「预约 UI 上下文」(bookingConfig / resourcesOrigin / date)。
@@ -43,10 +45,13 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
43
45
  */
44
46
  protected createSubModule(moduleName: string): Module | null;
45
47
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
46
- private getBookingTicketBusinessCode;
48
+ protected getBookingTicketBusinessCode(): string | null;
47
49
  private getIdGeneratorPlugin;
48
50
  private loadOpenDataConfig;
49
51
  getOpenData(): Promise<OpenDataConfig | null>;
52
+ getInvoiceLayoutConfig(): Promise<InvoiceLayoutConfig>;
53
+ getInvoiceTemplateSettings(): Promise<InvoiceTemplateSettings>;
54
+ protected isInvoiceOpenDataCacheCurrent(): boolean;
50
55
  /** 清除店铺级 OpenData;下一次 getOpenData 时会重新拉取。 */
51
56
  clearOpenDataCache(): void;
52
57
  private getShortNumberOrDeviceId;
@@ -334,7 +339,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
334
339
  * 获取当前的客户搜索条件
335
340
  * @returns 当前搜索条件
336
341
  */
337
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
342
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
338
343
  /**
339
344
  * 获取客户列表状态(包含滚动加载相关状态)
340
345
  * @returns 客户状态
@@ -453,7 +458,19 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
453
458
  * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
454
459
  * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
455
460
  */
456
- decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
461
+ decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
462
+ action: "reloadCatalog";
463
+ } | {
464
+ action: "add";
465
+ cacheItem: any;
466
+ } | {
467
+ action: "requiresDetail";
468
+ payload: AddProductRequiresDetailPayload;
469
+ } | {
470
+ action: "requiresBookingEdit";
471
+ cacheItem: any;
472
+ payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
473
+ };
457
474
  /** 规格弹窗 callback 后的第二段决策。 */
458
475
  decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
459
476
  /**