@pisell/pisellos 2.3.114 → 2.3.116

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.
@@ -203,8 +203,18 @@ export interface PointCardSnapshotItem {
203
203
  par_value: string;
204
204
  used_par_value: string;
205
205
  }
206
+ export interface VirtualCurrencySnapshotItem {
207
+ id: number | string;
208
+ tag: 'virtual_currency';
209
+ product_id?: number | string;
210
+ product_name: string;
211
+ par_value: string;
212
+ used_par_value: string;
213
+ name: Record<string, string>;
214
+ }
206
215
  export interface OrderMetaList {
207
216
  point_cards_snapshot?: PointCardSnapshotItem[];
217
+ virtual_currency_snapshot?: VirtualCurrencySnapshotItem[];
208
218
  }
209
219
  export interface OrderProduct extends OrderProductIdentity {
210
220
  order_detail_id: number | null;
@@ -964,6 +974,7 @@ export interface OrderModuleAPI {
964
974
  }) => Promise<Discount[]>;
965
975
  getDiscountList: () => Discount[];
966
976
  getAvailableWalletIds: () => number[];
977
+ getCustomerWalletPrepareConfigEpoch: () => number;
967
978
  applyDiscount: () => void;
968
979
  /**
969
980
  * 注入促销评估器。
@@ -1,6 +1,6 @@
1
1
  import Decimal from 'decimal.js';
2
2
  import type { CartItem } from "../Cart";
3
- import type { OrderProductDiscountItem, OrderMetaList, OrderProduct, OrderSubmitPayload, OrderSubmitProduct, OrderSummary, OrderTempOrder, PointCardSnapshotItem } from './types';
3
+ import type { OrderProductDiscountItem, OrderMetaList, OrderProduct, OrderSubmitPayload, OrderSubmitProduct, OrderSummary, OrderTempOrder, PointCardSnapshotItem, VirtualCurrencySnapshotItem } from './types';
4
4
  import type { RulesParamsHooks } from '../Rules/types';
5
5
  import type { MapOrderPaymentsOptions, OrderPaymentData, OrderPaymentSource } from './types';
6
6
  import { createUuidV4 } from './utils/orderCollectionIdentity';
@@ -18,6 +18,8 @@ export interface OrderProductsDepositSummary {
18
18
  import type { WindowPlugin } from '../../plugins';
19
19
  export declare function normalizePointCardSnapshotItem(value: unknown): PointCardSnapshotItem | null;
20
20
  export declare function buildPointCardSnapshotFromWalletPassList(value: unknown): PointCardSnapshotItem[];
21
+ export declare function normalizeVirtualCurrencySnapshotItem(value: unknown): VirtualCurrencySnapshotItem | null;
22
+ export declare function buildVirtualCurrencySnapshotFromList(value: unknown): VirtualCurrencySnapshotItem[];
21
23
  export declare function normalizeOrderMetaList(value: unknown): OrderMetaList | undefined;
22
24
  /**
23
25
  * 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
@@ -9,14 +9,18 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
9
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
10
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
11
11
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12
+ 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; } } }; }
12
13
  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; }
13
14
  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; }
14
15
  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; }
15
16
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
16
17
  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); }
17
- 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; } } }; }
18
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
19
+ 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."); }
18
20
  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); }
19
21
  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; }
22
+ 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; } }
23
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
24
  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); }
21
25
  import dayjs from "dayjs";
22
26
  import Decimal from 'decimal.js';
@@ -25,6 +29,7 @@ import { buildProductLineFingerprint, createEmptySummary } from "../../solution/
25
29
  import { createUuidV4 } from "./utils/orderCollectionIdentity";
26
30
  import { encodeSalesNotes } from "./salesNotes";
27
31
  var POINT_CARD_SNAPSHOT_TAG = 'point_card';
32
+ var VIRTUAL_CURRENCY_SNAPSHOT_TAG = 'virtual_currency';
28
33
  function isPlainObject(value) {
29
34
  return Boolean(value) && _typeof(value) === 'object' && !Array.isArray(value);
30
35
  }
@@ -63,6 +68,106 @@ export function buildPointCardSnapshotFromWalletPassList(value) {
63
68
  return result;
64
69
  }, []);
65
70
  }
71
+ function normalizeSnapshotNameMap(value) {
72
+ if (typeof value === 'string' || typeof value === 'number') {
73
+ var normalizedText = String(value).trim();
74
+ return normalizedText ? {
75
+ original: normalizedText
76
+ } : {};
77
+ }
78
+ if (!isPlainObject(value)) return {};
79
+ return Object.entries(value).reduce(function (result, _ref) {
80
+ var _ref2 = _slicedToArray(_ref, 2),
81
+ locale = _ref2[0],
82
+ text = _ref2[1];
83
+ if (!locale.trim()) return result;
84
+ if (typeof text !== 'string' && typeof text !== 'number') return result;
85
+ var normalizedText = String(text).trim();
86
+ if (normalizedText) result[locale] = normalizedText;
87
+ return result;
88
+ }, {});
89
+ }
90
+ function buildVirtualCurrencySnapshotName(value) {
91
+ var _value$amount_format;
92
+ if (!isPlainObject(value)) return {};
93
+ var amountFormat = String((_value$amount_format = value.amount_format) !== null && _value$amount_format !== void 0 ? _value$amount_format : '').trim();
94
+ var configuredName;
95
+ if (amountFormat === '{{amount}} {{unit}}') {
96
+ configuredName = value.unit_label;
97
+ } else if (amountFormat === '{{amount}} {{sym}}') {
98
+ configuredName = value.symbol;
99
+ } else {
100
+ return {};
101
+ }
102
+ var configuredNameMap = normalizeSnapshotNameMap(configuredName);
103
+ var shortNameMap = normalizeSnapshotNameMap(value.short_name);
104
+
105
+ // The configured unit/symbol is resolved before short_name. If it already
106
+ // carries a global fallback, keep it authoritative so (for example)
107
+ // short_name.en cannot mask unit_label.original. When it only has explicit
108
+ // locale entries, merge short_name so other receipt locales can still fall
109
+ // back after the configured value has no match.
110
+ var hasConfiguredGlobalFallback = ['original', 'auto', 'default', 'en'].some(function (locale) {
111
+ return Boolean(configuredNameMap[locale]);
112
+ });
113
+ if (hasConfiguredGlobalFallback) return configuredNameMap;
114
+ return _objectSpread(_objectSpread({}, shortNameMap), configuredNameMap);
115
+ }
116
+ export function normalizeVirtualCurrencySnapshotItem(value) {
117
+ var _value$product_name2, _value$par_value2, _value$used_par_value2;
118
+ if (!isPlainObject(value)) return null;
119
+ var id = normalizeSnapshotScalar(value.id);
120
+ if (id === undefined) return null;
121
+ if (String(value.tag || '').trim().toLowerCase() !== VIRTUAL_CURRENCY_SNAPSHOT_TAG) {
122
+ return null;
123
+ }
124
+ var snapshot = {
125
+ id: id,
126
+ tag: 'virtual_currency',
127
+ product_name: String((_value$product_name2 = value.product_name) !== null && _value$product_name2 !== void 0 ? _value$product_name2 : ''),
128
+ par_value: String((_value$par_value2 = value.par_value) !== null && _value$par_value2 !== void 0 ? _value$par_value2 : ''),
129
+ used_par_value: String((_value$used_par_value2 = value.used_par_value) !== null && _value$used_par_value2 !== void 0 ? _value$used_par_value2 : ''),
130
+ name: normalizeSnapshotNameMap(value.name)
131
+ };
132
+ var productId = normalizeSnapshotScalar(value.product_id);
133
+ if (productId !== undefined) {
134
+ snapshot.product_id = productId;
135
+ }
136
+ return snapshot;
137
+ }
138
+ function normalizeVirtualCurrencySnapshotList(value) {
139
+ if (!Array.isArray(value)) return [];
140
+ return value.reduce(function (result, item) {
141
+ var normalized = normalizeVirtualCurrencySnapshotItem(item);
142
+ if (normalized) result.push(normalized);
143
+ return result;
144
+ }, []);
145
+ }
146
+ export function buildVirtualCurrencySnapshotFromList(value) {
147
+ if (!Array.isArray(value)) return [];
148
+ return value.reduce(function (result, item) {
149
+ var _item$tag, _item$product_name, _item$par_value, _item$used_par_value;
150
+ if (!isPlainObject(item)) return result;
151
+ var id = normalizeSnapshotScalar(item.id);
152
+ if (id === undefined) return result;
153
+ var sourceTag = String((_item$tag = item.tag) !== null && _item$tag !== void 0 ? _item$tag : '').trim().toLowerCase();
154
+ if (sourceTag !== VIRTUAL_CURRENCY_SNAPSHOT_TAG) return result;
155
+ var snapshot = {
156
+ id: id,
157
+ tag: 'virtual_currency',
158
+ product_name: String((_item$product_name = item.product_name) !== null && _item$product_name !== void 0 ? _item$product_name : ''),
159
+ par_value: String((_item$par_value = item.par_value) !== null && _item$par_value !== void 0 ? _item$par_value : ''),
160
+ used_par_value: String((_item$used_par_value = item.used_par_value) !== null && _item$used_par_value !== void 0 ? _item$used_par_value : ''),
161
+ name: buildVirtualCurrencySnapshotName(item.virtual_currency_display)
162
+ };
163
+ var productId = normalizeSnapshotScalar(item.product_id);
164
+ if (productId !== undefined) {
165
+ snapshot.product_id = productId;
166
+ }
167
+ result.push(snapshot);
168
+ return result;
169
+ }, []);
170
+ }
66
171
  export function normalizeOrderMetaList(value) {
67
172
  if (value === undefined) return undefined;
68
173
  if (!isPlainObject(value)) return undefined;
@@ -70,6 +175,9 @@ export function normalizeOrderMetaList(value) {
70
175
  if (Object.prototype.hasOwnProperty.call(value, 'point_cards_snapshot')) {
71
176
  normalized.point_cards_snapshot = buildPointCardSnapshotFromWalletPassList(value.point_cards_snapshot);
72
177
  }
178
+ if (Object.prototype.hasOwnProperty.call(value, 'virtual_currency_snapshot')) {
179
+ normalized.virtual_currency_snapshot = normalizeVirtualCurrencySnapshotList(value.virtual_currency_snapshot);
180
+ }
73
181
  if (Object.keys(normalized).length > 0) return normalized;
74
182
  return {};
75
183
  }
@@ -97,13 +205,13 @@ export function composeLinePrice(params) {
97
205
  _step;
98
206
  try {
99
207
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
100
- var _ref, _item$num;
208
+ var _ref3, _item$num;
101
209
  var item = _step.value;
102
210
  // markdown(减价)按带符号净额取减;markup/原价维持相加。
103
211
  var signedUnit = getBundleSignedUnit(item, {
104
212
  useOriginal: useOriginalBundle
105
213
  });
106
- var rawNum = (_ref = (_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : item === null || item === void 0 ? void 0 : item.quantity) !== null && _ref !== void 0 ? _ref : 1;
214
+ var rawNum = (_ref3 = (_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : item === null || item === void 0 ? void 0 : item.quantity) !== null && _ref3 !== void 0 ? _ref3 : 1;
107
215
  var num = new Decimal(Number(rawNum) || 0);
108
216
  total = total.plus(signedUnit.times(num));
109
217
  }
@@ -167,12 +275,12 @@ function getSafeOrderProductNum(num) {
167
275
  return Math.floor(parsedNum);
168
276
  }
169
277
  function getOrderProductDepositUnitTotal(product) {
170
- var _ref2;
278
+ var _ref4;
171
279
  var metadata = product.metadata || {};
172
280
  var paymentPrice = metadata.main_product_attached_bundle_payment_price;
173
281
  var mainSellingPrice = metadata.main_product_selling_price;
174
282
  var fallbackPrice = product.selling_price;
175
- return new Decimal(Number((_ref2 = paymentPrice !== null && paymentPrice !== void 0 ? paymentPrice : mainSellingPrice) !== null && _ref2 !== void 0 ? _ref2 : fallbackPrice) || 0);
283
+ return new Decimal(Number((_ref4 = paymentPrice !== null && paymentPrice !== void 0 ? paymentPrice : mainSellingPrice) !== null && _ref4 !== void 0 ? _ref4 : fallbackPrice) || 0);
176
284
  }
177
285
  function normalizeDepositProtocols(protocols) {
178
286
  if (!Array.isArray(protocols)) return [];
@@ -221,13 +329,13 @@ function handleOrderProductDeposit(params) {
221
329
  };
222
330
  }
223
331
  function resolveOrderProductDepositSource(product, runtimeOrigin) {
224
- var _ref3, _record$custom_deposi, _ref4, _record$variant;
332
+ var _ref5, _record$custom_deposi, _ref6, _record$variant;
225
333
  var record = product;
226
334
  var origin = record._origin || runtimeOrigin || {};
227
335
  var originProduct = origin.product || {};
228
336
  return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, originProduct), origin), record), {}, {
229
- custom_deposit_data: (_ref3 = (_record$custom_deposi = record.custom_deposit_data) !== null && _record$custom_deposi !== void 0 ? _record$custom_deposi : origin.custom_deposit_data) !== null && _ref3 !== void 0 ? _ref3 : originProduct.custom_deposit_data,
230
- variant: (_ref4 = (_record$variant = record.variant) !== null && _record$variant !== void 0 ? _record$variant : origin.variant) !== null && _ref4 !== void 0 ? _ref4 : originProduct.variant
337
+ custom_deposit_data: (_ref5 = (_record$custom_deposi = record.custom_deposit_data) !== null && _record$custom_deposi !== void 0 ? _record$custom_deposi : origin.custom_deposit_data) !== null && _ref5 !== void 0 ? _ref5 : originProduct.custom_deposit_data,
338
+ variant: (_ref6 = (_record$variant = record.variant) !== null && _record$variant !== void 0 ? _record$variant : origin.variant) !== null && _ref6 !== void 0 ? _ref6 : originProduct.variant
231
339
  });
232
340
  }
233
341
  function getOrderProductDeposit(product, runtimeOrigin) {
@@ -379,12 +487,12 @@ export function isMarkdownBundle(bundle) {
379
487
  * - markup(加价)/原价子商品:维持 `+(bundle_selling_price ?? price)`,行为不变。
380
488
  */
381
489
  export function getBundleSignedUnit(bundle, options) {
382
- var _options$useOriginal, _ref11, _bundle$original_pric2, _bundle$bundle_sellin;
490
+ var _options$useOriginal, _ref13, _bundle$original_pric2, _bundle$bundle_sellin;
383
491
  if (!bundle || _typeof(bundle) !== 'object') return new Decimal(0);
384
492
  var useOriginal = (_options$useOriginal = options === null || options === void 0 ? void 0 : options.useOriginal) !== null && _options$useOriginal !== void 0 ? _options$useOriginal : false;
385
493
  if (isMarkdownBundle(bundle)) {
386
- var _ref5, _ref6, _ref7, _bundle$original_pric, _ref8, _ref9, _ref10, _bundle$custom_price;
387
- var catalog = useOriginal ? (_ref5 = (_ref6 = (_ref7 = (_bundle$original_pric = bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle.product_price) !== null && _ref7 !== void 0 ? _ref7 : bundle.custom_price) !== null && _ref6 !== void 0 ? _ref6 : bundle.base_price) !== null && _ref5 !== void 0 ? _ref5 : bundle.price : (_ref8 = (_ref9 = (_ref10 = (_bundle$custom_price = bundle.custom_price) !== null && _bundle$custom_price !== void 0 ? _bundle$custom_price : bundle.product_price) !== null && _ref10 !== void 0 ? _ref10 : bundle.original_price) !== null && _ref9 !== void 0 ? _ref9 : bundle.base_price) !== null && _ref8 !== void 0 ? _ref8 : bundle.price;
494
+ var _ref7, _ref8, _ref9, _bundle$original_pric, _ref10, _ref11, _ref12, _bundle$custom_price;
495
+ var catalog = useOriginal ? (_ref7 = (_ref8 = (_ref9 = (_bundle$original_pric = bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle.product_price) !== null && _ref9 !== void 0 ? _ref9 : bundle.custom_price) !== null && _ref8 !== void 0 ? _ref8 : bundle.base_price) !== null && _ref7 !== void 0 ? _ref7 : bundle.price : (_ref10 = (_ref11 = (_ref12 = (_bundle$custom_price = bundle.custom_price) !== null && _bundle$custom_price !== void 0 ? _bundle$custom_price : bundle.product_price) !== null && _ref12 !== void 0 ? _ref12 : bundle.original_price) !== null && _ref11 !== void 0 ? _ref11 : bundle.base_price) !== null && _ref10 !== void 0 ? _ref10 : bundle.price;
388
496
  if (catalog !== undefined && catalog !== null && catalog !== '') {
389
497
  var raw = new Decimal(Number(catalog) || 0);
390
498
  // 负值表示价格已是「带符号净额」(如 cart/changePrice 产出的 -3.7),直接取用不再扣 option,
@@ -395,7 +503,7 @@ export function getBundleSignedUnit(bundle, options) {
395
503
  // 仅剩净额(无毛价)兜底:直接取负,不再扣 option
396
504
  return new Decimal(Number(bundle.bundle_selling_price) || 0).abs().negated();
397
505
  }
398
- var rawPrice = useOriginal ? (_ref11 = (_bundle$original_pric2 = bundle.original_price) !== null && _bundle$original_pric2 !== void 0 ? _bundle$original_pric2 : bundle.product_price) !== null && _ref11 !== void 0 ? _ref11 : bundle.price : (_bundle$bundle_sellin = bundle.bundle_selling_price) !== null && _bundle$bundle_sellin !== void 0 ? _bundle$bundle_sellin : bundle.price;
506
+ var rawPrice = useOriginal ? (_ref13 = (_bundle$original_pric2 = bundle.original_price) !== null && _bundle$original_pric2 !== void 0 ? _bundle$original_pric2 : bundle.product_price) !== null && _ref13 !== void 0 ? _ref13 : bundle.price : (_bundle$bundle_sellin = bundle.bundle_selling_price) !== null && _bundle$bundle_sellin !== void 0 ? _bundle$bundle_sellin : bundle.price;
399
507
  return new Decimal(Number(rawPrice) || 0);
400
508
  }
401
509
 
@@ -613,8 +721,8 @@ export function createDefaultOrderRulesHooks() {
613
721
  return new Decimal(Number(totalLike) || 0).dividedBy(effectiveNum).toDecimalPlaces(2).toString();
614
722
  };
615
723
  var getBundleIdentity = function getBundleIdentity(bundle) {
616
- var _ref12, _bundle$bundle_id, _ref13, _ref14, _bundle$bundle_produc, _ref15, _ref16, _bundle$bundle_varian, _ref17, _bundle$bundle_group_;
617
- return [(_ref12 = (_bundle$bundle_id = bundle.bundle_id) !== null && _bundle$bundle_id !== void 0 ? _bundle$bundle_id : bundle.id) !== null && _ref12 !== void 0 ? _ref12 : '', (_ref13 = (_ref14 = (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id) !== null && _ref14 !== void 0 ? _ref14 : bundle.product_id) !== null && _ref13 !== void 0 ? _ref13 : '', (_ref15 = (_ref16 = (_bundle$bundle_varian = bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle.variant_id) !== null && _ref16 !== void 0 ? _ref16 : bundle.product_variant_id) !== null && _ref15 !== void 0 ? _ref15 : 0, (_ref17 = (_bundle$bundle_group_ = bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle.group_id) !== null && _ref17 !== void 0 ? _ref17 : ''].join('|');
724
+ var _ref14, _bundle$bundle_id, _ref15, _ref16, _bundle$bundle_produc, _ref17, _ref18, _bundle$bundle_varian, _ref19, _bundle$bundle_group_;
725
+ return [(_ref14 = (_bundle$bundle_id = bundle.bundle_id) !== null && _bundle$bundle_id !== void 0 ? _bundle$bundle_id : bundle.id) !== null && _ref14 !== void 0 ? _ref14 : '', (_ref15 = (_ref16 = (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id) !== null && _ref16 !== void 0 ? _ref16 : bundle.product_id) !== null && _ref15 !== void 0 ? _ref15 : '', (_ref17 = (_ref18 = (_bundle$bundle_varian = bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle.variant_id) !== null && _ref18 !== void 0 ? _ref18 : bundle.product_variant_id) !== null && _ref17 !== void 0 ? _ref17 : 0, (_ref19 = (_bundle$bundle_group_ = bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle.group_id) !== null && _ref19 !== void 0 ? _ref19 : ''].join('|');
618
726
  };
619
727
  var mergeRulesBundlePrices = function mergeRulesBundlePrices(currentBundle, rulesBundle) {
620
728
  if (!Array.isArray(rulesBundle)) return rulesBundle;
@@ -624,7 +732,7 @@ export function createDefaultOrderRulesHooks() {
624
732
  currentByIdentity.set(getBundleIdentity(bundle), bundle);
625
733
  });
626
734
  return rulesBundle.map(function (bundle) {
627
- var _bundle$price_type_ex2, _ref18, _ref19, _current$price, _ref20, _ref21, _ref22, _current$original_pri;
735
+ var _bundle$price_type_ex2, _ref20, _ref21, _current$price, _ref22, _ref23, _ref24, _current$original_pri;
628
736
  if (!bundle || _typeof(bundle) !== 'object') return bundle;
629
737
  var current = currentByIdentity.get(getBundleIdentity(bundle));
630
738
  if (!current) return bundle;
@@ -633,8 +741,8 @@ export function createDefaultOrderRulesHooks() {
633
741
  } : {});
634
742
  var isProductPriceBundle = ((_bundle$price_type_ex2 = bundle.price_type_ext) !== null && _bundle$price_type_ex2 !== void 0 ? _bundle$price_type_ex2 : current.price_type_ext) === 'product_price';
635
743
  if (!isProductPriceBundle) return bundleWithDisplayFields;
636
- var sourcePrice = (_ref18 = (_ref19 = (_current$price = current.price) !== null && _current$price !== void 0 ? _current$price : current.custom_price) !== null && _ref19 !== void 0 ? _ref19 : current.original_price) !== null && _ref18 !== void 0 ? _ref18 : current.bundle_selling_price;
637
- var originalPrice = (_ref20 = (_ref21 = (_ref22 = (_current$original_pri = current.original_price) !== null && _current$original_pri !== void 0 ? _current$original_pri : current.product_price) !== null && _ref22 !== void 0 ? _ref22 : current.price) !== null && _ref21 !== void 0 ? _ref21 : current.custom_price) !== null && _ref20 !== void 0 ? _ref20 : sourcePrice;
744
+ var sourcePrice = (_ref20 = (_ref21 = (_current$price = current.price) !== null && _current$price !== void 0 ? _current$price : current.custom_price) !== null && _ref21 !== void 0 ? _ref21 : current.original_price) !== null && _ref20 !== void 0 ? _ref20 : current.bundle_selling_price;
745
+ var originalPrice = (_ref22 = (_ref23 = (_ref24 = (_current$original_pri = current.original_price) !== null && _current$original_pri !== void 0 ? _current$original_pri : current.product_price) !== null && _ref24 !== void 0 ? _ref24 : current.price) !== null && _ref23 !== void 0 ? _ref23 : current.custom_price) !== null && _ref22 !== void 0 ? _ref22 : sourcePrice;
638
746
  return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, bundleWithDisplayFields), sourcePrice !== undefined ? {
639
747
  price: sourcePrice
640
748
  } : {}), originalPrice !== undefined ? {
@@ -698,10 +806,10 @@ export function createDefaultOrderRulesHooks() {
698
806
  };
699
807
  },
700
808
  setProduct: function setProduct(product, values) {
701
- var _ref23, _values$quantity, _ref24, _metadataAny$source_p, _values$discount_list, _values$quantity2;
702
- var nextNum = Number((_ref23 = (_values$quantity = values.quantity) !== null && _values$quantity !== void 0 ? _values$quantity : product.num) !== null && _ref23 !== void 0 ? _ref23 : 1) || 1;
809
+ var _ref25, _values$quantity, _ref26, _metadataAny$source_p, _values$discount_list, _values$quantity2;
810
+ var nextNum = Number((_ref25 = (_values$quantity = values.quantity) !== null && _values$quantity !== void 0 ? _values$quantity : product.num) !== null && _ref25 !== void 0 ? _ref25 : 1) || 1;
703
811
  var metadataAny = product.metadata || {};
704
- var existedSource = (_ref24 = (_metadataAny$source_p = metadataAny.source_product_price) !== null && _metadataAny$source_p !== void 0 ? _metadataAny$source_p : product.selling_price) !== null && _ref24 !== void 0 ? _ref24 : '0';
812
+ var existedSource = (_ref26 = (_metadataAny$source_p = metadataAny.source_product_price) !== null && _metadataAny$source_p !== void 0 ? _metadataAny$source_p : product.selling_price) !== null && _ref26 !== void 0 ? _ref26 : '0';
705
813
  var nextOptions = getProductSkuOptions(product);
706
814
  var optionSum = sumOptionUnitPrice(nextOptions);
707
815
 
@@ -912,7 +1020,7 @@ function formatSubmitBundleItems(bundle) {
912
1020
  var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
913
1021
  if (!Array.isArray(bundle)) return [];
914
1022
  return bundle.map(function (b) {
915
- var _ref25, _rawBundle$price, _rawBundle$surcharge_, _rawBundle$num, _rawBundle$is_charge_, _rawBundle$bundle_var, _rawBundle$quantity, _rawBundle$extension_, _rawBundle$extension_2, _ref26, _rawBundle$price_type, _ref27, _rawBundle$price_type2, _rawBundle$bundle_gro, _rawBundle$bundle_id, _rawBundle$bundle_pro;
1023
+ var _ref27, _rawBundle$price, _rawBundle$surcharge_, _rawBundle$num, _rawBundle$is_charge_, _rawBundle$bundle_var, _rawBundle$quantity, _rawBundle$extension_, _rawBundle$extension_2, _ref28, _rawBundle$price_type, _ref29, _rawBundle$price_type2, _rawBundle$bundle_gro, _rawBundle$bundle_id, _rawBundle$bundle_pro;
916
1024
  var rawBundle = b && _typeof(b) === 'object' ? b : {};
917
1025
  var existedMetadata = rawBundle.metadata && _typeof(rawBundle.metadata) === 'object' ? rawBundle.metadata : {};
918
1026
  var _customProductBundleMapId = existedMetadata.custom_product_bundle_map_id,
@@ -923,7 +1031,7 @@ function formatSubmitBundleItems(bundle) {
923
1031
  var sellingPrice = formatOptions.virtualSettlementMode ? '0.00' : getBundleSellingMagnitude(rawBundle).toFixed(2);
924
1032
  // payment 价由整单折扣均摊层产出;缺省(无折扣)时与 selling 净额同义。
925
1033
  var paymentPrice = formatOptions.virtualSettlementMode ? '0.00' : rawBundle.bundle_payment_price !== undefined && rawBundle.bundle_payment_price !== null && rawBundle.bundle_payment_price !== '' ? toMoneyString(rawBundle.bundle_payment_price) : sellingPrice;
926
- var priceValue = formatOptions.virtualSettlementMode ? 0 : (_ref25 = (_rawBundle$price = rawBundle.price) !== null && _rawBundle$price !== void 0 ? _rawBundle$price : rawBundle.custom_price) !== null && _ref25 !== void 0 ? _ref25 : rawBundle.bundle_selling_price;
1034
+ var priceValue = formatOptions.virtualSettlementMode ? 0 : (_ref27 = (_rawBundle$price = rawBundle.price) !== null && _rawBundle$price !== void 0 ? _rawBundle$price : rawBundle.custom_price) !== null && _ref27 !== void 0 ? _ref27 : rawBundle.bundle_selling_price;
927
1035
  var relationSurchargeIds = Array.isArray(rawBundle.relation_surcharge_ids) ? rawBundle.relation_surcharge_ids : Array.isArray(existedMetadata.relation_surcharge_ids) ? existedMetadata.relation_surcharge_ids : [];
928
1036
  var surchargeFee = toMoneyString((_rawBundle$surcharge_ = rawBundle.surcharge_fee) !== null && _rawBundle$surcharge_ !== void 0 ? _rawBundle$surcharge_ : existedMetadata.surcharge_fee);
929
1037
  var productDiscountDifference = toBundleNumber(existedMetadata.product_discount_difference, 0);
@@ -942,8 +1050,8 @@ function formatSubmitBundleItems(bundle) {
942
1050
  extension_id: (_rawBundle$extension_ = rawBundle.extension_id) !== null && _rawBundle$extension_ !== void 0 ? _rawBundle$extension_ : 0,
943
1051
  extension_type: (_rawBundle$extension_2 = rawBundle.extension_type) !== null && _rawBundle$extension_2 !== void 0 ? _rawBundle$extension_2 : 'normal',
944
1052
  price: priceValue,
945
- price_type: (_ref26 = (_rawBundle$price_type = rawBundle.price_type) !== null && _rawBundle$price_type !== void 0 ? _rawBundle$price_type : rawBundle.custom_price_type) !== null && _ref26 !== void 0 ? _ref26 : '',
946
- price_type_ext: (_ref27 = (_rawBundle$price_type2 = rawBundle.price_type_ext) !== null && _rawBundle$price_type2 !== void 0 ? _rawBundle$price_type2 : rawBundle.custom_price_type_ext) !== null && _ref27 !== void 0 ? _ref27 : '',
1053
+ price_type: (_ref28 = (_rawBundle$price_type = rawBundle.price_type) !== null && _rawBundle$price_type !== void 0 ? _rawBundle$price_type : rawBundle.custom_price_type) !== null && _ref28 !== void 0 ? _ref28 : '',
1054
+ price_type_ext: (_ref29 = (_rawBundle$price_type2 = rawBundle.price_type_ext) !== null && _rawBundle$price_type2 !== void 0 ? _rawBundle$price_type2 : rawBundle.custom_price_type_ext) !== null && _ref29 !== void 0 ? _ref29 : '',
947
1055
  bundle_selling_price: sellingPrice,
948
1056
  bundle_payment_price: paymentPrice,
949
1057
  option: formatSubmitOptionItems(rawBundle.option, formatOptions),
@@ -979,11 +1087,11 @@ function formatSubmitBundleItems(bundle) {
979
1087
  * 法币仅做字段/metadata 裁剪;虚拟币在出站前再次执行零加价与固定单价断言。
980
1088
  */
981
1089
  function normalizeSubmitProduct(product) {
982
- var _ref29, _submitProduct$bundle, _rawMetadata$product_, _rawMetadata$selected, _rawMetadata$selected2, _submitProduct$produc, _submitProduct$paymen;
1090
+ var _ref31, _submitProduct$bundle, _rawMetadata$product_, _rawMetadata$selected, _rawMetadata$selected2, _submitProduct$produc, _submitProduct$paymen;
983
1091
  var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
984
- var _ref28 = product,
985
- _runtimeUid = _ref28.unique_identification_number,
986
- submitProduct = _objectWithoutProperties(_ref28, _excluded2);
1092
+ var _ref30 = product,
1093
+ _runtimeUid = _ref30.unique_identification_number,
1094
+ submitProduct = _objectWithoutProperties(_ref30, _excluded2);
987
1095
  var num = submitProduct.num,
988
1096
  _productSurchargeFee = submitProduct.surcharge_fee,
989
1097
  _deprecatedDiscountAmount = submitProduct.discount_amount,
@@ -1000,7 +1108,7 @@ function normalizeSubmitProduct(product) {
1000
1108
  // 兼容历史 BigSale 编辑链路:bundle_edit 曾被写入 metadata,
1001
1109
  // 出站时需提升到商品顶层;套餐未编辑时也必须显式提交 0。
1002
1110
  var hasProductBundle = Array.isArray(submitProduct.product_bundle) && submitProduct.product_bundle.length > 0;
1003
- var bundleEdit = (_ref29 = (_submitProduct$bundle = submitProduct.bundle_edit) !== null && _submitProduct$bundle !== void 0 ? _submitProduct$bundle : rawMetadata.bundle_edit) !== null && _ref29 !== void 0 ? _ref29 : hasProductBundle ? 0 : undefined;
1111
+ var bundleEdit = (_ref31 = (_submitProduct$bundle = submitProduct.bundle_edit) !== null && _submitProduct$bundle !== void 0 ? _submitProduct$bundle : rawMetadata.bundle_edit) !== null && _ref31 !== void 0 ? _ref31 : hasProductBundle ? 0 : undefined;
1004
1112
  var cleanMetadata = {};
1005
1113
  if (rawMetadata.unique_identification_number) {
1006
1114
  cleanMetadata.unique_identification_number = rawMetadata.unique_identification_number;
@@ -1231,7 +1339,7 @@ export function resolveSubmitOrderType(params) {
1231
1339
  return 'virtual';
1232
1340
  }
1233
1341
  export function buildSubmitPayload(params) {
1234
- var _tempOrder$metadata2, _tempOrder$customer_i, _tempOrder$country_ca, _tempOrder$phone, _tempOrder$email, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref31, _tempOrder$is_price_i, _tempOrder$is_deposit, _tempOrder$_extend, _enhancedPayload$summ;
1342
+ var _tempOrder$metadata2, _tempOrder$customer_i, _tempOrder$country_ca, _tempOrder$phone, _tempOrder$email, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref33, _tempOrder$is_price_i, _tempOrder$is_deposit, _tempOrder$_extend, _enhancedPayload$summ;
1235
1343
  var tempOrder = params.tempOrder,
1236
1344
  cacheId = params.cacheId,
1237
1345
  _params$now = params.now,
@@ -1245,29 +1353,29 @@ export function buildSubmitPayload(params) {
1245
1353
  var scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
1246
1354
  var bookingUuid = createUuidV4();
1247
1355
  var virtualSettlementMode = ((_tempOrder$metadata2 = tempOrder.metadata) === null || _tempOrder$metadata2 === void 0 || (_tempOrder$metadata2 = _tempOrder$metadata2.currency_settlement_config) === null || _tempOrder$metadata2 === void 0 ? void 0 : _tempOrder$metadata2.settlement_type) === 'virtual_currency';
1248
- var _ref30 = tempOrder,
1249
- _extend = _ref30._extend,
1250
- _relationId = _ref30.relation_id,
1251
- _tableFormId = _ref30.table_form_id,
1252
- _resourceId = _ref30.resource_id,
1253
- _summary = _ref30.summary,
1254
- _lastOrderInfo = _ref30.lastOrderInfo,
1255
- _paidAmount = _ref30.paid_amount,
1256
- _shopId = _ref30.shop_id,
1257
- _shopNote = _ref30.shop_note,
1258
- _shopServiceType = _ref30.shop_service_type,
1259
- _startTime = _ref30.start_time,
1260
- _customer = _ref30.customer,
1261
- _discountList = _ref30.discount_list,
1262
- _orderMetaList = _ref30.order_meta_list,
1263
- _rootTaxFee = _ref30.tax_fee,
1264
- _totalAmount = _ref30.total_amount,
1265
- _totalRefundAmount = _ref30.total_refund_amount,
1266
- _createDate = _ref30.create_date,
1267
- _holderId = _ref30.holder_id,
1268
- _paymentStatus = _ref30.payment_status,
1269
- _notes = _ref30.notes,
1270
- tempOrderRest = _objectWithoutProperties(_ref30, _excluded4);
1356
+ var _ref32 = tempOrder,
1357
+ _extend = _ref32._extend,
1358
+ _relationId = _ref32.relation_id,
1359
+ _tableFormId = _ref32.table_form_id,
1360
+ _resourceId = _ref32.resource_id,
1361
+ _summary = _ref32.summary,
1362
+ _lastOrderInfo = _ref32.lastOrderInfo,
1363
+ _paidAmount = _ref32.paid_amount,
1364
+ _shopId = _ref32.shop_id,
1365
+ _shopNote = _ref32.shop_note,
1366
+ _shopServiceType = _ref32.shop_service_type,
1367
+ _startTime = _ref32.start_time,
1368
+ _customer = _ref32.customer,
1369
+ _discountList = _ref32.discount_list,
1370
+ _orderMetaList = _ref32.order_meta_list,
1371
+ _rootTaxFee = _ref32.tax_fee,
1372
+ _totalAmount = _ref32.total_amount,
1373
+ _totalRefundAmount = _ref32.total_refund_amount,
1374
+ _createDate = _ref32.create_date,
1375
+ _holderId = _ref32.holder_id,
1376
+ _paymentStatus = _ref32.payment_status,
1377
+ _notes = _ref32.notes,
1378
+ tempOrderRest = _objectWithoutProperties(_ref32, _excluded4);
1271
1379
  var resolvedBusinessCode = businessCode !== null && businessCode !== void 0 ? businessCode : tempOrder.business_code;
1272
1380
  var normalizedOrderMetaList = normalizeOrderMetaList(tempOrder.order_meta_list);
1273
1381
  var submitType = resolveSubmitOrderType({
@@ -1292,7 +1400,7 @@ export function buildSubmitPayload(params) {
1292
1400
  type: submitType,
1293
1401
  business_code: resolvedBusinessCode,
1294
1402
  sales_channel: tempOrder.sales_channel || 'my_pisel',
1295
- order_sales_channel: (_ref31 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref31 !== void 0 ? _ref31 : 'online_store',
1403
+ order_sales_channel: (_ref33 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref33 !== void 0 ? _ref33 : 'online_store',
1296
1404
  status: tempOrder.status || 'normal'
1297
1405
  }, params.includePaymentStatus !== false ? {
1298
1406
  payment_status: tempOrder.payment_status || 'payment_processing'
@@ -1320,13 +1428,13 @@ export function buildSubmitPayload(params) {
1320
1428
  // holder: tempOrder.holder || null,
1321
1429
  summary: summary || tempOrder.summary || createEmptySummary(),
1322
1430
  metadata: function () {
1323
- var _ref32 = tempOrder.metadata || {},
1324
- _collectPax = _ref32.collect_pax,
1325
- _tableOccupancyDuration = _ref32.table_occupancy_duration,
1326
- _cartSettlementKey = _ref32.cart_settlement_key,
1327
- _cartSettlementSnapshot = _ref32.cart_settlement_snapshot,
1328
- _legalCurrencySnapshot = _ref32.legal_currency_snapshot,
1329
- rest = _objectWithoutProperties(_ref32, _excluded5);
1431
+ var _ref34 = tempOrder.metadata || {},
1432
+ _collectPax = _ref34.collect_pax,
1433
+ _tableOccupancyDuration = _ref34.table_occupancy_duration,
1434
+ _cartSettlementKey = _ref34.cart_settlement_key,
1435
+ _cartSettlementSnapshot = _ref34.cart_settlement_snapshot,
1436
+ _legalCurrencySnapshot = _ref34.legal_currency_snapshot,
1437
+ rest = _objectWithoutProperties(_ref34, _excluded5);
1330
1438
  return _objectSpread({}, rest);
1331
1439
  }()
1332
1440
  }, (_tempOrder$_extend = tempOrder._extend) !== null && _tempOrder$_extend !== void 0 && (_tempOrder$_extend = _tempOrder$_extend.salesNotesState) !== null && _tempOrder$_extend !== void 0 && _tempOrder$_extend.dirty ? {
@@ -1543,8 +1651,8 @@ export function getRuntimeProductOrigin(tempOrder, product) {
1543
1651
  return tempOrder._extend.productsByUid[uid].origin;
1544
1652
  }
1545
1653
  var matchedProduct = ((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || []).find(function (item) {
1546
- var _ref33, _item$product_id, _ref34, _product$product_id;
1547
- return item === product || getOrderProductLineUid(item) === uid || String((_ref33 = (_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : item === null || item === void 0 ? void 0 : item.id) !== null && _ref33 !== void 0 ? _ref33 : '') === String((_ref34 = (_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product === null || product === void 0 ? void 0 : product.id) !== null && _ref34 !== void 0 ? _ref34 : '');
1654
+ var _ref35, _item$product_id, _ref36, _product$product_id;
1655
+ return item === product || getOrderProductLineUid(item) === uid || String((_ref35 = (_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : item === null || item === void 0 ? void 0 : item.id) !== null && _ref35 !== void 0 ? _ref35 : '') === String((_ref36 = (_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product === null || product === void 0 ? void 0 : product.id) !== null && _ref36 !== void 0 ? _ref36 : '');
1548
1656
  });
1549
1657
  var matchedUid = matchedProduct ? getOrderProductLineUid(matchedProduct) : '';
1550
1658
  return matchedUid ? (tempOrder === null || tempOrder === void 0 || (_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.productsByUid) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4[matchedUid]) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.origin) || null : null;
@@ -3249,6 +3249,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3249
3249
  mergedRecord[_field] = cloneDeep(incomingRecord[_field]);
3250
3250
  }
3251
3251
 
3252
+ // order_meta_list 是一次性生成的完整业务快照。incoming 明确携带时
3253
+ // 必须整体覆盖(包括 null / 空对象 / 空数组);省略时才保留 existing。
3254
+ if (Object.prototype.hasOwnProperty.call(incomingRecord, 'order_meta_list')) {
3255
+ mergedRecord.order_meta_list = cloneDeep(incomingRecord.order_meta_list);
3256
+ }
3257
+
3252
3258
  // 子项数组遵循完整快照语义:incoming 自有且为数组(包括 [])时权威替换;
3253
3259
  // 字段缺席或不是数组时视为稀疏 patch,继续保留 existing。
3254
3260
  for (var _i6 = 0, _ORDER_AUTHORITATIVE_2 = ORDER_AUTHORITATIVE_COLLECTION_FIELDS; _i6 < _ORDER_AUTHORITATIVE_2.length; _i6++) {
@@ -456,6 +456,15 @@ export interface OrderData {
456
456
  par_value: string;
457
457
  used_par_value: string;
458
458
  }>;
459
+ virtual_currency_snapshot?: Array<{
460
+ id: number | string;
461
+ tag: 'virtual_currency';
462
+ product_id?: number | string;
463
+ product_name: string;
464
+ par_value: string;
465
+ used_par_value: string;
466
+ name: Record<string, string>;
467
+ }>;
459
468
  };
460
469
  /**
461
470
  * 金额汇总(仅输出)。