@pisell/pisellos 2.3.124 → 2.3.125

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 (93) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  2. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +0 -2
  3. package/dist/model/strategy/adapter/walletPass/evaluator.js +2 -4
  4. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +19 -58
  5. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +12 -24
  6. package/dist/modules/Customer/index.js +3 -6
  7. package/dist/modules/Customer/types.d.ts +0 -2
  8. package/dist/modules/Discount/index.d.ts +2 -2
  9. package/dist/modules/Discount/index.js +151 -37
  10. package/dist/modules/Discount/types.d.ts +5 -36
  11. package/dist/modules/Order/index.d.ts +13 -8
  12. package/dist/modules/Order/index.js +307 -432
  13. package/dist/modules/Order/types.d.ts +5 -0
  14. package/dist/modules/Order/utils/orderCollectionIdentity.js +12 -16
  15. package/dist/modules/Order/utils.d.ts +11 -1
  16. package/dist/modules/Order/utils.js +127 -122
  17. package/dist/modules/Payment/types.d.ts +1 -21
  18. package/dist/modules/Payment/types.js +0 -2
  19. package/dist/modules/Payment/walletpass.d.ts +1 -1
  20. package/dist/modules/Payment/walletpass.js +47 -80
  21. package/dist/modules/Rules/index.d.ts +2 -2
  22. package/dist/modules/Rules/index.js +186 -480
  23. package/dist/modules/Rules/types.d.ts +0 -4
  24. package/dist/server/modules/order/types.d.ts +0 -2
  25. package/dist/solution/BaseSales/index.d.ts +0 -1
  26. package/dist/solution/BaseSales/index.js +59 -51
  27. package/dist/solution/BaseSales/types.d.ts +2 -2
  28. package/dist/solution/BaseSales/utils/cartPromotion.js +126 -141
  29. package/dist/solution/BookingByStep/index.d.ts +1 -1
  30. package/dist/solution/BookingTicket/index.d.ts +2 -1
  31. package/dist/solution/BookingTicket/index.js +63 -60
  32. package/dist/solution/BookingTicket/types.d.ts +1 -5
  33. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -2
  34. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +147 -338
  35. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +4 -8
  36. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -6
  37. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +6 -19
  38. package/dist/solution/ShopDiscount/index.d.ts +0 -2
  39. package/dist/solution/ShopDiscount/index.js +42 -99
  40. package/dist/solution/ShopDiscount/utils.d.ts +2 -4
  41. package/dist/solution/ShopDiscount/utils.js +23 -43
  42. package/dist/solution/UnifiedBookingSales/index.js +2 -2
  43. package/lib/model/strategy/adapter/promotion/index.js +1 -46
  44. package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +0 -2
  45. package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
  46. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +6 -35
  47. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -13
  48. package/lib/modules/Customer/index.js +1 -5
  49. package/lib/modules/Customer/types.d.ts +0 -2
  50. package/lib/modules/Discount/index.d.ts +2 -2
  51. package/lib/modules/Discount/index.js +129 -23
  52. package/lib/modules/Discount/types.d.ts +5 -36
  53. package/lib/modules/Order/index.d.ts +13 -8
  54. package/lib/modules/Order/index.js +107 -215
  55. package/lib/modules/Order/types.d.ts +5 -0
  56. package/lib/modules/Order/utils/orderCollectionIdentity.js +11 -14
  57. package/lib/modules/Order/utils.d.ts +11 -1
  58. package/lib/modules/Order/utils.js +45 -39
  59. package/lib/modules/Payment/types.d.ts +1 -21
  60. package/lib/modules/Payment/types.js +0 -1
  61. package/lib/modules/Payment/walletpass.d.ts +1 -1
  62. package/lib/modules/Payment/walletpass.js +9 -29
  63. package/lib/modules/Rules/index.d.ts +2 -2
  64. package/lib/modules/Rules/index.js +110 -357
  65. package/lib/modules/Rules/types.d.ts +0 -4
  66. package/lib/server/modules/order/types.d.ts +0 -2
  67. package/lib/solution/BaseSales/index.d.ts +0 -1
  68. package/lib/solution/BaseSales/index.js +12 -5
  69. package/lib/solution/BaseSales/types.d.ts +2 -2
  70. package/lib/solution/BaseSales/utils/cartPromotion.js +4 -12
  71. package/lib/solution/BookingByStep/index.d.ts +1 -1
  72. package/lib/solution/BookingTicket/index.d.ts +2 -1
  73. package/lib/solution/BookingTicket/index.js +33 -36
  74. package/lib/solution/BookingTicket/types.d.ts +1 -5
  75. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -2
  76. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +42 -174
  77. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +4 -8
  78. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -6
  79. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +3 -11
  80. package/lib/solution/ShopDiscount/index.d.ts +0 -2
  81. package/lib/solution/ShopDiscount/index.js +9 -55
  82. package/lib/solution/ShopDiscount/utils.d.ts +2 -4
  83. package/lib/solution/ShopDiscount/utils.js +25 -42
  84. package/lib/solution/UnifiedBookingSales/index.js +2 -2
  85. package/package.json +1 -1
  86. package/dist/modules/Discount/availability.d.ts +0 -7
  87. package/dist/modules/Discount/availability.js +0 -49
  88. package/dist/modules/Discount/entitlementPass.d.ts +0 -34
  89. package/dist/modules/Discount/entitlementPass.js +0 -147
  90. package/lib/modules/Discount/availability.d.ts +0 -7
  91. package/lib/modules/Discount/availability.js +0 -43
  92. package/lib/modules/Discount/entitlementPass.d.ts +0 -34
  93. package/lib/modules/Discount/entitlementPass.js +0 -141
@@ -29,10 +29,6 @@ export interface RulesCalcDiscountOptions {
29
29
  discountId?: number;
30
30
  selectedList?: SetDiscountSelectedParams[];
31
31
  scan?: boolean;
32
- /** 本次扫码优先使用的次卡实例;普通重算不传,继续保留商品行当前选择。 */
33
- preferredEntitlementPassIds?: number[];
34
- /** 普通重算保留商品行已应用的次卡;最优选择传 false 恢复自动排序。 */
35
- preserveEntitlementSelection?: boolean;
36
32
  /** Change time 重报价目标行:允许已选编辑态折扣卡重新应用到这些 booking 商品。 */
37
33
  reapplyBookingDiscountProductUids?: string[];
38
34
  }
@@ -36,8 +36,6 @@ export type OrderSurchargeType = string;
36
36
  export interface OrderProductDiscountMetadata {
37
37
  /** 设备端本地唯一标识,用于与服务端记录对齐 */
38
38
  unique_identification_number?: string;
39
- /** 月卡扣除本单新增使用后的剩余次数;不限次数时为 null。 */
40
- balance?: number | null;
41
39
  [key: string]: unknown;
42
40
  }
43
41
  /**
@@ -415,7 +415,6 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
415
415
  refreshWalletAssets(params?: {
416
416
  order_wait_pay_amount?: number;
417
417
  preserveSelection?: boolean;
418
- retainSearchResultCodes?: string[];
419
418
  }): Promise<WalletAssetsState>;
420
419
  /** 选择或取消单张钱包资产,并立即同步 pending wallet payments。 */
421
420
  selectWalletAsset(params: {
@@ -2815,7 +2815,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2815
2815
  (item.discount_list || []).forEach(function (discount) {
2816
2816
  var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
2817
2817
  var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
2818
- if (!discountId || !['entitlement_pass', 'good_pass', 'discount_card'].includes(discount.type)) return;
2818
+ if (!discountId || !['good_pass', 'discount_card'].includes(discount.type)) return;
2819
2819
  var quantity = item.quantity || item.num || item.product_quantity || 1;
2820
2820
  var savedAmount = new Decimal(discount.amount || 0).times(quantity).plus((discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.product_discount_difference) || 0);
2821
2821
  var index = historyDiscountList.findIndex(function (n) {
@@ -3380,8 +3380,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3380
3380
  return resolveIsFormSubject(tempOrder, product);
3381
3381
  },
3382
3382
  orderTotalAmount: orderTotalAmount
3383
- }, {
3384
- preserveEntitlementSelection: false
3385
3383
  }) || result;
3386
3384
  if (result.productList) {
3387
3385
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
@@ -4884,7 +4882,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4884
4882
  key: "initWalletData",
4885
4883
  value: function () {
4886
4884
  var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
4887
- var _snapshot$identity;
4885
+ var _this$store$order$mer, _this$store$order15, _snapshot$identity;
4888
4886
  var snapshot, walletBusinessData, result;
4889
4887
  return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4890
4888
  while (1) switch (_context43.prev = _context43.next) {
@@ -4919,7 +4917,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4919
4917
  return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
4920
4918
  case 10:
4921
4919
  result = _context43.sent;
4922
- _context43.next = 13;
4920
+ (_this$store$order$mer = (_this$store$order15 = this.store.order).mergePointCardSnapshotCodes) === null || _this$store$order$mer === void 0 || _this$store$order$mer.call(_this$store$order15, result.userIdentificationCodes, {
4921
+ customerId: walletBusinessData.customer_id,
4922
+ orderIdentity: snapshot === null || snapshot === void 0 ? void 0 : snapshot.identity
4923
+ });
4924
+ _context43.next = 14;
4923
4925
  return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
4924
4926
  orderId: snapshot === null || snapshot === void 0 || (_snapshot$identity = snapshot.identity) === null || _snapshot$identity === void 0 ? void 0 : _snapshot$identity.orderId,
4925
4927
  customerId: walletBusinessData.customer_id,
@@ -4930,9 +4932,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4930
4932
  },
4931
4933
  timestamp: Date.now()
4932
4934
  });
4933
- case 13:
4934
- return _context43.abrupt("return", result);
4935
4935
  case 14:
4936
+ return _context43.abrupt("return", result);
4937
+ case 15:
4936
4938
  case "end":
4937
4939
  return _context43.stop();
4938
4940
  }
@@ -4946,8 +4948,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4946
4948
  }, {
4947
4949
  key: "getCommittedWalletAssets",
4948
4950
  value: function getCommittedWalletAssets() {
4949
- var _this$store$order15, _this$store$order15$g;
4950
- var payments = ((_this$store$order15 = this.store.order) === null || _this$store$order15 === void 0 || (_this$store$order15$g = _this$store$order15.getOrderPayments) === null || _this$store$order15$g === void 0 ? void 0 : _this$store$order15$g.call(_this$store$order15)) || [];
4951
+ var _this$store$order16, _this$store$order16$g;
4952
+ var payments = ((_this$store$order16 = this.store.order) === null || _this$store$order16 === void 0 || (_this$store$order16$g = _this$store$order16.getOrderPayments) === null || _this$store$order16$g === void 0 ? void 0 : _this$store$order16$g.call(_this$store$order16)) || [];
4951
4953
  var committed = payments.filter(function (payment) {
4952
4954
  var voucherId = payment === null || payment === void 0 ? void 0 : payment.voucher_id;
4953
4955
  if (voucherId === undefined || voucherId === null || voucherId === 0) {
@@ -5125,6 +5127,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5125
5127
  key: "importWalletAssetsSnapshot",
5126
5128
  value: (function () {
5127
5129
  var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(snapshot) {
5130
+ var _this$store$order17, _this$store$order17$m;
5128
5131
  var state;
5129
5132
  return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5130
5133
  while (1) switch (_context46.prev = _context46.next) {
@@ -5136,11 +5139,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5136
5139
  throw new Error('payment 模块未初始化');
5137
5140
  case 2:
5138
5141
  state = this.store.payment.wallet.importWalletAssetsSnapshot(snapshot);
5139
- _context46.next = 5;
5142
+ (_this$store$order17 = this.store.order) === null || _this$store$order17 === void 0 || (_this$store$order17$m = _this$store$order17.mergePointCardSnapshotCodes) === null || _this$store$order17$m === void 0 || _this$store$order17$m.call(_this$store$order17, state.items);
5143
+ _context46.next = 6;
5140
5144
  return this.syncSelectedWalletAssets(state);
5141
- case 5:
5142
- return _context46.abrupt("return", this.publishWalletAssetsState(state));
5143
5145
  case 6:
5146
+ return _context46.abrupt("return", this.publishWalletAssetsState(state));
5147
+ case 7:
5144
5148
  case "end":
5145
5149
  return _context46.stop();
5146
5150
  }
@@ -5159,8 +5163,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5159
5163
  key: "refreshWalletAssets",
5160
5164
  value: (function () {
5161
5165
  var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
5162
- var _previousState$custom, _businessData$custome;
5163
- var refreshSequence, wallet, businessData, emptyState, previousState, hasPreviousWalletContext, customerChanged, clearedState, refreshTask, state, committed;
5166
+ var _this$store$order$get6, _previousState$custom, _businessData$custome;
5167
+ var refreshSequence, wallet, businessData, emptyState, pointCardSnapshotMergeContext, previousState, hasPreviousWalletContext, customerChanged, clearedState, refreshTask, state, _this$store$order$mer2, _this$store$order18, _wallet$getUserIdenti, committed;
5164
5168
  return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5165
5169
  while (1) switch (_context47.prev = _context47.next) {
5166
5170
  case 0:
@@ -5190,46 +5194,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5190
5194
  });
5191
5195
  return _context47.abrupt("return", this.publishWalletAssetsState(emptyState));
5192
5196
  case 12:
5197
+ pointCardSnapshotMergeContext = {
5198
+ customerId: businessData.customer_id,
5199
+ orderIdentity: (_this$store$order$get6 = this.store.order.getOrderSnapshot()) === null || _this$store$order$get6 === void 0 ? void 0 : _this$store$order$get6.identity
5200
+ };
5193
5201
  previousState = wallet.getWalletAssetsState();
5194
5202
  hasPreviousWalletContext = previousState.status !== 'idle' || previousState.items.length > 0 || previousState.selectedIds.length > 0 || previousState.customerId !== undefined;
5195
5203
  customerChanged = hasPreviousWalletContext && String((_previousState$custom = previousState.customerId) !== null && _previousState$custom !== void 0 ? _previousState$custom : '') !== String((_businessData$custome = businessData.customer_id) !== null && _businessData$custome !== void 0 ? _businessData$custome : '');
5196
5204
  if (!customerChanged) {
5197
- _context47.next = 20;
5205
+ _context47.next = 21;
5198
5206
  break;
5199
5207
  }
5200
5208
  clearedState = wallet.clearWalletAssetSelection();
5201
5209
  this.updateVoucherOrderPayments([], {
5202
5210
  status: 'payment_pending'
5203
5211
  });
5204
- _context47.next = 20;
5212
+ _context47.next = 21;
5205
5213
  return this.publishWalletAssetsState(clearedState);
5206
- case 20:
5214
+ case 21:
5207
5215
  refreshTask = wallet.refreshWalletAssetsFromBusinessAsync(businessData, {
5208
- preserveSelection: (params === null || params === void 0 ? void 0 : params.preserveSelection) !== false && !customerChanged,
5209
- retainSearchResultCodes: params === null || params === void 0 ? void 0 : params.retainSearchResultCodes
5216
+ preserveSelection: (params === null || params === void 0 ? void 0 : params.preserveSelection) !== false && !customerChanged
5210
5217
  });
5211
- _context47.next = 23;
5218
+ _context47.next = 24;
5212
5219
  return this.publishWalletAssetsState(wallet.getWalletAssetsState());
5213
- case 23:
5214
- _context47.next = 25;
5220
+ case 24:
5221
+ _context47.next = 26;
5215
5222
  return refreshTask;
5216
- case 25:
5223
+ case 26:
5217
5224
  state = _context47.sent;
5218
5225
  if (!(refreshSequence !== this.walletAssetsRefreshSequence)) {
5219
- _context47.next = 28;
5226
+ _context47.next = 29;
5220
5227
  break;
5221
5228
  }
5222
5229
  return _context47.abrupt("return", wallet.getWalletAssetsState());
5223
- case 28:
5230
+ case 29:
5224
5231
  if (state.status !== 'error') {
5225
5232
  committed = this.getCommittedWalletAssets();
5226
5233
  state = wallet.setCommittedWalletAssets(committed.ids, committed.assets);
5234
+ (_this$store$order$mer2 = (_this$store$order18 = this.store.order).mergePointCardSnapshotCodes) === null || _this$store$order$mer2 === void 0 || _this$store$order$mer2.call(_this$store$order18, ((_wallet$getUserIdenti = wallet.getUserIdentificationCodes) === null || _wallet$getUserIdenti === void 0 ? void 0 : _wallet$getUserIdenti.call(wallet)) || [], pointCardSnapshotMergeContext);
5227
5235
  }
5228
- _context47.next = 31;
5236
+ _context47.next = 32;
5229
5237
  return this.syncSelectedWalletAssets(state);
5230
- case 31:
5231
- return _context47.abrupt("return", this.publishWalletAssetsState(state));
5232
5238
  case 32:
5239
+ return _context47.abrupt("return", this.publishWalletAssetsState(state));
5240
+ case 33:
5233
5241
  case "end":
5234
5242
  return _context47.stop();
5235
5243
  }
@@ -5388,11 +5396,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5388
5396
  }, {
5389
5397
  key: "updateOrderCustomer",
5390
5398
  value: function updateOrderCustomer(customer) {
5391
- var _this$store$order$get6, _this$store$order16, _this$store$order$get7, _this$store$order17;
5399
+ var _this$store$order$get7, _this$store$order19, _this$store$order$get8, _this$store$order20;
5392
5400
  if (!this.store.order) throw new Error('order 模块未初始化');
5393
- var previousCustomerId = this.resolveDiscountConfigCustomerId((_this$store$order$get6 = (_this$store$order16 = this.store.order).getTempOrder) === null || _this$store$order$get6 === void 0 ? void 0 : _this$store$order$get6.call(_this$store$order16));
5401
+ var previousCustomerId = this.resolveDiscountConfigCustomerId((_this$store$order$get7 = (_this$store$order19 = this.store.order).getTempOrder) === null || _this$store$order$get7 === void 0 ? void 0 : _this$store$order$get7.call(_this$store$order19));
5394
5402
  var result = this.store.order.updateTempOrderCustomer(customer);
5395
- var nextCustomerId = this.resolveDiscountConfigCustomerId((_this$store$order$get7 = (_this$store$order17 = this.store.order).getTempOrder) === null || _this$store$order$get7 === void 0 ? void 0 : _this$store$order$get7.call(_this$store$order17));
5403
+ var nextCustomerId = this.resolveDiscountConfigCustomerId((_this$store$order$get8 = (_this$store$order20 = this.store.order).getTempOrder) === null || _this$store$order$get8 === void 0 ? void 0 : _this$store$order$get8.call(_this$store$order20));
5396
5404
  if (String(previousCustomerId) !== String(nextCustomerId)) {
5397
5405
  this.discountConfigCacheKey = null;
5398
5406
  this.hasManualDiscountSelection = false;
@@ -5461,8 +5469,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5461
5469
  }, {
5462
5470
  key: "getPendingWalletPaymentAmount",
5463
5471
  value: function getPendingWalletPaymentAmount() {
5464
- var _this$store$order18, _this$store$order18$g;
5465
- var payments = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ((_this$store$order18 = this.store.order) === null || _this$store$order18 === void 0 || (_this$store$order18$g = _this$store$order18.getOrderPayments) === null || _this$store$order18$g === void 0 ? void 0 : _this$store$order18$g.call(_this$store$order18)) || [];
5472
+ var _this$store$order21, _this$store$order21$g;
5473
+ var payments = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ((_this$store$order21 = this.store.order) === null || _this$store$order21 === void 0 || (_this$store$order21$g = _this$store$order21.getOrderPayments) === null || _this$store$order21$g === void 0 ? void 0 : _this$store$order21$g.call(_this$store$order21)) || [];
5466
5474
  return payments.reduce(function (total, payment) {
5467
5475
  if ((payment === null || payment === void 0 ? void 0 : payment.status) !== 'payment_pending' || (payment === null || payment === void 0 ? void 0 : payment.voucher_id) === undefined || Number(payment.voucher_id) === 0) {
5468
5476
  return total;
@@ -5480,7 +5488,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5480
5488
  key: "getCashPaymentConfig",
5481
5489
  value: (function () {
5482
5490
  var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53() {
5483
- var _this$store$order19, _this$store$order19$g, _this$store$order20, _this$store$order20$g, _this$otherParams34;
5491
+ var _this$store$order22, _this$store$order22$g, _this$store$order23, _this$store$order23$g, _this$otherParams34;
5484
5492
  var paymentMethods, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, currency, recommendedAmounts;
5485
5493
  return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5486
5494
  while (1) switch (_context53.prev = _context53.next) {
@@ -5503,10 +5511,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5503
5511
  paymentMethods = _context53.sent;
5504
5512
  paymentMethod = this.findCashPaymentMethod(paymentMethods);
5505
5513
  case 9:
5506
- amountSnapshot = (_this$store$order19 = this.store.order) === null || _this$store$order19 === void 0 || (_this$store$order19$g = _this$store$order19.getOrderAmountSnapshot) === null || _this$store$order19$g === void 0 ? void 0 : _this$store$order19$g.call(_this$store$order19);
5514
+ amountSnapshot = (_this$store$order22 = this.store.order) === null || _this$store$order22 === void 0 || (_this$store$order22$g = _this$store$order22.getOrderAmountSnapshot) === null || _this$store$order22$g === void 0 ? void 0 : _this$store$order22$g.call(_this$store$order22);
5507
5515
  pendingWalletAmount = this.getPendingWalletPaymentAmount();
5508
5516
  amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
5509
- currency = ((_this$store$order20 = this.store.order) === null || _this$store$order20 === void 0 || (_this$store$order20$g = _this$store$order20.getTempOrder) === null || _this$store$order20$g === void 0 || (_this$store$order20$g = _this$store$order20$g.call(_this$store$order20)) === null || _this$store$order20$g === void 0 ? void 0 : _this$store$order20$g.currency_code) || ((_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.currency) || 'USD';
5517
+ currency = ((_this$store$order23 = this.store.order) === null || _this$store$order23 === void 0 || (_this$store$order23$g = _this$store$order23.getTempOrder) === null || _this$store$order23$g === void 0 || (_this$store$order23$g = _this$store$order23$g.call(_this$store$order23)) === null || _this$store$order23$g === void 0 ? void 0 : _this$store$order23$g.currency_code) || ((_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.currency) || 'USD';
5510
5518
  recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
5511
5519
  return _context53.abrupt("return", {
5512
5520
  available: Boolean(paymentMethod && amountDue > 0),
@@ -5536,8 +5544,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5536
5544
  key: "confirmWalletPayment",
5537
5545
  value: (function () {
5538
5546
  var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54() {
5539
- var _this$store$order$get8, _this$store$order21, _this$store$order$get10, _this$store$order$get11, _this$store$order23;
5540
- var beforePayments, pendingWalletAmount, amountSnapshot, _this$store$order$get9, _this$store$order22, _submitResult, _latestAmountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
5547
+ var _this$store$order$get9, _this$store$order24, _this$store$order$get11, _this$store$order$get12, _this$store$order26;
5548
+ var beforePayments, pendingWalletAmount, amountSnapshot, _this$store$order$get10, _this$store$order25, _submitResult, _latestAmountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
5541
5549
  return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5542
5550
  while (1) switch (_context54.prev = _context54.next) {
5543
5551
  case 0:
@@ -5549,7 +5557,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5549
5557
  case 2:
5550
5558
  beforePayments = cloneDeep(this.store.order.getOrderPayments());
5551
5559
  pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
5552
- amountSnapshot = (_this$store$order$get8 = (_this$store$order21 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get8 === void 0 ? void 0 : _this$store$order$get8.call(_this$store$order21);
5560
+ amountSnapshot = (_this$store$order$get9 = (_this$store$order24 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get9 === void 0 ? void 0 : _this$store$order$get9.call(_this$store$order24);
5553
5561
  if (!pendingWalletAmount.lte(0)) {
5554
5562
  _context54.next = 14;
5555
5563
  break;
@@ -5569,7 +5577,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5569
5577
  }
5570
5578
  throw new Error(getSalesSubmitErrorMessage(_submitResult, '订单提交失败'));
5571
5579
  case 12:
5572
- _latestAmountSnapshot = (_this$store$order$get9 = (_this$store$order22 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get9 === void 0 ? void 0 : _this$store$order$get9.call(_this$store$order22);
5580
+ _latestAmountSnapshot = (_this$store$order$get10 = (_this$store$order25 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get10 === void 0 ? void 0 : _this$store$order$get10.call(_this$store$order25);
5573
5581
  return _context54.abrupt("return", {
5574
5582
  submitResult: _submitResult,
5575
5583
  payments: this.store.order.getOrderPayments(),
@@ -5583,7 +5591,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5583
5591
  }
5584
5592
  throw new Error('Wallet 支付尚未覆盖全部待支付金额');
5585
5593
  case 17:
5586
- beforePaymentStatus = (_this$store$order$get10 = this.store.order.getTempOrder()) === null || _this$store$order$get10 === void 0 ? void 0 : _this$store$order$get10.payment_status;
5594
+ beforePaymentStatus = (_this$store$order$get11 = this.store.order.getTempOrder()) === null || _this$store$order$get11 === void 0 ? void 0 : _this$store$order$get11.payment_status;
5587
5595
  _context54.prev = 18;
5588
5596
  _context54.next = 21;
5589
5597
  return this.submitSalesOrder({
@@ -5635,7 +5643,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5635
5643
  error: _context54.t1 instanceof Error ? _context54.t1.message : String(_context54.t1)
5636
5644
  });
5637
5645
  case 45:
5638
- latestAmountSnapshot = (_this$store$order$get11 = (_this$store$order23 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get11 === void 0 ? void 0 : _this$store$order$get11.call(_this$store$order23);
5646
+ latestAmountSnapshot = (_this$store$order$get12 = (_this$store$order26 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get12 === void 0 ? void 0 : _this$store$order$get12.call(_this$store$order26);
5639
5647
  return _context54.abrupt("return", {
5640
5648
  submitResult: submitResult,
5641
5649
  payments: this.store.order.getOrderPayments(),
@@ -5661,7 +5669,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5661
5669
  key: "payCash",
5662
5670
  value: (function () {
5663
5671
  var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(params) {
5664
- var _this$store$order$get12, _params$actualPaidAmo, _this$otherParams35, _this$window, _this$window$postMess;
5672
+ var _this$store$order$get13, _params$actualPaidAmo, _this$otherParams35, _this$window, _this$window$postMess;
5665
5673
  var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, paymentTimestamp, actualPaidAmount, changeAmount, shopWalletPassId, payments, payment, syncResult, committed, walletState, restoredTempOrder;
5666
5674
  return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5667
5675
  while (1) switch (_context55.prev = _context55.next) {
@@ -5705,7 +5713,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5705
5713
  throw new Error('现金支付金额超过当前待支付金额');
5706
5714
  case 17:
5707
5715
  beforePayments = cloneDeep(this.store.order.getOrderPayments());
5708
- beforePaymentStatus = (_this$store$order$get12 = this.store.order.getTempOrder()) === null || _this$store$order$get12 === void 0 ? void 0 : _this$store$order$get12.payment_status;
5716
+ beforePaymentStatus = (_this$store$order$get13 = this.store.order.getTempOrder()) === null || _this$store$order$get13 === void 0 ? void 0 : _this$store$order$get13.payment_status;
5709
5717
  uniquePaymentNumber = createUuidV4();
5710
5718
  paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
5711
5719
  actualPaidAmount = Number((_params$actualPaidAmo = params.actualPaidAmount) !== null && _params$actualPaidAmo !== void 0 ? _params$actualPaidAmo : amount);
@@ -5816,7 +5824,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5816
5824
  key: "commitPaymentMethodPayment",
5817
5825
  value: (function () {
5818
5826
  var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(params) {
5819
- var _this$store$order$get13, _this$store$order24, _this$store$order$get14, _params$metadata, _params$originAmount;
5827
+ var _this$store$order$get14, _this$store$order27, _this$store$order$get15, _params$metadata, _params$originAmount;
5820
5828
  var amount, paymentMethods, findPaymentMethod, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, beforePayments, beforePaymentStatus, paymentTimestamp, metadata, serviceCharge, serviceFee, payments, payment, syncResult, committed, walletState, restoredTempOrder;
5821
5829
  return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5822
5830
  while (1) switch (_context56.prev = _context56.next) {
@@ -5860,7 +5868,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5860
5868
  }
5861
5869
  throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(params.paymentMethodCode || params.paymentMethodId || ''));
5862
5870
  case 15:
5863
- amountSnapshot = (_this$store$order$get13 = (_this$store$order24 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get13 === void 0 ? void 0 : _this$store$order$get13.call(_this$store$order24);
5871
+ amountSnapshot = (_this$store$order$get14 = (_this$store$order27 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get14 === void 0 ? void 0 : _this$store$order$get14.call(_this$store$order27);
5864
5872
  pendingWalletAmount = this.getPendingWalletPaymentAmount();
5865
5873
  amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
5866
5874
  if (!amountDue.lte(0)) {
@@ -5876,7 +5884,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5876
5884
  throw new Error('支付金额超过当前待支付金额');
5877
5885
  case 22:
5878
5886
  beforePayments = cloneDeep(this.store.order.getOrderPayments());
5879
- beforePaymentStatus = (_this$store$order$get14 = this.store.order.getTempOrder()) === null || _this$store$order$get14 === void 0 ? void 0 : _this$store$order$get14.payment_status;
5887
+ beforePaymentStatus = (_this$store$order$get15 = this.store.order.getTempOrder()) === null || _this$store$order$get15 === void 0 ? void 0 : _this$store$order$get15.payment_status;
5880
5888
  paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
5881
5889
  metadata = _objectSpread(_objectSpread({}, params.metadata || {}), {}, {
5882
5890
  unique_payment_number: ((_params$metadata = params.metadata) === null || _params$metadata === void 0 ? void 0 : _params$metadata.unique_payment_number) || createUuidV4()
@@ -6661,16 +6669,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
6661
6669
  }, {
6662
6670
  key: "getUnfulfilledPromotions",
6663
6671
  value: function getUnfulfilledPromotions() {
6664
- var _this$store$order25;
6665
- return ((_this$store$order25 = this.store.order) === null || _this$store$order25 === void 0 ? void 0 : _this$store$order25.getUnfulfilledPromotions()) || [];
6672
+ var _this$store$order28;
6673
+ return ((_this$store$order28 = this.store.order) === null || _this$store$order28 === void 0 ? void 0 : _this$store$order28.getUnfulfilledPromotions()) || [];
6666
6674
  }
6667
6675
 
6668
6676
  /** 最近一次促销计算输出的赠品操作 diff。 */
6669
6677
  }, {
6670
6678
  key: "getLastGiftActions",
6671
6679
  value: function getLastGiftActions() {
6672
- var _this$store$order26;
6673
- return ((_this$store$order26 = this.store.order) === null || _this$store$order26 === void 0 ? void 0 : _this$store$order26.getLastGiftActions()) || null;
6680
+ var _this$store$order29;
6681
+ return ((_this$store$order29 = this.store.order) === null || _this$store$order29 === void 0 ? void 0 : _this$store$order29.getLastGiftActions()) || null;
6674
6682
  }
6675
6683
 
6676
6684
  // 获取商品列表
@@ -441,10 +441,10 @@ export interface BaseSalesAddLogParams extends BaseSalesLogInput {
441
441
  /** BaseSales.scanPromotionCode 对外的轻量结果(UI 可用 getDiscountList 或 scannedDiscountList 补 Holder) */
442
442
  export interface BaseSalesScanCodeResult {
443
443
  isAvailable: boolean;
444
- /** 卡券已加入 Promotion;可能因次数、时间或当前订单条件而暂时无法应用。 */
444
+ /** 卡券已加入 Promotion;false 时可能是无效、过期或已使用。 */
445
445
  isAccepted?: boolean;
446
446
  type?: 'server' | string;
447
447
  unavailableReason?: 'time_limit' | string;
448
- /** 扫码卡券资料及最新可用状态,供 Holder 补全等流程使用。 */
448
+ /** batchSearch 原始结果;Holder 补全等流程可从这里读取原始卡券。 */
449
449
  scannedDiscountList?: Discount[];
450
450
  }