@pisell/pisellos 2.2.245 → 2.2.247

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.
@@ -34,6 +34,7 @@ export interface OrderPromotionEvaluator {
34
34
  products: any[];
35
35
  channel?: string;
36
36
  }, matchVariant?: boolean): any[];
37
+ getStrategyConfigs?: () => unknown[];
37
38
  }
38
39
  /** 赠品解析回调 context(OS → SDK 的请求体) */
39
40
  export interface OrderGiftSelectContext {
@@ -283,7 +283,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
283
283
  filter_prepare_wallet_pass: 1
284
284
  }); // 并行获取用户识别码列表和订单详情
285
285
  _context3.next = 4;
286
- return Promise.all([this.getUserIdentificationCodeListAsync(identificationParams), baseParams.payment_order_id ? this.getOrderBasicDetailAsync(baseParams.payment_order_id) : Promise.resolve(null)]);
286
+ return Promise.all([this.getUserIdentificationCodeListAsync(identificationParams), baseParams.payment_order_id && typeof baseParams.payment_order_id === 'string' && !baseParams.payment_order_id.startsWith('LOCAL_') ? this.getOrderBasicDetailAsync(baseParams.payment_order_id) : Promise.resolve(null)]);
287
287
  case 4:
288
288
  _yield$Promise$all = _context3.sent;
289
289
  _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
@@ -1063,7 +1063,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1063
1063
  }
1064
1064
  return _context11.abrupt("continue", 44);
1065
1065
  case 40:
1066
- updatedList[matchIndex] = this.mergeOrderRecords(updatedList[matchIndex], pendingOrder);
1066
+ updatedList[matchIndex] = this.mergeOrderRecords(updatedList[matchIndex], pendingOrder, {
1067
+ preferIncomingProducts: true
1068
+ });
1067
1069
  pendingMap.delete(_storageKey);
1068
1070
  memoryPendingMap.delete(_storageKey);
1069
1071
  mergeActions[_storageKey] = 'update';
@@ -1953,7 +1955,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1953
1955
  }
1954
1956
  }, {
1955
1957
  key: "mergeOrderRecords",
1956
- value: function mergeOrderRecords(existing, incoming) {
1958
+ value: function mergeOrderRecords(existing, incoming, options) {
1957
1959
  var preferred = this.pickPreferredOrder(existing, incoming);
1958
1960
  var secondary = preferred === existing ? incoming : existing;
1959
1961
  var merged = _objectSpread(_objectSpread({}, secondary), preferred);
@@ -1973,6 +1975,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1973
1975
  mergedRecord[field] = secondaryRecord[field];
1974
1976
  }
1975
1977
  }
1978
+ var hasIncomingProducts = Object.prototype.hasOwnProperty.call(incomingRecord, 'products');
1979
+ var shouldUseIncomingProductsSnapshot = (options === null || options === void 0 ? void 0 : options.preferIncomingProducts) === true && hasIncomingProducts && incomingRecord.products !== undefined && incomingRecord.products !== null;
1976
1980
  for (var _i4 = 0, _incomingPatchFields = incomingPatchFields; _i4 < _incomingPatchFields.length; _i4++) {
1977
1981
  var _field = _incomingPatchFields[_i4];
1978
1982
  if (!Object.prototype.hasOwnProperty.call(incomingRecord, _field)) continue;
@@ -1980,7 +1984,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1980
1984
  if (typeof incomingRecord[_field] === 'string' && incomingRecord[_field] === '') continue;
1981
1985
  mergedRecord[_field] = cloneDeep(incomingRecord[_field]);
1982
1986
  }
1983
- mergedRecord.products = this.mergeOrderProductLists(preferredRecord.products, secondaryRecord.products);
1987
+ mergedRecord.products = shouldUseIncomingProductsSnapshot ? cloneDeep(incomingRecord.products) : this.mergeOrderProductLists(preferredRecord.products, secondaryRecord.products);
1984
1988
  if (!this.isPendingSyncOrder(preferred) || !this.isPendingSyncOrder(secondary)) {
1985
1989
  merged.need_sync = 0;
1986
1990
  }
@@ -35,6 +35,7 @@ export interface SmallTicketProduct {
35
35
  original_price: string;
36
36
  total_original_price: string;
37
37
  extension_list: any[];
38
+ discount_list?: any[];
38
39
  options?: Array<{
39
40
  name: string;
40
41
  num?: number;
@@ -38,6 +38,7 @@ var LABELS = {
38
38
  remainingPoints: 'Remaining points',
39
39
  table: 'Table',
40
40
  orderDiscount: 'Order discount',
41
+ manualDiscount: 'Manual discount',
41
42
  payProcessingFee: 'Pay processing fee',
42
43
  rounding: 'Rounding'
43
44
  },
@@ -61,6 +62,7 @@ var LABELS = {
61
62
  remainingPoints: '剩余积分',
62
63
  table: '桌台',
63
64
  orderDiscount: '整单折扣',
65
+ manualDiscount: '手动折扣',
64
66
  payProcessingFee: '支付手续费',
65
67
  rounding: '抹零'
66
68
  },
@@ -84,6 +86,7 @@ var LABELS = {
84
86
  remainingPoints: '剩餘積分',
85
87
  table: '桌台',
86
88
  orderDiscount: '整單折扣',
89
+ manualDiscount: '手動折扣',
87
90
  payProcessingFee: '支付手續費',
88
91
  rounding: '抹零'
89
92
  }
@@ -197,14 +200,21 @@ function buildProducts(order, locale, productMap) {
197
200
  parentProduct: parentProduct,
198
201
  locale: locale
199
202
  });
200
- return _objectSpread(_objectSpread(_objectSpread({
203
+ var discountList = normalizeProductDiscounts({
204
+ product: product,
205
+ locale: locale,
206
+ currencySymbol: currencySymbol
207
+ });
208
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread({
201
209
  product_title: productTitle,
202
210
  product_quantity: quantity,
203
211
  selling_price: formatMoney(sellingPrice, currencySymbol),
204
212
  original_price: formatMoney(originalPrice, currencySymbol),
205
213
  total_original_price: formatMoney(new Decimal(toMoneyNumber(originalPrice)).mul(quantity), currencySymbol),
206
214
  extension_list: Array.isArray(product.extension_list) ? product.extension_list : []
207
- }, options.length ? {
215
+ }, discountList.length ? {
216
+ discount_list: discountList
217
+ } : {}), options.length ? {
208
218
  options: options
209
219
  } : {}), resolvedVariant ? {
210
220
  variant: resolvedVariant
@@ -215,6 +225,30 @@ function buildProducts(order, locale, productMap) {
215
225
  } : {});
216
226
  });
217
227
  }
228
+ function normalizeProductDiscounts(params) {
229
+ var product = params.product,
230
+ locale = params.locale,
231
+ currencySymbol = params.currencySymbol;
232
+ return normalizeArray(product.discount_list).map(function (discount) {
233
+ var _ref8, _discount$amount;
234
+ var title = resolveDiscountTitle(discount, locale);
235
+ var amount = (_ref8 = (_discount$amount = discount.amount) !== null && _discount$amount !== void 0 ? _discount$amount : discount.value) !== null && _ref8 !== void 0 ? _ref8 : discount.discount_amount;
236
+ var formattedAmount = formatNegativeMoney(amount, currencySymbol);
237
+ return _objectSpread(_objectSpread({}, discount), {}, {
238
+ item: title,
239
+ name: title,
240
+ title: title,
241
+ value: formattedAmount
242
+ });
243
+ });
244
+ }
245
+ function resolveDiscountTitle(discount, locale) {
246
+ var _ref9, _ref10, _ref11, _ref12, _discount$discount$na, _discount$discount, _discount$discount2, _discount$discount3;
247
+ var title = getLocalizedValue((_ref9 = (_ref10 = (_ref11 = (_ref12 = (_discount$discount$na = (_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.name) !== null && _discount$discount$na !== void 0 ? _discount$discount$na : (_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.title) !== null && _ref12 !== void 0 ? _ref12 : (_discount$discount3 = discount.discount) === null || _discount$discount3 === void 0 ? void 0 : _discount$discount3.message) !== null && _ref11 !== void 0 ? _ref11 : discount.name) !== null && _ref10 !== void 0 ? _ref10 : discount.title) !== null && _ref9 !== void 0 ? _ref9 : discount.message, locale);
248
+ if (title) return title;
249
+ if (discount.type === 'product') return label(locale, 'manualDiscount');
250
+ return '';
251
+ }
218
252
  function resolveProductTitle(params) {
219
253
  var _product$product_id2;
220
254
  var product = params.product,
@@ -235,9 +269,9 @@ function normalizeProductOptions(params) {
235
269
  parentProduct = params.parentProduct;
236
270
  var rawOptions = Array.isArray(params.options) ? params.options : Array.isArray(product.options) ? product.options : Array.isArray((_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.option) ? product.product_sku.option : [];
237
271
  return rawOptions.map(function (option) {
238
- var _ref8, _option$original_pric, _ref9, _option$value, _option$num;
239
- var price = (_ref8 = (_option$original_pric = option.original_price) !== null && _option$original_pric !== void 0 ? _option$original_pric : option.add_price) !== null && _ref8 !== void 0 ? _ref8 : option.price;
240
- var value = (_ref9 = (_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : option.option) !== null && _ref9 !== void 0 ? _ref9 : option.item;
272
+ var _ref13, _option$original_pric, _ref14, _option$value, _option$num;
273
+ var price = (_ref13 = (_option$original_pric = option.original_price) !== null && _option$original_pric !== void 0 ? _option$original_pric : option.add_price) !== null && _ref13 !== void 0 ? _ref13 : option.price;
274
+ var value = (_ref14 = (_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : option.option) !== null && _ref14 !== void 0 ? _ref14 : option.item;
241
275
  var name = getProductTitleSource(option, locale) || resolveOptionTitleFromParentProduct({
242
276
  option: option,
243
277
  parentProduct: parentProduct,
@@ -262,7 +296,7 @@ function normalizeProductCombinations(params) {
262
296
  parentProduct = params.parentProduct;
263
297
  var bundles = Array.isArray(product.product_bundle) ? product.product_bundle : [];
264
298
  return bundles.map(function (bundle) {
265
- var _ref10, _bundle$num;
299
+ var _ref15, _bundle$num;
266
300
  var combinationsOptions = normalizeProductOptions({
267
301
  product: {},
268
302
  locale: locale,
@@ -279,14 +313,14 @@ function normalizeProductCombinations(params) {
279
313
  var optionTitle = buildOptionTitleSuffix(combinationsOptions);
280
314
  return {
281
315
  product_title: "".concat(baseTitle).concat(optionTitle),
282
- product_quantity: toNumber((_ref10 = (_bundle$num = bundle.num) !== null && _bundle$num !== void 0 ? _bundle$num : bundle.quantity) !== null && _ref10 !== void 0 ? _ref10 : 1, 1),
316
+ product_quantity: toNumber((_ref15 = (_bundle$num = bundle.num) !== null && _bundle$num !== void 0 ? _bundle$num : bundle.quantity) !== null && _ref15 !== void 0 ? _ref15 : 1, 1),
283
317
  price: formatBundlePrice(bundle, currencySymbol),
284
318
  combinations_options: combinationsOptions
285
319
  };
286
320
  });
287
321
  }
288
322
  function resolveBundleProductTitle(params) {
289
- var _ref11, _ref12, _bundle$bundle_produc;
323
+ var _ref16, _ref17, _bundle$bundle_produc;
290
324
  var bundle = params.bundle,
291
325
  productMap = params.productMap,
292
326
  locale = params.locale,
@@ -299,7 +333,7 @@ function resolveBundleProductTitle(params) {
299
333
  });
300
334
  var parentBundleTitle = parentBundleItem ? getProductTitleSource(parentBundleItem, locale) : '';
301
335
  if (parentBundleTitle) return parentBundleTitle;
302
- var productId = (_ref11 = (_ref12 = (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id) !== null && _ref12 !== void 0 ? _ref12 : bundle.product_id) !== null && _ref11 !== void 0 ? _ref11 : bundle.id;
336
+ var productId = (_ref16 = (_ref17 = (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id) !== null && _ref17 !== void 0 ? _ref17 : bundle.product_id) !== null && _ref16 !== void 0 ? _ref16 : bundle.id;
303
337
  var fallbackProduct = resolveProductFromMap(productId, productMap);
304
338
  if (!fallbackProduct) return '';
305
339
  return getProductTitleSource(fallbackProduct, locale);
@@ -351,10 +385,10 @@ function resolveVariantTextFromSkuKey(params) {
351
385
  }
352
386
  function resolveVariantTextFromNameMap(params) {
353
387
  if (!params.nameMap || _typeof(params.nameMap) !== 'object') return '';
354
- return Object.entries(params.nameMap).map(function (_ref13) {
355
- var _ref14 = _slicedToArray(_ref13, 2),
356
- groupPositionId = _ref14[0],
357
- value = _ref14[1];
388
+ return Object.entries(params.nameMap).map(function (_ref18) {
389
+ var _ref19 = _slicedToArray(_ref18, 2),
390
+ groupPositionId = _ref19[0],
391
+ value = _ref19[1];
358
392
  var group = resolveVariantGroup(params.parentProduct, groupPositionId);
359
393
  if (!group) return '';
360
394
  var groupName = getLocalizedValue(group.name, params.locale);
@@ -388,12 +422,12 @@ function getProductTitleSource(source, locale) {
388
422
  return resolveTitleValue(source.product_title, locale) || resolveTitleValue(source.title, locale) || resolveTitleValue(source.name, locale);
389
423
  }
390
424
  function resolveTitleValue(value, locale) {
391
- var _ref15, _ref16, _ref17, _ref18, _value$locale;
425
+ var _ref20, _ref21, _ref22, _ref23, _value$locale;
392
426
  if (value === undefined || value === null) return '';
393
427
  if (_typeof(value) !== 'object') return stringify(value);
394
428
  var dashedLocale = locale.replace('_', '-');
395
429
  var underscoredLocale = locale.replace('-', '_');
396
- return stringify((_ref15 = (_ref16 = (_ref17 = (_ref18 = (_value$locale = value[locale]) !== null && _value$locale !== void 0 ? _value$locale : value[dashedLocale]) !== null && _ref18 !== void 0 ? _ref18 : value[underscoredLocale]) !== null && _ref17 !== void 0 ? _ref17 : value.original) !== null && _ref16 !== void 0 ? _ref16 : value.auto) !== null && _ref15 !== void 0 ? _ref15 : '');
430
+ return stringify((_ref20 = (_ref21 = (_ref22 = (_ref23 = (_value$locale = value[locale]) !== null && _value$locale !== void 0 ? _value$locale : value[dashedLocale]) !== null && _ref23 !== void 0 ? _ref23 : value[underscoredLocale]) !== null && _ref22 !== void 0 ? _ref22 : value.original) !== null && _ref21 !== void 0 ? _ref21 : value.auto) !== null && _ref20 !== void 0 ? _ref20 : '');
397
431
  }
398
432
  function resolveOptionTitleFromParentProduct(params) {
399
433
  var option = params.option,
@@ -411,17 +445,17 @@ function flattenOptionItems(parentProduct) {
411
445
  return optionGroups.flatMap(function (group) {
412
446
  var items = normalizeArray(group.option_item || group.option_items || group.option || group.options || group.items || group.children || group.product_option_item);
413
447
  return items.map(function (item) {
414
- var _ref19, _item$option_group_id;
448
+ var _ref24, _item$option_group_id;
415
449
  return _objectSpread(_objectSpread({}, item), {}, {
416
- option_group_id: (_ref19 = (_item$option_group_id = item.option_group_id) !== null && _item$option_group_id !== void 0 ? _item$option_group_id : group.id) !== null && _ref19 !== void 0 ? _ref19 : group.option_group_id
450
+ option_group_id: (_ref24 = (_item$option_group_id = item.option_group_id) !== null && _item$option_group_id !== void 0 ? _item$option_group_id : group.id) !== null && _ref24 !== void 0 ? _ref24 : group.option_group_id
417
451
  });
418
452
  });
419
453
  });
420
454
  }
421
455
  function isOptionItemMatch(option, item) {
422
- var _ref20, _option$option_group_, _ref21, _item$option_group_it, _option$option_group_2, _item$option_group_id2;
423
- var optionItemId = (_ref20 = (_option$option_group_ = option.option_group_item_id) !== null && _option$option_group_ !== void 0 ? _option$option_group_ : option.product_option_item_id) !== null && _ref20 !== void 0 ? _ref20 : option.id;
424
- var itemId = (_ref21 = (_item$option_group_it = item.option_group_item_id) !== null && _item$option_group_it !== void 0 ? _item$option_group_it : item.product_option_item_id) !== null && _ref21 !== void 0 ? _ref21 : item.id;
456
+ var _ref25, _option$option_group_, _ref26, _item$option_group_it, _option$option_group_2, _item$option_group_id2;
457
+ var optionItemId = (_ref25 = (_option$option_group_ = option.option_group_item_id) !== null && _option$option_group_ !== void 0 ? _option$option_group_ : option.product_option_item_id) !== null && _ref25 !== void 0 ? _ref25 : option.id;
458
+ var itemId = (_ref26 = (_item$option_group_it = item.option_group_item_id) !== null && _item$option_group_it !== void 0 ? _item$option_group_it : item.product_option_item_id) !== null && _ref26 !== void 0 ? _ref26 : item.id;
425
459
  if (!isSameId(optionItemId, itemId)) return false;
426
460
  var optionGroupId = (_option$option_group_2 = option.option_group_id) !== null && _option$option_group_2 !== void 0 ? _option$option_group_2 : option.group_id;
427
461
  var itemGroupId = (_item$option_group_id2 = item.option_group_id) !== null && _item$option_group_id2 !== void 0 ? _item$option_group_id2 : item.group_id;
@@ -431,16 +465,16 @@ function isOptionItemMatch(option, item) {
431
465
  return true;
432
466
  }
433
467
  function resolveBundleItemFromParentProduct(params) {
434
- var _ref22, _bundle$bundle_varian, _bundle$bundle_id, _bundle$bundle_group_, _ref24, _bundle$bundle_produc2;
468
+ var _ref27, _bundle$bundle_varian, _bundle$bundle_id, _bundle$bundle_group_, _ref29, _bundle$bundle_produc2;
435
469
  var bundle = params.bundle,
436
470
  parentProduct = params.parentProduct;
437
471
  if (!parentProduct) return null;
438
472
  var bundleItems = flattenBundleItems(parentProduct);
439
- var bundleVariantId = (_ref22 = (_bundle$bundle_varian = bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle.variant_id) !== null && _ref22 !== void 0 ? _ref22 : bundle.product_variant_id;
473
+ var bundleVariantId = (_ref27 = (_bundle$bundle_varian = bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle.variant_id) !== null && _ref27 !== void 0 ? _ref27 : bundle.product_variant_id;
440
474
  if (isNonZeroId(bundleVariantId)) {
441
475
  var matchedByVariant = bundleItems.find(function (item) {
442
- var _ref23, _item$bundle_variant_;
443
- return isSameId((_ref23 = (_item$bundle_variant_ = item.bundle_variant_id) !== null && _item$bundle_variant_ !== void 0 ? _item$bundle_variant_ : item.variant_id) !== null && _ref23 !== void 0 ? _ref23 : item.product_variant_id, bundleVariantId);
476
+ var _ref28, _item$bundle_variant_;
477
+ return isSameId((_ref28 = (_item$bundle_variant_ = item.bundle_variant_id) !== null && _item$bundle_variant_ !== void 0 ? _item$bundle_variant_ : item.variant_id) !== null && _ref28 !== void 0 ? _ref28 : item.product_variant_id, bundleVariantId);
444
478
  });
445
479
  if (matchedByVariant) return matchedByVariant;
446
480
  }
@@ -453,18 +487,18 @@ function resolveBundleItemFromParentProduct(params) {
453
487
  if (matchedByBundleId) return matchedByBundleId;
454
488
  }
455
489
  var bundleGroupId = (_bundle$bundle_group_ = bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle.group_id;
456
- var bundleProductId = (_ref24 = (_bundle$bundle_produc2 = bundle.bundle_product_id) !== null && _bundle$bundle_produc2 !== void 0 ? _bundle$bundle_produc2 : bundle._bundle_product_id) !== null && _ref24 !== void 0 ? _ref24 : bundle.product_id;
490
+ var bundleProductId = (_ref29 = (_bundle$bundle_produc2 = bundle.bundle_product_id) !== null && _bundle$bundle_produc2 !== void 0 ? _bundle$bundle_produc2 : bundle._bundle_product_id) !== null && _ref29 !== void 0 ? _ref29 : bundle.product_id;
457
491
  if (isPresentId(bundleGroupId) && isPresentId(bundleProductId)) {
458
492
  var matchedByGroupAndProduct = bundleItems.find(function (item) {
459
- var _item$group_id, _ref25, _item$bundle_product_;
460
- return isSameId((_item$group_id = item.group_id) !== null && _item$group_id !== void 0 ? _item$group_id : item.bundle_group_id, bundleGroupId) && isSameId((_ref25 = (_item$bundle_product_ = item.bundle_product_id) !== null && _item$bundle_product_ !== void 0 ? _item$bundle_product_ : item._bundle_product_id) !== null && _ref25 !== void 0 ? _ref25 : item.product_id, bundleProductId);
493
+ var _item$group_id, _ref30, _item$bundle_product_;
494
+ return isSameId((_item$group_id = item.group_id) !== null && _item$group_id !== void 0 ? _item$group_id : item.bundle_group_id, bundleGroupId) && isSameId((_ref30 = (_item$bundle_product_ = item.bundle_product_id) !== null && _item$bundle_product_ !== void 0 ? _item$bundle_product_ : item._bundle_product_id) !== null && _ref30 !== void 0 ? _ref30 : item.product_id, bundleProductId);
461
495
  });
462
496
  if (matchedByGroupAndProduct) return matchedByGroupAndProduct;
463
497
  }
464
498
  if (isPresentId(bundleProductId)) {
465
499
  return bundleItems.find(function (item) {
466
- var _ref26, _item$bundle_product_2;
467
- return isSameId((_ref26 = (_item$bundle_product_2 = item.bundle_product_id) !== null && _item$bundle_product_2 !== void 0 ? _item$bundle_product_2 : item._bundle_product_id) !== null && _ref26 !== void 0 ? _ref26 : item.product_id, bundleProductId);
500
+ var _ref31, _item$bundle_product_2;
501
+ return isSameId((_ref31 = (_item$bundle_product_2 = item.bundle_product_id) !== null && _item$bundle_product_2 !== void 0 ? _item$bundle_product_2 : item._bundle_product_id) !== null && _ref31 !== void 0 ? _ref31 : item.product_id, bundleProductId);
468
502
  }) || null;
469
503
  }
470
504
  return null;
@@ -474,9 +508,9 @@ function flattenBundleItems(parentProduct) {
474
508
  return bundleGroups.flatMap(function (group) {
475
509
  var items = Array.isArray(group.bundle_item) ? group.bundle_item : [];
476
510
  return items.map(function (item) {
477
- var _ref27, _item$group_id2;
511
+ var _ref32, _item$group_id2;
478
512
  return _objectSpread(_objectSpread({}, item), {}, {
479
- group_id: (_ref27 = (_item$group_id2 = item.group_id) !== null && _item$group_id2 !== void 0 ? _item$group_id2 : group.id) !== null && _ref27 !== void 0 ? _ref27 : group.group_id
513
+ group_id: (_ref32 = (_item$group_id2 = item.group_id) !== null && _item$group_id2 !== void 0 ? _item$group_id2 : group.id) !== null && _ref32 !== void 0 ? _ref32 : group.group_id
480
514
  });
481
515
  });
482
516
  });
@@ -502,14 +536,15 @@ function buildOptionTitleSuffix(options) {
502
536
  return text ? "(".concat(text, ")") : '';
503
537
  }
504
538
  function formatBundlePrice(bundle, currencySymbol) {
505
- var _ref28, _ref29, _bundle$bundle_sellin;
506
- var value = (_ref28 = (_ref29 = (_bundle$bundle_sellin = bundle.bundle_selling_price) !== null && _bundle$bundle_sellin !== void 0 ? _bundle$bundle_sellin : bundle.bundle_sum_price) !== null && _ref29 !== void 0 ? _ref29 : bundle.price) !== null && _ref28 !== void 0 ? _ref28 : 0;
539
+ var _ref33, _ref34, _bundle$bundle_sellin;
540
+ var value = (_ref33 = (_ref34 = (_bundle$bundle_sellin = bundle.bundle_selling_price) !== null && _bundle$bundle_sellin !== void 0 ? _bundle$bundle_sellin : bundle.bundle_sum_price) !== null && _ref34 !== void 0 ? _ref34 : bundle.price) !== null && _ref33 !== void 0 ? _ref33 : 0;
507
541
  var amount = new Decimal(toMoneyNumber(value));
508
542
  var isNegative = bundle.price_type === 'markdown' || bundle.price_type === 'markup' && bundle.price_type_ext === 'product_price';
509
543
  if (isNegative) return "-".concat(currencySymbol).concat(amount.abs().toFixed(2));
510
544
  return formatMoney(amount, currencySymbol);
511
545
  }
512
546
  function buildFees(params) {
547
+ var _ref36, _order$shop_discount;
513
548
  var order = params.order,
514
549
  shopInfo = params.shopInfo,
515
550
  locale = params.locale,
@@ -518,20 +553,20 @@ function buildFees(params) {
518
553
  currencySymbol = params.currencySymbol;
519
554
  var fees = [];
520
555
  for (var _i = 0, _normalizeArray = normalizeArray(order.surcharges || summary.surcharges); _i < _normalizeArray.length; _i++) {
521
- var _ref30, _surcharge$amount;
556
+ var _ref35, _surcharge$amount;
522
557
  var surcharge = _normalizeArray[_i];
523
- var value = (_ref30 = (_surcharge$amount = surcharge.amount) !== null && _surcharge$amount !== void 0 ? _surcharge$amount : surcharge.value) !== null && _ref30 !== void 0 ? _ref30 : surcharge.total_amount;
558
+ var value = (_ref35 = (_surcharge$amount = surcharge.amount) !== null && _surcharge$amount !== void 0 ? _surcharge$amount : surcharge.value) !== null && _ref35 !== void 0 ? _ref35 : surcharge.total_amount;
524
559
  if (!isNonZero(value)) continue;
525
560
  fees.push({
526
561
  item: getLocalizedValue(surcharge.name || surcharge.title || surcharge.item, locale),
527
562
  value: formatMoney(value, currencySymbol)
528
563
  });
529
564
  }
530
- var discountAmount = summary.discount_amount || order.discount_amount || order.shop_discount;
565
+ var discountAmount = (_ref36 = (_order$shop_discount = order.shop_discount) !== null && _order$shop_discount !== void 0 ? _order$shop_discount : summary.discount_amount) !== null && _ref36 !== void 0 ? _ref36 : order.discount_amount;
531
566
  if (isNonZero(discountAmount)) {
532
567
  fees.push({
533
568
  item: label(locale, 'orderDiscount'),
534
- value: formatMoney(new Decimal(toMoneyNumber(discountAmount)).neg(), currencySymbol)
569
+ value: formatNegativeMoney(discountAmount, currencySymbol)
535
570
  });
536
571
  }
537
572
  var taxFee = summary.tax_fee || order.tax_fee;
@@ -655,8 +690,8 @@ function buildPaymentData(params) {
655
690
  currencySymbol: params.currencySymbol
656
691
  })));
657
692
  } else {
658
- var _ref31, _payment$remaining_am, _payment$metadata;
659
- var remainingAmount = (_ref31 = (_payment$remaining_am = payment.remaining_amount) !== null && _payment$remaining_am !== void 0 ? _payment$remaining_am : payment.balance) !== null && _ref31 !== void 0 ? _ref31 : (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata.remaining_amount;
693
+ var _ref37, _payment$remaining_am, _payment$metadata;
694
+ var remainingAmount = (_ref37 = (_payment$remaining_am = payment.remaining_amount) !== null && _payment$remaining_am !== void 0 ? _payment$remaining_am : payment.balance) !== null && _ref37 !== void 0 ? _ref37 : (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata.remaining_amount;
660
695
  if (remainingAmount !== undefined && remainingAmount !== null) {
661
696
  items.push({
662
697
  item: label(params.locale, 'remainingAmount'),
@@ -764,11 +799,12 @@ function label(locale, key) {
764
799
  return ((_LABELS$locale = LABELS[locale]) === null || _LABELS$locale === void 0 ? void 0 : _LABELS$locale[key]) || LABELS.en[key] || key;
765
800
  }
766
801
  function getLocalizedValue(value, locale) {
767
- var _ref32, _ref33, _ref34, _value$locale2;
802
+ var _ref38, _ref39, _ref40, _ref41, _ref42, _ref43, _value$locale2;
768
803
  if (value === undefined || value === null) return '';
769
804
  if (_typeof(value) !== 'object') return stringify(value);
770
805
  var dashedLocale = locale.replace('_', '-');
771
- return stringify((_ref32 = (_ref33 = (_ref34 = (_value$locale2 = value[locale]) !== null && _value$locale2 !== void 0 ? _value$locale2 : value[dashedLocale]) !== null && _ref34 !== void 0 ? _ref34 : value.default) !== null && _ref33 !== void 0 ? _ref33 : value.en) !== null && _ref32 !== void 0 ? _ref32 : '');
806
+ var underscoredLocale = locale.replace('-', '_');
807
+ return stringify((_ref38 = (_ref39 = (_ref40 = (_ref41 = (_ref42 = (_ref43 = (_value$locale2 = value[locale]) !== null && _value$locale2 !== void 0 ? _value$locale2 : value[dashedLocale]) !== null && _ref43 !== void 0 ? _ref43 : value[underscoredLocale]) !== null && _ref42 !== void 0 ? _ref42 : value.original) !== null && _ref41 !== void 0 ? _ref41 : value.auto) !== null && _ref40 !== void 0 ? _ref40 : value.default) !== null && _ref39 !== void 0 ? _ref39 : value.en) !== null && _ref38 !== void 0 ? _ref38 : '');
772
808
  }
773
809
  function serviceTypeToLabelKey(serviceType) {
774
810
  var normalized = serviceType.toLowerCase();
@@ -793,6 +829,10 @@ function formatMoney(value, currencySymbol) {
793
829
  var amount = new Decimal(toMoneyNumber(value));
794
830
  return "".concat(currencySymbol).concat(amount.toFixed(2));
795
831
  }
832
+ function formatNegativeMoney(value, currencySymbol) {
833
+ var amount = new Decimal(toMoneyNumber(value)).abs();
834
+ return "-".concat(currencySymbol).concat(amount.toFixed(2));
835
+ }
796
836
  function calculateReceiptPaidAmount(order, summary) {
797
837
  var _summary$pay_service_, _summary$total_amount;
798
838
  var paidAmount = sumPayments(order.payments);
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 2 | 1 | 5 | 3 | 6 | 4;
314
+ weekNum: 0 | 5 | 1 | 4 | 2 | 3 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -322,7 +322,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
322
322
  * 获取当前的客户搜索条件
323
323
  * @returns 当前搜索条件
324
324
  */
325
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
325
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
326
326
  /**
327
327
  * 获取客户列表状态(包含滚动加载相关状态)
328
328
  * @returns 客户状态
@@ -1,49 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
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
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/model/strategy/adapter/promotion/index.ts
30
- var promotion_exports = {};
31
- __export(promotion_exports, {
32
- BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
33
- PromotionAdapter: () => import_adapter.PromotionAdapter,
34
- PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
35
- X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
36
- default: () => import_adapter2.default
37
- });
38
- module.exports = __toCommonJS(promotion_exports);
39
- var import_evaluator = require("./evaluator");
40
- var import_adapter = require("./adapter");
41
- var import_adapter2 = __toESM(require("./adapter"));
42
- var import_examples = require("./examples");
43
- // Annotate the CommonJS export names for ESM import in node:
44
- 0 && (module.exports = {
45
- BUY_X_GET_Y_FREE_STRATEGY,
46
- PromotionAdapter,
47
- PromotionEvaluator,
48
- X_ITEMS_FOR_Y_PRICE_STRATEGY
49
- });
@@ -78,7 +78,7 @@ function mapOrderBundleToOtherBundle(bundle) {
78
78
  });
79
79
  }
80
80
  function buildNormalProductCacheItemFromOrderLine(input) {
81
- var _a, _b, _c, _d;
81
+ var _a, _b, _c, _d, _e;
82
82
  const { product, sourceProduct } = input;
83
83
  const resolvedId = product.product_id ?? (sourceProduct == null ? void 0 : sourceProduct.id);
84
84
  const sourcePrice = resolveSourceProductPrice(product, sourceProduct);
@@ -117,6 +117,9 @@ function buildNormalProductCacheItemFromOrderLine(input) {
117
117
  skuValue: JSON.parse(JSON.stringify(skuValue)),
118
118
  _skuValue: JSON.parse(JSON.stringify(skuValue)),
119
119
  isNormalProduct: true,
120
+ metadata: {
121
+ product_add_schedule_time: (_e = product.metadata) == null ? void 0 : _e.product_add_schedule_time
122
+ },
120
123
  ...productOptionString ? { product_option_string: productOptionString } : {},
121
124
  ...(originExtend == null ? void 0 : originExtend.priceOverride) !== void 0 ? { priceOverride: originExtend.priceOverride } : {},
122
125
  ...(originExtend == null ? void 0 : originExtend.bundle_edit) !== void 0 ? { bundle_edit: originExtend.bundle_edit } : {}
@@ -132,7 +135,7 @@ function buildNormalProductCacheItemFromOrderLine(input) {
132
135
  id: resolvedId,
133
136
  product_id: resolvedId,
134
137
  _id: uid,
135
- title: sourceProduct == null ? void 0 : sourceProduct.title,
138
+ title: (sourceProduct == null ? void 0 : sourceProduct.title) ?? product.product_title ?? "",
136
139
  price: (sourceProduct == null ? void 0 : sourceProduct.price) ?? sourcePrice,
137
140
  selling_price: product.selling_price,
138
141
  original_price: product.original_price,
@@ -26,6 +26,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
26
26
  private giftSelectResolver;
27
27
  /** applyPromotion 递归保护 flag(写路径同步调 applyPromotion,禁止重入) */
28
28
  private isApplyingPromotion;
29
+ /** 商品曾应用过客户券卡,客户变更剥离后需强制跑一次 calcDiscount 复位价格 */
30
+ private hasActiveCustomerBoundDiscount;
29
31
  /** 最近一次 applyPromotion 的未满足促销提示 */
30
32
  private lastUnfulfilledPromotions;
31
33
  /** 最近一次 applyPromotion 的赠品操作 diff(debug / SDK 读取使用) */
@@ -179,6 +181,9 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
179
181
  private buildOrderProductsFingerprint;
180
182
  private buildProductStructuralFingerprintItem;
181
183
  private buildOrderProductsStructuralFingerprint;
184
+ private getManualDepositOverride;
185
+ private setManualDepositOverride;
186
+ private clearManualDepositOverride;
182
187
  private getOriginalSalesSnapshot;
183
188
  private isSnapshotPayableAmountUnchanged;
184
189
  private restoreOriginalSnapshotIfProductsUnchanged;
@@ -255,6 +260,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
255
260
  updateTempOrderContactsInfo(contactsInfo: Record<string, any> | null): Record<string, any> | null;
256
261
  private buildTempOrderCustomer;
257
262
  private isCustomerBoundDiscount;
263
+ private productHasCustomerBoundDiscount;
264
+ private shouldSkipDiscountCalculation;
258
265
  private clearCustomerBoundDiscounts;
259
266
  /**
260
267
  * 更新当前 tempOrder 的客户协议字段。
@@ -422,7 +429,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
422
429
  generateIdempotencyToken(): string;
423
430
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
424
431
  createOrder(params: CommitOrderParams['query']): {
425
- type: "appointment_booking" | "virtual";
432
+ type: "virtual" | "appointment_booking";
426
433
  platform: string;
427
434
  sales_channel: string;
428
435
  order_sales_channel: string;