@pisell/pisellos 0.10.77 → 0.10.79
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/modules/Discount/types.d.ts +4 -0
- package/dist/modules/Order/index.js +27 -13
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/ProductList/index.d.ts +2 -0
- package/dist/modules/ProductList/index.js +125 -39
- package/dist/modules/ResourcePlanner/planner.js +5 -0
- 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.d.ts +12 -1
- package/dist/solution/BaseSales/index.js +316 -206
- 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 +1 -13
- package/dist/solution/UnifiedBookingSales/index.d.ts +23 -1
- package/dist/solution/UnifiedBookingSales/index.js +1307 -635
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.js +271 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +25 -2
- package/dist/solution/UnifiedBookingSales/types.js +2 -0
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +277 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +5 -4
- package/lib/modules/Discount/types.d.ts +4 -0
- package/lib/modules/Order/index.js +11 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ProductList/index.d.ts +2 -0
- package/lib/modules/ProductList/index.js +56 -0
- package/lib/modules/ResourcePlanner/planner.js +4 -0
- 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.d.ts +12 -1
- package/lib/solution/BaseSales/index.js +84 -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 +1 -13
- package/lib/solution/UnifiedBookingSales/index.d.ts +23 -1
- package/lib/solution/UnifiedBookingSales/index.js +359 -5
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.js +199 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +25 -2
- package/lib/solution/UnifiedBookingSales/types.js +1 -0
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +151 -0
- 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
|
});
|
|
@@ -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
|
}
|
|
@@ -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(): "duration" | "session" | "normal";
|
|
53
53
|
}
|
|
@@ -37,6 +37,8 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
37
37
|
schedule_date?: string;
|
|
38
38
|
channel?: string;
|
|
39
39
|
}): Promise<any>;
|
|
40
|
+
/** Venue-only raw, complete pool load. No date/customer evaluation and no shared catalog publication. */
|
|
41
|
+
loadVenueCatalogPool(params?: Pick<ProductListLoadProductsParams, 'product_ids' | 'collection' | 'category_ids' | 'extension_type' | 'cacheId'>): Promise<ProductData[]>;
|
|
40
42
|
/**
|
|
41
43
|
* Remember raw remote product records before client-side Data Variant
|
|
42
44
|
* evaluation. Quote-only reads can then always start from a clean baseline.
|
|
@@ -413,11 +413,97 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
413
413
|
return _loadProductsPrice.apply(this, arguments);
|
|
414
414
|
}
|
|
415
415
|
return loadProductsPrice;
|
|
416
|
+
}() /** Venue-only raw, complete pool load. No date/customer evaluation and no shared catalog publication. */
|
|
417
|
+
}, {
|
|
418
|
+
key: "loadVenueCatalogPool",
|
|
419
|
+
value: (function () {
|
|
420
|
+
var _loadVenueCatalogPool = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
421
|
+
var _this$otherParams5, _params$product_ids, _params$category_ids, _params$extension_typ, _ref4, _data$total;
|
|
422
|
+
var params,
|
|
423
|
+
channelMap,
|
|
424
|
+
channel,
|
|
425
|
+
response,
|
|
426
|
+
data,
|
|
427
|
+
total,
|
|
428
|
+
_args7 = arguments;
|
|
429
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
430
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
431
|
+
case 0:
|
|
432
|
+
params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
|
|
433
|
+
channelMap = {
|
|
434
|
+
online_store: 'online-store',
|
|
435
|
+
scan_to_order: 'online-store',
|
|
436
|
+
'scan-to-order': 'online-store',
|
|
437
|
+
scan_to_order_2: 'online-store',
|
|
438
|
+
scan_to_order_3: 'scantoorder3'
|
|
439
|
+
};
|
|
440
|
+
channel = (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.channel;
|
|
441
|
+
_context7.next = 5;
|
|
442
|
+
return this.request.post('/product/query', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
443
|
+
// The customer endpoint otherwise filters out future/variant members.
|
|
444
|
+
open_quotation: 0,
|
|
445
|
+
open_bundle: 1,
|
|
446
|
+
with: _toConsumableArray(PRODUCT_QUERY_DATA_VARIANT_RELATIONS),
|
|
447
|
+
with_count: ['bundleGroup', 'optionGroup'],
|
|
448
|
+
with_schedule: 1,
|
|
449
|
+
status: 'published',
|
|
450
|
+
num: 500,
|
|
451
|
+
skip: 1,
|
|
452
|
+
is_eject: 1,
|
|
453
|
+
// Channel is stable for this runtime owner and remains a server publication
|
|
454
|
+
// filter. Date/customer/menu membership and pricing are evaluated locally.
|
|
455
|
+
application_code: typeof channel === 'string' ? channelMap[channel] || channel : channel
|
|
456
|
+
}, (_params$product_ids = params.product_ids) !== null && _params$product_ids !== void 0 && _params$product_ids.length ? {
|
|
457
|
+
ids: params.product_ids
|
|
458
|
+
} : {}), params.collection ? {
|
|
459
|
+
collection: params.collection
|
|
460
|
+
} : {}), (_params$category_ids = params.category_ids) !== null && _params$category_ids !== void 0 && _params$category_ids.length ? {
|
|
461
|
+
category_ids: params.category_ids
|
|
462
|
+
} : {}), (_params$extension_typ = params.extension_type) !== null && _params$extension_typ !== void 0 && _params$extension_typ.length ? {
|
|
463
|
+
extension_type: params.extension_type
|
|
464
|
+
} : {}), {}, {
|
|
465
|
+
front_end_cache_id: params.cacheId
|
|
466
|
+
}), {
|
|
467
|
+
useCache: false,
|
|
468
|
+
customToast: function customToast() {}
|
|
469
|
+
});
|
|
470
|
+
case 5:
|
|
471
|
+
response = _context7.sent;
|
|
472
|
+
data = response === null || response === void 0 ? void 0 : response.data;
|
|
473
|
+
if (!((response === null || response === void 0 ? void 0 : response.status) === false || (response === null || response === void 0 ? void 0 : response.code) != null && Number(response.code) !== 200 || !Array.isArray(data === null || data === void 0 ? void 0 : data.list))) {
|
|
474
|
+
_context7.next = 9;
|
|
475
|
+
break;
|
|
476
|
+
}
|
|
477
|
+
throw Object.assign(new Error((response === null || response === void 0 ? void 0 : response.message) || 'The complete venue product pool could not be loaded.'), {
|
|
478
|
+
code: 'VENUE_CATALOG_LOAD_FAILED'
|
|
479
|
+
});
|
|
480
|
+
case 9:
|
|
481
|
+
total = (_ref4 = (_data$total = data.total) !== null && _data$total !== void 0 ? _data$total : data.total_count) !== null && _ref4 !== void 0 ? _ref4 : data.total_num;
|
|
482
|
+
if (!(total != null && Number.isFinite(Number(total)) && Number(total) > data.list.length || total == null && data.list.length >= 500)) {
|
|
483
|
+
_context7.next = 12;
|
|
484
|
+
break;
|
|
485
|
+
}
|
|
486
|
+
throw Object.assign(new Error('The venue product pool is incomplete. A single complete catalog response is required.'), {
|
|
487
|
+
code: 'VENUE_CATALOG_INCOMPLETE'
|
|
488
|
+
});
|
|
489
|
+
case 12:
|
|
490
|
+
return _context7.abrupt("return", cloneDeep(data.list));
|
|
491
|
+
case 13:
|
|
492
|
+
case "end":
|
|
493
|
+
return _context7.stop();
|
|
494
|
+
}
|
|
495
|
+
}, _callee7, this);
|
|
496
|
+
}));
|
|
497
|
+
function loadVenueCatalogPool() {
|
|
498
|
+
return _loadVenueCatalogPool.apply(this, arguments);
|
|
499
|
+
}
|
|
500
|
+
return loadVenueCatalogPool;
|
|
416
501
|
}()
|
|
417
502
|
/**
|
|
418
503
|
* Remember raw remote product records before client-side Data Variant
|
|
419
504
|
* evaluation. Quote-only reads can then always start from a clean baseline.
|
|
420
505
|
*/
|
|
506
|
+
)
|
|
421
507
|
}, {
|
|
422
508
|
key: "rememberRawProductQueryResult",
|
|
423
509
|
value: function rememberRawProductQueryResult(products) {
|
|
@@ -471,19 +557,19 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
471
557
|
}, {
|
|
472
558
|
key: "getProducts",
|
|
473
559
|
value: function () {
|
|
474
|
-
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
475
|
-
return _regeneratorRuntime().wrap(function
|
|
476
|
-
while (1) switch (
|
|
560
|
+
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
561
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
562
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
477
563
|
case 0:
|
|
478
|
-
|
|
564
|
+
_context8.next = 2;
|
|
479
565
|
return this.core.effects.emit("".concat(this.name, ":onGetProducts"), this.store.list);
|
|
480
566
|
case 2:
|
|
481
|
-
return
|
|
567
|
+
return _context8.abrupt("return", cloneDeep(this.store.list));
|
|
482
568
|
case 3:
|
|
483
569
|
case "end":
|
|
484
|
-
return
|
|
570
|
+
return _context8.stop();
|
|
485
571
|
}
|
|
486
|
-
},
|
|
572
|
+
}, _callee8, this);
|
|
487
573
|
}));
|
|
488
574
|
function getProducts() {
|
|
489
575
|
return _getProducts.apply(this, arguments);
|
|
@@ -493,23 +579,23 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
493
579
|
}, {
|
|
494
580
|
key: "getProduct",
|
|
495
581
|
value: function () {
|
|
496
|
-
var _getProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
582
|
+
var _getProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(id) {
|
|
497
583
|
var product;
|
|
498
|
-
return _regeneratorRuntime().wrap(function
|
|
499
|
-
while (1) switch (
|
|
584
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
585
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
500
586
|
case 0:
|
|
501
|
-
|
|
587
|
+
_context9.next = 2;
|
|
502
588
|
return this.core.effects.emit("".concat(this.name, ":onGetProduct"), this.store.list);
|
|
503
589
|
case 2:
|
|
504
590
|
product = this.store.list.find(function (product) {
|
|
505
591
|
return product.id === id;
|
|
506
592
|
});
|
|
507
|
-
return
|
|
593
|
+
return _context9.abrupt("return", product ? cloneDeep(product) : undefined);
|
|
508
594
|
case 4:
|
|
509
595
|
case "end":
|
|
510
|
-
return
|
|
596
|
+
return _context9.stop();
|
|
511
597
|
}
|
|
512
|
-
},
|
|
598
|
+
}, _callee9, this);
|
|
513
599
|
}));
|
|
514
600
|
function getProduct(_x7) {
|
|
515
601
|
return _getProduct.apply(this, arguments);
|
|
@@ -519,7 +605,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
519
605
|
}, {
|
|
520
606
|
key: "queryProducts",
|
|
521
607
|
value: function () {
|
|
522
|
-
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
608
|
+
var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
523
609
|
var params,
|
|
524
610
|
includeIds,
|
|
525
611
|
excludeIds,
|
|
@@ -530,11 +616,11 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
530
616
|
channelApplications,
|
|
531
617
|
codeOrBarcode,
|
|
532
618
|
products,
|
|
533
|
-
|
|
534
|
-
return _regeneratorRuntime().wrap(function
|
|
535
|
-
while (1) switch (
|
|
619
|
+
_args10 = arguments;
|
|
620
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
621
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
536
622
|
case 0:
|
|
537
|
-
params =
|
|
623
|
+
params = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {};
|
|
538
624
|
includeIds = normalizeQuerySet(params.includeIds);
|
|
539
625
|
excludeIds = normalizeQuerySet(params.excludeIds);
|
|
540
626
|
categoryIds = normalizeQuerySet(params.categoryIds);
|
|
@@ -573,12 +659,12 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
573
659
|
}
|
|
574
660
|
return true;
|
|
575
661
|
});
|
|
576
|
-
return
|
|
662
|
+
return _context10.abrupt("return", cloneDeep(products));
|
|
577
663
|
case 11:
|
|
578
664
|
case "end":
|
|
579
|
-
return
|
|
665
|
+
return _context10.stop();
|
|
580
666
|
}
|
|
581
|
-
},
|
|
667
|
+
}, _callee10, this);
|
|
582
668
|
}));
|
|
583
669
|
function queryProducts() {
|
|
584
670
|
return _queryProducts.apply(this, arguments);
|
|
@@ -588,21 +674,21 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
588
674
|
}, {
|
|
589
675
|
key: "getProductByIds",
|
|
590
676
|
value: function () {
|
|
591
|
-
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
592
|
-
return _regeneratorRuntime().wrap(function
|
|
593
|
-
while (1) switch (
|
|
677
|
+
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(ids) {
|
|
678
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
679
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
594
680
|
case 0:
|
|
595
|
-
|
|
681
|
+
_context11.next = 2;
|
|
596
682
|
return this.core.effects.emit("".concat(this.name, ":onGetProductByIds"), this.store.list);
|
|
597
683
|
case 2:
|
|
598
|
-
return
|
|
684
|
+
return _context11.abrupt("return", this.queryProducts({
|
|
599
685
|
includeIds: ids
|
|
600
686
|
}));
|
|
601
687
|
case 3:
|
|
602
688
|
case "end":
|
|
603
|
-
return
|
|
689
|
+
return _context11.stop();
|
|
604
690
|
}
|
|
605
|
-
},
|
|
691
|
+
}, _callee11, this);
|
|
606
692
|
}));
|
|
607
693
|
function getProductByIds(_x8) {
|
|
608
694
|
return _getProductByIds.apply(this, arguments);
|
|
@@ -612,10 +698,10 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
612
698
|
}, {
|
|
613
699
|
key: "addProduct",
|
|
614
700
|
value: function () {
|
|
615
|
-
var _addProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
701
|
+
var _addProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(products) {
|
|
616
702
|
var _this6 = this;
|
|
617
|
-
return _regeneratorRuntime().wrap(function
|
|
618
|
-
while (1) switch (
|
|
703
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
704
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
619
705
|
case 0:
|
|
620
706
|
// list 需要根据 id 去重
|
|
621
707
|
if (!this.store.list) {
|
|
@@ -638,9 +724,9 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
638
724
|
this.core.effects.emit("".concat(this.name, ":changed"), this.store.list);
|
|
639
725
|
case 4:
|
|
640
726
|
case "end":
|
|
641
|
-
return
|
|
727
|
+
return _context12.stop();
|
|
642
728
|
}
|
|
643
|
-
},
|
|
729
|
+
}, _callee12, this);
|
|
644
730
|
}));
|
|
645
731
|
function addProduct(_x9) {
|
|
646
732
|
return _addProduct.apply(this, arguments);
|
|
@@ -650,16 +736,16 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
650
736
|
}, {
|
|
651
737
|
key: "selectProducts",
|
|
652
738
|
value: function () {
|
|
653
|
-
var _selectProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
654
|
-
return _regeneratorRuntime().wrap(function
|
|
655
|
-
while (1) switch (
|
|
739
|
+
var _selectProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(products) {
|
|
740
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
741
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
656
742
|
case 0:
|
|
657
743
|
this.store.selectProducts = products;
|
|
658
744
|
case 1:
|
|
659
745
|
case "end":
|
|
660
|
-
return
|
|
746
|
+
return _context13.stop();
|
|
661
747
|
}
|
|
662
|
-
},
|
|
748
|
+
}, _callee13, this);
|
|
663
749
|
}));
|
|
664
750
|
function selectProducts(_x10) {
|
|
665
751
|
return _selectProducts.apply(this, arguments);
|
|
@@ -560,6 +560,11 @@ function buildCellKey(params) {
|
|
|
560
560
|
return [String(params.productId), params.groupId, String(params.resourceId), params.start, params.end].join(':');
|
|
561
561
|
}
|
|
562
562
|
function dedupeOccupancyRefKey(occupancy) {
|
|
563
|
+
var _occupancy$raw;
|
|
564
|
+
var sessionKey = (_occupancy$raw = occupancy.raw) === null || _occupancy$raw === void 0 ? void 0 : _occupancy$raw.__availabilitySessionOccupancyKey;
|
|
565
|
+
if (typeof sessionKey === 'string' && sessionKey) {
|
|
566
|
+
return "session:".concat(JSON.stringify([String(occupancy.resourceId), sessionKey]));
|
|
567
|
+
}
|
|
563
568
|
if (occupancy.scheduleEventId !== undefined && occupancy.scheduleEventId !== null) {
|
|
564
569
|
return "scheduleEvent:".concat(String(occupancy.resourceId), ":").concat(String(occupancy.scheduleEventId));
|
|
565
570
|
}
|
|
@@ -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 优惠券
|