@pisell/pisellos 2.2.197 → 2.2.199

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 (45) hide show
  1. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +7 -3
  2. package/dist/modules/Cart/utils/cartProduct.js +11 -1
  3. package/dist/modules/Cart/utils/changePrice.js +11 -11
  4. package/dist/modules/Order/index.d.ts +16 -0
  5. package/dist/modules/Order/index.js +1232 -568
  6. package/dist/modules/Order/types.d.ts +1 -0
  7. package/dist/modules/Order/utils.d.ts +33 -2
  8. package/dist/modules/Order/utils.js +112 -55
  9. package/dist/modules/Payment/walletpass.js +14 -7
  10. package/dist/modules/SalesSummary/utils.js +394 -149
  11. package/dist/server/index.d.ts +3 -0
  12. package/dist/server/index.js +294 -190
  13. package/dist/server/modules/order/index.d.ts +8 -0
  14. package/dist/server/modules/order/index.js +536 -317
  15. package/dist/server/modules/order/types.d.ts +2 -0
  16. package/dist/solution/BaseSales/index.js +2 -1
  17. package/dist/solution/BaseSales/types.d.ts +1 -0
  18. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +19 -4
  19. package/dist/solution/BookingByStep/index.d.ts +1 -1
  20. package/dist/solution/ScanOrder/types.d.ts +1 -0
  21. package/dist/solution/ScanOrder/utils.js +26 -9
  22. package/dist/solution/VenueBooking/index.js +2 -1
  23. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +4 -1
  24. package/lib/modules/Cart/utils/cartProduct.js +11 -1
  25. package/lib/modules/Cart/utils/changePrice.js +12 -20
  26. package/lib/modules/Order/index.d.ts +16 -0
  27. package/lib/modules/Order/index.js +525 -18
  28. package/lib/modules/Order/types.d.ts +1 -0
  29. package/lib/modules/Order/utils.d.ts +33 -2
  30. package/lib/modules/Order/utils.js +44 -9
  31. package/lib/modules/Payment/walletpass.js +7 -3
  32. package/lib/modules/SalesSummary/utils.js +256 -46
  33. package/lib/server/index.d.ts +3 -0
  34. package/lib/server/index.js +82 -3
  35. package/lib/server/modules/order/index.d.ts +8 -0
  36. package/lib/server/modules/order/index.js +106 -4
  37. package/lib/server/modules/order/types.d.ts +2 -0
  38. package/lib/solution/BaseSales/index.js +2 -1
  39. package/lib/solution/BaseSales/types.d.ts +1 -0
  40. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +15 -1
  41. package/lib/solution/BookingByStep/index.d.ts +1 -1
  42. package/lib/solution/ScanOrder/types.d.ts +1 -0
  43. package/lib/solution/ScanOrder/utils.js +28 -10
  44. package/lib/solution/VenueBooking/index.js +2 -1
  45. package/package.json +1 -1
@@ -393,6 +393,8 @@ export interface OrderData {
393
393
  /** 本地辅助字段 */
394
394
  shop_id?: number;
395
395
  create_date?: string;
396
+ /** 本地待同步标记:1 表示需要后续同步到云端 */
397
+ need_sync?: 0 | 1 | number;
396
398
  /** 兼容:部分场景仍使用顶层 total_amount */
397
399
  total_amount?: OrderMoneyString | number;
398
400
  /** 扩展字段(物流、标签等);使用 any 以便筛选与数据源扩展 */
@@ -2033,7 +2033,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2033
2033
  var products = tempOrder === null || tempOrder === void 0 || (_tempOrder$products2 = tempOrder.products) === null || _tempOrder$products2 === void 0 ? void 0 : _tempOrder$products2.filter(function (n) {
2034
2034
  return n.product_id;
2035
2035
  });
2036
- return products.map(function (product) {
2036
+ var walletProducts = products.map(function (product) {
2037
2037
  var _product$product_vari2, _product$is_charge_ta, _product$holder_id, _metadata$main_produc, _metadata$main_produc2;
2038
2038
  var metadata = product.metadata || {};
2039
2039
  return {
@@ -2079,6 +2079,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2079
2079
  })
2080
2080
  };
2081
2081
  });
2082
+ return walletProducts;
2082
2083
  }
2083
2084
  }, {
2084
2085
  key: "initWalletData",
@@ -126,6 +126,7 @@ export interface BaseSalesSummary {
126
126
  shipping_tax_fee: string;
127
127
  tax_fee: string;
128
128
  surcharge_fee: string;
129
+ surcharges?: any[];
129
130
  discount_amount: string;
130
131
  deposit_amount: string;
131
132
  deposit?: {
@@ -4,7 +4,7 @@ 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
- import { composeLinePrice, normalizeProductSkuOptions, sumOptionUnitPrice } from "../../../modules/Order/utils";
7
+ import { composeLinePrice, getBundleSellingMagnitude, normalizeProductSkuOptions, sumOptionUnitPrice } from "../../../modules/Order/utils";
8
8
  import { buildManualProductDiscountItem, mergeManualProductDiscountIntoList, resolveManualDiscountOriginTotal, resolveManualDiscountReasonFromSources, shouldBuildManualProductDiscount } from "../../../modules/Order/utils/manualProductDiscount";
9
9
  function toNumber(value) {
10
10
  var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
@@ -49,18 +49,33 @@ function normalizeBundleItems(bundleItems) {
49
49
  var preferPriceField = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
50
50
  if (!Array.isArray(bundleItems)) return [];
51
51
  return bundleItems.map(function (bundleItem) {
52
- var _ref2, _ref3, _ref4, _bundleItem$price, _ref5, _ref6, _ref7, _bundleItem$bundle_se, _bundleItem$num, _bundleItem$quantity, _bundleItem$price2, _ref8, _ref9, _bundleItem$original_;
52
+ var _ref2, _ref3, _ref4, _bundleItem$price, _ref5, _ref6, _ref7, _bundleItem$bundle_se, _bundleItem$num, _bundleItem$price2, _bundleItem$quantity, _bundleItem$price3, _ref8, _ref9, _bundleItem$original_, _normalizedItem$price;
53
53
  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';
54
54
  var unitStr = toPriceString(unitSelling, '0.00');
55
55
  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);
56
- return _objectSpread(_objectSpread({}, bundleItem), {}, {
56
+ var magnitudeSource = _objectSpread(_objectSpread({}, bundleItem), {}, {
57
+ option: normalizeOptionItems(bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.option),
58
+ bundle_selling_price: unitStr,
59
+ // 计算 markdown 净额时,只传真实毛价;仅有 bundle_selling_price 时按历史净额兜底。
60
+ price: (_bundleItem$price2 = bundleItem.price) !== null && _bundleItem$price2 !== void 0 ? _bundleItem$price2 : bundleItem.custom_price
61
+ });
62
+ var normalizedItem = _objectSpread(_objectSpread({}, bundleItem), {}, {
57
63
  num: num,
58
64
  quantity: (_bundleItem$quantity = bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.quantity) !== null && _bundleItem$quantity !== void 0 ? _bundleItem$quantity : num,
59
- price: (_bundleItem$price2 = bundleItem.price) !== null && _bundleItem$price2 !== void 0 ? _bundleItem$price2 : unitStr,
65
+ // price 保留毛价(markdown 仍为正),由 price_type 决定符号。
66
+ price: (_bundleItem$price3 = bundleItem.price) !== null && _bundleItem$price3 !== void 0 ? _bundleItem$price3 : unitStr,
60
67
  bundle_selling_price: unitStr,
61
68
  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,
62
69
  option: normalizeOptionItems(bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.option)
63
70
  });
71
+ // bundle_selling_price 落「正净额」:markdown = |price| − Σoptions;markup/原价维持原值。
72
+ normalizedItem.bundle_selling_price = getBundleSellingMagnitude(magnitudeSource).toFixed(2);
73
+ if (((_normalizedItem$price = normalizedItem.price_type) !== null && _normalizedItem$price !== void 0 ? _normalizedItem$price : normalizedItem.custom_price_type) === 'markdown' && (normalizedItem.price_type_ext === '' || normalizedItem.price_type_ext === undefined || normalizedItem.price_type_ext === null)) {
74
+ var _normalizedItem$custo;
75
+ normalizedItem.custom_price = (_normalizedItem$custo = normalizedItem.custom_price) !== null && _normalizedItem$custo !== void 0 ? _normalizedItem$custo : normalizedItem.price;
76
+ normalizedItem.price = normalizedItem.bundle_selling_price;
77
+ }
78
+ return normalizedItem;
64
79
  });
65
80
  }
66
81
  function findVariantById(origin, variantId) {
@@ -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 | 6 | 3 | 5 | 4;
314
+ weekNum: 0 | 1 | 2 | 3 | 5 | 4 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -115,6 +115,7 @@ export interface ScanOrderSummary {
115
115
  shipping_tax_fee: string;
116
116
  tax_fee: string;
117
117
  surcharge_fee: string;
118
+ surcharges: any[];
118
119
  discount_amount: string;
119
120
  deposit_amount: string;
120
121
  deposit?: {
@@ -13,7 +13,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
13
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; }
14
14
  import dayjs from 'dayjs';
15
15
  import Decimal from 'decimal.js';
16
- import { composeLinePrice, createUuidV4, ensureProductSku, getProductSkuOptions, normalizeProductSkuOptions, resolveManualOverrideLineOriginalPrice, sumOptionUnitPrice } from "../../modules/Order/utils";
16
+ import { composeLinePrice, createUuidV4, ensureProductSku, getBundleSellingMagnitude, getProductSkuOptions, normalizeProductSkuOptions, resolveManualOverrideLineOriginalPrice, sumOptionUnitPrice } from "../../modules/Order/utils";
17
17
  import { ensureManualProductDiscountList } from "../../modules/Order/utils/manualProductDiscount";
18
18
 
19
19
  /**
@@ -31,6 +31,7 @@ export function createEmptySummary() {
31
31
  shipping_tax_fee: '0.00',
32
32
  tax_fee: '0.00',
33
33
  surcharge_fee: '0.00',
34
+ surcharges: [],
34
35
  discount_amount: '0.00',
35
36
  deposit_amount: '0.00',
36
37
  expect_amount: '0.00',
@@ -510,16 +511,32 @@ export function normalizeOrderProduct(product) {
510
511
  });
511
512
  }
512
513
  var normalizedBundle = bundleInput.map(function (item) {
513
- var _item$bundle_id2, _item$bundle_product_, _item$bundle_group_id, _ref5, _item$bundle_selling_, _ref6, _ref7, _item$price2, _ref8, _item$price_type, _ref9, _item$price_type_ext;
514
- return _objectSpread(_objectSpread({}, item), {}, {
514
+ var _item$price2, _item$bundle_id2, _item$bundle_product_, _item$bundle_group_id, _ref5, _ref6, _item$price3, _ref7, _item$price_type, _ref8, _item$price_type_ext;
515
+ var magnitudeSource = _objectSpread(_objectSpread({}, item), {}, {
516
+ // 计算 markdown 净额时,只把真实毛价交给 helper;若只有 bundle_selling_price,
517
+ // helper 会按历史净额兜底,避免 option 二次扣减。
518
+ price: (_item$price2 = item.price) !== null && _item$price2 !== void 0 ? _item$price2 : item.custom_price
519
+ });
520
+ var normalizedItem = _objectSpread(_objectSpread({}, item), {}, {
515
521
  bundle_id: (_item$bundle_id2 = item.bundle_id) !== null && _item$bundle_id2 !== void 0 ? _item$bundle_id2 : item.id,
516
522
  bundle_product_id: (_item$bundle_product_ = item.bundle_product_id) !== null && _item$bundle_product_ !== void 0 ? _item$bundle_product_ : item._bundle_product_id,
517
523
  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,
518
- bundle_selling_price: (_ref5 = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref5 !== void 0 ? _ref5 : '0.00',
519
- price: (_ref6 = (_ref7 = (_item$price2 = item.price) !== null && _item$price2 !== void 0 ? _item$price2 : item.custom_price) !== null && _ref7 !== void 0 ? _ref7 : item.bundle_selling_price) !== null && _ref6 !== void 0 ? _ref6 : '0.00',
520
- price_type: (_ref8 = (_item$price_type = item.price_type) !== null && _item$price_type !== void 0 ? _item$price_type : item.custom_price_type) !== null && _ref8 !== void 0 ? _ref8 : '',
521
- price_type_ext: (_ref9 = (_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 && _ref9 !== void 0 ? _ref9 : ''
524
+ // price 保留毛价(markdown 仍为 5),由 price_type 决定符号。
525
+ price: (_ref5 = (_ref6 = (_item$price3 = item.price) !== null && _item$price3 !== void 0 ? _item$price3 : item.custom_price) !== null && _ref6 !== void 0 ? _ref6 : item.bundle_selling_price) !== null && _ref5 !== void 0 ? _ref5 : '0.00',
526
+ price_type: (_ref7 = (_item$price_type = item.price_type) !== null && _item$price_type !== void 0 ? _item$price_type : item.custom_price_type) !== null && _ref7 !== void 0 ? _ref7 : '',
527
+ price_type_ext: (_ref8 = (_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 && _ref8 !== void 0 ? _ref8 : ''
522
528
  });
529
+ // bundle_selling_price 落「正净额」:markdown = |price| − Σoptions;markup/原价维持原值。
530
+ normalizedItem.bundle_selling_price = getBundleSellingMagnitude(magnitudeSource).toFixed(2);
531
+ if (normalizedItem.price_type === 'markdown' && (normalizedItem.price_type_ext === '' || normalizedItem.price_type_ext === undefined || normalizedItem.price_type_ext === null)) {
532
+ var _normalizedItem$custo;
533
+ normalizedItem.custom_price = (_normalizedItem$custo = normalizedItem.custom_price) !== null && _normalizedItem$custo !== void 0 ? _normalizedItem$custo : normalizedItem.price;
534
+ normalizedItem.price = normalizedItem.bundle_selling_price;
535
+ }
536
+ if ((normalizedItem.price_type === 'markdown' || normalizedItem.price_type === 'markup') && (normalizedItem.price_type_ext === '' || normalizedItem.price_type_ext === undefined || normalizedItem.price_type_ext === null)) {
537
+ delete normalizedItem.original_total;
538
+ }
539
+ return normalizedItem;
523
540
  });
524
541
  var normalizedOptions = normalizeProductSkuOptions((_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.option);
525
542
  var optionSum = sumOptionUnitPrice(normalizedOptions);
@@ -541,7 +558,7 @@ export function normalizeOrderProduct(product) {
541
558
  var variantPrice = Array.isArray(variantList) ? (_variantList$find = variantList.find(function (v) {
542
559
  return Number(v === null || v === void 0 ? void 0 : v.id) === variantId;
543
560
  })) === null || _variantList$find === void 0 ? void 0 : _variantList$find.price : undefined;
544
- var resolvedSource = function (_product$_origin, _product$_origin2, _ref10, _product$original_pri) {
561
+ var resolvedSource = function (_product$_origin, _product$_origin2, _ref9, _product$original_pri) {
545
562
  if (metadata.source_product_price !== undefined) {
546
563
  return String(metadata.source_product_price);
547
564
  }
@@ -559,7 +576,7 @@ export function normalizeOrderProduct(product) {
559
576
  if (!isV2 && metadata.main_product_original_price !== undefined) {
560
577
  return String(metadata.main_product_original_price);
561
578
  }
562
- return (_ref10 = (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : product.selling_price) !== null && _ref10 !== void 0 ? _ref10 : '0.00';
579
+ return (_ref9 = (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : product.selling_price) !== null && _ref9 !== void 0 ? _ref9 : '0.00';
563
580
  }();
564
581
 
565
582
  // 2) 派生 main_product_original_price(含 option、不含折扣)
@@ -2295,7 +2295,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2295
2295
  key: "getOrderProducts",
2296
2296
  value: function getOrderProducts() {
2297
2297
  if (!this.store.order) throw new Error('order 模块未初始化');
2298
- return this.store.order.getOrderProducts();
2298
+ var products = this.store.order.getOrderProducts();
2299
+ return products;
2299
2300
  }
2300
2301
  }, {
2301
2302
  key: "getSummary",
@@ -64,11 +64,14 @@ function mapOrderBundleToOtherBundle(bundle) {
64
64
  const catalogOriginal = item.original_price ?? item.product_price ?? item.price ?? item.bundle_selling_price;
65
65
  const selling = item.bundle_selling_price ?? item.price ?? catalogOriginal;
66
66
  const { bundle_selling_price: _omitBundleSelling, ...rest } = item;
67
+ const isMarkupOrMarkdown = (item.price_type === "markdown" || item.price_type === "markup") && (item.price_type_ext === "" || item.price_type_ext === void 0 || item.price_type_ext === null);
68
+ if (isMarkupOrMarkdown)
69
+ delete rest.original_total;
67
70
  return {
68
71
  ...rest,
69
72
  price: selling,
70
73
  original_price: catalogOriginal,
71
- original_total: item.original_total ?? catalogOriginal,
74
+ ...isMarkupOrMarkdown ? {} : { original_total: item.original_total ?? catalogOriginal },
72
75
  num: item.num ?? item.quantity ?? 1,
73
76
  quantity: item.quantity ?? item.num ?? 1
74
77
  };
@@ -46,6 +46,7 @@ var import_decimal = __toESM(require("decimal.js"));
46
46
  var import_utils = require("../../Product/utils");
47
47
  var import_utils2 = require("../../../solution/ShopDiscount/utils");
48
48
  var import_utils3 = require("../../Summary/utils");
49
+ var import_utils4 = require("../../Order/utils");
49
50
  var toDiscountPayload = (discountItem) => {
50
51
  var _a, _b;
51
52
  return {
@@ -337,6 +338,15 @@ var formatBundleToOrigin = (bundle) => {
337
338
  var _a;
338
339
  return pre + (((_a = cur == null ? void 0 : cur.metadata) == null ? void 0 : _a.product_discount_difference) || 0);
339
340
  }, 0);
341
+ const normalizedBundle = {
342
+ ...d,
343
+ // 计算 markdown 净额时只传真实毛价;若仅有 bundle_selling_price,则由 helper 当历史净额兜底。
344
+ price: (d == null ? void 0 : d.price) ?? (d == null ? void 0 : d.custom_price),
345
+ bundle_selling_price: d == null ? void 0 : d.bundle_selling_price,
346
+ price_type: (d == null ? void 0 : d.price_type) ?? (d == null ? void 0 : d.custom_price_type),
347
+ price_type_ext: (d == null ? void 0 : d.price_type_ext) ?? (d == null ? void 0 : d.custom_price_type_ext),
348
+ option: getBundleValueByKey("option")
349
+ };
340
350
  return {
341
351
  bundle_group_id: getBundleValueByKey("group_id"),
342
352
  bundle_id: d.id,
@@ -347,7 +357,7 @@ var formatBundleToOrigin = (bundle) => {
347
357
  extension_type: getBundleValueByKey("extension_type"),
348
358
  option: formatOptionsToOrigin(getBundleValueByKey("option")),
349
359
  discount_list: d.discount_list,
350
- "bundle_selling_price": d == null ? void 0 : d.price,
360
+ "bundle_selling_price": (0, import_utils4.getBundleSellingMagnitude)(normalizedBundle).toFixed(2),
351
361
  "custom_price": d == null ? void 0 : d.price,
352
362
  metadata: {
353
363
  custom_product_bundle_map_id: d._id,
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __export = (target, all) => {
8
6
  for (var name in all)
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
16
14
  }
17
15
  return to;
18
16
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
18
 
29
19
  // src/modules/Cart/utils/changePrice.ts
@@ -32,7 +22,7 @@ __export(changePrice_exports, {
32
22
  updateAllCartItemPrice: () => updateAllCartItemPrice
33
23
  });
34
24
  module.exports = __toCommonJS(changePrice_exports);
35
- var import_decimal = __toESM(require("decimal.js"));
25
+ var import_utils = require("../../Order/utils");
36
26
  async function updateAllCartItemPrice(cartItems, priceData, getProduct, updateCart, updateItemInitInfo) {
37
27
  var _a, _b;
38
28
  for (const item of cartItems) {
@@ -57,18 +47,20 @@ async function updateAllCartItemPrice(cartItems, priceData, getProduct, updateCa
57
47
  const targetBundleItem = targetBundle.bundle_item.find(
58
48
  (m) => m.id === n.id
59
49
  );
60
- if (targetBundleItem.price_type === "markdown") {
61
- targetBundleItem.price = new import_decimal.default(targetBundleItem.price || 0).mul(-1).toNumber();
62
- }
63
- if (n.option) {
64
- targetBundleItem.price = new import_decimal.default(targetBundleItem.price || 0).add(n.option.reduce((pre, cur) => {
65
- return pre + new import_decimal.default(cur.price || 0).mul(cur.num || 1).toNumber();
66
- }, 0)).toNumber();
67
- }
68
50
  if (targetBundleItem) {
69
- return {
51
+ const normalizedBundle = {
70
52
  ...n,
71
53
  price: targetBundleItem.price,
54
+ custom_price: targetBundleItem.price,
55
+ price_type: targetBundleItem.price_type,
56
+ price_type_ext: targetBundleItem.price_type_ext
57
+ };
58
+ const bundleSellingPrice = (0, import_utils.getBundleSellingMagnitude)(normalizedBundle).toFixed(2);
59
+ return {
60
+ ...n,
61
+ custom_price: targetBundleItem.price,
62
+ price: targetBundleItem.price_type === "markdown" ? bundleSellingPrice : targetBundleItem.price,
63
+ bundle_selling_price: bundleSellingPrice,
72
64
  base_price: targetBundleItem.base_price
73
65
  };
74
66
  }
@@ -34,6 +34,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
34
34
  * BigSale 弹窗等短生命周期场景通过 setEnableTempOrderPersist(false) 关闭。
35
35
  */
36
36
  private draftPersistEnabled;
37
+ private collectHydratedEditDiscounts;
37
38
  /**
38
39
  * Populate `savedAmount` on each discount based on product-level discount details.
39
40
  * Only selected discounts get a non-zero value.
@@ -63,6 +64,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
63
64
  apply?: boolean;
64
65
  }): Promise<Discount[]>;
65
66
  getDiscountList(): Discount[];
67
+ private ensureEditDiscountConfigForProductChange;
66
68
  scanCode(code: string, customerId?: number): Promise<{
67
69
  isAvailable: boolean;
68
70
  discountList: Discount[];
@@ -147,11 +149,21 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
147
149
  private calculatePaidPaymentSummary;
148
150
  private calculatePaymentServiceFee;
149
151
  private calculatePaymentGapAmount;
152
+ private calculatePaymentRoundingAmount;
150
153
  private formatSummaryMetadataMoney;
151
154
  private syncSummaryProductMetadata;
152
155
  private calculateSummaryAmountGap;
153
156
  private getSummaryRefundAmount;
154
157
  private calculatePaymentTargetAmount;
158
+ private normalizeFingerprintMoney;
159
+ private normalizeFingerprintValue;
160
+ private buildProductFingerprintItem;
161
+ private buildOrderProductsFingerprint;
162
+ private buildProductStructuralFingerprintItem;
163
+ private buildOrderProductsStructuralFingerprint;
164
+ private getOriginalSalesSnapshot;
165
+ private restoreOriginalSnapshotIfProductsUnchanged;
166
+ private clearPersistedAmountFieldsForFullRecalc;
155
167
  private getPaymentTargetAmount;
156
168
  ensureTempOrder(): OrderTempOrder;
157
169
  restoreOrder(): OrderTempOrder;
@@ -186,6 +198,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
186
198
  updateTempOrderBuzzer(buzzer: string): string;
187
199
  updateTempOrderContactsInfo(contactsInfo: Record<string, any> | null): Record<string, any> | null;
188
200
  private buildTempOrderCustomer;
201
+ private isCustomerBoundDiscount;
202
+ private clearCustomerBoundDiscounts;
189
203
  /**
190
204
  * 更新当前 tempOrder 的客户协议字段。
191
205
  *
@@ -234,6 +248,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
234
248
  private shouldMergeProductToOrder;
235
249
  addProductToOrder(product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput): Promise<OrderProduct[]>;
236
250
  private hasGoodPassDiscount;
251
+ private getBundleRuntimeIdentity;
252
+ private preservePersistedBundlePriceFields;
237
253
  updateOrderProduct(params: UpdateOrderProductParams): Promise<OrderProduct[]>;
238
254
  updateOrderProductQuantity(params: UpdateOrderProductQuantityParams): Promise<OrderProduct[]>;
239
255
  updateOrderBooking(params: UpdateOrderBookingParams): any[];