@pisell/pisellos 2.3.40 → 2.3.42
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/core/index.d.ts +2 -0
- package/dist/core/index.js +7 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
- package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/dist/model/strategy/adapter/promotion/examples.js +99 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/dist/model/strategy/adapter/promotion/type.js +45 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +11 -40
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.d.ts +2 -0
- package/dist/modules/OpenData/index.js +10 -2
- package/dist/modules/Order/index.d.ts +29 -12
- package/dist/modules/Order/index.js +751 -510
- package/dist/modules/Order/payment-utils.d.ts +26 -0
- package/dist/modules/Order/payment-utils.js +225 -0
- package/dist/modules/Order/types.d.ts +33 -10
- package/dist/modules/Order/utils/orderCollectionIdentity.js +7 -2
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +13 -41
- package/dist/modules/Payment/index.d.ts +2 -0
- package/dist/modules/Payment/index.js +79 -50
- package/dist/modules/Payment/types.d.ts +99 -28
- package/dist/modules/Payment/types.js +20 -3
- package/dist/modules/Payment/walletpass.d.ts +25 -1
- package/dist/modules/Payment/walletpass.js +707 -157
- package/dist/modules/Product/types.d.ts +0 -1
- package/dist/modules/ProductList/index.js +14 -33
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/Rules/index.d.ts +1 -0
- package/dist/modules/Rules/index.js +89 -96
- package/dist/modules/SalesSummary/index.js +13 -12
- package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/index.js +2 -15
- package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
- package/dist/modules/Schedule/index.d.ts +1 -3
- package/dist/modules/Schedule/index.js +16 -21
- package/dist/modules/Summary/utils.js +13 -38
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +1 -3
- package/dist/plugins/window.d.ts +0 -1
- package/dist/server/index.d.ts +16 -14
- package/dist/server/index.js +1925 -1143
- package/dist/server/modules/order/index.d.ts +54 -4
- package/dist/server/modules/order/index.js +1600 -700
- package/dist/server/modules/order/types.d.ts +11 -3
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +109 -20
- package/dist/solution/BaseSales/index.js +1800 -480
- package/dist/solution/BaseSales/types.d.ts +52 -0
- package/dist/solution/BaseSales/types.js +2 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/dist/solution/BaseSales/utils/cartPromotion.js +90 -31
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/dist/solution/BookingByStep/index.d.ts +2 -17
- package/dist/solution/BookingByStep/index.js +215 -294
- package/dist/solution/BookingByStep/types.d.ts +1 -2
- package/dist/solution/BookingByStep/types.js +1 -3
- package/dist/solution/BookingByStep/utils/capacity.js +1 -17
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
- package/dist/solution/BookingTicket/index.d.ts +8 -4
- package/dist/solution/BookingTicket/index.js +134 -51
- package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +172 -82
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +10 -2
- package/dist/solution/ScanOrder/index.d.ts +14 -26
- package/dist/solution/ScanOrder/index.js +756 -1148
- package/dist/solution/ScanOrder/types.d.ts +1 -21
- package/dist/solution/ScanOrder/utils.d.ts +0 -8
- package/dist/solution/ScanOrder/utils.js +25 -66
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +87 -125
- package/dist/solution/VenueBooking/index.d.ts +11 -39
- package/dist/solution/VenueBooking/index.js +860 -1176
- package/dist/solution/VenueBooking/types.d.ts +0 -3
- package/dist/solution/VenueBooking/utils/resource.js +0 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +1 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/payment-number.d.ts +9 -0
- package/dist/utils/payment-number.js +69 -0
- package/lib/core/index.d.ts +2 -0
- package/lib/core/index.js +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/lib/model/strategy/adapter/promotion/examples.js +91 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +2 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/lib/model/strategy/adapter/promotion/type.js +2 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +0 -9
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/OpenData/index.d.ts +2 -0
- package/lib/modules/OpenData/index.js +6 -1
- package/lib/modules/Order/index.d.ts +29 -12
- package/lib/modules/Order/index.js +197 -87
- package/lib/modules/Order/payment-utils.d.ts +26 -0
- package/lib/modules/Order/payment-utils.js +224 -0
- package/lib/modules/Order/types.d.ts +33 -10
- package/lib/modules/Order/utils/orderCollectionIdentity.js +3 -0
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +16 -40
- package/lib/modules/Payment/index.d.ts +2 -0
- package/lib/modules/Payment/index.js +34 -13
- package/lib/modules/Payment/types.d.ts +99 -28
- package/lib/modules/Payment/types.js +4 -3
- package/lib/modules/Payment/walletpass.d.ts +25 -1
- package/lib/modules/Payment/walletpass.js +470 -21
- package/lib/modules/Product/types.d.ts +0 -1
- package/lib/modules/ProductList/index.js +31 -40
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/Rules/index.d.ts +1 -0
- package/lib/modules/Rules/index.js +47 -40
- package/lib/modules/SalesSummary/index.js +7 -6
- package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/index.js +1 -13
- package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
- package/lib/modules/Schedule/index.d.ts +1 -3
- package/lib/modules/Schedule/index.js +8 -10
- package/lib/modules/Summary/utils.js +1 -21
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +1 -5
- package/lib/plugins/window.d.ts +0 -1
- package/lib/server/index.d.ts +16 -14
- package/lib/server/index.js +675 -83
- package/lib/server/modules/order/index.d.ts +54 -4
- package/lib/server/modules/order/index.js +679 -66
- package/lib/server/modules/order/types.d.ts +11 -3
- package/lib/solution/BaseSales/index.d.ts +109 -20
- package/lib/solution/BaseSales/index.js +883 -70
- package/lib/solution/BaseSales/types.d.ts +52 -0
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +63 -12
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -17
- package/lib/solution/BookingByStep/index.js +18 -60
- package/lib/solution/BookingByStep/types.d.ts +1 -2
- package/lib/solution/BookingByStep/types.js +0 -5
- package/lib/solution/BookingByStep/utils/capacity.js +1 -20
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
- package/lib/solution/BookingTicket/index.d.ts +8 -4
- package/lib/solution/BookingTicket/index.js +64 -19
- package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +36 -4
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +5 -3
- package/lib/solution/ScanOrder/index.d.ts +14 -26
- package/lib/solution/ScanOrder/index.js +190 -449
- package/lib/solution/ScanOrder/types.d.ts +1 -21
- package/lib/solution/ScanOrder/utils.d.ts +0 -8
- package/lib/solution/ScanOrder/utils.js +0 -31
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +0 -14
- package/lib/solution/VenueBooking/index.d.ts +11 -39
- package/lib/solution/VenueBooking/index.js +123 -328
- package/lib/solution/VenueBooking/types.d.ts +0 -3
- package/lib/solution/VenueBooking/utils/resource.js +0 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +1 -3
- package/lib/types/index.d.ts +1 -1
- package/lib/utils/payment-number.d.ts +9 -0
- package/lib/utils/payment-number.js +64 -0
- package/package.json +1 -1
- package/dist/modules/Holder/index.d.ts +0 -48
- package/dist/modules/Holder/index.js +0 -640
- package/dist/modules/Holder/types.d.ts +0 -123
- package/dist/modules/Holder/types.js +0 -1
- package/dist/modules/Holder/utils.d.ts +0 -13
- package/dist/modules/Holder/utils.js +0 -34
- package/dist/modules/ResourcePlanner/index.d.ts +0 -24
- package/dist/modules/ResourcePlanner/index.js +0 -181
- package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
- package/dist/modules/ResourcePlanner/planner.js +0 -1069
- package/dist/modules/ResourcePlanner/types.d.ts +0 -227
- package/dist/modules/ResourcePlanner/types.js +0 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/dist/solution/UnifiedBookingSales/index.js +0 -1871
- package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/dist/solution/UnifiedBookingSales/types.js +0 -11
- package/lib/modules/Holder/index.d.ts +0 -48
- package/lib/modules/Holder/index.js +0 -402
- package/lib/modules/Holder/types.d.ts +0 -123
- package/lib/modules/Holder/types.js +0 -17
- package/lib/modules/Holder/utils.d.ts +0 -13
- package/lib/modules/Holder/utils.js +0 -71
- package/lib/modules/ResourcePlanner/index.d.ts +0 -24
- package/lib/modules/ResourcePlanner/index.js +0 -148
- package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
- package/lib/modules/ResourcePlanner/planner.js +0 -933
- package/lib/modules/ResourcePlanner/types.d.ts +0 -227
- package/lib/modules/ResourcePlanner/types.js +0 -17
- package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/lib/solution/UnifiedBookingSales/index.js +0 -1076
- package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/lib/solution/UnifiedBookingSales/types.js +0 -33
|
@@ -167,6 +167,16 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
167
167
|
resolveDiscountListForManualOverride(discountList) {
|
|
168
168
|
return this.excludeDiscountListByType(discountList, "promotion");
|
|
169
169
|
}
|
|
170
|
+
isItemRewardProductDiscount(product) {
|
|
171
|
+
var _a;
|
|
172
|
+
const discountList = Array.isArray(product == null ? void 0 : product.discount_list) ? product.discount_list : [];
|
|
173
|
+
return ((_a = product == null ? void 0 : product._promotion) == null ? void 0 : _a.actionType) === "ITEM_REWARD" && discountList.some(
|
|
174
|
+
(item) => {
|
|
175
|
+
var _a2, _b;
|
|
176
|
+
return (item == null ? void 0 : item.type) === "product" && ((_a2 = item == null ? void 0 : item.metadata) == null ? void 0 : _a2.source) === "promotion" && ((_b = item == null ? void 0 : item.metadata) == null ? void 0 : _b.actionType) === "ITEM_REWARD";
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
}
|
|
170
180
|
// 获取券不可用的原因
|
|
171
181
|
getUnavailableReason(discountList, productList) {
|
|
172
182
|
var _a;
|
|
@@ -290,8 +300,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
290
300
|
_id: product._id,
|
|
291
301
|
parentId: product._id,
|
|
292
302
|
quantity: product.quantity,
|
|
293
|
-
num: product.num
|
|
294
|
-
booking_id: product.booking_id
|
|
303
|
+
num: product.num
|
|
295
304
|
});
|
|
296
305
|
if (product.bundle && Array.isArray(product.bundle) && product.bundle.length > 0) {
|
|
297
306
|
product.bundle.forEach((bundleItem, bundleIndex) => {
|
|
@@ -303,8 +312,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
303
312
|
bundleIndex,
|
|
304
313
|
// 虚拟商品属性
|
|
305
314
|
price: Number(bundleItem.price || 0),
|
|
306
|
-
id: bundleItem._bundle_product_id,
|
|
307
|
-
// 🔥 使用 _bundle_product_id
|
|
315
|
+
id: bundleItem.bundle_product_id ?? bundleItem._bundle_product_id ?? bundleItem.product_id,
|
|
308
316
|
_id: `${product._id}_bundle_${bundleIndex}`,
|
|
309
317
|
parentId: product._id,
|
|
310
318
|
num: bundleItem.num || 1,
|
|
@@ -313,7 +321,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
313
321
|
origin_total: new import_decimal.default(bundleItem.price || 0).mul(bundleItem.num || 1).toNumber(),
|
|
314
322
|
original_price: bundleItem.original_price,
|
|
315
323
|
// 继承主商品属性
|
|
316
|
-
booking_id:
|
|
324
|
+
booking_id: product.booking_id,
|
|
317
325
|
discount_list: bundleItem.discount_list || []
|
|
318
326
|
});
|
|
319
327
|
});
|
|
@@ -501,6 +509,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
501
509
|
startDate: (_a2 = flatItem.parentProduct) == null ? void 0 : _a2.startDate
|
|
502
510
|
};
|
|
503
511
|
}
|
|
512
|
+
if (this.isItemRewardProductDiscount(product)) {
|
|
513
|
+
return false;
|
|
514
|
+
}
|
|
504
515
|
const isAvailableProduct = flatItem.type === "main" ? !((product == null ? void 0 : product.booking_id) && ((_b = product == null ? void 0 : product.discount_list) == null ? void 0 : _b.length) && ((_c = product == null ? void 0 : product.discount_list) == null ? void 0 : _c.every((d) => d.id && ["good_pass", "discount_card", "product_discount_card"].includes(d.tag || d.type)))) : !((flatItem == null ? void 0 : flatItem.booking_id) && !!((_e = (_d = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _d.discount_list) == null ? void 0 : _e.length) && ((_g = (_f = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _f.discount_list) == null ? void 0 : _g.every((d) => d.id)));
|
|
505
516
|
if (!isAvailableProduct) {
|
|
506
517
|
return false;
|
|
@@ -626,6 +637,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
626
637
|
};
|
|
627
638
|
originProduct = flatItem.originProduct;
|
|
628
639
|
}
|
|
640
|
+
const isItemRewardProductDiscount = this.isItemRewardProductDiscount(product);
|
|
629
641
|
addModeDiscount.forEach((discount) => {
|
|
630
642
|
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
631
643
|
const limitedData = discount == null ? void 0 : discount.limited_relation_product_data;
|
|
@@ -649,7 +661,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
649
661
|
].includes(discount2.tag || discount2.type)
|
|
650
662
|
))) : !((flatItem == null ? void 0 : flatItem.booking_id) && !!((_d = (_c = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _c.discount_list) == null ? void 0 : _d.length) && ((_f = (_e = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _e.discount_list) == null ? void 0 : _f.every((discount2) => discount2.id)));
|
|
651
663
|
const isBundleAvailable = this.checkPackageSubItemUsageRules(discount, flatItem);
|
|
652
|
-
if (isAvailableProduct && isLimitedProduct && timeLimit && isBundleAvailable && ((_g = discount.config) == null ? void 0 : _g.isAvailable)) {
|
|
664
|
+
if (isAvailableProduct && !isItemRewardProductDiscount && isLimitedProduct && timeLimit && isBundleAvailable && ((_g = discount.config) == null ? void 0 : _g.isAvailable)) {
|
|
653
665
|
(_h = discountApplicability.get(discount.id)) == null ? void 0 : _h.push(product.id);
|
|
654
666
|
const applicableProducts = discountApplicableProducts.get(discount.id) || [];
|
|
655
667
|
const discountType = discount.tag || discount.type;
|
|
@@ -671,8 +683,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
671
683
|
discount_product_id: discount.product_id
|
|
672
684
|
},
|
|
673
685
|
metadata: {
|
|
674
|
-
num
|
|
675
|
-
discount_rule_uncheck_flag: discount == null ? void 0 : discount.discount_rule_uncheck_flag
|
|
686
|
+
num
|
|
676
687
|
}
|
|
677
688
|
};
|
|
678
689
|
applicableProducts.push(productData);
|
|
@@ -773,6 +784,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
773
784
|
}
|
|
774
785
|
const applicableDiscounts = sortedDiscountList.filter((discount) => {
|
|
775
786
|
var _a3, _b2, _c2, _d2;
|
|
787
|
+
if (this.isItemRewardProductDiscount(product))
|
|
788
|
+
return false;
|
|
776
789
|
const discountType = discount.tag || discount.type;
|
|
777
790
|
const currentOriginUid = getOriginProductUid(originProduct);
|
|
778
791
|
const isReapplyEditModeDiscountForProduct = discount.isEditMode && reapplyBookingDiscountProductUids.size > 0 && currentOriginUid && reapplyBookingDiscountProductUids.has(String(currentOriginUid)) && discount.isSelected === true;
|
|
@@ -842,11 +855,17 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
842
855
|
}
|
|
843
856
|
return false;
|
|
844
857
|
});
|
|
845
|
-
const
|
|
858
|
+
const explicitlySelectedDiscountCard = (options == null ? void 0 : options.isSelected) === true && options.discountId !== void 0 ? applicableDiscounts.find((discount) => {
|
|
859
|
+
const discountType = discount.tag || discount.type;
|
|
860
|
+
return String(discount.id) === String(options.discountId) && ["discount_card", "product_discount_card"].includes(discountType);
|
|
861
|
+
}) : void 0;
|
|
862
|
+
const scannedSelectedDiscountCard = applicableDiscounts.find(
|
|
846
863
|
(n) => n.isScan && n.isSelected && (n.tag || n.type) !== "good_pass"
|
|
847
864
|
);
|
|
865
|
+
const selectedDiscountCard = explicitlySelectedDiscountCard || scannedSelectedDiscountCard;
|
|
848
866
|
const selectedDiscount = selectedDiscountCard || applicableDiscounts[0];
|
|
849
867
|
let isManualDiscount = false;
|
|
868
|
+
let isItemRewardProductDiscount = false;
|
|
850
869
|
if (flatItem.type === "main") {
|
|
851
870
|
isManualDiscount = typeof product.isManualDiscount === "boolean" ? product.isManualDiscount : ((_g = product.discount_list) == null ? void 0 : _g.some((item) => item.type === "product")) || product.total != product.origin_total && (product.bundle || []).every(
|
|
852
871
|
(item) => {
|
|
@@ -857,7 +876,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
857
876
|
_i,
|
|
858
877
|
(item) => item.type === "product"
|
|
859
878
|
)));
|
|
860
|
-
|
|
879
|
+
isItemRewardProductDiscount = this.isItemRewardProductDiscount(product);
|
|
880
|
+
if (product.inPromotion && !isItemRewardProductDiscount) {
|
|
861
881
|
isManualDiscount = false;
|
|
862
882
|
}
|
|
863
883
|
} else {
|
|
@@ -971,14 +991,16 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
971
991
|
} else {
|
|
972
992
|
let total = product.inPromotion ? ((_w = product == null ? void 0 : product._promotion) == null ? void 0 : _w.finalPrice) ?? product.origin_total ?? product.total : product.origin_total ?? product.total;
|
|
973
993
|
let main_product_selling_price = product.price;
|
|
974
|
-
if ((product.discount_list || []).some((item) => item.type === "promotion") || (0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
|
|
994
|
+
if ((product.discount_list || []).some((item) => item.type === "promotion") || isItemRewardProductDiscount || (0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
|
|
975
995
|
total = product.total ?? product.origin_total;
|
|
976
996
|
main_product_selling_price = product.main_product_selling_price ?? main_product_selling_price;
|
|
977
997
|
}
|
|
978
998
|
processedProductsMap.set(product._id, [
|
|
979
999
|
this.hooks.setProduct(originProduct, {
|
|
980
1000
|
...isManualDiscount ? {
|
|
981
|
-
price: product.price
|
|
1001
|
+
price: product.price,
|
|
1002
|
+
main_product_selling_price: isItemRewardProductDiscount ? main_product_selling_price : product.price,
|
|
1003
|
+
...isItemRewardProductDiscount ? { total } : {}
|
|
982
1004
|
} : {
|
|
983
1005
|
_id: product._id.split("___")[0] + "___" + index,
|
|
984
1006
|
total,
|
|
@@ -1109,7 +1131,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1109
1131
|
config: selectedDiscount2 == null ? void 0 : selectedDiscount2.config,
|
|
1110
1132
|
metadata: {
|
|
1111
1133
|
num: 1,
|
|
1112
|
-
discount_rule_uncheck_flag: selectedDiscount2 == null ? void 0 : selectedDiscount2.discount_rule_uncheck_flag,
|
|
1113
1134
|
// 🔥 order_level 分摊差值
|
|
1114
1135
|
...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference },
|
|
1115
1136
|
/** 仅主商品上的优惠金额(不含 option) */
|
|
@@ -1190,7 +1211,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1190
1211
|
metadata: {
|
|
1191
1212
|
// 🔥 使用拆分后的唯一 _id
|
|
1192
1213
|
custom_product_bundle_map_id: uniqueId,
|
|
1193
|
-
discount_rule_uncheck_flag: selectedDiscount2 == null ? void 0 : selectedDiscount2.discount_rule_uncheck_flag,
|
|
1194
1214
|
num: 1
|
|
1195
1215
|
},
|
|
1196
1216
|
_num: 1,
|
|
@@ -1220,7 +1240,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1220
1240
|
_id: `${flatItem._id}_split_rest`,
|
|
1221
1241
|
num: normalNum,
|
|
1222
1242
|
quantity: normalNum,
|
|
1223
|
-
discount_list:
|
|
1243
|
+
discount_list: [],
|
|
1224
1244
|
processed: true
|
|
1225
1245
|
});
|
|
1226
1246
|
}
|
|
@@ -1269,7 +1289,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1269
1289
|
metadata: {
|
|
1270
1290
|
// 🔥 使用唯一的 _id
|
|
1271
1291
|
custom_product_bundle_map_id: uniqueId,
|
|
1272
|
-
discount_rule_uncheck_flag: selectedDiscount2 == null ? void 0 : selectedDiscount2.discount_rule_uncheck_flag,
|
|
1273
1292
|
num: product.num || 1,
|
|
1274
1293
|
// 🔥 order_level 分摊差值
|
|
1275
1294
|
...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference }
|
|
@@ -1284,7 +1303,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1284
1303
|
...flatItem,
|
|
1285
1304
|
total: targetProductTotal,
|
|
1286
1305
|
price: new import_decimal.default(productOriginTotal || 0).minus(fixedAmountPerItem).toNumber(),
|
|
1287
|
-
discount_list:
|
|
1306
|
+
discount_list: [discountDetail],
|
|
1288
1307
|
processed: true
|
|
1289
1308
|
});
|
|
1290
1309
|
}
|
|
@@ -1705,7 +1724,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1705
1724
|
* @returns 是否可用
|
|
1706
1725
|
*/
|
|
1707
1726
|
checkPackageSubItemUsageRules(discount, flatItem) {
|
|
1708
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
1727
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1709
1728
|
const limitedData = discount.limited_relation_product_data;
|
|
1710
1729
|
const usageRules = limitedData == null ? void 0 : limitedData.package_sub_item_usage_rules;
|
|
1711
1730
|
const rules = ["original_price", ...(usageRules == null ? void 0 : usageRules.rules) || []];
|
|
@@ -1717,7 +1736,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1717
1736
|
const { type: scopeType, exclude_bundle_product_ids = [], include_bundle_product_ids = [], filter = 0 } = packageScope || {};
|
|
1718
1737
|
const isMainProduct = flatItem.type === "main";
|
|
1719
1738
|
const isBundleItem = flatItem.type === "bundle";
|
|
1720
|
-
const bundleMainProductId = (_a = flatItem.product) == null ? void 0 : _a.product_id;
|
|
1721
1739
|
if (isMainProduct) {
|
|
1722
1740
|
return true;
|
|
1723
1741
|
}
|
|
@@ -1726,9 +1744,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1726
1744
|
return true;
|
|
1727
1745
|
}
|
|
1728
1746
|
if (isBundleItem) {
|
|
1729
|
-
const priceType = (
|
|
1730
|
-
const priceTypeExt = (
|
|
1731
|
-
const mainProductId = ((
|
|
1747
|
+
const priceType = (_a = flatItem.bundleItem) == null ? void 0 : _a.price_type;
|
|
1748
|
+
const priceTypeExt = (_b = flatItem.bundleItem) == null ? void 0 : _b.price_type_ext;
|
|
1749
|
+
const mainProductId = ((_d = (_c = flatItem == null ? void 0 : flatItem.originProduct) == null ? void 0 : _c._productOrigin) == null ? void 0 : _d.id) || ((_e = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _e.id) || 0;
|
|
1732
1750
|
const isOriginalPrice = priceType === "markup" && priceTypeExt === "product_price";
|
|
1733
1751
|
const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
|
|
1734
1752
|
if (rules.length > 0) {
|
|
@@ -1740,11 +1758,11 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1740
1758
|
if (!filter) {
|
|
1741
1759
|
isScopeValid = true;
|
|
1742
1760
|
} else {
|
|
1743
|
-
isScopeValid = !exclude_bundle_product_ids.includes(Number(
|
|
1761
|
+
isScopeValid = !exclude_bundle_product_ids.includes(Number(mainProductId));
|
|
1744
1762
|
}
|
|
1745
1763
|
}
|
|
1746
1764
|
if (scopeType === "specific_packages" || scopeType === "products") {
|
|
1747
|
-
isScopeValid = include_bundle_product_ids.includes(Number(
|
|
1765
|
+
isScopeValid = include_bundle_product_ids.includes(Number(mainProductId));
|
|
1748
1766
|
}
|
|
1749
1767
|
if (isPriceValid && isScopeValid) {
|
|
1750
1768
|
return true;
|
|
@@ -1760,26 +1778,15 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1760
1778
|
return false;
|
|
1761
1779
|
}
|
|
1762
1780
|
if (isBundleItem) {
|
|
1763
|
-
const priceType = (
|
|
1764
|
-
const priceTypeExt = (
|
|
1781
|
+
const priceType = (_f = flatItem.bundleItem) == null ? void 0 : _f.price_type;
|
|
1782
|
+
const priceTypeExt = (_g = flatItem.bundleItem) == null ? void 0 : _g.price_type_ext;
|
|
1765
1783
|
const isOriginalPrice = priceType === "markup" && priceTypeExt === "product_price";
|
|
1766
1784
|
const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
|
|
1767
1785
|
if (rules.length > 0) {
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
const isPriceValid = _isOriginalPrice || _isMarkupPrice;
|
|
1771
|
-
let isScopeValid = false;
|
|
1772
|
-
if (scopeType === "all_packages" || scopeType === "product_all") {
|
|
1773
|
-
if (!filter) {
|
|
1774
|
-
isScopeValid = true;
|
|
1775
|
-
} else {
|
|
1776
|
-
isScopeValid = !exclude_bundle_product_ids.includes(Number(bundleMainProductId));
|
|
1777
|
-
}
|
|
1778
|
-
}
|
|
1779
|
-
if (scopeType === "specific_packages" || scopeType === "products") {
|
|
1780
|
-
isScopeValid = include_bundle_product_ids.includes(Number(bundleMainProductId));
|
|
1786
|
+
if (isOriginalPrice && rules.includes("original_price")) {
|
|
1787
|
+
return true;
|
|
1781
1788
|
}
|
|
1782
|
-
if (
|
|
1789
|
+
if (isMarkupPrice && rules.includes("markup_price")) {
|
|
1783
1790
|
return true;
|
|
1784
1791
|
}
|
|
1785
1792
|
return false;
|
|
@@ -53,6 +53,9 @@ var SalesSummaryModule = class extends import_BaseModule.BaseModule {
|
|
|
53
53
|
this.store.surchargeList = ((_a = options.initialState) == null ? void 0 : _a.surchargeList) || [];
|
|
54
54
|
this.store.summary = ((_b = options.initialState) == null ? void 0 : _b.summary) || (0, import_utils.createEmptySalesSummary)();
|
|
55
55
|
this.surchargeListModuleName = ((_c = this.otherParams) == null ? void 0 : _c.surchargeListModuleName) || "surchargeList";
|
|
56
|
+
if (!this.appPlugin) {
|
|
57
|
+
throw new Error("SalesSummaryModule 需要 app 插件支持");
|
|
58
|
+
}
|
|
56
59
|
if (!this.request) {
|
|
57
60
|
throw new Error("SalesSummaryModule 需要 request 插件支持");
|
|
58
61
|
}
|
|
@@ -106,14 +109,12 @@ var SalesSummaryModule = class extends import_BaseModule.BaseModule {
|
|
|
106
109
|
}
|
|
107
110
|
}
|
|
108
111
|
getAppData(key) {
|
|
109
|
-
var _a, _b, _c, _d, _e, _f
|
|
110
|
-
const getData = (_b = (_a = this.appPlugin)
|
|
112
|
+
var _a, _b, _c, _d, _e, _f;
|
|
113
|
+
const getData = (_b = (_a = this.appPlugin).getData) == null ? void 0 : _b.call(_a);
|
|
111
114
|
if (typeof getData === "function")
|
|
112
115
|
return getData(key);
|
|
113
|
-
const app =
|
|
114
|
-
|
|
115
|
-
return void 0;
|
|
116
|
-
const coreData = (_h = (_f = (_e = app == null ? void 0 : app.models) == null ? void 0 : _e.getStore) == null ? void 0 : (_g = _f.call(_e)).getDataByModel) == null ? void 0 : _h.call(_g, "core", "core");
|
|
116
|
+
const app = this.appPlugin.getApp();
|
|
117
|
+
const coreData = (_f = (_d = (_c = app == null ? void 0 : app.models) == null ? void 0 : _c.getStore) == null ? void 0 : (_e = _d.call(_c)).getDataByModel) == null ? void 0 : _f.call(_e, "core", "core");
|
|
117
118
|
return coreData == null ? void 0 : coreData[key];
|
|
118
119
|
}
|
|
119
120
|
getTaxConfig() {
|
|
@@ -11,12 +11,10 @@ export declare class ScanOrderLoggerModule extends BaseModule implements Module,
|
|
|
11
11
|
protected defaultName: string;
|
|
12
12
|
protected defaultVersion: string;
|
|
13
13
|
private store;
|
|
14
|
-
private window?;
|
|
15
14
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
16
15
|
setContext(context: ScanOrderLoggerContext): void;
|
|
17
16
|
setProvider(provider: ScanOrderLoggerProviderType): void;
|
|
18
17
|
setProviderConfig(providerConfig: ScanOrderLoggerProviderConfig): void;
|
|
19
|
-
private getCurrentHost;
|
|
20
18
|
private buildRecord;
|
|
21
19
|
addLog(params: ScanOrderLogInput): Promise<void>;
|
|
22
20
|
}
|
|
@@ -60,7 +60,6 @@ var ScanOrderLoggerModule = class extends import_BaseModule.BaseModule {
|
|
|
60
60
|
var _a, _b, _c;
|
|
61
61
|
this.core = core;
|
|
62
62
|
this.store = options.store;
|
|
63
|
-
this.window = core.getPlugin("window") || void 0;
|
|
64
63
|
const provider = ((_a = options.otherParams) == null ? void 0 : _a.provider) || "feishu";
|
|
65
64
|
const providerConfig = ((_b = options.otherParams) == null ? void 0 : _b.providerConfig) || {};
|
|
66
65
|
const context = ((_c = options.otherParams) == null ? void 0 : _c.context) || {};
|
|
@@ -102,25 +101,14 @@ var ScanOrderLoggerModule = class extends import_BaseModule.BaseModule {
|
|
|
102
101
|
}
|
|
103
102
|
};
|
|
104
103
|
}
|
|
105
|
-
getCurrentHost() {
|
|
106
|
-
var _a, _b;
|
|
107
|
-
const host = (_b = (_a = this.window) == null ? void 0 : _a.location) == null ? void 0 : _b.host;
|
|
108
|
-
if (typeof host === "string" && host.length > 0)
|
|
109
|
-
return host;
|
|
110
|
-
return void 0;
|
|
111
|
-
}
|
|
112
104
|
buildRecord(params) {
|
|
113
|
-
const host = this.getCurrentHost();
|
|
114
105
|
return {
|
|
115
106
|
level: params.level || "info",
|
|
116
107
|
title: params.title,
|
|
117
108
|
timestamp: params.timestamp || (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss"),
|
|
118
109
|
payload: params.payload || {},
|
|
119
110
|
extra: params.extra || {},
|
|
120
|
-
context: {
|
|
121
|
-
...this.store.context || {},
|
|
122
|
-
...host ? { host } : {}
|
|
123
|
-
}
|
|
111
|
+
context: this.store.context || {}
|
|
124
112
|
};
|
|
125
113
|
}
|
|
126
114
|
async addLog(params) {
|
|
@@ -112,29 +112,20 @@ async function flushQueue() {
|
|
|
112
112
|
}
|
|
113
113
|
var feishuLoggerProvider = {
|
|
114
114
|
async send(payload) {
|
|
115
|
-
var _a, _b, _c, _d
|
|
115
|
+
var _a, _b, _c, _d;
|
|
116
116
|
cachedProviderConfig = payload.providerConfig;
|
|
117
117
|
const webhook = (_b = (_a = payload.providerConfig) == null ? void 0 : _a.feishu) == null ? void 0 : _b.webhook;
|
|
118
|
-
const errorHook = (_d = (_c = payload.providerConfig) == null ? void 0 : _c.feishu) == null ? void 0 : _d.errorHook;
|
|
119
|
-
if (typeof fetch !== "function") {
|
|
120
|
-
console.warn("[ScanOrderLogger] 当前环境不支持 fetch,跳过 Feishu 日志上报");
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (payload.record.level === "error" && isWebhookUsable(errorHook)) {
|
|
124
|
-
try {
|
|
125
|
-
await postToFeishu(errorHook, buildFeishuBody([payload.record]));
|
|
126
|
-
} catch (error) {
|
|
127
|
-
console.warn("[ScanOrderLogger] Feishu errorHook 上报失败", error);
|
|
128
|
-
}
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
118
|
if (!webhook) {
|
|
132
119
|
console.warn("[ScanOrderLogger] Feishu webhook 未配置,跳过日志上报");
|
|
133
120
|
return;
|
|
134
121
|
}
|
|
135
122
|
if (!isWebhookUsable(webhook))
|
|
136
123
|
return;
|
|
137
|
-
|
|
124
|
+
if (typeof fetch !== "function") {
|
|
125
|
+
console.warn("[ScanOrderLogger] 当前环境不支持 fetch,跳过 Feishu 日志上报");
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const throttleMs = ((_d = (_c = payload.providerConfig) == null ? void 0 : _c.feishu) == null ? void 0 : _d.throttleMs) ?? DEFAULT_THROTTLE_MS;
|
|
138
129
|
if (throttleMs <= 0) {
|
|
139
130
|
try {
|
|
140
131
|
await postToFeishu(webhook, buildFeishuBody([payload.record]));
|
|
@@ -2,7 +2,6 @@ export type ScanOrderLogLevel = 'info' | 'warning' | 'error' | 'debug';
|
|
|
2
2
|
export type ScanOrderLoggerProviderType = 'feishu' | 'grafana';
|
|
3
3
|
export interface ScanOrderLoggerProviderFeishuConfig {
|
|
4
4
|
webhook?: string;
|
|
5
|
-
errorHook?: string;
|
|
6
5
|
/**
|
|
7
6
|
* 节流窗口毫秒数,默认 3000ms
|
|
8
7
|
* - >0:首条日志进入队列并启动定时器,窗口结束后合并成一条 Feishu post 统一发送
|
|
@@ -24,9 +24,7 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
|
|
|
24
24
|
*
|
|
25
25
|
* @memberof ScheduleModule
|
|
26
26
|
*/
|
|
27
|
-
loadAllSchedule(
|
|
28
|
-
useCache?: boolean;
|
|
29
|
-
}): Promise<void>;
|
|
27
|
+
loadAllSchedule(): Promise<void>;
|
|
30
28
|
setScheduleList(list: ScheduleItem[]): void;
|
|
31
29
|
private syncScheduleMap;
|
|
32
30
|
getScheduleList(): ScheduleItem[];
|
|
@@ -95,12 +95,12 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
|
95
95
|
*
|
|
96
96
|
* @memberof ScheduleModule
|
|
97
97
|
*/
|
|
98
|
-
async loadAllSchedule(
|
|
98
|
+
async loadAllSchedule() {
|
|
99
99
|
var _a;
|
|
100
100
|
const scheduleList = await this.request.get(
|
|
101
101
|
`/schedule`,
|
|
102
102
|
{ num: 999 },
|
|
103
|
-
{ useCache:
|
|
103
|
+
{ useCache: true }
|
|
104
104
|
);
|
|
105
105
|
this.setScheduleList(((_a = scheduleList.data) == null ? void 0 : _a.list) || []);
|
|
106
106
|
}
|
|
@@ -126,6 +126,7 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
|
126
126
|
custom_page_id,
|
|
127
127
|
channel
|
|
128
128
|
}) {
|
|
129
|
+
var _a, _b, _c;
|
|
129
130
|
if ((0, import_dayjs.default)(startDate).isBefore((0, import_dayjs.default)(), "day")) {
|
|
130
131
|
startDate = (0, import_dayjs.default)().format("YYYY-MM-DD");
|
|
131
132
|
}
|
|
@@ -143,20 +144,17 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
|
143
144
|
channel
|
|
144
145
|
}
|
|
145
146
|
);
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
this.setAvailabilityScheduleDateList(dateList);
|
|
150
|
-
this.setOtherProductsIds(otherProductIds);
|
|
151
|
-
if (!dateList.length && !otherProductIds.length || (0, import_dayjs.default)(endDate).isBefore((0, import_dayjs.default)(), "day")) {
|
|
147
|
+
this.setAvailabilityScheduleDateList(res.data.date_list);
|
|
148
|
+
this.setOtherProductsIds(res.data.other_product_ids || []);
|
|
149
|
+
if (!((_a = res.data.date_list) == null ? void 0 : _a.length) && !((_b = res.data.other_product_ids) == null ? void 0 : _b.length) || (0, import_dayjs.default)(endDate).isBefore((0, import_dayjs.default)(), "day")) {
|
|
152
150
|
return dates;
|
|
153
151
|
}
|
|
154
|
-
if (
|
|
152
|
+
if ((_c = res.data.other_product_ids) == null ? void 0 : _c.length) {
|
|
155
153
|
dates.forEach((n) => {
|
|
156
154
|
n.status = "available";
|
|
157
155
|
});
|
|
158
156
|
} else {
|
|
159
|
-
|
|
157
|
+
res.data.date_list.forEach((n) => {
|
|
160
158
|
const index = dates.findIndex((m) => m.date === n.date);
|
|
161
159
|
if (index !== -1) {
|
|
162
160
|
dates[index].status = "available";
|
|
@@ -437,31 +437,11 @@ var getBundleItemIsDiscountPrice = (item) => {
|
|
|
437
437
|
var getBundleItemIsMarkupOrDiscountPrice = (item) => {
|
|
438
438
|
return getBundleItemIsMarkupPrice(item) || getBundleItemIsDiscountPrice(item);
|
|
439
439
|
};
|
|
440
|
-
var getDiscountAmount = (discounts) => {
|
|
441
|
-
return (discounts || []).reduce((total, discount) => {
|
|
442
|
-
return total.add(new import_decimal.default(discount.amount || 0));
|
|
443
|
-
}, new import_decimal.default(0)).toNumber();
|
|
444
|
-
};
|
|
445
440
|
var getMainProductTotal = (item) => {
|
|
446
|
-
var _a, _b
|
|
441
|
+
var _a, _b;
|
|
447
442
|
let total = new import_decimal.default(
|
|
448
443
|
(item == null ? void 0 : item.main_product_selling_price) ?? ((_a = item == null ? void 0 : item.metadata) == null ? void 0 : _a.main_product_selling_price) ?? ((_b = item == null ? void 0 : item.metadata) == null ? void 0 : _b.main_product_original_price) ?? 0
|
|
449
444
|
);
|
|
450
|
-
const hasMainProductPrice = (item == null ? void 0 : item.main_product_selling_price) != null || ((_c = item == null ? void 0 : item.metadata) == null ? void 0 : _c.main_product_selling_price) != null || ((_d = item == null ? void 0 : item.metadata) == null ? void 0 : _d.main_product_original_price) != null;
|
|
451
|
-
if (!hasMainProductPrice) {
|
|
452
|
-
total = new import_decimal.default((item == null ? void 0 : item.main_product_selling_price) ?? ((_e = item == null ? void 0 : item.metadata) == null ? void 0 : _e.main_product_selling_price) ?? item.price ?? 0);
|
|
453
|
-
const discount = ((_g = (_f = item == null ? void 0 : item._origin) == null ? void 0 : _f.product) == null ? void 0 : _g.discount_list) || ((_j = (_i = (_h = item == null ? void 0 : item._originData) == null ? void 0 : _h.product) == null ? void 0 : _i.discount_list) == null ? void 0 : _j.filter((item2) => {
|
|
454
|
-
var _a2;
|
|
455
|
-
return !((_a2 = item2 == null ? void 0 : item2.metadata) == null ? void 0 : _a2.custom_product_bundle_map_id);
|
|
456
|
-
})) || [];
|
|
457
|
-
const mainProductDiscountAmount = getDiscountAmount(discount);
|
|
458
|
-
total = total.minus(mainProductDiscountAmount);
|
|
459
|
-
if ((item == null ? void 0 : item.option) && Array.isArray(item == null ? void 0 : item.option)) {
|
|
460
|
-
total = total.add(item == null ? void 0 : item.option.reduce((t, option) => {
|
|
461
|
-
return t.add(new import_decimal.default(option.price || 0).mul(option.num || 1));
|
|
462
|
-
}, new import_decimal.default(0)));
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
445
|
for (let bundleItem of (item == null ? void 0 : item.bundle) || []) {
|
|
466
446
|
if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
|
|
467
447
|
const bundleItemTotal = new import_decimal.default(bundleItem.bundle_selling_price ?? bundleItem.price ?? 0);
|
package/lib/modules/index.d.ts
CHANGED
package/lib/modules/index.js
CHANGED
|
@@ -36,8 +36,6 @@ __reExport(modules_exports, require("./Quotation"), module.exports);
|
|
|
36
36
|
__reExport(modules_exports, require("./ScanOrderLogger"), module.exports);
|
|
37
37
|
__reExport(modules_exports, require("./OpenData"), module.exports);
|
|
38
38
|
__reExport(modules_exports, require("./BookingContext"), module.exports);
|
|
39
|
-
__reExport(modules_exports, require("./Holder"), module.exports);
|
|
40
|
-
__reExport(modules_exports, require("./ResourcePlanner"), module.exports);
|
|
41
39
|
// Annotate the CommonJS export names for ESM import in node:
|
|
42
40
|
0 && (module.exports = {
|
|
43
41
|
...require("./Product"),
|
|
@@ -59,7 +57,5 @@ __reExport(modules_exports, require("./ResourcePlanner"), module.exports);
|
|
|
59
57
|
...require("./Quotation"),
|
|
60
58
|
...require("./ScanOrderLogger"),
|
|
61
59
|
...require("./OpenData"),
|
|
62
|
-
...require("./BookingContext")
|
|
63
|
-
...require("./Holder"),
|
|
64
|
-
...require("./ResourcePlanner")
|
|
60
|
+
...require("./BookingContext")
|
|
65
61
|
});
|
package/lib/plugins/window.d.ts
CHANGED
package/lib/server/index.d.ts
CHANGED
|
@@ -49,10 +49,6 @@ declare class Server {
|
|
|
49
49
|
private productQuerySubscribers;
|
|
50
50
|
/** subscriberId → 智能定价变价时间点定时器句柄(与 subscriber 分离存储,便于 clear) */
|
|
51
51
|
private productQueryScheduleTimers;
|
|
52
|
-
/** 餐牌筛选为空时才触发的菜单/日程缓存自愈,避免每次商品查询都请求远端。 */
|
|
53
|
-
private menuScheduleRefreshInFlight;
|
|
54
|
-
private lastMenuScheduleRefreshAt;
|
|
55
|
-
private readonly MENU_SCHEDULE_REFRESH_COOLDOWN_MS;
|
|
56
52
|
private orderQuerySubscribers;
|
|
57
53
|
private bookingQuerySubscribers;
|
|
58
54
|
private bookingRemoteQuerySubscribers;
|
|
@@ -61,6 +57,7 @@ declare class Server {
|
|
|
61
57
|
private readonly BOOKING_REMOTE_CACHE_MAX_ENTRIES;
|
|
62
58
|
private salesSearchSubscribers;
|
|
63
59
|
private deviceTaskActionsRegistered;
|
|
60
|
+
private localPaymentUpdateQueues;
|
|
64
61
|
private floorPlanQuerySubscribers;
|
|
65
62
|
private moduleRegistry;
|
|
66
63
|
constructor(core: PisellCore);
|
|
@@ -124,6 +121,8 @@ declare class Server {
|
|
|
124
121
|
private handleSyncSalesTask;
|
|
125
122
|
private runCheckoutSync;
|
|
126
123
|
private omitCheckoutSyncMode;
|
|
124
|
+
private buildRemoteCheckoutData;
|
|
125
|
+
private mergeCheckoutSyncPayments;
|
|
127
126
|
private persistSyncedCheckoutOrder;
|
|
128
127
|
/**
|
|
129
128
|
* 将普通层 QuotationModule 的报价单计算能力桥接到 Server Products 模块。
|
|
@@ -263,16 +262,6 @@ declare class Server {
|
|
|
263
262
|
* 存储订阅者信息,便于数据变更时推送最新结果
|
|
264
263
|
*/
|
|
265
264
|
private handleProductQuery;
|
|
266
|
-
/**
|
|
267
|
-
* ProductList callers such as standalone retail pages do not always have a selected schedule.
|
|
268
|
-
* In that case query against the current local time so menu availability can still be evaluated.
|
|
269
|
-
*/
|
|
270
|
-
private resolveProductQueryScheduleContext;
|
|
271
|
-
/**
|
|
272
|
-
* OpenData 的关联餐牌可能已更新,而 server_menu/server_schedule 仍命中本地持久化缓存。
|
|
273
|
-
* 仅在当前筛选没有任何生效餐牌时刷新一次,并由调用方重新计算筛选结果。
|
|
274
|
-
*/
|
|
275
|
-
private refreshMenuScheduleCacheAfterEmptyResult;
|
|
276
265
|
/**
|
|
277
266
|
* 按商品 id 查询单条(GET /shop/product/query/:productId)
|
|
278
267
|
* schedule_date 必填:query 或 data;schedule_datetime 可选。不走订阅。
|
|
@@ -467,6 +456,18 @@ declare class Server {
|
|
|
467
456
|
*/
|
|
468
457
|
private handleUpdateLocalOrder;
|
|
469
458
|
private handleOrderSalesCheckout;
|
|
459
|
+
private handleOrderSalesDraft;
|
|
460
|
+
private createLocalPaymentOperationId;
|
|
461
|
+
private buildLocalPaymentOrderLogContext;
|
|
462
|
+
private isValidLocalPaymentDecimal;
|
|
463
|
+
private getInvalidLocalPaymentSurchargeFields;
|
|
464
|
+
private buildLocalPaymentSurchargeUpdate;
|
|
465
|
+
private handleGetLocalPayment;
|
|
466
|
+
private handleUpdateLocalPayment;
|
|
467
|
+
private runLocalPaymentUpdateInQueue;
|
|
468
|
+
private processLocalPaymentUpdate;
|
|
469
|
+
private processSuccessfulLocalPayment;
|
|
470
|
+
private sanitizeLocalRecoveryOrder;
|
|
470
471
|
private handleOrderCheckout;
|
|
471
472
|
private getDeviceTaskPlugin;
|
|
472
473
|
private getIdGeneratorPlugin;
|
|
@@ -494,6 +495,7 @@ declare class Server {
|
|
|
494
495
|
private syncMachinecodeRedeemStatusToLocalOrder;
|
|
495
496
|
private handleOrderCheckoutSubmit;
|
|
496
497
|
private handleSyncCheckoutSubmit;
|
|
498
|
+
private handleOrderDraftSubmit;
|
|
497
499
|
private handlePendingSyncCheckoutOrder;
|
|
498
500
|
private buildPendingSyncCheckoutOrder;
|
|
499
501
|
private shouldBuildSmallTicketData;
|