@pisell/pisellos 2.3.170 → 2.3.172
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/inventory/index.d.ts +92 -0
- package/dist/inventory/index.js +509 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +5 -4
- package/dist/modules/Discount/index.js +1 -0
- package/dist/modules/Discount/types.d.ts +4 -0
- package/dist/modules/Order/index.d.ts +25 -3
- package/dist/modules/Order/index.js +1791 -1318
- package/dist/modules/Order/types.d.ts +7 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
- package/dist/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/dist/modules/Order/utils/productVoucherGroups.js +115 -0
- package/dist/modules/Payment/walletpass.js +32 -6
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +33 -12
- package/dist/modules/Rules/index.d.ts +5 -10
- package/dist/modules/Rules/index.js +197 -107
- package/dist/modules/Rules/promotionSelection.d.ts +14 -0
- package/dist/modules/Rules/promotionSelection.js +390 -0
- package/dist/modules/Rules/types.d.ts +9 -0
- package/dist/server/modules/order/index.d.ts +6 -0
- package/dist/server/modules/order/index.js +782 -447
- package/dist/solution/BaseSales/index.d.ts +16 -1
- package/dist/solution/BaseSales/index.js +1545 -1339
- package/dist/solution/BaseSales/utils/cartPromotion.js +5 -2
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.js +200 -108
- package/dist/solution/BookingTicket/types.d.ts +14 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +4 -3
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +94 -58
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +10 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +117 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.js +69 -49
- package/dist/utils/platform.d.ts +2 -0
- package/dist/utils/platform.js +6 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +12 -0
- package/lib/inventory/index.d.ts +92 -0
- package/lib/inventory/index.js +287 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +5 -4
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/Discount/index.js +1 -0
- package/lib/modules/Discount/types.d.ts +4 -0
- package/lib/modules/Order/index.d.ts +25 -3
- package/lib/modules/Order/index.js +203 -38
- package/lib/modules/Order/types.d.ts +7 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
- package/lib/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/lib/modules/Order/utils/productVoucherGroups.js +64 -0
- package/lib/modules/Payment/walletpass.js +23 -1
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +15 -0
- package/lib/modules/Rules/index.d.ts +5 -10
- package/lib/modules/Rules/index.js +68 -22
- package/lib/modules/Rules/promotionSelection.d.ts +14 -0
- package/lib/modules/Rules/promotionSelection.js +230 -0
- package/lib/modules/Rules/types.d.ts +9 -0
- package/lib/server/modules/order/index.d.ts +6 -0
- package/lib/server/modules/order/index.js +226 -29
- package/lib/solution/BaseSales/index.d.ts +16 -1
- package/lib/solution/BaseSales/index.js +108 -14
- package/lib/solution/BaseSales/utils/cartPromotion.js +5 -2
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.js +38 -2
- package/lib/solution/BookingTicket/types.d.ts +14 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -3
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +14 -2
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +10 -0
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +71 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +1 -1
- package/lib/solution/UnifiedBookingSales/index.js +14 -3
- package/lib/utils/platform.d.ts +2 -0
- package/lib/utils/platform.js +7 -0
- package/package.json +1 -1
|
@@ -792,6 +792,7 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
792
792
|
_iterator11.f();
|
|
793
793
|
}
|
|
794
794
|
var allocatedPricesByProductId = new Map();
|
|
795
|
+
var expectedPromoTotal = new Decimal(0);
|
|
795
796
|
for (var g = 0; g < groupCount; g++) {
|
|
796
797
|
var startIdx = g * x;
|
|
797
798
|
var endIdx = startIdx + x;
|
|
@@ -802,8 +803,9 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
802
803
|
return sum.plus(u.price);
|
|
803
804
|
}, new Decimal(0));
|
|
804
805
|
|
|
805
|
-
//
|
|
806
|
-
var groupPriceDecimal = new Decimal(groupPrice);
|
|
806
|
+
// 组价高于本组原价时保留原价,尾差目标也必须使用封顶后的实际组价。
|
|
807
|
+
var groupPriceDecimal = Decimal.min(new Decimal(groupPrice), groupOriginalTotal);
|
|
808
|
+
expectedPromoTotal = expectedPromoTotal.plus(groupPriceDecimal);
|
|
807
809
|
var allocatedSum = new Decimal(0);
|
|
808
810
|
for (var i = 0; i < groupUnits.length; i++) {
|
|
809
811
|
var unit = groupUnits[i];
|
|
@@ -911,14 +913,13 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
911
913
|
processedQuantityMap.set(_key, _processedQty + _availableQty);
|
|
912
914
|
}
|
|
913
915
|
|
|
914
|
-
// 8.
|
|
916
|
+
// 8. 尾差调整:只补实际组价的舍入差额,不将高于原价的组价补到某一件。
|
|
915
917
|
} catch (err) {
|
|
916
918
|
_iterator12.e(err);
|
|
917
919
|
} finally {
|
|
918
920
|
_iterator12.f();
|
|
919
921
|
}
|
|
920
922
|
if (groupCount > 0) {
|
|
921
|
-
var expectedPromoTotal = new Decimal(groupPrice).mul(groupCount);
|
|
922
923
|
var promoItems = result.filter(function (p) {
|
|
923
924
|
return p.inPromotion;
|
|
924
925
|
});
|
|
@@ -265,6 +265,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
265
265
|
_context5.next = 3;
|
|
266
266
|
return this.request.get("/machinecode/batch-search", _objectSpread(_objectSpread({
|
|
267
267
|
code: code,
|
|
268
|
+
resolve_ticket_order: 1,
|
|
268
269
|
translate_flag: 1,
|
|
269
270
|
tags: ['entitlement_pass', 'good_pass', 'product_discount_card'],
|
|
270
271
|
// available: 1,
|
|
@@ -158,6 +158,10 @@ export interface Discount {
|
|
|
158
158
|
discount_calculation_mode: 'item_level' | 'order_level';
|
|
159
159
|
};
|
|
160
160
|
isManualSelect?: boolean;
|
|
161
|
+
/** X 件 Y 元互斥选择的手动意图;isSelected 只表示本次实际应用结果。 */
|
|
162
|
+
promotionSelection?: 'card' | 'promotion';
|
|
163
|
+
/** 记录手动操作影响的促销组,避免卡失效后普通重算丢失取消意图。 */
|
|
164
|
+
promotionSelectionStrategyIds?: string[];
|
|
161
165
|
isDisabled?: boolean;
|
|
162
166
|
isSelected?: boolean;
|
|
163
167
|
isAvailable?: boolean;
|
|
@@ -4,7 +4,8 @@ import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrde
|
|
|
4
4
|
import { CartItem } from '../Cart/types';
|
|
5
5
|
import { type SubmitPayloadEnhancer } from './utils';
|
|
6
6
|
import { type PickupTimingBooking, type PickupTimingBookingInput } from './pickupTiming';
|
|
7
|
-
import
|
|
7
|
+
import { type ProductVoucherGroup } from './utils/productVoucherGroups';
|
|
8
|
+
import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, OrderHooksConfig, OrderCartIntentCommitContext, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, SalesNote, SalesNotesMutationSnapshot, SetSalesNoteInput, PickupReferenceMode, PointCardSnapshotMergeContext, PointCardSnapshotItem, ShopServiceData, ShopServiceType } from './types';
|
|
8
9
|
import type { ICustomer } from '../AccountList/types';
|
|
9
10
|
import type { Discount } from '../Discount/types';
|
|
10
11
|
import { UnavailableReason } from '../Rules/types';
|
|
@@ -29,6 +30,12 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
29
30
|
private rulesHooksOverride?;
|
|
30
31
|
private moduleHooksOverride?;
|
|
31
32
|
private orderHooks?;
|
|
33
|
+
private cartCommandQueue;
|
|
34
|
+
private queueCartCommand;
|
|
35
|
+
/** Use the exact Order normalizers/merge rules on a private draft, not a second projection. */
|
|
36
|
+
private beginCartMutation;
|
|
37
|
+
/** Serializes checkout preparation with local cart commands; hydration remains outside this guard. */
|
|
38
|
+
prepareCheckout<T>(prepare: (items: OrderProduct[]) => Promise<T>): Promise<T>;
|
|
32
39
|
private otherParams?;
|
|
33
40
|
/** 评估器引用;由 SalesSdkProvider 注入,未注入时 applyPromotion 静默跳过 */
|
|
34
41
|
private promotionEvaluator;
|
|
@@ -66,7 +73,11 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
66
73
|
* @example
|
|
67
74
|
* orderModule.updateOtherParams({ cacheId: 'cache-2', channel: 'pos' });
|
|
68
75
|
*/
|
|
69
|
-
updateOtherParams(params: Record<string, any
|
|
76
|
+
updateOtherParams(params: Record<string, any>, options?: {
|
|
77
|
+
hooks?: OrderHooksConfig;
|
|
78
|
+
changedParams?: Record<string, any>;
|
|
79
|
+
cover?: boolean;
|
|
80
|
+
}): void;
|
|
70
81
|
/** Internal intent boundary shared with asynchronous scanner/detail flows. */
|
|
71
82
|
createCartIntentCommitGuard(action: OrderCartIntentCommitContext['action'], tempOrder?: OrderTempOrder | null): () => void;
|
|
72
83
|
/** PC/H5 属于在线店铺;其它或缺失平台统一沿用 POS 行为。 */
|
|
@@ -84,6 +95,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
84
95
|
*/
|
|
85
96
|
private logError;
|
|
86
97
|
private registerDiscountModules;
|
|
98
|
+
setProductVoucherGroups(groups: ProductVoucherGroup[]): void;
|
|
99
|
+
validateProductVoucherSelection(): void;
|
|
87
100
|
private createDefaultRulesHooks;
|
|
88
101
|
/**
|
|
89
102
|
* Stable across notifyTempOrderChanged's immutable copy, but changes when a
|
|
@@ -102,7 +115,9 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
102
115
|
getCustomerWalletPrepareConfigEpoch(): number;
|
|
103
116
|
private syncScannedDiscountsToOriginalDiscountList;
|
|
104
117
|
private ensureEditDiscountConfigForProductChange;
|
|
105
|
-
scanCode(code: string, customerId?: number
|
|
118
|
+
scanCode(code: string, customerId?: number, options?: {
|
|
119
|
+
productVouchersOnly?: boolean;
|
|
120
|
+
}): Promise<{
|
|
106
121
|
isAvailable: boolean;
|
|
107
122
|
isAccepted?: boolean;
|
|
108
123
|
discountList: Discount[];
|
|
@@ -482,6 +497,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
482
497
|
* // → tempOrder.products 新增 3 行,每行 num=1,bookings 3 条
|
|
483
498
|
*/
|
|
484
499
|
addProductToOrder(product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions): Promise<OrderProduct[]>;
|
|
500
|
+
private addProductToOrderDraft;
|
|
485
501
|
/**
|
|
486
502
|
* 批量添加商品行,所有行追加完成后只触发一次促销、折扣、summary 重算与持久化。
|
|
487
503
|
*
|
|
@@ -497,6 +513,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
497
513
|
}>, options?: {
|
|
498
514
|
skipEditDiscountConfigRefresh?: boolean;
|
|
499
515
|
}): Promise<OrderProduct[]>;
|
|
516
|
+
private addProductsToOrderDraft;
|
|
500
517
|
private getFullCoveragePassDiscounts;
|
|
501
518
|
private hasEntitlementPassDiscount;
|
|
502
519
|
private hasGoodPassDiscount;
|
|
@@ -508,10 +525,13 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
508
525
|
private isRestrictedCartProductUpdate;
|
|
509
526
|
private applyOrderProductUpdateToTempOrder;
|
|
510
527
|
updateOrderProduct(params: UpdateOrderProductParams): Promise<OrderProduct[]>;
|
|
528
|
+
private updateOrderProductDraft;
|
|
511
529
|
updateOrderProducts(paramsList: UpdateOrderProductParams[]): Promise<OrderProduct[]>;
|
|
530
|
+
private updateOrderProductsDraft;
|
|
512
531
|
updateOrderProductQuantity(params: UpdateOrderProductQuantityParams, options?: {
|
|
513
532
|
isCurrentOrder?: () => boolean;
|
|
514
533
|
}): Promise<OrderProduct[]>;
|
|
534
|
+
private updateOrderProductQuantityDraft;
|
|
515
535
|
updateOrderBooking(params: UpdateOrderBookingParams): any[];
|
|
516
536
|
/**
|
|
517
537
|
* 商品行写路径收尾:促销 → 折扣 → 清洗 → summary → 持久化。
|
|
@@ -528,12 +548,14 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
528
548
|
* await order.removeProductsFromOrder([identityA, identityB]);
|
|
529
549
|
*/
|
|
530
550
|
removeProductsFromOrder(identities: OrderProductIdentity[], options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
551
|
+
private removeProductsFromOrderDraft;
|
|
531
552
|
removeProductFromOrder(identity: OrderProductIdentity, options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
532
553
|
/**
|
|
533
554
|
* 仅清空购物车行(products / bookings),不重置整单。
|
|
534
555
|
* 普通整单 note 保持不变;以商品行为主体的 Sales Notes 同步删除。
|
|
535
556
|
*/
|
|
536
557
|
clearOrderCartLines(): Promise<OrderTempOrder>;
|
|
558
|
+
private clearOrderCartLinesDraft;
|
|
537
559
|
/**
|
|
538
560
|
* 切换购物车结算单位时清理所有会影响新币种的订单状态,但保留当前客户。
|
|
539
561
|
*/
|