@pisell/pisellos 2.2.323 → 2.2.324
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/inventory/index.d.ts +92 -0
- package/dist/inventory/index.js +509 -0
- package/dist/modules/BookingContext/index.d.ts +2 -2
- package/dist/modules/BookingContext/index.js +55 -25
- package/dist/modules/BookingContext/types.d.ts +2 -0
- package/dist/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
- package/dist/modules/BookingContext/utils/calendarBooking.js +207 -0
- package/dist/modules/BookingContext/utils/index.d.ts +1 -0
- package/dist/modules/BookingContext/utils/index.js +1 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +20 -1
- package/dist/modules/BookingContext/utils/productExtend.js +122 -29
- package/dist/modules/Date/index.d.ts +1 -1
- package/dist/modules/Date/index.js +60 -14
- package/dist/modules/Date/types.d.ts +5 -0
- package/dist/modules/Discount/index.js +1 -0
- package/dist/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +1 -0
- package/dist/modules/OpenData/salesSettings.d.ts +32 -0
- package/dist/modules/OpenData/salesSettings.js +80 -0
- package/dist/modules/OpenData/types.d.ts +16 -0
- package/dist/modules/OpenData/utils.d.ts +1 -1
- package/dist/modules/OpenData/utils.js +3 -2
- package/dist/modules/Order/index.d.ts +54 -11
- package/dist/modules/Order/index.js +2699 -1411
- package/dist/modules/Order/types.d.ts +43 -5
- package/dist/modules/Order/types.js +4 -0
- package/dist/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/dist/modules/Order/unpaidAmountGap.js +72 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
- package/dist/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/dist/modules/Order/utils/productVoucherGroups.js +115 -0
- package/dist/modules/Order/utils.d.ts +3 -1
- package/dist/modules/Order/utils.js +6 -2
- package/dist/modules/ProductList/clientDataVariants.js +6 -2
- package/dist/modules/ProductList/index.d.ts +2 -0
- package/dist/modules/ProductList/index.js +161 -51
- package/dist/modules/ResourcePlanner/planner.js +58 -2
- package/dist/modules/ResourcePlanner/types.d.ts +13 -0
- package/dist/modules/Rules/index.d.ts +2 -0
- package/dist/modules/Rules/index.js +58 -39
- package/dist/modules/Schedule/index.d.ts +7 -1
- package/dist/modules/Schedule/index.js +155 -39
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/modules/bookingReadValidation.d.ts +6 -0
- package/dist/modules/bookingReadValidation.js +72 -0
- package/dist/plugins/request.d.ts +2 -0
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.js +1312 -1154
- package/dist/server/modules/order/index.js +2 -1
- package/dist/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/dist/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/dist/shared/receipt/small-ticket.d.ts +4 -0
- package/dist/shared/receipt/small-ticket.js +70 -12
- package/dist/solution/BaseSales/index.d.ts +39 -5
- package/dist/solution/BaseSales/index.js +1828 -1462
- package/dist/solution/BaseSales/types.d.ts +1 -0
- package/dist/solution/BaseSales/types.js +1 -0
- package/dist/solution/BookingByStep/index.d.ts +17 -3
- package/dist/solution/BookingByStep/index.js +676 -361
- package/dist/solution/BookingByStep/utils/resources.d.ts +10 -0
- package/dist/solution/BookingByStep/utils/resources.js +117 -76
- package/dist/solution/BookingTicket/index.d.ts +15 -3
- package/dist/solution/BookingTicket/index.js +249 -135
- package/dist/solution/BookingTicket/types.d.ts +14 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +39 -11
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.js +188 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +88 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/dist/solution/OrderInvoicePreview/index.js +14 -8
- package/dist/solution/ScanOrder/index.d.ts +2 -0
- package/dist/solution/ScanOrder/index.js +166 -67
- package/dist/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/dist/solution/ScanOrder/menuAvailability.js +363 -0
- package/dist/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
- package/dist/solution/UnifiedBookingSales/catalogQueryBatch.js +202 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +96 -4
- package/dist/solution/UnifiedBookingSales/index.js +3374 -1177
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +4 -0
- package/dist/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/dist/solution/UnifiedBookingSales/salesSettings.js +81 -0
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.js +271 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +71 -2
- package/dist/solution/UnifiedBookingSales/types.js +7 -1
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +283 -0
- package/dist/utils/platform.d.ts +2 -0
- package/dist/utils/platform.js +6 -0
- package/dist/utils/pos-receipt-auto-print.d.ts +4 -0
- package/dist/utils/pos-receipt-auto-print.js +14 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +12 -0
- package/lib/inventory/index.d.ts +92 -0
- package/lib/inventory/index.js +287 -0
- package/lib/modules/BookingContext/index.d.ts +2 -2
- package/lib/modules/BookingContext/index.js +42 -10
- package/lib/modules/BookingContext/types.d.ts +2 -0
- package/lib/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
- package/lib/modules/BookingContext/utils/calendarBooking.js +156 -0
- package/lib/modules/BookingContext/utils/index.d.ts +1 -0
- package/lib/modules/BookingContext/utils/index.js +11 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +20 -1
- package/lib/modules/BookingContext/utils/productExtend.js +96 -7
- package/lib/modules/Date/index.d.ts +1 -1
- package/lib/modules/Date/index.js +28 -5
- package/lib/modules/Date/types.d.ts +5 -0
- package/lib/modules/Discount/index.js +1 -0
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +12 -0
- package/lib/modules/OpenData/salesSettings.d.ts +32 -0
- package/lib/modules/OpenData/salesSettings.js +70 -0
- package/lib/modules/OpenData/types.d.ts +16 -0
- package/lib/modules/OpenData/utils.d.ts +1 -1
- package/lib/modules/OpenData/utils.js +3 -2
- package/lib/modules/Order/index.d.ts +54 -11
- package/lib/modules/Order/index.js +659 -80
- package/lib/modules/Order/types.d.ts +43 -5
- package/lib/modules/Order/types.js +2 -0
- package/lib/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/lib/modules/Order/unpaidAmountGap.js +60 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
- package/lib/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/lib/modules/Order/utils/productVoucherGroups.js +64 -0
- package/lib/modules/Order/utils.d.ts +3 -1
- package/lib/modules/Order/utils.js +6 -2
- package/lib/modules/ProductList/clientDataVariants.js +6 -2
- package/lib/modules/ProductList/index.d.ts +2 -0
- package/lib/modules/ProductList/index.js +74 -0
- package/lib/modules/ResourcePlanner/planner.js +52 -1
- package/lib/modules/ResourcePlanner/types.d.ts +13 -0
- package/lib/modules/Rules/index.d.ts +2 -0
- package/lib/modules/Rules/index.js +25 -9
- package/lib/modules/Schedule/index.d.ts +7 -1
- package/lib/modules/Schedule/index.js +68 -4
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/bookingReadValidation.d.ts +6 -0
- package/lib/modules/bookingReadValidation.js +56 -0
- package/lib/plugins/request.d.ts +2 -0
- package/lib/server/index.d.ts +5 -0
- package/lib/server/index.js +124 -16
- package/lib/server/modules/order/index.js +2 -1
- package/lib/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/lib/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/lib/shared/receipt/small-ticket.d.ts +4 -0
- package/lib/shared/receipt/small-ticket.js +63 -8
- package/lib/solution/BaseSales/index.d.ts +39 -5
- package/lib/solution/BaseSales/index.js +212 -18
- package/lib/solution/BaseSales/types.d.ts +1 -0
- package/lib/solution/BaseSales/types.js +1 -0
- package/lib/solution/BookingByStep/index.d.ts +17 -3
- package/lib/solution/BookingByStep/index.js +222 -14
- package/lib/solution/BookingByStep/utils/resources.d.ts +10 -0
- package/lib/solution/BookingByStep/utils/resources.js +25 -15
- package/lib/solution/BookingTicket/index.d.ts +15 -3
- package/lib/solution/BookingTicket/index.js +47 -4
- package/lib/solution/BookingTicket/types.d.ts +14 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +37 -6
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.js +136 -0
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +54 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/lib/solution/OrderInvoicePreview/index.js +7 -1
- package/lib/solution/ScanOrder/index.d.ts +2 -0
- package/lib/solution/ScanOrder/index.js +72 -2
- package/lib/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/lib/solution/ScanOrder/menuAvailability.js +203 -0
- package/lib/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
- package/lib/solution/UnifiedBookingSales/catalogQueryBatch.js +109 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +96 -4
- package/lib/solution/UnifiedBookingSales/index.js +1316 -73
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +2 -0
- package/lib/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/lib/solution/UnifiedBookingSales/salesSettings.js +72 -0
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.js +199 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +71 -2
- package/lib/solution/UnifiedBookingSales/types.js +4 -1
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +155 -0
- package/lib/utils/platform.d.ts +2 -0
- package/lib/utils/platform.js +7 -0
- package/lib/utils/pos-receipt-auto-print.d.ts +4 -0
- package/lib/utils/pos-receipt-auto-print.js +13 -0
- package/package.json +1 -1
|
@@ -60,10 +60,16 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
60
60
|
_defineProperty(_assertThisInitialized(_this), "window", void 0);
|
|
61
61
|
// WindowPlugin 实例
|
|
62
62
|
_defineProperty(_assertThisInitialized(_this), "hooks", void 0);
|
|
63
|
+
_defineProperty(_assertThisInitialized(_this), "discountScope", void 0);
|
|
63
64
|
_this.hooks = {};
|
|
64
65
|
return _this;
|
|
65
66
|
}
|
|
66
67
|
_createClass(RulesModule, [{
|
|
68
|
+
key: "setDiscountScope",
|
|
69
|
+
value: function setDiscountScope(scope) {
|
|
70
|
+
this.discountScope = scope;
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
67
73
|
key: "initialize",
|
|
68
74
|
value: function () {
|
|
69
75
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
@@ -317,7 +323,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
317
323
|
_step;
|
|
318
324
|
try {
|
|
319
325
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
320
|
-
var
|
|
326
|
+
var _discount = _step.value;
|
|
321
327
|
var bookingTimes = productList.length ? productList.map(function (item) {
|
|
322
328
|
var product = _this3.hooks.getProduct(item);
|
|
323
329
|
return ((product === null || product === void 0 ? void 0 : product.startDate) || dayjs()).format('YYYY-MM-DD HH:mm:ss');
|
|
@@ -327,7 +333,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
327
333
|
try {
|
|
328
334
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
329
335
|
var bookingTime = _step3.value;
|
|
330
|
-
var filteredList = filterDiscountListByBookingTime([
|
|
336
|
+
var filteredList = filterDiscountListByBookingTime([_discount], bookingTime);
|
|
331
337
|
if (filteredList.length === 0) {
|
|
332
338
|
return UnavailableReason.TimeLimit;
|
|
333
339
|
}
|
|
@@ -349,8 +355,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
349
355
|
_step2;
|
|
350
356
|
try {
|
|
351
357
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
352
|
-
var
|
|
353
|
-
var limitedData =
|
|
358
|
+
var _discount2 = _step2.value;
|
|
359
|
+
var limitedData = _discount2.limited_relation_product_data;
|
|
354
360
|
var hasApplicableProduct = false;
|
|
355
361
|
var _iterator4 = _createForOfIteratorHelper(productList),
|
|
356
362
|
_step4;
|
|
@@ -358,11 +364,11 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
358
364
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
359
365
|
var _limitedData$product_;
|
|
360
366
|
var item = _step4.value;
|
|
361
|
-
var
|
|
367
|
+
var _product = this.hooks.getProduct(item);
|
|
362
368
|
if (limitedData.type === 'product_all') {
|
|
363
369
|
hasApplicableProduct = true;
|
|
364
370
|
break;
|
|
365
|
-
} else if ((_limitedData$product_ = limitedData.product_ids) !== null && _limitedData$product_ !== void 0 && _limitedData$product_.includes(
|
|
371
|
+
} else if ((_limitedData$product_ = limitedData.product_ids) !== null && _limitedData$product_ !== void 0 && _limitedData$product_.includes(_product.id)) {
|
|
366
372
|
hasApplicableProduct = true;
|
|
367
373
|
break;
|
|
368
374
|
}
|
|
@@ -450,13 +456,13 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
450
456
|
return selectedDiscount.isEditMode === true && selectedDiscount.isSelected === true && ['entitlement_pass', 'good_pass', 'discount_card', 'product_discount_card'].includes(discountType !== null && discountType !== void 0 ? discountType : '');
|
|
451
457
|
};
|
|
452
458
|
var resolveReapplyBookingDiscountPercent = function resolveReapplyBookingDiscountPercent(originProduct, selectedDiscount) {
|
|
453
|
-
var
|
|
459
|
+
var _discount3;
|
|
454
460
|
if (!shouldReapplyBookingDiscount(originProduct, selectedDiscount)) return undefined;
|
|
455
461
|
var discountType = (selectedDiscount === null || selectedDiscount === void 0 ? void 0 : selectedDiscount.tag) || (selectedDiscount === null || selectedDiscount === void 0 ? void 0 : selectedDiscount.type);
|
|
456
462
|
if (discountType !== 'discount_card' && discountType !== 'product_discount_card') {
|
|
457
463
|
return undefined;
|
|
458
464
|
}
|
|
459
|
-
var percent = Number((
|
|
465
|
+
var percent = Number((_discount3 = selectedDiscount.discount) === null || _discount3 === void 0 ? void 0 : _discount3.percent);
|
|
460
466
|
return Number.isFinite(percent) ? percent : undefined;
|
|
461
467
|
};
|
|
462
468
|
var editModeDiscount = [];
|
|
@@ -992,7 +998,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
992
998
|
|
|
993
999
|
// 辅助函数:检查商品是否对某个折扣卡可用
|
|
994
1000
|
var checkItemApplicableForDiscount = function checkItemApplicableForDiscount(flatItem, discount) {
|
|
995
|
-
var _discount$config2,
|
|
1001
|
+
var _discount$config2, _product2, _product3, _product4, _flatItem$bundleItem, _flatItem$bundleItem2, _product5;
|
|
1002
|
+
if (_this5.discountScope && !_this5.discountScope(flatItem.originProduct, discount)) return false;
|
|
996
1003
|
if (((_discount$config2 = discount.config) === null || _discount$config2 === void 0 ? void 0 : _discount$config2.isAvailable) === false) return false;
|
|
997
1004
|
if (isCardBlockedByPromotion(flatItem, discount)) return false;
|
|
998
1005
|
var product;
|
|
@@ -1016,7 +1023,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1016
1023
|
}
|
|
1017
1024
|
|
|
1018
1025
|
// 编辑的商品使用了优惠券不可用
|
|
1019
|
-
var isAvailableProduct = flatItem.type === 'main' ? !((
|
|
1026
|
+
var isAvailableProduct = flatItem.type === 'main' ? !((_product2 = product) !== null && _product2 !== void 0 && _product2.booking_id && (_product3 = product) !== null && _product3 !== void 0 && (_product3 = _product3.discount_list) !== null && _product3 !== void 0 && _product3.length && (_product4 = product) !== null && _product4 !== void 0 && (_product4 = _product4.discount_list) !== null && _product4 !== void 0 && _product4.every(function (d) {
|
|
1020
1027
|
return d.id && ['entitlement_pass', 'good_pass', 'discount_card', 'product_discount_card'].includes(d.tag || d.type);
|
|
1021
1028
|
})) : !(flatItem !== null && flatItem !== void 0 && flatItem.booking_id && !!(flatItem !== null && flatItem !== void 0 && (_flatItem$bundleItem = flatItem.bundleItem) !== null && _flatItem$bundleItem !== void 0 && (_flatItem$bundleItem = _flatItem$bundleItem.discount_list) !== null && _flatItem$bundleItem !== void 0 && _flatItem$bundleItem.length) && flatItem !== null && flatItem !== void 0 && (_flatItem$bundleItem2 = flatItem.bundleItem) !== null && _flatItem$bundleItem2 !== void 0 && (_flatItem$bundleItem2 = _flatItem$bundleItem2.discount_list) !== null && _flatItem$bundleItem2 !== void 0 && _flatItem$bundleItem2.every(function (d) {
|
|
1022
1029
|
return d.id;
|
|
@@ -1037,7 +1044,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1037
1044
|
var limitedData = discount.limited_relation_product_data;
|
|
1038
1045
|
|
|
1039
1046
|
// 时间限制检查
|
|
1040
|
-
var timeLimit = !!filterDiscountListByBookingTime([discount], (((
|
|
1047
|
+
var timeLimit = !!filterDiscountListByBookingTime([discount], (((_product5 = product) === null || _product5 === void 0 ? void 0 : _product5.startDate) || dayjs()).format('YYYY-MM-DD HH:mm:ss')).length;
|
|
1041
1048
|
if (!timeLimit) {
|
|
1042
1049
|
return false;
|
|
1043
1050
|
}
|
|
@@ -1215,10 +1222,28 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1215
1222
|
|
|
1216
1223
|
// 记录已应用优惠券的商品信息
|
|
1217
1224
|
var appliedDiscountProducts = new Map();
|
|
1225
|
+
var hasPayableOptions = function hasPayableOptions(product) {
|
|
1226
|
+
return (product.options || []).reduce(function (total, option) {
|
|
1227
|
+
var _ref14, _ref15, _ref16, _option$_original_pri, _ref17, _option$num;
|
|
1228
|
+
var unitPrice = Number((_ref14 = (_ref15 = (_ref16 = (_option$_original_pri = option._original_price) !== null && _option$_original_pri !== void 0 ? _option$_original_pri : option._original_add_price) !== null && _ref16 !== void 0 ? _ref16 : option.price) !== null && _ref15 !== void 0 ? _ref15 : option.add_price) !== null && _ref14 !== void 0 ? _ref14 : 0);
|
|
1229
|
+
var quantity = Number((_ref17 = (_option$num = option.num) !== null && _option$num !== void 0 ? _option$num : option.quantity) !== null && _ref17 !== void 0 ? _ref17 : 1);
|
|
1230
|
+
if (!Number.isFinite(unitPrice) || !Number.isFinite(quantity) || quantity <= 0) {
|
|
1231
|
+
return total;
|
|
1232
|
+
}
|
|
1233
|
+
return total.plus(new Decimal(unitPrice).mul(quantity));
|
|
1234
|
+
}, new Decimal(0)).greaterThan(0);
|
|
1235
|
+
};
|
|
1236
|
+
|
|
1237
|
+
// 只排除赠品主项的零可抵扣金额;收费 option 和独立 bundle 保持原有规则。
|
|
1238
|
+
var isGiftWithoutDeductibleAmount = function isGiftWithoutDeductibleAmount(flatItem, discount) {
|
|
1239
|
+
var _flatItem$originProdu, _discount$config4;
|
|
1240
|
+
if (flatItem.type !== 'main' || !((_flatItem$originProdu = flatItem.originProduct) !== null && _flatItem$originProdu !== void 0 && (_flatItem$originProdu = _flatItem$originProdu.metadata) !== null && _flatItem$originProdu !== void 0 && _flatItem$originProdu._giftInfo) || Number(flatItem.price || 0) > 0) return false;
|
|
1241
|
+
return !((_discount$config4 = discount.config) !== null && _discount$config4 !== void 0 && _discount$config4.deductOptionPrice) || !hasPayableOptions(flatItem.product);
|
|
1242
|
+
};
|
|
1218
1243
|
|
|
1219
1244
|
// 可用性和实际应用共用金额判断;零基础价商品可按策略抵扣收费 option。
|
|
1220
1245
|
var isDiscountCardPriceAvailable = function isDiscountCardPriceAvailable(flatItem, discount) {
|
|
1221
|
-
var _product$discount_lis2, _discount$
|
|
1246
|
+
var _product$discount_lis2, _discount$config5;
|
|
1222
1247
|
var product = flatItem.type === 'main' ? flatItem.product : flatItem.bundleItem;
|
|
1223
1248
|
if (!(Number(flatItem.price) <= 0 || !flatItem.price) || (_product$discount_lis2 = product.discount_list) !== null && _product$discount_lis2 !== void 0 && _product$discount_lis2.some(function (item) {
|
|
1224
1249
|
var _item$discount2;
|
|
@@ -1226,18 +1251,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1226
1251
|
})) {
|
|
1227
1252
|
return true;
|
|
1228
1253
|
}
|
|
1229
|
-
if (flatItem.type !== 'main' || Number(flatItem.price) !== 0 || !['discount_card', 'product_discount_card'].includes(discount.tag || discount.type || '') || !((_discount$
|
|
1254
|
+
if (flatItem.type !== 'main' || Number(flatItem.price) !== 0 || !['discount_card', 'product_discount_card'].includes(discount.tag || discount.type || '') || !((_discount$config5 = discount.config) !== null && _discount$config5 !== void 0 && _discount$config5.deductOptionPrice) || isOrderLevelFixedAmountDiscount(discount)) {
|
|
1230
1255
|
return false;
|
|
1231
1256
|
}
|
|
1232
|
-
return (product
|
|
1233
|
-
var _ref14, _ref15, _ref16, _option$_original_pri, _ref17, _option$num;
|
|
1234
|
-
var unitPrice = Number((_ref14 = (_ref15 = (_ref16 = (_option$_original_pri = option._original_price) !== null && _option$_original_pri !== void 0 ? _option$_original_pri : option._original_add_price) !== null && _ref16 !== void 0 ? _ref16 : option.price) !== null && _ref15 !== void 0 ? _ref15 : option.add_price) !== null && _ref14 !== void 0 ? _ref14 : 0);
|
|
1235
|
-
var quantity = Number((_ref17 = (_option$num = option.num) !== null && _option$num !== void 0 ? _option$num : option.quantity) !== null && _ref17 !== void 0 ? _ref17 : 1);
|
|
1236
|
-
if (!Number.isFinite(unitPrice) || !Number.isFinite(quantity) || quantity <= 0) {
|
|
1237
|
-
return total;
|
|
1238
|
-
}
|
|
1239
|
-
return total.plus(new Decimal(unitPrice).mul(quantity));
|
|
1240
|
-
}, new Decimal(0)).greaterThan(0);
|
|
1257
|
+
return hasPayableOptions(product);
|
|
1241
1258
|
};
|
|
1242
1259
|
|
|
1243
1260
|
// 首先遍历所有商品和所有优惠券,确定每个优惠券的适用范围,包括isSelected为false的优惠券
|
|
@@ -1267,7 +1284,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1267
1284
|
}
|
|
1268
1285
|
var isItemRewardProductDiscount = _this5.isItemRewardProductDiscount(product);
|
|
1269
1286
|
addModeDiscount.forEach(function (discount) {
|
|
1270
|
-
var
|
|
1287
|
+
var _product6, _product7, _product8, _product9, _flatItem$bundleItem3, _flatItem$bundleItem4, _discount$config6;
|
|
1271
1288
|
var limitedData = discount === null || discount === void 0 ? void 0 : discount.limited_relation_product_data;
|
|
1272
1289
|
// 拿到discount配置的holder信息 product信息 product.holder 加在 isLimitedProduct
|
|
1273
1290
|
var _tempVar = (flatItem === null || flatItem === void 0 ? void 0 : flatItem.type) === 'bundle' ? flatItem === null || flatItem === void 0 ? void 0 : flatItem.parentProduct : flatItem === null || flatItem === void 0 ? void 0 : flatItem.product;
|
|
@@ -1275,14 +1292,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1275
1292
|
isNeedHolder: resolveIsFormSubject(_tempVar) && !(_tempVar !== null && _tempVar !== void 0 && _tempVar.isNormalProduct),
|
|
1276
1293
|
holder_id: (_tempVar === null || _tempVar === void 0 ? void 0 : _tempVar.holder_id) || product.holder_id
|
|
1277
1294
|
}, flatItem.originProduct, holders);
|
|
1278
|
-
var timeReason = getDiscountTimeUnavailableReason(discount, (((
|
|
1295
|
+
var timeReason = getDiscountTimeUnavailableReason(discount, (((_product6 = product) === null || _product6 === void 0 ? void 0 : _product6.startDate) || dayjs()).format('YYYY-MM-DD HH:mm:ss'));
|
|
1279
1296
|
var timeLimit = !timeReason;
|
|
1280
1297
|
// 是符合折扣的商品
|
|
1281
1298
|
var isProductInScope = limitedData.type === 'product_all' && limitedData.filter !== 1 || limitedData.type === 'product_all' && limitedData.filter === 1 && !limitedData.exclude_product_ids.includes(product.id) || limitedData.product_ids && limitedData.product_ids.includes(product.id);
|
|
1282
1299
|
var isLimitedProduct = isProductInScope && isHolderMatch;
|
|
1283
1300
|
|
|
1284
1301
|
// 编辑的商品 使用了优惠券不可用
|
|
1285
|
-
var isAvailableProduct = flatItem.type === 'main' ? !((
|
|
1302
|
+
var isAvailableProduct = flatItem.type === 'main' ? !((_product7 = product) !== null && _product7 !== void 0 && _product7.booking_id && (_product8 = product) !== null && _product8 !== void 0 && (_product8 = _product8.discount_list) !== null && _product8 !== void 0 && _product8.length && (_product9 = product) !== null && _product9 !== void 0 && (_product9 = _product9.discount_list) !== null && _product9 !== void 0 && _product9.every(function (discount) {
|
|
1286
1303
|
return discount.id && ['entitlement_pass', 'good_pass', 'discount_card', 'product_discount_card'].includes(discount.tag || discount.type);
|
|
1287
1304
|
})) : !(flatItem !== null && flatItem !== void 0 && flatItem.booking_id && !!(flatItem !== null && flatItem !== void 0 && (_flatItem$bundleItem3 = flatItem.bundleItem) !== null && _flatItem$bundleItem3 !== void 0 && (_flatItem$bundleItem3 = _flatItem$bundleItem3.discount_list) !== null && _flatItem$bundleItem3 !== void 0 && _flatItem$bundleItem3.length) && flatItem !== null && flatItem !== void 0 && (_flatItem$bundleItem4 = flatItem.bundleItem) !== null && _flatItem$bundleItem4 !== void 0 && (_flatItem$bundleItem4 = _flatItem$bundleItem4.discount_list) !== null && _flatItem$bundleItem4 !== void 0 && _flatItem$bundleItem4.every(function (discount) {
|
|
1288
1305
|
return discount.id;
|
|
@@ -1298,7 +1315,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1298
1315
|
}
|
|
1299
1316
|
|
|
1300
1317
|
// 判断优惠券是否适用于该商品
|
|
1301
|
-
if (isAvailableProduct && !isItemRewardProductDiscount && isLimitedProduct && timeLimit && isBundleAvailable && (_discount$
|
|
1318
|
+
if (isAvailableProduct && !isItemRewardProductDiscount && !isGiftWithoutDeductibleAmount(flatItem, discount) && isLimitedProduct && timeLimit && isBundleAvailable && (_discount$config6 = discount.config) !== null && _discount$config6 !== void 0 && _discount$config6.isAvailable && (isFullCoveragePass(discount) || isDiscountCardPriceAvailable(flatItem, discount)) && (!isEntitlementPass(discount) || getRemainingEntitlementUses(discount, 0, 1) > 0)) {
|
|
1302
1319
|
var _discountApplicabilit, _discount$metadata4, _discount$metadata5, _discount$metadata6;
|
|
1303
1320
|
// 记录此优惠券适用的商品
|
|
1304
1321
|
(_discountApplicabilit = discountApplicability.get(discount.id)) === null || _discountApplicabilit === void 0 || _discountApplicabilit.push(product.id);
|
|
@@ -1402,7 +1419,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1402
1419
|
// 然后再处理应用哪些优惠券,此时只考虑filteredDiscountList中的优惠券
|
|
1403
1420
|
// 🔥 使用扁平化后的列表进行处理
|
|
1404
1421
|
sortedFlattenedList.forEach(function (flatItem, index) {
|
|
1405
|
-
var
|
|
1422
|
+
var _product10, _originProduct, _originProduct2, _originProduct3, _product$discount_lis3, _product11;
|
|
1406
1423
|
// 获取商品数据
|
|
1407
1424
|
var product, originProduct;
|
|
1408
1425
|
if (flatItem.type === 'main') {
|
|
@@ -1426,8 +1443,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1426
1443
|
};
|
|
1427
1444
|
originProduct = flatItem.originProduct;
|
|
1428
1445
|
}
|
|
1429
|
-
var isPersistedProduct = ((
|
|
1430
|
-
var hasExistingWalletDiscount = ((_product$discount_lis3 = product.discount_list) === null || _product$discount_lis3 === void 0 ? void 0 : _product$discount_lis3.length) && ((
|
|
1446
|
+
var isPersistedProduct = ((_product10 = product) === null || _product10 === void 0 ? void 0 : _product10.booking_id) || ((_originProduct = originProduct) === null || _originProduct === void 0 ? void 0 : _originProduct.order_detail_id) || ((_originProduct2 = originProduct) === null || _originProduct2 === void 0 ? void 0 : _originProduct2.orderDetailId) || ((_originProduct3 = originProduct) === null || _originProduct3 === void 0 ? void 0 : _originProduct3.booking_id);
|
|
1447
|
+
var hasExistingWalletDiscount = ((_product$discount_lis3 = product.discount_list) === null || _product$discount_lis3 === void 0 ? void 0 : _product$discount_lis3.length) && ((_product11 = product) === null || _product11 === void 0 || (_product11 = _product11.discount_list) === null || _product11 === void 0 ? void 0 : _product11.every(function (discount) {
|
|
1431
1448
|
var _discount$id, _discount$discount4;
|
|
1432
1449
|
var discountIdentity = (_discount$id = discount.id) !== null && _discount$id !== void 0 ? _discount$id : (_discount$discount4 = discount.discount) === null || _discount$discount4 === void 0 ? void 0 : _discount$discount4.resource_id;
|
|
1433
1450
|
var discountType = discount.tag || discount.type;
|
|
@@ -1449,6 +1466,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1449
1466
|
// 找到适用于此商品的所有优惠券,仅考虑isSelected不为false的优惠券
|
|
1450
1467
|
var applicableDiscounts = sortedDiscountList.filter(function (discount) {
|
|
1451
1468
|
var _product$discount_lis4;
|
|
1469
|
+
if (isGiftWithoutDeductibleAmount(flatItem, discount)) return false;
|
|
1470
|
+
if (_this5.discountScope && !_this5.discountScope(originProduct, discount)) return false;
|
|
1452
1471
|
if (_this5.isItemRewardProductDiscount(product)) return false;
|
|
1453
1472
|
if (isCardBlockedByPromotion(flatItem, discount)) return false;
|
|
1454
1473
|
// 🔥 检查策略可用性(针对全额抵扣卡和折扣卡)
|
|
@@ -1461,9 +1480,9 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1461
1480
|
if (!discount.isSelected) return false;
|
|
1462
1481
|
}
|
|
1463
1482
|
if (['entitlement_pass', 'good_pass', 'discount_card', 'product_discount_card'].includes(discountType !== null && discountType !== void 0 ? discountType : '') && !isReapplyEditModeDiscountForProduct) {
|
|
1464
|
-
var _discount$
|
|
1483
|
+
var _discount$config7;
|
|
1465
1484
|
// 如果策略检查后没有config,说明不可用
|
|
1466
|
-
if (discount.config === undefined || !(discount !== null && discount !== void 0 && (_discount$
|
|
1485
|
+
if (discount.config === undefined || !(discount !== null && discount !== void 0 && (_discount$config7 = discount.config) !== null && _discount$config7 !== void 0 && _discount$config7.isAvailable)) {
|
|
1467
1486
|
return false;
|
|
1468
1487
|
}
|
|
1469
1488
|
}
|
|
@@ -1485,8 +1504,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1485
1504
|
|
|
1486
1505
|
// 🔥 检查 maxUsagePerOrder 限制:同一 product_id 的商品券使用数量不能超过配置值
|
|
1487
1506
|
if (isFullCoveragePass(discount)) {
|
|
1488
|
-
var _discount$
|
|
1489
|
-
var maxUsagePerOrder = (_discount$
|
|
1507
|
+
var _discount$config8;
|
|
1508
|
+
var maxUsagePerOrder = (_discount$config8 = discount.config) === null || _discount$config8 === void 0 ? void 0 : _discount$config8.maxUsagePerOrder;
|
|
1490
1509
|
if (maxUsagePerOrder && maxUsagePerOrder > 0) {
|
|
1491
1510
|
var currentUsedCount = usedProductIdCounts.get(discount.product_id) || 0;
|
|
1492
1511
|
if (currentUsedCount >= maxUsagePerOrder) {
|
|
@@ -1567,14 +1586,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1567
1586
|
var isManualDiscount = false;
|
|
1568
1587
|
var isItemRewardProductDiscount = false;
|
|
1569
1588
|
if (flatItem.type === 'main') {
|
|
1570
|
-
var _product$discount_lis5, _product$discount_lis6,
|
|
1589
|
+
var _product$discount_lis5, _product$discount_lis6, _product12, _product12$every;
|
|
1571
1590
|
// 主商品:判断自身是否手动折扣
|
|
1572
1591
|
isManualDiscount = typeof product.isManualDiscount === 'boolean' ? product.isManualDiscount : ((_product$discount_lis5 = product.discount_list) === null || _product$discount_lis5 === void 0 ? void 0 : _product$discount_lis5.some(function (item) {
|
|
1573
1592
|
return item.type === 'product';
|
|
1574
1593
|
})) || product.total != product.origin_total && (product.bundle || []).every(function (item) {
|
|
1575
1594
|
var _ref23;
|
|
1576
1595
|
return !((_ref23 = item.discount_list || []) !== null && _ref23 !== void 0 && _ref23.length);
|
|
1577
|
-
}) && (!((_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.length) || ((
|
|
1596
|
+
}) && (!((_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.length) || ((_product12 = product) === null || _product12 === void 0 || (_product12 = _product12.discount_list) === null || _product12 === void 0 || (_product12$every = _product12.every) === null || _product12$every === void 0 ? void 0 : _product12$every.call(_product12, function (item) {
|
|
1578
1597
|
return item.type === 'product';
|
|
1579
1598
|
})));
|
|
1580
1599
|
isItemRewardProductDiscount = _this5.isItemRewardProductDiscount(product);
|
|
@@ -1683,8 +1702,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1683
1702
|
discount_list: isManualDiscount ? _this5.resolveDiscountListForManualOverride(product.discount_list) : _this5.filterDiscountListByType(product.discount_list, 'promotion')
|
|
1684
1703
|
}))]);
|
|
1685
1704
|
} else {
|
|
1686
|
-
var _ref25, _product$_promotion$f,
|
|
1687
|
-
var total = product.inPromotion ? (_ref25 = (_product$_promotion$f = (
|
|
1705
|
+
var _ref25, _product$_promotion$f, _product13, _product$origin_total;
|
|
1706
|
+
var total = product.inPromotion ? (_ref25 = (_product$_promotion$f = (_product13 = product) === null || _product13 === void 0 || (_product13 = _product13._promotion) === null || _product13 === void 0 ? void 0 : _product13.finalPrice) !== null && _product$_promotion$f !== void 0 ? _product$_promotion$f : product.origin_total) !== null && _ref25 !== void 0 ? _ref25 : product.total : (_product$origin_total = product.origin_total) !== null && _product$origin_total !== void 0 ? _product$origin_total : product.total;
|
|
1688
1707
|
var main_product_selling_price = product.price;
|
|
1689
1708
|
if ((product.discount_list || []).some(function (item) {
|
|
1690
1709
|
return item.type === 'promotion';
|
|
@@ -2639,7 +2658,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2639
2658
|
}, {
|
|
2640
2659
|
key: "checkPackageSubItemUsageRules",
|
|
2641
2660
|
value: function checkPackageSubItemUsageRules(discount, flatItem) {
|
|
2642
|
-
var _flatItem$product, _flatItem$
|
|
2661
|
+
var _flatItem$product, _flatItem$originProdu2, _flatItem$parentProdu10;
|
|
2643
2662
|
var limitedData = discount.limited_relation_product_data;
|
|
2644
2663
|
var usageRules = limitedData === null || limitedData === void 0 ? void 0 : limitedData.package_sub_item_usage_rules;
|
|
2645
2664
|
var rules = ['original_price'].concat(_toConsumableArray((usageRules === null || usageRules === void 0 ? void 0 : usageRules.rules) || []));
|
|
@@ -2664,7 +2683,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2664
2683
|
var isBundleItem = flatItem.type === 'bundle'; // 套餐中购买
|
|
2665
2684
|
var bundleMainProductId = (_flatItem$product = flatItem.product) === null || _flatItem$product === void 0 ? void 0 : _flatItem$product.product_id;
|
|
2666
2685
|
// 主商品id
|
|
2667
|
-
var mainProductId = (flatItem === null || flatItem === void 0 || (_flatItem$
|
|
2686
|
+
var mainProductId = (flatItem === null || flatItem === void 0 || (_flatItem$originProdu2 = flatItem.originProduct) === null || _flatItem$originProdu2 === void 0 || (_flatItem$originProdu2 = _flatItem$originProdu2._productOrigin) === null || _flatItem$originProdu2 === void 0 ? void 0 : _flatItem$originProdu2.id) || (flatItem === null || flatItem === void 0 || (_flatItem$parentProdu10 = flatItem.parentProduct) === null || _flatItem$parentProdu10 === void 0 ? void 0 : _flatItem$parentProdu10.id) || 0;
|
|
2668
2687
|
|
|
2669
2688
|
// 主商品直接可用
|
|
2670
2689
|
if (isMainProduct) {
|
|
@@ -14,6 +14,9 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
|
|
|
14
14
|
private scheduleListRequestVersion;
|
|
15
15
|
private scheduleCatalogScope;
|
|
16
16
|
private otherParams;
|
|
17
|
+
private catalogVersion;
|
|
18
|
+
private destroyed;
|
|
19
|
+
private availabilityRequestVersion;
|
|
17
20
|
constructor(name?: string, version?: string);
|
|
18
21
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
19
22
|
/**
|
|
@@ -34,12 +37,15 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
|
|
|
34
37
|
loadAllSchedule(options?: {
|
|
35
38
|
useCache?: boolean;
|
|
36
39
|
}): Promise<void>;
|
|
40
|
+
getScheduleCatalogVersion(): number;
|
|
41
|
+
/** Resolve only after the current scope has a successful catalog. */
|
|
42
|
+
ensureScheduleReady(): Promise<void>;
|
|
37
43
|
private loadScheduleCatalog;
|
|
38
44
|
setScheduleList(list: ScheduleItem[]): void;
|
|
39
45
|
private syncScheduleMap;
|
|
40
46
|
getScheduleList(): ScheduleItem[];
|
|
41
47
|
isScheduleListLoaded(): boolean;
|
|
42
|
-
loadScheduleAvailableDate({ startDate, endDate, custom_page_id, channel, }: LoadScheduleAvailableDateParams): Promise<import("../Date/types").ITime[]>;
|
|
48
|
+
loadScheduleAvailableDate({ startDate, endDate, custom_page_id, channel, assertCurrent, }: LoadScheduleAvailableDateParams): Promise<import("../Date/types").ITime[]>;
|
|
43
49
|
getScheduleListByIds(ids: number[]): ScheduleItem[];
|
|
44
50
|
setAvailabilityScheduleDateList(list: ScheduleAvailabilityDateItem[]): void;
|
|
45
51
|
getAvailabilityScheduleDateList(): ScheduleAvailabilityDateItem[];
|