@pisell/pisellos 0.10.78 → 0.10.80
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.
- package/dist/model/strategy/adapter/promotion/evaluator.js +5 -4
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/Discount/types.d.ts +4 -0
- package/dist/modules/Order/index.js +77 -49
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Rules/index.d.ts +3 -10
- package/dist/modules/Rules/index.js +164 -82
- package/dist/modules/Rules/promotionSelection.d.ts +14 -0
- package/dist/modules/Rules/promotionSelection.js +390 -0
- package/dist/modules/Rules/types.d.ts +9 -0
- package/dist/solution/BaseSales/index.js +41 -21
- package/dist/solution/BaseSales/utils/cartPromotion.js +5 -2
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.d.ts +13 -1
- package/lib/model/strategy/adapter/promotion/evaluator.js +5 -4
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/Discount/types.d.ts +4 -0
- package/lib/modules/Order/index.js +24 -4
- package/lib/modules/Order/types.d.ts +2 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Rules/index.d.ts +3 -10
- package/lib/modules/Rules/index.js +62 -22
- package/lib/modules/Rules/promotionSelection.d.ts +14 -0
- package/lib/modules/Rules/promotionSelection.js +230 -0
- package/lib/modules/Rules/types.d.ts +9 -0
- package/lib/solution/BaseSales/index.js +19 -5
- package/lib/solution/BaseSales/utils/cartPromotion.js +5 -2
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.d.ts +13 -1
- package/package.json +1 -1
|
@@ -807,6 +807,7 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
807
807
|
_iterator12.f();
|
|
808
808
|
}
|
|
809
809
|
var allocatedPricesByProductId = new Map();
|
|
810
|
+
var expectedPromoTotal = new Decimal(0);
|
|
810
811
|
for (var g = 0; g < groupCount; g++) {
|
|
811
812
|
var startIdx = g * x;
|
|
812
813
|
var endIdx = startIdx + x;
|
|
@@ -817,8 +818,9 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
817
818
|
return sum.plus(u.price);
|
|
818
819
|
}, new Decimal(0));
|
|
819
820
|
|
|
820
|
-
//
|
|
821
|
-
var groupPriceDecimal = new Decimal(groupPrice);
|
|
821
|
+
// 组价高于本组原价时保留原价,尾差目标也必须使用封顶后的实际组价。
|
|
822
|
+
var groupPriceDecimal = Decimal.min(new Decimal(groupPrice), groupOriginalTotal);
|
|
823
|
+
expectedPromoTotal = expectedPromoTotal.plus(groupPriceDecimal);
|
|
822
824
|
var allocatedSum = new Decimal(0);
|
|
823
825
|
for (var i = 0; i < groupUnits.length; i++) {
|
|
824
826
|
var unit = groupUnits[i];
|
|
@@ -926,14 +928,13 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
926
928
|
processedQuantityMap.set(_key, _processedQty + _availableQty);
|
|
927
929
|
}
|
|
928
930
|
|
|
929
|
-
// 8.
|
|
931
|
+
// 8. 尾差调整:只补实际组价的舍入差额,不将高于原价的组价补到某一件。
|
|
930
932
|
} catch (err) {
|
|
931
933
|
_iterator13.e(err);
|
|
932
934
|
} finally {
|
|
933
935
|
_iterator13.f();
|
|
934
936
|
}
|
|
935
937
|
if (groupCount > 0) {
|
|
936
|
-
var expectedPromoTotal = new Decimal(groupPrice).mul(groupCount);
|
|
937
938
|
var promoItems = result.filter(function (p) {
|
|
938
939
|
return p.inPromotion;
|
|
939
940
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// 导出评估器
|
|
2
|
+
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
+
|
|
4
|
+
// 导出适配器
|
|
5
|
+
export { PromotionAdapter } from "./adapter";
|
|
6
|
+
export { default } from "./adapter";
|
|
7
|
+
|
|
8
|
+
// 导出策略配置示例常量
|
|
9
|
+
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
|
|
@@ -158,6 +158,10 @@ export interface Discount {
|
|
|
158
158
|
discount_calculation_mode: 'item_level' | 'order_level';
|
|
159
159
|
};
|
|
160
160
|
isManualSelect?: boolean;
|
|
161
|
+
/** X 件 Y 元互斥选择的手动意图;isSelected 只表示本次实际应用结果。 */
|
|
162
|
+
promotionSelection?: 'card' | 'promotion';
|
|
163
|
+
/** 记录手动操作影响的促销组,避免卡失效后普通重算丢失取消意图。 */
|
|
164
|
+
promotionSelectionStrategyIds?: string[];
|
|
161
165
|
isDisabled?: boolean;
|
|
162
166
|
isSelected?: boolean;
|
|
163
167
|
isAvailable?: boolean;
|
|
@@ -867,7 +867,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
867
867
|
_this$store$discount,
|
|
868
868
|
_this7 = this,
|
|
869
869
|
_this$store$tempOrder3;
|
|
870
|
-
var orderId, requestEpoch, requestOrderIdentityKey, prepareConfigResult, isCurrentRequest, discountList, _this$store$discount2, _this$store$discount3, _this$store$discount4, currentDiscountList, currentCommittedDiscounts, currentScanDiscounts, currentScanDiscountById, committedDiscountById, mergedCommittedDiscountIds, refreshedScanDiscountIds, runtimeDiscountIds, runtimeDiscounts, retainedCommittedDiscounts, retainedScanDiscounts, mergedDiscountList;
|
|
870
|
+
var orderId, requestEpoch, requestOrderIdentityKey, prepareConfigResult, isCurrentRequest, discountList, _this$store$discount2, _this$store$discount3, _this$store$discount4, currentDiscountList, currentPromotionSelections, currentCommittedDiscounts, currentScanDiscounts, currentScanDiscountById, committedDiscountById, mergedCommittedDiscountIds, refreshedScanDiscountIds, runtimeDiscountIds, runtimeDiscounts, retainedCommittedDiscounts, retainedScanDiscounts, mergedDiscountList;
|
|
871
871
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
872
872
|
while (1) switch (_context6.prev = _context6.next) {
|
|
873
873
|
case 0:
|
|
@@ -912,10 +912,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
912
912
|
});
|
|
913
913
|
}
|
|
914
914
|
if (!discountList) {
|
|
915
|
-
_context6.next =
|
|
915
|
+
_context6.next = 33;
|
|
916
916
|
break;
|
|
917
917
|
}
|
|
918
918
|
currentDiscountList = ((_this$store$discount2 = this.store.discount) === null || _this$store$discount2 === void 0 ? void 0 : _this$store$discount2.getDiscountList()) || [];
|
|
919
|
+
currentPromotionSelections = new Map(currentDiscountList.filter(function (discount) {
|
|
920
|
+
return !discount.isEditMode && discount.promotionSelection;
|
|
921
|
+
}).map(function (discount) {
|
|
922
|
+
return [String(discount.id), discount];
|
|
923
|
+
}));
|
|
919
924
|
currentCommittedDiscounts = currentDiscountList.filter(function (discount) {
|
|
920
925
|
var _discount$committedAp;
|
|
921
926
|
return (discount === null || discount === void 0 ? void 0 : discount.isEditMode) || (discount === null || discount === void 0 || (_discount$committedAp = discount.committedAppliedProductDetails) === null || _discount$committedAp === void 0 ? void 0 : _discount$committedAp.length);
|
|
@@ -958,6 +963,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
958
963
|
isManualSelect: (_currentScanDiscount$2 = currentScanDiscount.isManualSelect) !== null && _currentScanDiscount$2 !== void 0 ? _currentScanDiscount$2 : nextDiscount.isManualSelect
|
|
959
964
|
});
|
|
960
965
|
}
|
|
966
|
+
var currentSelection = currentPromotionSelections.get(String(discount.id));
|
|
967
|
+
if (currentSelection) {
|
|
968
|
+
nextDiscount = _objectSpread(_objectSpread({}, nextDiscount), {}, {
|
|
969
|
+
promotionSelection: currentSelection.promotionSelection,
|
|
970
|
+
promotionSelectionStrategyIds: currentSelection.promotionSelectionStrategyIds,
|
|
971
|
+
isManualSelect: currentSelection.isManualSelect,
|
|
972
|
+
isSelected: currentSelection.isSelected
|
|
973
|
+
});
|
|
974
|
+
}
|
|
961
975
|
return [nextDiscount];
|
|
962
976
|
});
|
|
963
977
|
retainedCommittedDiscounts = currentCommittedDiscounts.filter(function (discount) {
|
|
@@ -979,34 +993,34 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
979
993
|
});
|
|
980
994
|
mergedDiscountList = [].concat(_toConsumableArray(retainedCommittedDiscounts), _toConsumableArray(retainedScanDiscounts), _toConsumableArray(runtimeDiscounts));
|
|
981
995
|
if (isCurrentRequest()) {
|
|
982
|
-
_context6.next =
|
|
996
|
+
_context6.next = 27;
|
|
983
997
|
break;
|
|
984
998
|
}
|
|
985
999
|
return _context6.abrupt("return", this.getDiscountList());
|
|
986
|
-
case
|
|
987
|
-
_context6.next =
|
|
1000
|
+
case 27:
|
|
1001
|
+
_context6.next = 29;
|
|
988
1002
|
return (_this$store$discount3 = this.store.discount) === null || _this$store$discount3 === void 0 ? void 0 : _this$store$discount3.setOriginalDiscountList(mergedDiscountList);
|
|
989
|
-
case
|
|
1003
|
+
case 29:
|
|
990
1004
|
if (isCurrentRequest()) {
|
|
991
|
-
_context6.next =
|
|
1005
|
+
_context6.next = 31;
|
|
992
1006
|
break;
|
|
993
1007
|
}
|
|
994
1008
|
return _context6.abrupt("return", this.getDiscountList());
|
|
995
|
-
case
|
|
996
|
-
_context6.next =
|
|
1009
|
+
case 31:
|
|
1010
|
+
_context6.next = 33;
|
|
997
1011
|
return (_this$store$discount4 = this.store.discount) === null || _this$store$discount4 === void 0 ? void 0 : _this$store$discount4.setDiscountList(mergedDiscountList);
|
|
998
|
-
case
|
|
1012
|
+
case 33:
|
|
999
1013
|
if (isCurrentRequest()) {
|
|
1000
|
-
_context6.next =
|
|
1014
|
+
_context6.next = 35;
|
|
1001
1015
|
break;
|
|
1002
1016
|
}
|
|
1003
1017
|
return _context6.abrupt("return", this.getDiscountList());
|
|
1004
|
-
case
|
|
1018
|
+
case 35:
|
|
1005
1019
|
if (params.apply !== false && (_this$store$tempOrder3 = this.store.tempOrder) !== null && _this$store$tempOrder3 !== void 0 && (_this$store$tempOrder3 = _this$store$tempOrder3.products) !== null && _this$store$tempOrder3 !== void 0 && _this$store$tempOrder3.length) {
|
|
1006
1020
|
this.applyDiscount();
|
|
1007
1021
|
}
|
|
1008
1022
|
return _context6.abrupt("return", this.getDiscountList());
|
|
1009
|
-
case
|
|
1023
|
+
case 37:
|
|
1010
1024
|
case "end":
|
|
1011
1025
|
return _context6.stop();
|
|
1012
1026
|
}
|
|
@@ -7142,7 +7156,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
7142
7156
|
case 0:
|
|
7143
7157
|
return _context44.abrupt("return", this.queueCartCommand(function () {
|
|
7144
7158
|
return _this49.removeProductsFromOrderDraft(identities, options);
|
|
7145
|
-
}, Boolean(options === null || options === void 0 ? void 0 : options.isCurrentOrder)));
|
|
7159
|
+
}, Boolean((options === null || options === void 0 ? void 0 : options.isCurrentOrder) || (options === null || options === void 0 ? void 0 : options.beforeApply))));
|
|
7146
7160
|
case 1:
|
|
7147
7161
|
case "end":
|
|
7148
7162
|
return _context44.stop();
|
|
@@ -7158,8 +7172,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
7158
7172
|
key: "removeProductsFromOrderDraft",
|
|
7159
7173
|
value: function () {
|
|
7160
7174
|
var _removeProductsFromOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(identities, options) {
|
|
7161
|
-
var
|
|
7162
|
-
|
|
7175
|
+
var _options$beforeApply3,
|
|
7176
|
+
_this50 = this;
|
|
7177
|
+
var _this$store$tempOrder10, _this$store$tempOrder11, guarded, mutation, tempOrder, identity, isCurrentOrder, beforeCommit, productsBeforeRemove, bookingsBeforeRemove, preserveDisplayPosition, anchorIndex, productsAfterAnchor, matchedProducts, removedProducts, _i2, _removedProducts, product, linkedBookingUidsToRemove, _iterator28, _step28, _loop5, remainingProductIndex, remainingProduct, nextProduct, productsWithoutRemaining, nextProductIndex;
|
|
7163
7178
|
return _regeneratorRuntime().wrap(function _callee41$(_context46) {
|
|
7164
7179
|
while (1) switch (_context46.prev = _context46.next) {
|
|
7165
7180
|
case 0:
|
|
@@ -7169,8 +7184,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
7169
7184
|
}
|
|
7170
7185
|
return _context46.abrupt("return", ((_this$store$tempOrder10 = this.store.tempOrder) === null || _this$store$tempOrder10 === void 0 ? void 0 : _this$store$tempOrder10.products) || []);
|
|
7171
7186
|
case 2:
|
|
7187
|
+
// Validate inside the command queue, before creating or mutating the draft.
|
|
7188
|
+
if (identities.length) options === null || options === void 0 || (_options$beforeApply3 = options.beforeApply) === null || _options$beforeApply3 === void 0 || _options$beforeApply3.call(options);
|
|
7189
|
+
if (!(options !== null && options !== void 0 && options.isCurrentOrder && !options.isCurrentOrder())) {
|
|
7190
|
+
_context46.next = 5;
|
|
7191
|
+
break;
|
|
7192
|
+
}
|
|
7193
|
+
return _context46.abrupt("return", ((_this$store$tempOrder11 = this.store.tempOrder) === null || _this$store$tempOrder11 === void 0 ? void 0 : _this$store$tempOrder11.products) || []);
|
|
7194
|
+
case 5:
|
|
7195
|
+
guarded = Boolean((options === null || options === void 0 ? void 0 : options.isCurrentOrder) || (options === null || options === void 0 ? void 0 : options.beforeApply));
|
|
7172
7196
|
mutation = this.beginCartMutation({
|
|
7173
|
-
forceDraft:
|
|
7197
|
+
forceDraft: guarded
|
|
7174
7198
|
});
|
|
7175
7199
|
tempOrder = mutation.draft;
|
|
7176
7200
|
identity = [mutation.current.order_id, mutation.current.external_sale_number];
|
|
@@ -7178,17 +7202,21 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
7178
7202
|
var _options$isCurrentOrd3, _options$isCurrentOrd4;
|
|
7179
7203
|
return _this50.store.tempOrder === mutation.current && mutation.current.order_id === identity[0] && mutation.current.external_sale_number === identity[1] && ((_options$isCurrentOrd3 = options === null || options === void 0 || (_options$isCurrentOrd4 = options.isCurrentOrder) === null || _options$isCurrentOrd4 === void 0 ? void 0 : _options$isCurrentOrd4.call(options)) !== null && _options$isCurrentOrd3 !== void 0 ? _options$isCurrentOrd3 : true);
|
|
7180
7204
|
};
|
|
7181
|
-
beforeCommit =
|
|
7205
|
+
beforeCommit = guarded ? function () {
|
|
7206
|
+
var _options$beforeApply4;
|
|
7207
|
+
// Inventory validation can await. Recheck the live source snapshot before
|
|
7208
|
+
// publication; never run this row-snapshot guard during finalization.
|
|
7209
|
+
options === null || options === void 0 || (_options$beforeApply4 = options.beforeApply) === null || _options$beforeApply4 === void 0 || _options$beforeApply4.call(options);
|
|
7182
7210
|
if (!isCurrentOrder()) throw Object.assign(new Error('Order product removal interrupted by an order change'), {
|
|
7183
7211
|
code: 'AVAILABILITY_SELECTION_STALE'
|
|
7184
7212
|
});
|
|
7185
7213
|
} : undefined;
|
|
7186
7214
|
if (identities.length) {
|
|
7187
|
-
_context46.next =
|
|
7215
|
+
_context46.next = 13;
|
|
7188
7216
|
break;
|
|
7189
7217
|
}
|
|
7190
7218
|
return _context46.abrupt("return", tempOrder.products);
|
|
7191
|
-
case
|
|
7219
|
+
case 13:
|
|
7192
7220
|
// 商品删除会同步删除以商品行为主关系的 Notes;快照不完整时禁止产生孤儿 Relation。
|
|
7193
7221
|
this.ensureSalesNotesLoadedForMutation(tempOrder);
|
|
7194
7222
|
this.repairDuplicateProductLineIdentities(tempOrder);
|
|
@@ -7220,7 +7248,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
7220
7248
|
}
|
|
7221
7249
|
linkedBookingUidsToRemove = new Set();
|
|
7222
7250
|
_iterator28 = _createForOfIteratorHelper(matchedProducts);
|
|
7223
|
-
_context46.prev =
|
|
7251
|
+
_context46.prev = 26;
|
|
7224
7252
|
_loop5 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop5() {
|
|
7225
7253
|
var _metadata11, _metadata12, _metadata13, _metadata14;
|
|
7226
7254
|
var product, productUid, productBookingUid, isAddTimeProduct;
|
|
@@ -7255,33 +7283,33 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
7255
7283
|
}, _loop5);
|
|
7256
7284
|
});
|
|
7257
7285
|
_iterator28.s();
|
|
7258
|
-
case
|
|
7286
|
+
case 29:
|
|
7259
7287
|
if ((_step28 = _iterator28.n()).done) {
|
|
7260
|
-
_context46.next =
|
|
7288
|
+
_context46.next = 35;
|
|
7261
7289
|
break;
|
|
7262
7290
|
}
|
|
7263
|
-
return _context46.delegateYield(_loop5(), "t0",
|
|
7264
|
-
case
|
|
7291
|
+
return _context46.delegateYield(_loop5(), "t0", 31);
|
|
7292
|
+
case 31:
|
|
7265
7293
|
if (!_context46.t0) {
|
|
7266
|
-
_context46.next =
|
|
7294
|
+
_context46.next = 33;
|
|
7267
7295
|
break;
|
|
7268
7296
|
}
|
|
7269
|
-
return _context46.abrupt("continue",
|
|
7270
|
-
case
|
|
7271
|
-
_context46.next =
|
|
7297
|
+
return _context46.abrupt("continue", 33);
|
|
7298
|
+
case 33:
|
|
7299
|
+
_context46.next = 29;
|
|
7272
7300
|
break;
|
|
7273
|
-
case
|
|
7274
|
-
_context46.next =
|
|
7301
|
+
case 35:
|
|
7302
|
+
_context46.next = 40;
|
|
7275
7303
|
break;
|
|
7276
|
-
case
|
|
7277
|
-
_context46.prev =
|
|
7278
|
-
_context46.t1 = _context46["catch"](
|
|
7304
|
+
case 37:
|
|
7305
|
+
_context46.prev = 37;
|
|
7306
|
+
_context46.t1 = _context46["catch"](26);
|
|
7279
7307
|
_iterator28.e(_context46.t1);
|
|
7280
|
-
case
|
|
7281
|
-
_context46.prev =
|
|
7308
|
+
case 40:
|
|
7309
|
+
_context46.prev = 40;
|
|
7282
7310
|
_iterator28.f();
|
|
7283
|
-
return _context46.finish(
|
|
7284
|
-
case
|
|
7311
|
+
return _context46.finish(40);
|
|
7312
|
+
case 43:
|
|
7285
7313
|
if (linkedBookingUidsToRemove.size > 0) {
|
|
7286
7314
|
// 删除主预约商品时,同步移除挂在同一 booking_uid 下的加时商品,避免残留孤儿行。
|
|
7287
7315
|
tempOrder.products = (tempOrder.products || []).filter(function (line) {
|
|
@@ -7312,28 +7340,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
7312
7340
|
}));
|
|
7313
7341
|
this.removeSalesNotesForMissingProductLines(tempOrder);
|
|
7314
7342
|
if (!mutation.commit) {
|
|
7315
|
-
_context46.next =
|
|
7343
|
+
_context46.next = 51;
|
|
7316
7344
|
break;
|
|
7317
7345
|
}
|
|
7318
|
-
_context46.next =
|
|
7346
|
+
_context46.next = 50;
|
|
7319
7347
|
return mutation.commit(beforeCommit);
|
|
7320
|
-
case
|
|
7348
|
+
case 50:
|
|
7321
7349
|
tempOrder = _context46.sent;
|
|
7322
|
-
case
|
|
7323
|
-
_context46.next =
|
|
7324
|
-
return this.finalizeAfterProductsMutation(tempOrder,
|
|
7350
|
+
case 51:
|
|
7351
|
+
_context46.next = 53;
|
|
7352
|
+
return this.finalizeAfterProductsMutation(tempOrder, guarded ? {
|
|
7325
7353
|
isCurrentOrder: isCurrentOrder
|
|
7326
7354
|
} : undefined);
|
|
7327
|
-
case
|
|
7355
|
+
case 53:
|
|
7328
7356
|
this.logInfo('removeProductsFromOrder success', {
|
|
7329
7357
|
identities: identities
|
|
7330
7358
|
});
|
|
7331
7359
|
return _context46.abrupt("return", tempOrder.products);
|
|
7332
|
-
case
|
|
7360
|
+
case 55:
|
|
7333
7361
|
case "end":
|
|
7334
7362
|
return _context46.stop();
|
|
7335
7363
|
}
|
|
7336
|
-
}, _callee41, this, [[
|
|
7364
|
+
}, _callee41, this, [[26, 37, 40, 43]]);
|
|
7337
7365
|
}));
|
|
7338
7366
|
function removeProductsFromOrderDraft(_x53, _x54) {
|
|
7339
7367
|
return _removeProductsFromOrderDraft.apply(this, arguments);
|
|
@@ -9130,8 +9158,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
9130
9158
|
}, {
|
|
9131
9159
|
key: "getVouchers",
|
|
9132
9160
|
value: function getVouchers() {
|
|
9133
|
-
var _this$store$
|
|
9134
|
-
return ((_this$store$
|
|
9161
|
+
var _this$store$tempOrder12;
|
|
9162
|
+
return ((_this$store$tempOrder12 = this.store.tempOrder) === null || _this$store$tempOrder12 === void 0 ? void 0 : _this$store$tempOrder12.vouchers) || [];
|
|
9135
9163
|
}
|
|
9136
9164
|
}], [{
|
|
9137
9165
|
key: "populateSavedAmounts",
|
|
@@ -482,6 +482,8 @@ export interface ReplaceBookingProductWithRelatedRetailParams {
|
|
|
482
482
|
* 预约合并行减量时仍删除最新真实行,再把剩余代表行移动到被删除代表行原位置。
|
|
483
483
|
*/
|
|
484
484
|
export interface RemoveProductsFromOrderOptions {
|
|
485
|
+
/** Synchronous, read-only validation before draft mutation and again before publication after async guards; may throw. Never called during finalization. */
|
|
486
|
+
beforeApply?: () => void;
|
|
485
487
|
/** Prevent an asynchronous deletion/finalization from crossing order or business scopes. */
|
|
486
488
|
isCurrentOrder?: () => boolean;
|
|
487
489
|
preserveDisplayPosition?: {
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { Rules, RulesModuleAPI, DiscountResult, RulesFormSubject, RulesCalcDiscountOptions, UnavailableReason } from './types';
|
|
3
|
+
import { Rules, RulesModuleAPI, DiscountResult, RulesFormSubject, RulesCalcDiscountOptions, RulesCalcDiscountParams, UnavailableReason } from './types';
|
|
4
4
|
import { Discount } from '../Discount/types';
|
|
5
5
|
import { WindowPlugin } from '../../plugins';
|
|
6
6
|
export declare class RulesModule extends BaseModule implements Module, RulesModuleAPI {
|
|
@@ -46,15 +46,8 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
46
46
|
resolveDiscountListForManualOverride(discountList: Discount[]): Discount[];
|
|
47
47
|
private isItemRewardProductDiscount;
|
|
48
48
|
private getUnavailableReason;
|
|
49
|
-
calcDiscount(
|
|
50
|
-
|
|
51
|
-
productList: any[];
|
|
52
|
-
holders: {
|
|
53
|
-
form_record_id: number;
|
|
54
|
-
}[];
|
|
55
|
-
isFormSubject: RulesFormSubject;
|
|
56
|
-
orderTotalAmount: number;
|
|
57
|
-
}, options?: RulesCalcDiscountOptions): DiscountResult;
|
|
49
|
+
calcDiscount(params: RulesCalcDiscountParams, options?: RulesCalcDiscountOptions): DiscountResult;
|
|
50
|
+
private calcDiscountCore;
|
|
58
51
|
/**
|
|
59
52
|
* 检查优惠是否符合 PackageSubItemUsageRules 配置
|
|
60
53
|
* @param discount 优惠券
|