@pisell/pisellos 2.2.164 → 2.2.166

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 (36) hide show
  1. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +45 -15
  2. package/dist/modules/Order/index.d.ts +10 -3
  3. package/dist/modules/Order/index.js +275 -142
  4. package/dist/modules/Order/types.d.ts +9 -2
  5. package/dist/modules/Order/types.js +2 -0
  6. package/dist/modules/Order/utils.d.ts +13 -0
  7. package/dist/modules/Order/utils.js +69 -15
  8. package/dist/server/index.js +1 -0
  9. package/dist/solution/BaseSales/index.d.ts +9 -1
  10. package/dist/solution/BaseSales/index.js +378 -241
  11. package/dist/solution/BaseSales/types.d.ts +3 -0
  12. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +33 -14
  13. package/dist/solution/BaseSales/utils.js +36 -7
  14. package/dist/solution/BookingTicket/index.d.ts +3 -0
  15. package/dist/solution/BookingTicket/index.js +170 -86
  16. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +4 -2
  17. package/dist/solution/BookingTicket/utils/addProductDecision.js +37 -19
  18. package/dist/solution/ScanOrder/utils.js +36 -7
  19. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +35 -9
  20. package/lib/modules/Order/index.d.ts +10 -3
  21. package/lib/modules/Order/index.js +107 -4
  22. package/lib/modules/Order/types.d.ts +9 -2
  23. package/lib/modules/Order/utils.d.ts +13 -0
  24. package/lib/modules/Order/utils.js +57 -9
  25. package/lib/server/index.js +1 -0
  26. package/lib/solution/BaseSales/index.d.ts +9 -1
  27. package/lib/solution/BaseSales/index.js +71 -3
  28. package/lib/solution/BaseSales/types.d.ts +3 -0
  29. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +31 -10
  30. package/lib/solution/BaseSales/utils.js +37 -5
  31. package/lib/solution/BookingTicket/index.d.ts +3 -0
  32. package/lib/solution/BookingTicket/index.js +57 -6
  33. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +4 -2
  34. package/lib/solution/BookingTicket/utils/addProductDecision.js +28 -12
  35. package/lib/solution/ScanOrder/utils.js +37 -5
  36. package/package.json +1 -1
@@ -42,6 +42,9 @@ export interface BaseSalesOrderProductIdentity {
42
42
  product_option_item?: any[];
43
43
  product_bundle?: any[];
44
44
  }
45
+ export interface BaseSalesUpdateOrderProductQuantityParams extends BaseSalesOrderProductIdentity {
46
+ num: number;
47
+ }
45
48
  export interface BaseSalesOrderProduct extends BaseSalesOrderProductIdentity {
46
49
  order_detail_id: number | null;
47
50
  num: number;
@@ -43,9 +43,19 @@ function normalizeOptionItems(optionItems) {
43
43
  });
44
44
  }
45
45
  function normalizeBundleItems(bundleItems) {
46
+ var preferPriceField = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
46
47
  if (!Array.isArray(bundleItems)) return [];
47
48
  return bundleItems.map(function (bundleItem) {
49
+ var _ref2, _ref3, _ref4, _bundleItem$price, _ref5, _ref6, _ref7, _bundleItem$bundle_se, _bundleItem$num, _bundleItem$quantity, _bundleItem$price2, _ref8, _ref9, _bundleItem$original_;
50
+ var unitSelling = preferPriceField ? (_ref2 = (_ref3 = (_ref4 = (_bundleItem$price = bundleItem.price) !== null && _bundleItem$price !== void 0 ? _bundleItem$price : bundleItem.bundle_selling_price) !== null && _ref4 !== void 0 ? _ref4 : bundleItem.custom_price) !== null && _ref3 !== void 0 ? _ref3 : bundleItem.product_price) !== null && _ref2 !== void 0 ? _ref2 : '0' : (_ref5 = (_ref6 = (_ref7 = (_bundleItem$bundle_se = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se !== void 0 ? _bundleItem$bundle_se : bundleItem.price) !== null && _ref7 !== void 0 ? _ref7 : bundleItem.custom_price) !== null && _ref6 !== void 0 ? _ref6 : bundleItem.product_price) !== null && _ref5 !== void 0 ? _ref5 : '0';
51
+ var unitStr = toPriceString(unitSelling, '0.00');
52
+ var num = toSafePositiveInt((_bundleItem$num = bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.num) !== null && _bundleItem$num !== void 0 ? _bundleItem$num : bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.quantity, 1);
48
53
  return _objectSpread(_objectSpread({}, bundleItem), {}, {
54
+ num: num,
55
+ quantity: (_bundleItem$quantity = bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.quantity) !== null && _bundleItem$quantity !== void 0 ? _bundleItem$quantity : num,
56
+ price: (_bundleItem$price2 = bundleItem.price) !== null && _bundleItem$price2 !== void 0 ? _bundleItem$price2 : unitStr,
57
+ bundle_selling_price: unitStr,
58
+ original_price: (_ref8 = (_ref9 = (_bundleItem$original_ = bundleItem.original_price) !== null && _bundleItem$original_ !== void 0 ? _bundleItem$original_ : bundleItem.product_price) !== null && _ref9 !== void 0 ? _ref9 : bundleItem.price) !== null && _ref8 !== void 0 ? _ref8 : unitStr,
49
59
  option: normalizeOptionItems(bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.option)
50
60
  });
51
61
  });
@@ -64,23 +74,25 @@ function findVariantById(origin, variantId) {
64
74
  * 注意:这里不生成 identity,缺省时由 OrderModule 自动补齐。
65
75
  */
66
76
  export function transformBaseProductToOrderProduct(params) {
67
- var _ref2, _ref3, _ref4, _payload$product_id, _ref5, _ref6, _payload$product_vari, _payload$_origin, _payload$_origin2, _ref7, _findVariantById, _ref8, _ref9, _ref10, _ref11, _ref12, _ref13, _ref14, _payload$price, _ref15, _payload$option, _payload$bundle, _payload$unique_ident, _payload$quantity, _ref16, _ref17, _payload$tax_fee, _ref18, _ref19, _payload$is_charge_ta;
77
+ var _ref10, _ref11, _ref12, _payload$product_id, _ref13, _ref14, _payload$product_vari, _payload$_origin, _payload$_origin2, _ref15, _findVariantById, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _payload$price, _ref23, _payload$line_total, _payload$_extend, _ref24, _payload$option, _payload$bundle, _payload$unique_ident, _payload$quantity, _ref25, _ref26, _payload$tax_fee, _ref27, _ref28, _payload$is_charge_ta;
68
78
  var payload = params.payload,
69
79
  _params$fallbackProdu = params.fallbackProductId,
70
80
  fallbackProductId = _params$fallbackProdu === void 0 ? null : _params$fallbackProdu;
71
81
  if (!payload || _typeof(payload) !== 'object') return null;
72
82
  var sourceProduct = params.sourceProduct || params.sourceItem || {};
73
- var productId = toProductId((_ref2 = (_ref3 = (_ref4 = (_payload$product_id = payload.product_id) !== null && _payload$product_id !== void 0 ? _payload$product_id : payload.id) !== null && _ref4 !== void 0 ? _ref4 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.product_id) !== null && _ref3 !== void 0 ? _ref3 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.id) !== null && _ref2 !== void 0 ? _ref2 : fallbackProductId);
83
+ var productId = toProductId((_ref10 = (_ref11 = (_ref12 = (_payload$product_id = payload.product_id) !== null && _payload$product_id !== void 0 ? _payload$product_id : payload.id) !== null && _ref12 !== void 0 ? _ref12 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.product_id) !== null && _ref11 !== void 0 ? _ref11 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.id) !== null && _ref10 !== void 0 ? _ref10 : fallbackProductId);
74
84
  if (productId === null) return null;
75
- var productVariantId = toNumber((_ref5 = (_ref6 = (_payload$product_vari = payload.product_variant_id) !== null && _payload$product_vari !== void 0 ? _payload$product_vari : payload.variant_id) !== null && _ref6 !== void 0 ? _ref6 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.product_variant_id) !== null && _ref5 !== void 0 ? _ref5 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.variant_id, 0);
85
+ 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);
76
86
  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 || {};
77
87
  var origin = _objectSpread(_objectSpread({}, sourceProduct || {}), callbackOrigin || {});
78
- var matchedVariant = (_ref7 = (_findVariantById = findVariantById(callbackOrigin, productVariantId)) !== null && _findVariantById !== void 0 ? _findVariantById : findVariantById(sourceProduct, productVariantId)) !== null && _ref7 !== void 0 ? _ref7 : findVariantById(origin, productVariantId);
79
- var sourceProductPrice = toPriceString((_ref8 = (_ref9 = (_ref10 = (_ref11 = (_ref12 = (_ref13 = (_ref14 = (_payload$price = payload.price) !== null && _payload$price !== void 0 ? _payload$price : payload.selling_price) !== null && _ref14 !== void 0 ? _ref14 : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.price) !== null && _ref13 !== void 0 ? _ref13 : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.base_price) !== null && _ref12 !== void 0 ? _ref12 : origin === null || origin === void 0 ? void 0 : origin.price) !== null && _ref11 !== void 0 ? _ref11 : origin === null || origin === void 0 ? void 0 : origin.base_price) !== null && _ref10 !== void 0 ? _ref10 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _ref9 !== void 0 ? _ref9 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.selling_price) !== null && _ref8 !== void 0 ? _ref8 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price, '0.00');
80
- var productOptionItem = normalizeOptionItems((_ref15 = (_payload$option = payload.option) !== null && _payload$option !== void 0 ? _payload$option : payload.options) !== null && _ref15 !== void 0 ? _ref15 : payload.product_option_item);
81
- var productBundle = normalizeBundleItems((_payload$bundle = payload.bundle) !== null && _payload$bundle !== void 0 ? _payload$bundle : payload.product_bundle);
88
+ var matchedVariant = (_ref15 = (_findVariantById = findVariantById(callbackOrigin, productVariantId)) !== null && _findVariantById !== void 0 ? _findVariantById : findVariantById(sourceProduct, productVariantId)) !== null && _ref15 !== void 0 ? _ref15 : findVariantById(origin, productVariantId);
89
+ var sourceProductPrice = toPriceString((_ref16 = (_ref17 = (_ref18 = (_ref19 = (_ref20 = (_ref21 = (_ref22 = (_payload$price = payload.price) !== null && _payload$price !== void 0 ? _payload$price : payload.selling_price) !== null && _ref22 !== void 0 ? _ref22 : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.price) !== null && _ref21 !== void 0 ? _ref21 : 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, '0.00');
90
+ var lineCompositeTotal = toPriceString((_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, sourceProductPrice);
91
+ var hasPriceOverride = payload.price_override !== undefined && payload.price_override !== null && payload.price_override !== '';
92
+ var productOptionItem = normalizeOptionItems((_ref24 = (_payload$option = payload.option) !== null && _payload$option !== void 0 ? _payload$option : payload.options) !== null && _ref24 !== void 0 ? _ref24 : payload.product_option_item);
93
+ var productBundle = normalizeBundleItems((_payload$bundle = payload.bundle) !== null && _payload$bundle !== void 0 ? _payload$bundle : payload.product_bundle, hasPriceOverride);
82
94
  var uniqueIdentificationNumber = (_payload$unique_ident = payload.unique_identification_number) !== null && _payload$unique_ident !== void 0 ? _payload$unique_ident : payload.unique;
83
- var metadata = {
95
+ var metadata = _objectSpread(_objectSpread({
84
96
  unique: payload.unique,
85
97
  session: payload.session,
86
98
  form: payload.form,
@@ -91,8 +103,14 @@ export function transformBaseProductToOrderProduct(params) {
91
103
  policy_id: payload.policy_id,
92
104
  source_shop_id: payload.source_shop_id,
93
105
  origin: origin,
94
- source_product_price: sourceProductPrice
95
- };
106
+ source_product_price: sourceProductPrice,
107
+ main_product_selling_price: sourceProductPrice,
108
+ main_product_original_price: sourceProductPrice
109
+ }, hasPriceOverride ? {
110
+ price_override: String(payload.price_override)
111
+ } : {}), payload.bundle_edit !== undefined ? {
112
+ bundle_edit: payload.bundle_edit
113
+ } : {});
96
114
  if (uniqueIdentificationNumber) {
97
115
  metadata.unique_identification_number = String(uniqueIdentificationNumber);
98
116
  }
@@ -103,10 +121,11 @@ export function transformBaseProductToOrderProduct(params) {
103
121
  num: toSafePositiveInt((_payload$quantity = payload.quantity) !== null && _payload$quantity !== void 0 ? _payload$quantity : payload.num, 1),
104
122
  product_option_item: productOptionItem,
105
123
  product_bundle: productBundle,
106
- selling_price: sourceProductPrice,
107
- original_price: sourceProductPrice,
108
- tax_fee: toPriceString((_ref16 = (_ref17 = (_payload$tax_fee = payload.tax_fee) !== null && _payload$tax_fee !== void 0 ? _payload$tax_fee : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.tax_fee) !== null && _ref17 !== void 0 ? _ref17 : origin === null || origin === void 0 ? void 0 : origin.tax_fee) !== null && _ref16 !== void 0 ? _ref16 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.tax_fee, '0.00'),
109
- is_charge_tax: toNumber((_ref18 = (_ref19 = (_payload$is_charge_ta = payload.is_charge_tax) !== null && _payload$is_charge_ta !== void 0 ? _payload$is_charge_ta : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.is_charge_tax) !== null && _ref19 !== void 0 ? _ref19 : origin === null || origin === void 0 ? void 0 : origin.is_charge_tax) !== null && _ref18 !== void 0 ? _ref18 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.is_charge_tax, 0),
124
+ // 折后行价由 normalizeOrderProduct 按 main + bundle 合成;手动改价时 bundle 已为分摊后单价
125
+ selling_price: lineCompositeTotal,
126
+ original_price: lineCompositeTotal,
127
+ tax_fee: toPriceString((_ref25 = (_ref26 = (_payload$tax_fee = payload.tax_fee) !== null && _payload$tax_fee !== void 0 ? _payload$tax_fee : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.tax_fee) !== null && _ref26 !== void 0 ? _ref26 : origin === null || origin === void 0 ? void 0 : origin.tax_fee) !== null && _ref25 !== void 0 ? _ref25 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.tax_fee, '0.00'),
128
+ is_charge_tax: toNumber((_ref27 = (_ref28 = (_payload$is_charge_ta = payload.is_charge_tax) !== null && _payload$is_charge_ta !== void 0 ? _payload$is_charge_ta : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.is_charge_tax) !== null && _ref28 !== void 0 ? _ref28 : origin === null || origin === void 0 ? void 0 : origin.is_charge_tax) !== null && _ref27 !== void 0 ? _ref27 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.is_charge_tax, 0),
110
129
  metadata: metadata,
111
130
  note: payload.note != null ? String(payload.note) : '',
112
131
  _origin: _objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
@@ -5,7 +5,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
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
7
  import Decimal from 'decimal.js';
8
- import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
8
+ import { composeLinePrice, createUuidV4, resolveManualOverrideLineOriginalPrice, sumOptionUnitPrice } from "../../modules/Order/utils";
9
9
 
10
10
  /**
11
11
  * 构建金额全为 0 的空 summary。
@@ -106,17 +106,42 @@ export function isSkuOnlyDeleteIdentity(x) {
106
106
  * - 因此多次 normalize 不会重复叠加 option/bundle。
107
107
  */
108
108
  export function normalizeOrderProduct(product) {
109
- var _product$metadata, _metadata$origin, _variantList$find, _product$is_charge_ta;
109
+ var _product$metadata, _metadata$origin, _metadata$origin2, _variantList$find, _product$is_charge_ta;
110
110
  var metadata = _objectSpread({}, product.metadata || {});
111
111
  // 不透明 identity 契约:每条订单行必须带 identity_key。
112
112
  // 调用方未传时由 SDK 自动生成 UUID,后续 update/remove 只做严格比对,避免猜测合成 key。
113
113
  var resolvedIdentityKey = (_product$metadata = product.metadata) !== null && _product$metadata !== void 0 && _product$metadata.unique_identification_number ? String(product.metadata.unique_identification_number) : product.unique_identification_number && String(product.unique_identification_number).length > 0 ? String(product.unique_identification_number) : product.identity_key && String(product.identity_key).length > 0 ? String(product.identity_key) : createUuidV4();
114
114
  metadata.unique_identification_number = resolvedIdentityKey;
115
- var normalizedBundle = (product.product_bundle || []).map(function (item) {
116
- var _ref2, _item$bundle_selling_, _ref3, _ref4, _item$price2, _ref5, _item$price_type, _ref6, _item$price_type_ext;
115
+ var priceOverride = metadata.price_override;
116
+ var originOtherBundle = (_metadata$origin = metadata.origin) === null || _metadata$origin === void 0 || (_metadata$origin = _metadata$origin._extend) === null || _metadata$origin === void 0 || (_metadata$origin = _metadata$origin.other) === null || _metadata$origin === void 0 ? void 0 : _metadata$origin.bundle;
117
+ var bundleInput = product.product_bundle || [];
118
+ if (priceOverride !== undefined && priceOverride !== null && priceOverride !== '' && Array.isArray(originOtherBundle) && originOtherBundle.length > 0) {
119
+ var priceById = new Map();
120
+ originOtherBundle.forEach(function (item) {
121
+ var _item$price2;
122
+ if ((item === null || item === void 0 ? void 0 : item.id) == null) return;
123
+ var unit = (_item$price2 = item.price) !== null && _item$price2 !== void 0 ? _item$price2 : item.bundle_selling_price;
124
+ if (unit === undefined || unit === null) return;
125
+ priceById.set(String(item.id), String(unit));
126
+ });
127
+ var base = Array.isArray(bundleInput) && bundleInput.length > 0 ? bundleInput : originOtherBundle;
128
+ bundleInput = base.map(function (item) {
129
+ var unit = priceById.get(String(item === null || item === void 0 ? void 0 : item.id));
130
+ if (unit === undefined) return item;
131
+ return _objectSpread(_objectSpread({}, item), {}, {
132
+ price: unit,
133
+ bundle_selling_price: unit
134
+ });
135
+ });
136
+ }
137
+ var normalizedBundle = bundleInput.map(function (item) {
138
+ var _item$bundle_id2, _item$bundle_product_, _item$bundle_group_id, _ref2, _item$bundle_selling_, _ref3, _ref4, _item$price3, _ref5, _item$price_type, _ref6, _item$price_type_ext;
117
139
  return _objectSpread(_objectSpread({}, item), {}, {
140
+ bundle_id: (_item$bundle_id2 = item.bundle_id) !== null && _item$bundle_id2 !== void 0 ? _item$bundle_id2 : item.id,
141
+ bundle_product_id: (_item$bundle_product_ = item.bundle_product_id) !== null && _item$bundle_product_ !== void 0 ? _item$bundle_product_ : item._bundle_product_id,
142
+ bundle_group_id: (_item$bundle_group_id = item.bundle_group_id) !== null && _item$bundle_group_id !== void 0 ? _item$bundle_group_id : item.group_id,
118
143
  bundle_selling_price: (_ref2 = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref2 !== void 0 ? _ref2 : '0.00',
119
- price: (_ref3 = (_ref4 = (_item$price2 = item.price) !== null && _item$price2 !== void 0 ? _item$price2 : item.custom_price) !== null && _ref4 !== void 0 ? _ref4 : item.bundle_selling_price) !== null && _ref3 !== void 0 ? _ref3 : '0.00',
144
+ price: (_ref3 = (_ref4 = (_item$price3 = item.price) !== null && _item$price3 !== void 0 ? _item$price3 : item.custom_price) !== null && _ref4 !== void 0 ? _ref4 : item.bundle_selling_price) !== null && _ref3 !== void 0 ? _ref3 : '0.00',
120
145
  price_type: (_ref5 = (_item$price_type = item.price_type) !== null && _item$price_type !== void 0 ? _item$price_type : item.custom_price_type) !== null && _ref5 !== void 0 ? _ref5 : '',
121
146
  price_type_ext: (_ref6 = (_item$price_type_ext = item.price_type_ext) !== null && _item$price_type_ext !== void 0 ? _item$price_type_ext : item.custom_price_type_ext) !== null && _ref6 !== void 0 ? _ref6 : ''
122
147
  });
@@ -134,7 +159,7 @@ export function normalizeOrderProduct(product) {
134
159
  // 6) 入参 selling_price(最末兜底,新添加路径 caller 只给 selling_price)
135
160
  var isV2 = metadata.price_schema_version === 2 || metadata.price_schema_version === '2';
136
161
  var variantId = Number(product.product_variant_id || 0);
137
- var variantList = variantId ? metadata === null || metadata === void 0 || (_metadata$origin = metadata.origin) === null || _metadata$origin === void 0 ? void 0 : _metadata$origin.variant : null;
162
+ var variantList = variantId ? metadata === null || metadata === void 0 || (_metadata$origin2 = metadata.origin) === null || _metadata$origin2 === void 0 ? void 0 : _metadata$origin2.variant : null;
138
163
  var variantPrice = Array.isArray(variantList) ? (_variantList$find = variantList.find(function (v) {
139
164
  return Number(v === null || v === void 0 ? void 0 : v.id) === variantId;
140
165
  })) === null || _variantList$find === void 0 ? void 0 : _variantList$find.price : undefined;
@@ -204,6 +229,10 @@ export function normalizeOrderProduct(product) {
204
229
  bundle: normalizedBundle,
205
230
  useOriginalBundle: true
206
231
  });
232
+ var finalOriginalPrice = resolveManualOverrideLineOriginalPrice({
233
+ num: product.num,
234
+ metadata: metadata
235
+ }, composedOriginalPrice);
207
236
  return {
208
237
  order_detail_id: product.order_detail_id || null,
209
238
  product_id: product.product_id,
@@ -211,7 +240,7 @@ export function normalizeOrderProduct(product) {
211
240
  product_variant_id: product.product_variant_id,
212
241
  product_option_item: normalizedOptions,
213
242
  selling_price: composedSellingPrice,
214
- original_price: composedOriginalPrice,
243
+ original_price: finalOriginalPrice,
215
244
  tax_fee: product.tax_fee || '0.00',
216
245
  is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
217
246
  discount_list: product.discount_list || [],
@@ -21,6 +21,8 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
21
21
  private platform;
22
22
  private scan;
23
23
  private productCatalog;
24
+ private orderCustomerDiscountRefreshInFlight;
25
+ private orderCustomerDiscountRefreshCustomerId;
24
26
  /**
25
27
  * 在 BaseSales 默认模块清单(products/order/salesSummary/schedule)基础上追加 customer + bookingContext。
26
28
  * bookingContext 是 SalesSdk 加车下沉所需的「预约 UI 上下文」(bookingConfig / resourcesOrigin / date)。
@@ -205,6 +207,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
205
207
  restoreOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
206
208
  /** 内部:基于 OrderModule 当前状态构造一份 OrderCustomerChangePayload。 */
207
209
  private buildOrderCustomerPayload;
210
+ private refreshDiscountConfigAfterOrderCustomerChange;
208
211
  /**
209
212
  * 获取客户分页信息
210
213
  * @returns 分页信息