@pisell/pisellos 2.3.230 → 2.3.232
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/adapter.js +14 -2
- package/dist/model/strategy/adapter/promotion/evaluator.js +23 -8
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/model/strategy/adapter/promotion/type.d.ts +10 -2
- package/dist/modules/Customer/types.d.ts +0 -4
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +1411 -1318
- package/dist/modules/Order/types.d.ts +13 -36
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils.js +0 -2
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/solution/BaseSales/index.js +0 -3
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +5 -18
- package/dist/solution/BaseSales/utils/cartPromotion.js +252 -168
- package/dist/solution/BookingByStep/index.d.ts +3 -3
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +45 -21
- package/dist/solution/BookingTicket/utils/redeemArrival.d.ts +9 -9
- package/dist/solution/Checkout/index.js +69 -104
- package/dist/solution/Checkout/types.d.ts +0 -1
- package/dist/solution/ScanOrder/index.d.ts +1 -0
- package/dist/solution/ScanOrder/index.js +54 -48
- package/dist/solution/ScanOrder/menuAvailability.js +3 -25
- package/dist/solution/ScanOrder/shopTime.d.ts +6 -0
- package/dist/solution/ScanOrder/shopTime.js +36 -0
- package/dist/solution/VenueBooking/index.js +490 -522
- package/lib/model/strategy/adapter/promotion/adapter.js +10 -1
- package/lib/model/strategy/adapter/promotion/evaluator.js +18 -6
- package/lib/model/strategy/adapter/promotion/type.d.ts +10 -2
- package/lib/modules/Customer/types.d.ts +0 -4
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +109 -76
- package/lib/modules/Order/types.d.ts +13 -36
- package/lib/modules/Order/types.js +1 -0
- package/lib/modules/Order/utils.js +1 -5
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/solution/BaseSales/index.js +0 -3
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +5 -18
- package/lib/solution/BaseSales/utils/cartPromotion.js +87 -40
- package/lib/solution/BookingByStep/index.d.ts +3 -3
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +28 -11
- package/lib/solution/BookingTicket/utils/redeemArrival.d.ts +9 -9
- package/lib/solution/Checkout/index.js +0 -21
- package/lib/solution/Checkout/types.d.ts +0 -1
- package/lib/solution/ScanOrder/index.d.ts +1 -0
- package/lib/solution/ScanOrder/index.js +26 -19
- package/lib/solution/ScanOrder/menuAvailability.js +3 -20
- package/lib/solution/ScanOrder/shopTime.d.ts +6 -0
- package/lib/solution/ScanOrder/shopTime.js +37 -0
- package/lib/solution/VenueBooking/index.js +1 -6
- package/package.json +1 -1
- package/dist/modules/Order/utils/bookingUuid.d.ts +0 -4
- package/dist/modules/Order/utils/bookingUuid.js +0 -24
- package/lib/modules/Order/utils/bookingUuid.d.ts +0 -4
- package/lib/modules/Order/utils/bookingUuid.js +0 -25
|
@@ -8,6 +8,7 @@ import type { PaymentItem } from '../Payment/types';
|
|
|
8
8
|
import type { ICustomer } from '../AccountList/types';
|
|
9
9
|
import type { OrderProductDiscountItem } from '../../server/modules/order/types';
|
|
10
10
|
import type { PickupTimingBooking, PickupTimingBookingInput } from './pickupTiming';
|
|
11
|
+
import type { FixedGiftProduct, GiftInfo } from '../../model/strategy/adapter/promotion/type';
|
|
11
12
|
export type { OrderProductDiscountItem } from '../../server/modules/order/types';
|
|
12
13
|
export type PickupReferenceMode = 'counter_pickup' | 'table_service';
|
|
13
14
|
export type ShopServiceType = 'dine_in' | 'takeaway' | 'pick_up' | 'delivery';
|
|
@@ -45,23 +46,17 @@ export interface OrderPromotionEvaluator {
|
|
|
45
46
|
getStrategyConfigs?: () => unknown[];
|
|
46
47
|
}
|
|
47
48
|
/** 赠品解析回调 context(OS → SDK 的请求体) */
|
|
48
|
-
export interface OrderGiftSelectContext {
|
|
49
|
-
/**
|
|
50
|
-
inventoryReserved?:
|
|
51
|
-
product_id: number;
|
|
52
|
-
product_variant_id: number;
|
|
53
|
-
quantity: number;
|
|
54
|
-
}>;
|
|
55
|
-
strategyId: string;
|
|
56
|
-
strategyName: string | Record<string, string>;
|
|
57
|
-
giftCount: number;
|
|
58
|
-
giftOptions: Array<{
|
|
59
|
-
product_id: number;
|
|
60
|
-
product_variant_id: number;
|
|
61
|
-
}>;
|
|
49
|
+
export interface OrderGiftSelectContext extends GiftInfo {
|
|
50
|
+
/** 购物车内已占用库存的商品,含触发活动的主商品 */
|
|
51
|
+
inventoryReserved?: FixedGiftProduct[];
|
|
62
52
|
/** 触发此赠品的主商品 metadata.unique_identification_number 列表 */
|
|
63
53
|
sourceProductIds: string[];
|
|
64
54
|
}
|
|
55
|
+
/** 草稿已提示的额度,包含顾客放弃的部分。 */
|
|
56
|
+
export interface OrderFixedGiftQuotas {
|
|
57
|
+
strategyId: string;
|
|
58
|
+
giftQuotas: FixedGiftProduct[];
|
|
59
|
+
}
|
|
65
60
|
/**
|
|
66
61
|
* 赠品 resolver 返回值。
|
|
67
62
|
*
|
|
@@ -71,7 +66,7 @@ export interface OrderGiftSelectContext {
|
|
|
71
66
|
export interface OrderGiftSelectResult {
|
|
72
67
|
/** 完整赠品购物车行,必须带 metadata._giftInfo。 */
|
|
73
68
|
products: Partial<OrderProduct>[];
|
|
74
|
-
/**
|
|
69
|
+
/** 固定赠品按 product_uid 关联预约,普通买赠沿用 products 下标。 */
|
|
75
70
|
bookings?: AddProductBookingInput[];
|
|
76
71
|
}
|
|
77
72
|
/**
|
|
@@ -104,16 +99,7 @@ export interface OrderUnfulfilledPromotion {
|
|
|
104
99
|
}
|
|
105
100
|
/** 上一次 applyPromotion 计算出的赠品操作(仅供调试/读取使用) */
|
|
106
101
|
export interface OrderLastGiftActions {
|
|
107
|
-
toAdd:
|
|
108
|
-
strategyId: string;
|
|
109
|
-
strategyName: string | Record<string, string>;
|
|
110
|
-
giftCount: number;
|
|
111
|
-
giftOptions: Array<{
|
|
112
|
-
product_id: number;
|
|
113
|
-
product_variant_id: number;
|
|
114
|
-
}>;
|
|
115
|
-
sourceProductIds: string[];
|
|
116
|
-
}>;
|
|
102
|
+
toAdd: OrderGiftSelectContext[];
|
|
117
103
|
toReduce: Array<{
|
|
118
104
|
strategyId: string;
|
|
119
105
|
items: Array<{
|
|
@@ -129,15 +115,7 @@ export interface OrderPromotionAppliedPayload {
|
|
|
129
115
|
unfulfilledPromotions: OrderUnfulfilledPromotion[];
|
|
130
116
|
giftActions: OrderLastGiftActions;
|
|
131
117
|
/** evaluator 返回的赠品摘要 */
|
|
132
|
-
gifts:
|
|
133
|
-
strategyId: string;
|
|
134
|
-
strategyName: string | Record<string, string>;
|
|
135
|
-
giftCount: number;
|
|
136
|
-
giftOptions: Array<{
|
|
137
|
-
product_id: number;
|
|
138
|
-
product_variant_id: number;
|
|
139
|
-
}>;
|
|
140
|
-
}>;
|
|
118
|
+
gifts: GiftInfo[];
|
|
141
119
|
/** 折扣重算后的最终商品列表 */
|
|
142
120
|
products: OrderProduct[];
|
|
143
121
|
}
|
|
@@ -420,6 +398,7 @@ export interface OrderTempOrder {
|
|
|
420
398
|
_extend?: {
|
|
421
399
|
productsByUid?: Record<string, Record<string, any>>;
|
|
422
400
|
salesNotesState?: SalesNotesRuntimeState;
|
|
401
|
+
fixedGiftQuotas?: OrderFixedGiftQuotas[];
|
|
423
402
|
[key: string]: any;
|
|
424
403
|
};
|
|
425
404
|
}
|
|
@@ -617,8 +596,6 @@ export interface CommitOrderParams {
|
|
|
617
596
|
};
|
|
618
597
|
}
|
|
619
598
|
export interface OrderSubmitBooking {
|
|
620
|
-
/** Stable booking identity, created once and shared with external allocations. */
|
|
621
|
-
uuid?: string | null;
|
|
622
599
|
relation_id?: string;
|
|
623
600
|
form_id?: string;
|
|
624
601
|
collect_pax?: number;
|
|
@@ -31,7 +31,6 @@ import { hasManualProductDiscountFlag } from "./utils/manualProductDiscount";
|
|
|
31
31
|
import { getProductHolderConfig } from "../Holder/utils";
|
|
32
32
|
import { buildProductLineFingerprint, createEmptySummary } from "../../solution/ScanOrder/utils";
|
|
33
33
|
import { createUuidV4 } from "./utils/orderCollectionIdentity";
|
|
34
|
-
import { assignBookingUuid } from "./utils/bookingUuid";
|
|
35
34
|
import { encodeSalesNotes } from "./salesNotes";
|
|
36
35
|
import { isFulfillmentTimingBooking } from "./pickupTiming";
|
|
37
36
|
import { ensureHolderRelationUuids, getProductHolderRelations, hasProductBooking, removeProductHolderRelations } from "./holderRelations";
|
|
@@ -1665,7 +1664,6 @@ export function buildSubmitPayload(params) {
|
|
|
1665
1664
|
bookings: (tempOrder.bookings || []).filter(function (booking) {
|
|
1666
1665
|
return isFulfillmentTimingBooking(booking) || Number(booking.parent_id) !== 0;
|
|
1667
1666
|
}).map(function (booking) {
|
|
1668
|
-
assignBookingUuid(booking);
|
|
1669
1667
|
return normalizeSubmitBooking(booking);
|
|
1670
1668
|
}),
|
|
1671
1669
|
payments: tempOrder.payments || [],
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "duration" | "normal" | "session";
|
|
53
53
|
}
|
|
@@ -256,9 +256,6 @@ function mergeBaseSalesCollectionItem(kind, currentItem, incomingItem, uidRemaps
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
var mergedItem = mergedUid ? setOrderCollectionUid(kind, incomingItem, mergedUid) : cloneDeep(incomingItem);
|
|
259
|
-
if (kind === 'booking' && !mergedItem.uuid && currentItem.uuid !== undefined) {
|
|
260
|
-
mergedItem.uuid = currentItem.uuid;
|
|
261
|
-
}
|
|
262
259
|
var persistentIdField = BASE_SALES_PERSISTENT_ID_FIELD_BY_KIND[kind];
|
|
263
260
|
if (isBaseSalesBlankValue(mergedItem[persistentIdField]) && !isBaseSalesBlankValue(identityMergedItem[persistentIdField])) {
|
|
264
261
|
mergedItem[persistentIdField] = identityMergedItem[persistentIdField];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { OrderProduct } from '../../../modules/Order/types';
|
|
1
|
+
import type { OrderFixedGiftQuotas, OrderProduct } from '../../../modules/Order/types';
|
|
2
|
+
import type { GiftInfo } from '../../../model/strategy/adapter/promotion/type';
|
|
2
3
|
/**
|
|
3
4
|
* 运行态商品行标记:该行由“不合并商品”加车策略创建,促销重算时必须保持独立。
|
|
4
5
|
* `normalizeSubmitProduct` 会按白名单裁剪 metadata,不会把此字段提交到后端。
|
|
@@ -49,15 +50,7 @@ export interface CartPromotionEvaluator {
|
|
|
49
50
|
_originalId?: string;
|
|
50
51
|
_originalIndex?: number;
|
|
51
52
|
}>;
|
|
52
|
-
gifts:
|
|
53
|
-
strategyId: string;
|
|
54
|
-
strategyName: string | Record<string, string>;
|
|
55
|
-
giftCount: number;
|
|
56
|
-
giftOptions: Array<{
|
|
57
|
-
product_id: number;
|
|
58
|
-
product_variant_id: number;
|
|
59
|
-
}>;
|
|
60
|
-
}>;
|
|
53
|
+
gifts: GiftInfo[];
|
|
61
54
|
totalDiscount: number;
|
|
62
55
|
};
|
|
63
56
|
getProductsApplicableStrategies(input: {
|
|
@@ -94,14 +87,7 @@ export interface GiftReduceItem {
|
|
|
94
87
|
newQuantity: number;
|
|
95
88
|
}
|
|
96
89
|
/** 赠品新增项 */
|
|
97
|
-
export interface GiftToAddAction {
|
|
98
|
-
strategyId: string;
|
|
99
|
-
strategyName: string | Record<string, string>;
|
|
100
|
-
giftCount: number;
|
|
101
|
-
giftOptions: Array<{
|
|
102
|
-
product_id: number;
|
|
103
|
-
product_variant_id: number;
|
|
104
|
-
}>;
|
|
90
|
+
export interface GiftToAddAction extends GiftInfo {
|
|
105
91
|
/** 触发此赠品的主商品 uid 列表 */
|
|
106
92
|
sourceProductIds: string[];
|
|
107
93
|
}
|
|
@@ -291,4 +277,5 @@ export declare function appendPromotionTags<T extends Record<string, any>>(produ
|
|
|
291
277
|
*/
|
|
292
278
|
export declare function processCartPromotion(list: OrderProduct[] | null | undefined, evaluator: CartPromotionEvaluator | null | undefined, options?: {
|
|
293
279
|
channel?: string;
|
|
280
|
+
previousFixedGiftQuotas?: OrderFixedGiftQuotas[];
|
|
294
281
|
}): ProcessCartPromotionResult;
|