@pisell/pisellos 2.2.262 → 2.2.264
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/index.d.ts +0 -4
- package/dist/model/strategy/adapter/index.js +1 -5
- 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/type.d.ts +90 -2
- package/dist/model/strategy/adapter/promotion/type.js +45 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +10 -16
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -2
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +1 -32
- package/dist/modules/Discount/index.d.ts +2 -5
- package/dist/modules/Discount/index.js +7 -30
- package/dist/modules/Discount/types.d.ts +0 -4
- package/dist/modules/Order/index.d.ts +2 -14
- package/dist/modules/Order/index.js +736 -1035
- package/dist/modules/Order/types.d.ts +0 -16
- package/dist/modules/Order/utils.d.ts +3 -4
- package/dist/modules/Order/utils.js +61 -54
- package/dist/modules/Product/types.d.ts +0 -22
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +2 -4
- package/dist/modules/ProductList/types.d.ts +0 -2
- package/dist/modules/Rules/index.d.ts +9 -2
- package/dist/modules/Rules/index.js +43 -69
- package/dist/modules/Rules/types.d.ts +1 -10
- package/dist/server/index.d.ts +0 -55
- package/dist/server/index.js +742 -1161
- package/dist/server/modules/order/index.d.ts +4 -10
- package/dist/server/modules/order/index.js +399 -404
- package/dist/server/modules/order/types.d.ts +0 -4
- package/dist/server/modules/products/index.d.ts +8 -31
- package/dist/server/modules/products/index.js +390 -549
- package/dist/server/modules/products/types.d.ts +0 -18
- package/dist/solution/BaseSales/index.d.ts +1 -21
- package/dist/solution/BaseSales/index.js +789 -1136
- package/dist/solution/BaseSales/types.d.ts +1 -6
- package/dist/solution/BaseSales/types.js +1 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/dist/solution/BaseSales/utils/cartPromotion.js +97 -50
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +8 -6
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -14
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +25 -59
- package/dist/solution/BookingTicket/types.d.ts +0 -2
- package/dist/solution/ScanOrder/index.js +31 -20
- package/dist/solution/ShopDiscount/index.js +14 -15
- package/dist/solution/VenueBooking/index.js +30 -19
- package/lib/model/strategy/adapter/index.d.ts +0 -4
- package/lib/model/strategy/adapter/index.js +2 -13
- 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 +51 -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 +0 -5
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -1
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +2 -23
- package/lib/modules/Discount/index.d.ts +2 -5
- package/lib/modules/Discount/index.js +3 -23
- package/lib/modules/Discount/types.d.ts +0 -4
- package/lib/modules/Order/index.d.ts +2 -14
- package/lib/modules/Order/index.js +60 -326
- package/lib/modules/Order/types.d.ts +0 -16
- package/lib/modules/Order/utils.d.ts +3 -4
- package/lib/modules/Order/utils.js +23 -22
- package/lib/modules/Product/types.d.ts +0 -22
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +2 -4
- package/lib/modules/ProductList/types.d.ts +0 -2
- package/lib/modules/Rules/index.d.ts +9 -2
- package/lib/modules/Rules/index.js +29 -61
- package/lib/modules/Rules/types.d.ts +1 -10
- package/lib/server/index.d.ts +0 -55
- package/lib/server/index.js +31 -327
- package/lib/server/modules/order/index.d.ts +4 -10
- package/lib/server/modules/order/index.js +139 -198
- package/lib/server/modules/order/types.d.ts +0 -4
- package/lib/server/modules/products/index.d.ts +8 -31
- package/lib/server/modules/products/index.js +35 -134
- package/lib/server/modules/products/types.d.ts +0 -18
- package/lib/solution/BaseSales/index.d.ts +1 -21
- package/lib/solution/BaseSales/index.js +72 -313
- package/lib/solution/BaseSales/types.d.ts +1 -6
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +64 -25
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +5 -4
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +0 -8
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +8 -33
- package/lib/solution/BookingTicket/types.d.ts +0 -2
- package/lib/solution/ScanOrder/index.js +8 -0
- package/lib/solution/ShopDiscount/index.js +1 -2
- package/lib/solution/VenueBooking/index.js +8 -0
- package/package.json +1 -1
- package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
- package/dist/model/strategy/adapter/dataVariant/adapter.js +0 -167
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +0 -780
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/dist/model/strategy/adapter/dataVariant/examples.js +0 -277
- package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/dist/model/strategy/adapter/dataVariant/index.js +0 -4
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -148
- package/dist/model/strategy/adapter/dataVariant/type.js +0 -54
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +0 -53
- package/dist/modules/Order/utils/orderCollectionIdentity.js +0 -405
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
- package/lib/model/strategy/adapter/dataVariant/adapter.js +0 -149
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +0 -583
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/lib/model/strategy/adapter/dataVariant/examples.js +0 -293
- package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/lib/model/strategy/adapter/dataVariant/index.js +0 -38
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -148
- package/lib/model/strategy/adapter/dataVariant/type.js +0 -31
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +0 -53
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -415
|
@@ -198,7 +198,6 @@ export interface OrderProduct extends OrderProductIdentity {
|
|
|
198
198
|
product_bundle: any[];
|
|
199
199
|
booking_uid?: string;
|
|
200
200
|
product_title?: OrderLocalizedText;
|
|
201
|
-
product_cover?: string;
|
|
202
201
|
metadata: Record<string, any>;
|
|
203
202
|
note?: string;
|
|
204
203
|
}
|
|
@@ -309,7 +308,6 @@ export interface OrderState {
|
|
|
309
308
|
lastOrderInfo?: Record<string, any>;
|
|
310
309
|
syncState?: OrderSyncState;
|
|
311
310
|
discountList: any[];
|
|
312
|
-
availableWalletIds?: number[];
|
|
313
311
|
discount: DiscountModule | null;
|
|
314
312
|
rules: RulesModule | null;
|
|
315
313
|
}
|
|
@@ -342,19 +340,6 @@ export interface UpdateOrderProductParams {
|
|
|
342
340
|
* });
|
|
343
341
|
*/
|
|
344
342
|
allow_booking_reprice?: boolean;
|
|
345
|
-
/**
|
|
346
|
-
* Change time 重报价后,允许当前预约商品行重新应用已选编辑态折扣卡。
|
|
347
|
-
*
|
|
348
|
-
* @example
|
|
349
|
-
* await order.updateOrderProduct({
|
|
350
|
-
* product_id: 1,
|
|
351
|
-
* product_variant_id: 0,
|
|
352
|
-
* updates: { discount_list: [] },
|
|
353
|
-
* booking: { duration: 2 },
|
|
354
|
-
* allow_booking_discount_reapply: true,
|
|
355
|
-
* });
|
|
356
|
-
*/
|
|
357
|
-
allow_booking_discount_reapply?: boolean;
|
|
358
343
|
}
|
|
359
344
|
/** 仅更新购物车行数量;行定位语义与 updateOrderProduct / removeProductFromOrder 保持一致 */
|
|
360
345
|
export interface UpdateOrderProductQuantityParams extends OrderProductIdentity {
|
|
@@ -776,7 +761,6 @@ export interface OrderModuleAPI {
|
|
|
776
761
|
apply?: boolean;
|
|
777
762
|
}) => Promise<Discount[]>;
|
|
778
763
|
getDiscountList: () => Discount[];
|
|
779
|
-
getAvailableWalletIds: () => number[];
|
|
780
764
|
applyDiscount: () => void;
|
|
781
765
|
/**
|
|
782
766
|
* 注入促销评估器。
|
|
@@ -3,7 +3,6 @@ import type { CartItem } from "../Cart";
|
|
|
3
3
|
import type { OrderProductDiscountItem, OrderProduct, OrderSubmitPayload, OrderSubmitProduct, OrderSummary, OrderTempOrder } from './types';
|
|
4
4
|
import type { RulesParamsHooks } from '../Rules/types';
|
|
5
5
|
import type { MapOrderPaymentsOptions, OrderPaymentData, OrderPaymentSource } from './types';
|
|
6
|
-
import { createUuidV4 } from './utils/orderCollectionIdentity';
|
|
7
6
|
export interface OrderProductsDepositProtocol {
|
|
8
7
|
id: number;
|
|
9
8
|
title: string;
|
|
@@ -68,8 +67,8 @@ export declare function sumOptionUnitPrice(options?: Array<{
|
|
|
68
67
|
/**
|
|
69
68
|
* 仅基于 tempOrder.products 重算整单定金。
|
|
70
69
|
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
70
|
+
* 对齐 Checkout relation_products 分支:商品定金先按商品规则计算,
|
|
71
|
+
* 再扣减商品券/折扣卡抵扣金额;tempOrder.bookings 不参与这里的计算。
|
|
73
72
|
*/
|
|
74
73
|
export declare function calculateOrderProductsDeposit(products?: OrderProduct[], options?: {
|
|
75
74
|
productsByUid?: Record<string, Record<string, any>>;
|
|
@@ -178,7 +177,7 @@ export declare const mergeRelationForms: (relationForms: {
|
|
|
178
177
|
form_record_ids: number[];
|
|
179
178
|
}[];
|
|
180
179
|
export declare const getAllDiscountList: (cartItem: CartItem) => any;
|
|
181
|
-
export
|
|
180
|
+
export declare function createUuidV4(): string;
|
|
182
181
|
export declare function isTempOrder(data: any): data is OrderTempOrder;
|
|
183
182
|
export declare function formatDateTime(date: Date): string;
|
|
184
183
|
export declare function normalizeBookingIsAll(booking: Record<string, any>): 0 | 1;
|
|
@@ -37,7 +37,7 @@ __export(utils_exports, {
|
|
|
37
37
|
createDefaultOrderRulesHooks: () => createDefaultOrderRulesHooks,
|
|
38
38
|
createDefaultTempOrder: () => createDefaultTempOrder,
|
|
39
39
|
createEmptySummary: () => import_utils2.createEmptySummary,
|
|
40
|
-
createUuidV4: () =>
|
|
40
|
+
createUuidV4: () => createUuidV4,
|
|
41
41
|
ensureManualProductDiscountList: () => import_manualProductDiscount.ensureManualProductDiscountList,
|
|
42
42
|
ensureProductSku: () => ensureProductSku,
|
|
43
43
|
findManualProductDiscountItem: () => import_manualProductDiscount.findManualProductDiscountItem,
|
|
@@ -86,7 +86,6 @@ module.exports = __toCommonJS(utils_exports);
|
|
|
86
86
|
var import_dayjs = __toESM(require("dayjs"));
|
|
87
87
|
var import_decimal = __toESM(require("decimal.js"));
|
|
88
88
|
var import_utils = require("../../solution/ScanOrder/utils");
|
|
89
|
-
var import_orderCollectionIdentity = require("./utils/orderCollectionIdentity");
|
|
90
89
|
var import_utils2 = require("../../solution/ScanOrder/utils");
|
|
91
90
|
var import_manualProductDiscount = require("./utils/manualProductDiscount");
|
|
92
91
|
function composeLinePrice(params) {
|
|
@@ -287,6 +286,9 @@ function calculateOrderProductsDeposit(products = [], options) {
|
|
|
287
286
|
if (!(deposit == null ? void 0 : deposit.total) || Number(deposit.total) <= 0)
|
|
288
287
|
continue;
|
|
289
288
|
total = total.plus(deposit.total);
|
|
289
|
+
for (const discount of product.discount_list || []) {
|
|
290
|
+
total = total.minus((discount == null ? void 0 : discount.amount) || 0);
|
|
291
|
+
}
|
|
290
292
|
for (const protocol of deposit.protocols || []) {
|
|
291
293
|
if (!protocolMap.has(protocol.id))
|
|
292
294
|
protocolMap.set(protocol.id, protocol);
|
|
@@ -444,7 +446,12 @@ function resolveEffectivePerUnitDiscount(product) {
|
|
|
444
446
|
(sum, discount) => sum + Number((discount == null ? void 0 : discount.amount) || 0),
|
|
445
447
|
0
|
|
446
448
|
);
|
|
447
|
-
const hasPromoDiscountItem = discountList.some(
|
|
449
|
+
const hasPromoDiscountItem = discountList.some(
|
|
450
|
+
(item) => {
|
|
451
|
+
var _a, _b;
|
|
452
|
+
return (item == null ? void 0 : item.type) === "promotion" || (item == null ? void 0 : item.type) === "product" && ((_a = item == null ? void 0 : item.metadata) == null ? void 0 : _a.source) === "promotion" && ((_b = item == null ? void 0 : item.metadata) == null ? void 0 : _b.actionType) === "ITEM_REWARD";
|
|
453
|
+
}
|
|
454
|
+
);
|
|
448
455
|
if (hasPromoDiscountItem)
|
|
449
456
|
return fromList;
|
|
450
457
|
const metadata = (product == null ? void 0 : product.metadata) || {};
|
|
@@ -493,17 +500,13 @@ function createDefaultOrderRulesHooks() {
|
|
|
493
500
|
const current = currentByIdentity.get(getBundleIdentity(bundle));
|
|
494
501
|
if (!current)
|
|
495
502
|
return bundle;
|
|
496
|
-
const bundleWithDisplayFields = {
|
|
497
|
-
...bundle,
|
|
498
|
-
...isEmptyOrderProductDisplayValue(bundle.cover) && !isEmptyOrderProductDisplayValue(current.cover) ? { cover: current.cover } : {}
|
|
499
|
-
};
|
|
500
503
|
const isProductPriceBundle = (bundle.price_type_ext ?? current.price_type_ext) === "product_price";
|
|
501
504
|
if (!isProductPriceBundle)
|
|
502
|
-
return
|
|
505
|
+
return bundle;
|
|
503
506
|
const sourcePrice = current.price ?? current.custom_price ?? current.original_price ?? current.bundle_selling_price;
|
|
504
507
|
const originalPrice = current.original_price ?? current.product_price ?? current.price ?? current.custom_price ?? sourcePrice;
|
|
505
508
|
return {
|
|
506
|
-
...
|
|
509
|
+
...bundle,
|
|
507
510
|
...sourcePrice !== void 0 ? { price: sourcePrice } : {},
|
|
508
511
|
...originalPrice !== void 0 ? { original_price: originalPrice } : {},
|
|
509
512
|
...current.original_total !== void 0 ? { original_total: current.original_total } : {}
|
|
@@ -642,6 +645,14 @@ var getAllDiscountList = (cartItem) => {
|
|
|
642
645
|
});
|
|
643
646
|
return discountList;
|
|
644
647
|
};
|
|
648
|
+
function createUuidV4() {
|
|
649
|
+
const template = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";
|
|
650
|
+
return template.replace(/[xy]/g, (char) => {
|
|
651
|
+
const randomValue = Math.floor(Math.random() * 16);
|
|
652
|
+
const value = char === "x" ? randomValue : randomValue & 3 | 8;
|
|
653
|
+
return value.toString(16);
|
|
654
|
+
});
|
|
655
|
+
}
|
|
645
656
|
function isTempOrder(data) {
|
|
646
657
|
if (!data || typeof data !== "object")
|
|
647
658
|
return false;
|
|
@@ -739,7 +750,6 @@ function formatSubmitBundleItems(bundle) {
|
|
|
739
750
|
bundle_group_id: (rawBundle == null ? void 0 : rawBundle.bundle_group_id) ?? (rawBundle == null ? void 0 : rawBundle.group_id),
|
|
740
751
|
bundle_id: (rawBundle == null ? void 0 : rawBundle.bundle_id) ?? (rawBundle == null ? void 0 : rawBundle.id),
|
|
741
752
|
bundle_product_id: (rawBundle == null ? void 0 : rawBundle.bundle_product_id) ?? (rawBundle == null ? void 0 : rawBundle._bundle_product_id),
|
|
742
|
-
cover: rawBundle.cover,
|
|
743
753
|
metadata: {
|
|
744
754
|
...submitMetadata,
|
|
745
755
|
...hasSubmitBundleDiscounts && bundleMapId !== void 0 ? { custom_product_bundle_map_id: bundleMapId } : {},
|
|
@@ -798,9 +808,6 @@ function normalizeSubmitProduct(product) {
|
|
|
798
808
|
if (rawMetadata.is_rule !== void 0) {
|
|
799
809
|
cleanMetadata.is_rule = rawMetadata.is_rule;
|
|
800
810
|
}
|
|
801
|
-
if (rawMetadata.holder_config !== void 0) {
|
|
802
|
-
cleanMetadata.holder_config = rawMetadata.holder_config;
|
|
803
|
-
}
|
|
804
811
|
const productSku = {
|
|
805
812
|
...submitProduct.product_sku && typeof submitProduct.product_sku === "object" ? submitProduct.product_sku : {},
|
|
806
813
|
option: formatSubmitOptionItems((_a = submitProduct.product_sku) == null ? void 0 : _a.option)
|
|
@@ -931,7 +938,7 @@ function buildSubmitPayload(params) {
|
|
|
931
938
|
enhance
|
|
932
939
|
} = params;
|
|
933
940
|
const scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
|
|
934
|
-
const bookingUuid =
|
|
941
|
+
const bookingUuid = createUuidV4();
|
|
935
942
|
const {
|
|
936
943
|
_extend,
|
|
937
944
|
relation_id: _relationId,
|
|
@@ -1079,7 +1086,7 @@ function formatV1Product(products) {
|
|
|
1079
1086
|
note: String(product.note ?? ""),
|
|
1080
1087
|
rowKey: product.product_id,
|
|
1081
1088
|
session: null,
|
|
1082
|
-
unique:
|
|
1089
|
+
unique: createUuidV4()
|
|
1083
1090
|
};
|
|
1084
1091
|
});
|
|
1085
1092
|
}
|
|
@@ -1157,16 +1164,11 @@ function isHolderConfigRequired(holderConfig) {
|
|
|
1157
1164
|
return Number(holderConfig.required) === 1;
|
|
1158
1165
|
}
|
|
1159
1166
|
function productRequiresFormSubject(tempOrder, product) {
|
|
1160
|
-
var _a, _b;
|
|
1161
|
-
const _orderProduct = (_a = tempOrder == null ? void 0 : tempOrder.products) == null ? void 0 : _a.find((item) => {
|
|
1162
|
-
return item.metadata.unique_identification_number === product._id || item.product_id === product.id;
|
|
1163
|
-
});
|
|
1164
1167
|
const runtimeOrigin = getRuntimeProductOrigin(tempOrder, product);
|
|
1165
|
-
return isHolderConfigRequired(
|
|
1168
|
+
return isHolderConfigRequired(product == null ? void 0 : product.holder_config) || isHolderConfigRequired(runtimeOrigin == null ? void 0 : runtimeOrigin.holder_config);
|
|
1166
1169
|
}
|
|
1167
1170
|
function resolveIsFormSubject(tempOrder, product) {
|
|
1168
1171
|
var _a;
|
|
1169
|
-
debugger;
|
|
1170
1172
|
if (((_a = tempOrder == null ? void 0 : tempOrder.holder) == null ? void 0 : _a.type) === "form")
|
|
1171
1173
|
return true;
|
|
1172
1174
|
if (product)
|
|
@@ -1195,7 +1197,6 @@ function mergeOrderProductDisplayFields(previous, next) {
|
|
|
1195
1197
|
"product_name",
|
|
1196
1198
|
"product_cover",
|
|
1197
1199
|
"cover",
|
|
1198
|
-
"product_cover",
|
|
1199
1200
|
"variant_title",
|
|
1200
1201
|
"product_sku",
|
|
1201
1202
|
"payment_price"
|
|
@@ -9,26 +9,6 @@ export interface ProductCollection {
|
|
|
9
9
|
/** 商品集合封面 */
|
|
10
10
|
cover: string;
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
* 商品 Data Variant 记录,结构与后端 data_variant 表对齐。
|
|
14
|
-
*/
|
|
15
|
-
export interface ProductDataVariant {
|
|
16
|
-
/** 变体记录 id */
|
|
17
|
-
id: number;
|
|
18
|
-
/** 店铺 id */
|
|
19
|
-
shop_id: number;
|
|
20
|
-
/** 所属模块,商品场景固定为 product */
|
|
21
|
-
module: string;
|
|
22
|
-
/** 模块数据 id,商品场景对应 product.id */
|
|
23
|
-
module_data_id: number;
|
|
24
|
-
/** 关联 data_variant_rule.id */
|
|
25
|
-
data_variant_rule_id: number;
|
|
26
|
-
/** 命中策略后覆盖到商品上的字段 */
|
|
27
|
-
data: Record<string, any>;
|
|
28
|
-
created_at: string | null;
|
|
29
|
-
updated_at: string | null;
|
|
30
|
-
deleted_at: string | null;
|
|
31
|
-
}
|
|
32
12
|
/**
|
|
33
13
|
* 商品基本信息接口
|
|
34
14
|
*/
|
|
@@ -234,8 +214,6 @@ export interface ProductData {
|
|
|
234
214
|
bundle_group_count: number;
|
|
235
215
|
/** 选项组数量 */
|
|
236
216
|
option_group_count: number;
|
|
237
|
-
/** 智能定价变体列表,/product/query with dataVariants 返回 */
|
|
238
|
-
data_variants?: ProductDataVariant[];
|
|
239
217
|
/** 服务时长 */
|
|
240
218
|
service_times?: any;
|
|
241
219
|
}
|
|
@@ -26,7 +26,7 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
26
26
|
* const products = await productList.getAddTimeProducts({ schedule_date: '2026-06-16' });
|
|
27
27
|
*/
|
|
28
28
|
getAddTimeProducts(params?: ProductListLoadProductsParams): Promise<any>;
|
|
29
|
-
loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, extension_type, status,
|
|
29
|
+
loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, extension_type, status, }?: ProductListLoadProductsParams, options?: {
|
|
30
30
|
callback?: (result: any) => void;
|
|
31
31
|
subscriberId?: string;
|
|
32
32
|
}): Promise<any>;
|
|
@@ -95,8 +95,7 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
95
95
|
cacheId,
|
|
96
96
|
with_schedule,
|
|
97
97
|
extension_type,
|
|
98
|
-
status = "published"
|
|
99
|
-
strategy_context
|
|
98
|
+
status = "published"
|
|
100
99
|
} = {}, options) {
|
|
101
100
|
var _a, _b;
|
|
102
101
|
let userPlugin = this.core.getPlugin("user");
|
|
@@ -136,8 +135,7 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
136
135
|
is_eject: 1,
|
|
137
136
|
with_schedule,
|
|
138
137
|
schedule_datetime,
|
|
139
|
-
extension_type
|
|
140
|
-
strategy_context
|
|
138
|
+
extension_type
|
|
141
139
|
},
|
|
142
140
|
{ osServer: true, callback: options == null ? void 0 : options.callback, subscriberId: options == null ? void 0 : options.subscriberId, customToast: () => {
|
|
143
141
|
} }
|
|
@@ -12,8 +12,6 @@ export interface ProductListLoadProductsParams {
|
|
|
12
12
|
with_schedule?: number;
|
|
13
13
|
extension_type?: string[];
|
|
14
14
|
status?: string;
|
|
15
|
-
/** 智能定价条件上下文,仅影响策略命中,不参与商品集合筛选 */
|
|
16
|
-
strategy_context?: Record<string, any>;
|
|
17
15
|
}
|
|
18
16
|
export interface ProductListData {
|
|
19
17
|
list: ProductData[];
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { Rules, RulesModuleAPI, DiscountResult, RulesFormSubject,
|
|
3
|
+
import { Rules, RulesModuleAPI, DiscountResult, RulesFormSubject, UnavailableReason } from './types';
|
|
4
4
|
import { Discount } from '../Discount/types';
|
|
5
|
+
import { SetDiscountSelectedParams } from '../../solution/ShopDiscount/types';
|
|
5
6
|
import { WindowPlugin } from '../../plugins';
|
|
6
7
|
export declare class RulesModule extends BaseModule implements Module, RulesModuleAPI {
|
|
7
8
|
protected defaultName: string;
|
|
@@ -35,6 +36,7 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
35
36
|
excludeDiscountListByType(discountList: Discount[], type: string): Discount[];
|
|
36
37
|
/** 手动改价场景:去掉 promotion,保留 type=product 等行内折扣 */
|
|
37
38
|
resolveDiscountListForManualOverride(discountList: Discount[]): Discount[];
|
|
39
|
+
private isItemRewardProductDiscount;
|
|
38
40
|
private getUnavailableReason;
|
|
39
41
|
calcDiscount({ discountList, productList, holders, isFormSubject, orderTotalAmount }: {
|
|
40
42
|
discountList: Discount[];
|
|
@@ -44,7 +46,12 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
44
46
|
}[];
|
|
45
47
|
isFormSubject: RulesFormSubject;
|
|
46
48
|
orderTotalAmount: number;
|
|
47
|
-
}, options?:
|
|
49
|
+
}, options?: {
|
|
50
|
+
isSelected?: boolean;
|
|
51
|
+
discountId?: number;
|
|
52
|
+
selectedList?: SetDiscountSelectedParams[];
|
|
53
|
+
scan?: boolean;
|
|
54
|
+
}): DiscountResult;
|
|
48
55
|
/**
|
|
49
56
|
* 检查优惠是否符合 PackageSubItemUsageRules 配置
|
|
50
57
|
* @param discount 优惠券
|
|
@@ -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;
|
|
@@ -209,36 +219,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
209
219
|
var _a;
|
|
210
220
|
const resolveIsFormSubject = (product) => typeof isFormSubject === "function" ? Boolean(isFormSubject(product)) : Boolean(isFormSubject);
|
|
211
221
|
const isEditModeAddNewProduct = productList.find((n) => n.booking_id) && productList.find((n) => !n.booking_id);
|
|
212
|
-
const reapplyBookingDiscountProductUids = new Set(
|
|
213
|
-
((options == null ? void 0 : options.reapplyBookingDiscountProductUids) || []).filter((uid) => uid !== void 0 && uid !== null && uid !== "").map(String)
|
|
214
|
-
);
|
|
215
|
-
const getOriginProductUid = (originProduct) => {
|
|
216
|
-
var _a2;
|
|
217
|
-
const uid = ((_a2 = originProduct == null ? void 0 : originProduct.metadata) == null ? void 0 : _a2.unique_identification_number) ?? (originProduct == null ? void 0 : originProduct.unique_identification_number);
|
|
218
|
-
if (uid === void 0 || uid === null || uid === "")
|
|
219
|
-
return void 0;
|
|
220
|
-
return String(uid);
|
|
221
|
-
};
|
|
222
|
-
const shouldReapplyBookingDiscount = (originProduct, selectedDiscount) => {
|
|
223
|
-
if (!selectedDiscount)
|
|
224
|
-
return false;
|
|
225
|
-
const uid = getOriginProductUid(originProduct);
|
|
226
|
-
if (!uid || !reapplyBookingDiscountProductUids.has(uid))
|
|
227
|
-
return false;
|
|
228
|
-
const discountType = selectedDiscount.tag || selectedDiscount.type;
|
|
229
|
-
return selectedDiscount.isEditMode === true && selectedDiscount.isSelected === true && ["good_pass", "discount_card", "product_discount_card"].includes(discountType);
|
|
230
|
-
};
|
|
231
|
-
const resolveReapplyEditModeDiscountPercent = (originProduct, selectedDiscount) => {
|
|
232
|
-
var _a2;
|
|
233
|
-
if (!shouldReapplyBookingDiscount(originProduct, selectedDiscount))
|
|
234
|
-
return void 0;
|
|
235
|
-
const discountType = (selectedDiscount == null ? void 0 : selectedDiscount.tag) || (selectedDiscount == null ? void 0 : selectedDiscount.type);
|
|
236
|
-
if (discountType !== "discount_card" && discountType !== "product_discount_card") {
|
|
237
|
-
return void 0;
|
|
238
|
-
}
|
|
239
|
-
const percent = Number((_a2 = selectedDiscount.discount) == null ? void 0 : _a2.percent);
|
|
240
|
-
return Number.isFinite(percent) ? percent : void 0;
|
|
241
|
-
};
|
|
242
222
|
const editModeDiscount = [];
|
|
243
223
|
const addModeDiscount = [];
|
|
244
224
|
discountList.forEach((discount) => {
|
|
@@ -262,6 +242,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
262
242
|
}
|
|
263
243
|
});
|
|
264
244
|
}
|
|
245
|
+
const filteredDiscountList = addModeDiscount.filter((discount) => {
|
|
246
|
+
return !discount.isManualSelect;
|
|
247
|
+
});
|
|
265
248
|
const hasDiscountInput = editModeDiscount.length > 0 || addModeDiscount.length > 0 || Boolean(options == null ? void 0 : options.discountId) || Boolean((_a = options == null ? void 0 : options.selectedList) == null ? void 0 : _a.length) || Boolean(options == null ? void 0 : options.scan);
|
|
266
249
|
if (!hasDiscountInput) {
|
|
267
250
|
return {
|
|
@@ -269,14 +252,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
269
252
|
productList
|
|
270
253
|
};
|
|
271
254
|
}
|
|
272
|
-
const canUseEditModeDiscountForReapply = (discount) => {
|
|
273
|
-
const discountType = discount.tag || discount.type;
|
|
274
|
-
return reapplyBookingDiscountProductUids.size > 0 && discount.isEditMode === true && discount.isSelected === true && ["good_pass", "discount_card", "product_discount_card"].includes(discountType);
|
|
275
|
-
};
|
|
276
|
-
const filteredDiscountList = [
|
|
277
|
-
...addModeDiscount.filter((discount) => !discount.isManualSelect),
|
|
278
|
-
...editModeDiscount.filter(canUseEditModeDiscountForReapply)
|
|
279
|
-
];
|
|
280
255
|
const flattenProductsWithBundle = (productList2) => {
|
|
281
256
|
const flattened = [];
|
|
282
257
|
productList2.forEach((originProduct) => {
|
|
@@ -500,6 +475,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
500
475
|
startDate: (_a2 = flatItem.parentProduct) == null ? void 0 : _a2.startDate
|
|
501
476
|
};
|
|
502
477
|
}
|
|
478
|
+
if (this.isItemRewardProductDiscount(product)) {
|
|
479
|
+
return false;
|
|
480
|
+
}
|
|
503
481
|
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)));
|
|
504
482
|
if (!isAvailableProduct) {
|
|
505
483
|
return false;
|
|
@@ -625,6 +603,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
625
603
|
};
|
|
626
604
|
originProduct = flatItem.originProduct;
|
|
627
605
|
}
|
|
606
|
+
const isItemRewardProductDiscount = this.isItemRewardProductDiscount(product);
|
|
628
607
|
addModeDiscount.forEach((discount) => {
|
|
629
608
|
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
630
609
|
const limitedData = discount == null ? void 0 : discount.limited_relation_product_data;
|
|
@@ -648,7 +627,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
648
627
|
].includes(discount2.tag || discount2.type)
|
|
649
628
|
))) : !((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)));
|
|
650
629
|
const isBundleAvailable = this.checkPackageSubItemUsageRules(discount, flatItem);
|
|
651
|
-
if (isAvailableProduct && isLimitedProduct && timeLimit && isBundleAvailable && ((_g = discount.config) == null ? void 0 : _g.isAvailable)) {
|
|
630
|
+
if (isAvailableProduct && !isItemRewardProductDiscount && isLimitedProduct && timeLimit && isBundleAvailable && ((_g = discount.config) == null ? void 0 : _g.isAvailable)) {
|
|
652
631
|
(_h = discountApplicability.get(discount.id)) == null ? void 0 : _h.push(product.id);
|
|
653
632
|
const applicableProducts = discountApplicableProducts.get(discount.id) || [];
|
|
654
633
|
const discountType = discount.tag || discount.type;
|
|
@@ -771,19 +750,12 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
771
750
|
}
|
|
772
751
|
const applicableDiscounts = sortedDiscountList.filter((discount) => {
|
|
773
752
|
var _a3, _b2, _c2, _d2;
|
|
753
|
+
if (this.isItemRewardProductDiscount(product))
|
|
754
|
+
return false;
|
|
774
755
|
const discountType = discount.tag || discount.type;
|
|
775
|
-
const currentOriginUid = getOriginProductUid(originProduct);
|
|
776
|
-
const isReapplyEditModeDiscountForProduct = discount.isEditMode && reapplyBookingDiscountProductUids.size > 0 && currentOriginUid && reapplyBookingDiscountProductUids.has(String(currentOriginUid)) && discount.isSelected === true;
|
|
777
|
-
if (discount.isEditMode && reapplyBookingDiscountProductUids.size > 0) {
|
|
778
|
-
const uid = currentOriginUid;
|
|
779
|
-
if (!uid || !reapplyBookingDiscountProductUids.has(uid))
|
|
780
|
-
return false;
|
|
781
|
-
if (!discount.isSelected)
|
|
782
|
-
return false;
|
|
783
|
-
}
|
|
784
756
|
if (["good_pass", "discount_card", "product_discount_card"].includes(
|
|
785
757
|
discountType
|
|
786
|
-
)
|
|
758
|
+
)) {
|
|
787
759
|
if (discount.config === void 0 || !((_a3 = discount == null ? void 0 : discount.config) == null ? void 0 : _a3.isAvailable)) {
|
|
788
760
|
return false;
|
|
789
761
|
}
|
|
@@ -845,6 +817,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
845
817
|
);
|
|
846
818
|
const selectedDiscount = selectedDiscountCard || applicableDiscounts[0];
|
|
847
819
|
let isManualDiscount = false;
|
|
820
|
+
let isItemRewardProductDiscount = false;
|
|
848
821
|
if (flatItem.type === "main") {
|
|
849
822
|
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(
|
|
850
823
|
(item) => {
|
|
@@ -855,7 +828,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
855
828
|
_i,
|
|
856
829
|
(item) => item.type === "product"
|
|
857
830
|
)));
|
|
858
|
-
|
|
831
|
+
isItemRewardProductDiscount = this.isItemRewardProductDiscount(product);
|
|
832
|
+
if (product.inPromotion && !isItemRewardProductDiscount) {
|
|
859
833
|
isManualDiscount = false;
|
|
860
834
|
}
|
|
861
835
|
} else {
|
|
@@ -969,7 +943,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
969
943
|
} else {
|
|
970
944
|
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;
|
|
971
945
|
let main_product_selling_price = product.price;
|
|
972
|
-
if ((product.discount_list || []).some((item) => item.type === "promotion") || (0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
|
|
946
|
+
if ((product.discount_list || []).some((item) => item.type === "promotion") || isItemRewardProductDiscount || (0, import_lodash_es.isBoolean)(product.vouchersApplicable) && !product.vouchersApplicable) {
|
|
973
947
|
total = product.total ?? product.origin_total;
|
|
974
948
|
main_product_selling_price = product.main_product_selling_price ?? main_product_selling_price;
|
|
975
949
|
}
|
|
@@ -977,7 +951,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
977
951
|
this.hooks.setProduct(originProduct, {
|
|
978
952
|
...isManualDiscount ? {
|
|
979
953
|
price: product.price,
|
|
980
|
-
main_product_selling_price: product.price
|
|
954
|
+
main_product_selling_price: isItemRewardProductDiscount ? main_product_selling_price : product.price,
|
|
955
|
+
...isItemRewardProductDiscount ? { total } : {}
|
|
981
956
|
} : {
|
|
982
957
|
_id: product._id.split("___")[0] + "___" + index,
|
|
983
958
|
total,
|
|
@@ -999,8 +974,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
999
974
|
}
|
|
1000
975
|
return;
|
|
1001
976
|
}
|
|
1002
|
-
|
|
1003
|
-
if (applicableDiscounts.length && product.booking_id && typeof selectedDiscount.isManualSelect === "undefined" && !(options == null ? void 0 : options.scan) && !isEditModeAddNewProduct && !shouldReapplyBookingDiscountForProduct) {
|
|
977
|
+
if (applicableDiscounts.length && product.booking_id && typeof selectedDiscount.isManualSelect === "undefined" && !(options == null ? void 0 : options.scan) && !isEditModeAddNewProduct) {
|
|
1004
978
|
return;
|
|
1005
979
|
}
|
|
1006
980
|
const isNeedSplit = (selectedDiscount.tag || selectedDiscount.type) === "good_pass";
|
|
@@ -1056,16 +1030,10 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1056
1030
|
let productDiscountDifference;
|
|
1057
1031
|
let discountedOptions = product.options;
|
|
1058
1032
|
let optionDiscountAmount = 0;
|
|
1059
|
-
let reapplyDiscountPercent;
|
|
1060
1033
|
if (isOrderLevel && productAllocation) {
|
|
1061
1034
|
amount = productAllocation.discountAmount;
|
|
1062
1035
|
productDiscountDifference = productAllocation.difference;
|
|
1063
1036
|
mainProductSellingPrice = Math.max(new import_decimal.default(product.price).minus(amount).toNumber(), 0);
|
|
1064
|
-
} else if (resolveReapplyEditModeDiscountPercent(originProduct, selectedDiscount2) !== void 0) {
|
|
1065
|
-
const percent = resolveReapplyEditModeDiscountPercent(originProduct, selectedDiscount2);
|
|
1066
|
-
reapplyDiscountPercent = new import_decimal.default(percent).toFixed(2);
|
|
1067
|
-
mainProductSellingPrice = new import_decimal.default(product.price || 0).mul(new import_decimal.default(100).minus(percent)).div(100).toDecimalPlaces(2).toNumber();
|
|
1068
|
-
amount = new import_decimal.default(product.price).minus(mainProductSellingPrice).toNumber();
|
|
1069
1037
|
} else {
|
|
1070
1038
|
mainProductSellingPrice = (0, import_utils.getDiscountAmount)(
|
|
1071
1039
|
selectedDiscount2,
|
|
@@ -1100,7 +1068,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1100
1068
|
title: selectedDiscount2.format_title,
|
|
1101
1069
|
original_amount: product.price,
|
|
1102
1070
|
product_id: originProduct.id || originProduct.product_id,
|
|
1103
|
-
percent:
|
|
1071
|
+
percent: selectedDiscount2.par_value,
|
|
1104
1072
|
discount_product_id: selectedDiscount2.product_id
|
|
1105
1073
|
},
|
|
1106
1074
|
// 前端使用的num数量,为了计算优惠金额
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Discount } from '../Discount/types';
|
|
2
|
-
import { SetDiscountSelectedParams } from '../../solution/ShopDiscount/types';
|
|
3
2
|
export declare enum UnavailableReason {
|
|
4
3
|
TimeLimit = "time_limit",
|
|
5
4
|
ProductNotApplicable = "product_not_applicable",
|
|
@@ -24,14 +23,6 @@ export interface DiscountResult {
|
|
|
24
23
|
discountList: any[];
|
|
25
24
|
}
|
|
26
25
|
export type RulesFormSubject = boolean | ((product: any) => boolean);
|
|
27
|
-
export interface RulesCalcDiscountOptions {
|
|
28
|
-
isSelected?: boolean;
|
|
29
|
-
discountId?: number;
|
|
30
|
-
selectedList?: SetDiscountSelectedParams[];
|
|
31
|
-
scan?: boolean;
|
|
32
|
-
/** Change time 重报价目标行:允许已选编辑态折扣卡重新应用到这些 booking 商品。 */
|
|
33
|
-
reapplyBookingDiscountProductUids?: string[];
|
|
34
|
-
}
|
|
35
26
|
export interface RulesModuleAPI {
|
|
36
27
|
setRulesList: (rulesList: Rules[]) => Promise<void>;
|
|
37
28
|
clear: () => Promise<void>;
|
|
@@ -43,7 +34,7 @@ export interface RulesModuleAPI {
|
|
|
43
34
|
}[];
|
|
44
35
|
isFormSubject: RulesFormSubject;
|
|
45
36
|
orderTotalAmount: number;
|
|
46
|
-
}
|
|
37
|
+
}) => DiscountResult;
|
|
47
38
|
}
|
|
48
39
|
type ProductDetail = {
|
|
49
40
|
isClient?: boolean;
|
package/lib/server/index.d.ts
CHANGED
|
@@ -47,8 +47,6 @@ declare class Server {
|
|
|
47
47
|
private prefixRouterGet;
|
|
48
48
|
router: Router;
|
|
49
49
|
private productQuerySubscribers;
|
|
50
|
-
/** subscriberId → 智能定价变价时间点定时器句柄(与 subscriber 分离存储,便于 clear) */
|
|
51
|
-
private productQueryScheduleTimers;
|
|
52
50
|
private orderQuerySubscribers;
|
|
53
51
|
private bookingQuerySubscribers;
|
|
54
52
|
private bookingRemoteQuerySubscribers;
|
|
@@ -212,48 +210,6 @@ declare class Server {
|
|
|
212
210
|
* 根据 subscriberId 移除商品查询订阅者
|
|
213
211
|
*/
|
|
214
212
|
removeProductQuerySubscriber(subscriberId?: string): void;
|
|
215
|
-
/**
|
|
216
|
-
* 构建商品 query 响应 data 段,附带智能定价 schedule_time_points 元数据。
|
|
217
|
-
*/
|
|
218
|
-
private buildProductQueryResultPayload;
|
|
219
|
-
/**
|
|
220
|
-
* 是否启用商品 query 订阅的 schedule 时间点定时重算。
|
|
221
|
-
* strategy_context.enable_schedule_reload === false 时关闭。
|
|
222
|
-
*/
|
|
223
|
-
private shouldScheduleProductQueryReload;
|
|
224
|
-
/**
|
|
225
|
-
* 清除指定 subscriber 的全部 schedule 定时器,防止重复 query 或 unsubscribe 后泄漏。
|
|
226
|
-
*/
|
|
227
|
-
private clearSubscriberScheduleTimers;
|
|
228
|
-
/**
|
|
229
|
-
* 从 productQueryScheduleTimers 移除已触发的 timer 引用。
|
|
230
|
-
*/
|
|
231
|
-
private removeScheduleTimerRef;
|
|
232
|
-
/**
|
|
233
|
-
* 计算 schedule 变价时间点到当前时刻的延迟(ms)。已过期返回 -1。
|
|
234
|
-
*/
|
|
235
|
-
private computeScheduleTimePointDelayMs;
|
|
236
|
-
/**
|
|
237
|
-
* 定时重算前刷新 subscriber schedule 上下文:使用执行瞬间时间,禁止沿用首次 query 的 schedule_datetime。
|
|
238
|
-
*/
|
|
239
|
-
private refreshSubscriberScheduleAtExecution;
|
|
240
|
-
/**
|
|
241
|
-
* 为 subscriber 注册智能定价 scheduleTimePoints 定时重算。
|
|
242
|
-
* 必须先 clearSubscriberScheduleTimers,再调用本方法。
|
|
243
|
-
*/
|
|
244
|
-
private scheduleSubscriberTimePointReloads;
|
|
245
|
-
/**
|
|
246
|
-
* schedule 变价时间点定时器触发:刷新 schedule_datetime 后重算并 callback。
|
|
247
|
-
*/
|
|
248
|
-
private onScheduleTimePointTimerFire;
|
|
249
|
-
/**
|
|
250
|
-
* 对单个商品 query 订阅者重算并推送(定时路径;不新建 schedule timer)。
|
|
251
|
-
*/
|
|
252
|
-
private recomputeAndNotifySubscriber;
|
|
253
|
-
/**
|
|
254
|
-
* query 完成后为 subscriber 同步 schedule 定时器(先 clear 再 schedule)。
|
|
255
|
-
*/
|
|
256
|
-
private syncProductQueryScheduleTimers;
|
|
257
213
|
/**
|
|
258
214
|
* 处理商品查询请求
|
|
259
215
|
* 存储订阅者信息,便于数据变更时推送最新结果
|
|
@@ -489,11 +445,6 @@ declare class Server {
|
|
|
489
445
|
private sumPaidOrderPayments;
|
|
490
446
|
private toAmountNumber;
|
|
491
447
|
private buildSmallTicketProductMap;
|
|
492
|
-
private collectSalesDetailProductIds;
|
|
493
|
-
private buildSalesDetailProductSnapshotMap;
|
|
494
|
-
private withProductCatalogSnapshots;
|
|
495
|
-
private withBundleCatalogSnapshots;
|
|
496
|
-
private withSalesDetailProductSnapshots;
|
|
497
448
|
private withPendingSyncProductTitles;
|
|
498
449
|
private buildProductTitleSnapshot;
|
|
499
450
|
private getProductTitleSnapshotCurrentLocale;
|
|
@@ -614,12 +565,6 @@ declare class Server {
|
|
|
614
565
|
* @param options.changedIds 变更的商品 IDs,用于增量更新价格缓存
|
|
615
566
|
*/
|
|
616
567
|
private computeProductQueryResult;
|
|
617
|
-
/**
|
|
618
|
-
* 构建商品格式化上下文。
|
|
619
|
-
*
|
|
620
|
-
* 智能定价条件使用全量 menuList/scheduleList;Product Query 顶层参数只保留筛选商品集合所需字段。
|
|
621
|
-
*/
|
|
622
|
-
private buildProductFormatterContext;
|
|
623
568
|
/**
|
|
624
569
|
* 数据变更后,遍历所有订阅者重新计算查询结果并通过 callback 推送
|
|
625
570
|
* 由 ProductsModule 的 onProductsSyncCompleted 事件触发
|