@pisell/pisellos 2.2.178 → 2.2.180
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/modules/Customer/index.d.ts +0 -6
- package/dist/modules/Customer/index.js +83 -129
- package/dist/modules/Customer/types.d.ts +0 -2
- package/dist/modules/Discount/index.d.ts +4 -2
- package/dist/modules/Discount/index.js +93 -8
- package/dist/modules/Discount/types.d.ts +7 -1
- package/dist/modules/Order/index.d.ts +17 -87
- package/dist/modules/Order/index.js +501 -1357
- package/dist/modules/Order/types.d.ts +19 -198
- package/dist/modules/Order/types.js +0 -31
- package/dist/modules/Order/utils.d.ts +1 -50
- package/dist/modules/Order/utils.js +32 -261
- package/dist/modules/Quotation/index.d.ts +1 -0
- package/dist/modules/Quotation/index.js +21 -23
- package/dist/modules/Rules/index.d.ts +0 -4
- package/dist/modules/Rules/index.js +10 -26
- package/dist/modules/SalesSummary/index.js +2 -4
- package/dist/modules/SalesSummary/utils.js +7 -21
- package/dist/modules/Schedule/index.js +2 -6
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +1 -2
- package/dist/server/index.js +29 -87
- package/dist/server/modules/order/index.d.ts +0 -23
- package/dist/server/modules/order/index.js +46 -123
- package/dist/server/modules/order/types.d.ts +2 -0
- package/dist/server/modules/order/utils/filterOrders.js +6 -20
- package/dist/server/modules/products/index.d.ts +1 -1
- package/dist/server/modules/products/index.js +113 -130
- package/dist/server/modules/schedule/index.js +6 -13
- package/dist/solution/BaseSales/index.d.ts +7 -89
- package/dist/solution/BaseSales/index.js +375 -1494
- package/dist/solution/BaseSales/types.d.ts +1 -67
- package/dist/solution/BaseSales/types.js +1 -3
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +1 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +16 -68
- package/dist/solution/BaseSales/utils.js +8 -46
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -133
- package/dist/solution/BookingTicket/index.js +175 -780
- package/dist/solution/BookingTicket/types.d.ts +0 -2
- package/dist/solution/BookingTicket/types.js +0 -3
- package/dist/solution/BookingTicket/utils/cartView.js +2 -4
- package/dist/solution/ScanOrder/index.d.ts +3 -9
- package/dist/solution/ScanOrder/index.js +128 -231
- package/dist/solution/ScanOrder/utils.js +8 -46
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +23 -18
- package/dist/solution/VenueBooking/index.d.ts +9 -5
- package/dist/solution/VenueBooking/index.js +55 -103
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/Customer/index.d.ts +0 -6
- package/lib/modules/Customer/index.js +11 -26
- package/lib/modules/Customer/types.d.ts +0 -2
- package/lib/modules/Discount/index.d.ts +4 -2
- package/lib/modules/Discount/index.js +63 -8
- package/lib/modules/Discount/types.d.ts +7 -1
- package/lib/modules/Order/index.d.ts +17 -87
- package/lib/modules/Order/index.js +150 -677
- package/lib/modules/Order/types.d.ts +19 -198
- package/lib/modules/Order/types.js +0 -1
- package/lib/modules/Order/utils.d.ts +1 -50
- package/lib/modules/Order/utils.js +22 -229
- package/lib/modules/Quotation/index.d.ts +1 -0
- package/lib/modules/Quotation/index.js +15 -18
- package/lib/modules/Rules/index.d.ts +0 -4
- package/lib/modules/Rules/index.js +14 -22
- package/lib/modules/SalesSummary/index.js +2 -4
- package/lib/modules/SalesSummary/utils.js +7 -21
- package/lib/modules/Schedule/index.js +1 -3
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +1 -3
- package/lib/server/index.js +4 -41
- package/lib/server/modules/order/index.d.ts +0 -23
- package/lib/server/modules/order/index.js +14 -46
- package/lib/server/modules/order/types.d.ts +2 -0
- package/lib/server/modules/order/utils/filterOrders.js +4 -12
- package/lib/server/modules/products/index.d.ts +1 -1
- package/lib/server/modules/products/index.js +20 -30
- package/lib/server/modules/schedule/index.js +1 -2
- package/lib/solution/BaseSales/index.d.ts +7 -89
- package/lib/solution/BaseSales/index.js +22 -736
- package/lib/solution/BaseSales/types.d.ts +1 -67
- package/lib/solution/BaseSales/types.js +1 -3
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +12 -71
- package/lib/solution/BaseSales/utils.js +6 -46
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -133
- package/lib/solution/BookingTicket/index.js +8 -352
- package/lib/solution/BookingTicket/types.d.ts +0 -2
- package/lib/solution/BookingTicket/types.js +0 -6
- package/lib/solution/BookingTicket/utils/cartView.js +2 -4
- package/lib/solution/ScanOrder/index.d.ts +3 -9
- package/lib/solution/ScanOrder/index.js +66 -147
- package/lib/solution/ScanOrder/utils.js +6 -46
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +4 -2
- package/lib/solution/VenueBooking/index.d.ts +9 -5
- package/lib/solution/VenueBooking/index.js +14 -50
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/package.json +2 -2
- package/dist/modules/BookingContext/index.d.ts +0 -37
- package/dist/modules/BookingContext/index.js +0 -436
- package/dist/modules/BookingContext/types.d.ts +0 -102
- package/dist/modules/BookingContext/types.js +0 -51
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -193
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -137
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -215
- package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/dist/modules/BookingContext/utils/flexible.js +0 -56
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
- package/dist/modules/BookingContext/utils/index.d.ts +0 -11
- package/dist/modules/BookingContext/utils/index.js +0 -11
- package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/dist/modules/BookingContext/utils/noResource.js +0 -77
- package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/dist/modules/BookingContext/utils/productExtend.js +0 -339
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
- package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
- package/dist/modules/BookingContext/utils/resources.js +0 -486
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/dist/modules/Order/utils/manualProductDiscount.js +0 -212
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +0 -275
- package/dist/solution/BaseSales/utils/cartPromotion.js +0 -1258
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/dist/solution/BaseSales/utils/quotationPrice.js +0 -237
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
- package/lib/modules/BookingContext/index.d.ts +0 -37
- package/lib/modules/BookingContext/index.js +0 -297
- package/lib/modules/BookingContext/types.d.ts +0 -102
- package/lib/modules/BookingContext/types.js +0 -34
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -207
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -141
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -198
- package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/lib/modules/BookingContext/utils/flexible.js +0 -80
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
- package/lib/modules/BookingContext/utils/index.d.ts +0 -11
- package/lib/modules/BookingContext/utils/index.js +0 -43
- package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/lib/modules/BookingContext/utils/noResource.js +0 -90
- package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/lib/modules/BookingContext/utils/productExtend.js +0 -283
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
- package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
- package/lib/modules/BookingContext/utils/resources.js +0 -377
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/lib/modules/Order/utils/manualProductDiscount.js +0 -207
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +0 -275
- package/lib/solution/BaseSales/utils/cartPromotion.js +0 -836
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/lib/solution/BaseSales/utils/quotationPrice.js +0 -277
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
|
@@ -2,117 +2,15 @@ import { CartItem } from '../Cart/types';
|
|
|
2
2
|
import type { DiscountModule } from '../Discount';
|
|
3
3
|
import type { RulesModule } from '../Rules';
|
|
4
4
|
import type { Discount } from '../Discount/types';
|
|
5
|
-
import type { UnavailableReason } from '../Rules/types';
|
|
6
5
|
import type { SubmitPayloadEnhancer } from './utils';
|
|
7
6
|
import type { PaymentItem } from '../Payment/types';
|
|
8
7
|
import type { ICustomer } from '../AccountList/types';
|
|
9
|
-
import type { OrderProductDiscountItem } from '../../server/modules/order/types';
|
|
10
|
-
export type { OrderProductDiscountItem } from '../../server/modules/order/types';
|
|
11
8
|
export declare enum OrderHooks {
|
|
12
9
|
OnOrderCreate = "order:onOrderCreate",
|
|
13
10
|
OnOrderUpdate = "order:onOrderUpdate",
|
|
14
11
|
OnOrderCancel = "order:onOrderCancel",
|
|
15
12
|
OnOrderStatusChange = "order:onOrderStatusChange",
|
|
16
|
-
OnOrderCustomerChange = "order:onOrderCustomerChange"
|
|
17
|
-
OnPromotionApplied = "order:onPromotionApplied"
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* 促销评估器协议(OS 与 PromotionEvaluator 之间的桥接接口)。
|
|
21
|
-
*
|
|
22
|
-
* 与 `pisell_os/src/model/strategy/adapter/promotion/evaluator.ts` 中的
|
|
23
|
-
* `PromotionEvaluator` 实例结构保持兼容。SalesSdkProvider 会从 `appHelper.utils.promotionEvaluator`
|
|
24
|
-
* 读取实例并通过 `setPromotionEvaluator` 注入到 OrderModule。
|
|
25
|
-
*
|
|
26
|
-
* 这里只声明 OrderModule 需要调用的子集,避免反向依赖具体 evaluator 实现。
|
|
27
|
-
*/
|
|
28
|
-
export interface OrderPromotionEvaluator {
|
|
29
|
-
evaluateCartWithPricing(input: {
|
|
30
|
-
products: any[];
|
|
31
|
-
channel?: string;
|
|
32
|
-
}): any;
|
|
33
|
-
getProductsApplicableStrategies(input: {
|
|
34
|
-
products: any[];
|
|
35
|
-
channel?: string;
|
|
36
|
-
}, matchVariant?: boolean): any[];
|
|
37
|
-
}
|
|
38
|
-
/** 赠品解析回调 context(OS → SDK 的请求体) */
|
|
39
|
-
export interface OrderGiftSelectContext {
|
|
40
|
-
strategyId: string;
|
|
41
|
-
strategyName: string | Record<string, string>;
|
|
42
|
-
giftCount: number;
|
|
43
|
-
giftOptions: Array<{
|
|
44
|
-
product_id: number;
|
|
45
|
-
product_variant_id: number;
|
|
46
|
-
}>;
|
|
47
|
-
/** 触发此赠品的主商品 metadata.unique_identification_number 列表 */
|
|
48
|
-
sourceProductIds: string[];
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* 赠品解析回调签名(SDK → OS 的返回值)。
|
|
52
|
-
*
|
|
53
|
-
* - 单选项:SDK 内部自动构造商品,不弹窗
|
|
54
|
-
* - 多选项:SDK 弹窗等用户确认后构造
|
|
55
|
-
* - 用户取消:抛错或返回空数组(OS 视为放弃本次添加)
|
|
56
|
-
*
|
|
57
|
-
* 返回的 OrderProduct 必须是完整的购物车行(含 metadata._giftInfo 标记),OS 会直接 push 入 tempOrder.products。
|
|
58
|
-
*/
|
|
59
|
-
export type OrderGiftSelectResolver = (ctx: OrderGiftSelectContext) => Promise<Partial<OrderProduct>[] | null>;
|
|
60
|
-
/** 未满足的促销策略(购物车底部 alert 渲染源) */
|
|
61
|
-
export interface OrderUnfulfilledPromotion {
|
|
62
|
-
strategyId: string;
|
|
63
|
-
strategyName: string | Record<string, string>;
|
|
64
|
-
actionType: string;
|
|
65
|
-
needQuantity: number;
|
|
66
|
-
currentQuantity: number;
|
|
67
|
-
requiredQuantity: number;
|
|
68
|
-
eligibleProducts: Array<{
|
|
69
|
-
product_id: number;
|
|
70
|
-
product_variant_id: number;
|
|
71
|
-
}>;
|
|
72
|
-
strategyMetadata?: any;
|
|
73
|
-
display?: {
|
|
74
|
-
text: string | Record<string, string>;
|
|
75
|
-
type: string;
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
/** 上一次 applyPromotion 计算出的赠品操作(仅供调试/读取使用) */
|
|
79
|
-
export interface OrderLastGiftActions {
|
|
80
|
-
toAdd: Array<{
|
|
81
|
-
strategyId: string;
|
|
82
|
-
strategyName: string | Record<string, string>;
|
|
83
|
-
giftCount: number;
|
|
84
|
-
giftOptions: Array<{
|
|
85
|
-
product_id: number;
|
|
86
|
-
product_variant_id: number;
|
|
87
|
-
}>;
|
|
88
|
-
sourceProductIds: string[];
|
|
89
|
-
}>;
|
|
90
|
-
toReduce: Array<{
|
|
91
|
-
strategyId: string;
|
|
92
|
-
items: Array<{
|
|
93
|
-
uid: string;
|
|
94
|
-
currentQuantity: number;
|
|
95
|
-
newQuantity: number;
|
|
96
|
-
}>;
|
|
97
|
-
}>;
|
|
98
|
-
toRemove: string[];
|
|
99
|
-
}
|
|
100
|
-
/** onPromotionApplied 事件 payload */
|
|
101
|
-
export interface OrderPromotionAppliedPayload {
|
|
102
|
-
unfulfilledPromotions: OrderUnfulfilledPromotion[];
|
|
103
|
-
giftActions: OrderLastGiftActions;
|
|
104
|
-
/** evaluator 返回的赠品摘要 */
|
|
105
|
-
gifts: Array<{
|
|
106
|
-
strategyId: string;
|
|
107
|
-
strategyName: string | Record<string, string>;
|
|
108
|
-
giftCount: number;
|
|
109
|
-
giftOptions: Array<{
|
|
110
|
-
product_id: number;
|
|
111
|
-
product_variant_id: number;
|
|
112
|
-
}>;
|
|
113
|
-
}>;
|
|
114
|
-
/** 处理后的商品列表 */
|
|
115
|
-
products: OrderProduct[];
|
|
13
|
+
OnOrderCustomerChange = "order:onOrderCustomerChange"
|
|
116
14
|
}
|
|
117
15
|
/**
|
|
118
16
|
* tempOrder 上的下单客户协议字段视图。
|
|
@@ -150,13 +48,6 @@ export interface OrderCustomerChangePayload {
|
|
|
150
48
|
patch: OrderCustomerView;
|
|
151
49
|
snapshot: ICustomer | null;
|
|
152
50
|
}
|
|
153
|
-
export interface OrderScanCodeResult {
|
|
154
|
-
isAvailable: boolean;
|
|
155
|
-
discountList: Discount[];
|
|
156
|
-
scannedDiscountList: Discount[];
|
|
157
|
-
type: 'server' | 'clientCalc';
|
|
158
|
-
unavailableReason?: UnavailableReason;
|
|
159
|
-
}
|
|
160
51
|
export interface OrderProductIdentity {
|
|
161
52
|
product_id: number | null;
|
|
162
53
|
product_variant_id: number;
|
|
@@ -175,7 +66,7 @@ export interface OrderProduct extends OrderProductIdentity {
|
|
|
175
66
|
original_price: string;
|
|
176
67
|
tax_fee: string;
|
|
177
68
|
is_charge_tax: number;
|
|
178
|
-
discount_list:
|
|
69
|
+
discount_list: any[];
|
|
179
70
|
product_bundle: any[];
|
|
180
71
|
booking_uid?: string;
|
|
181
72
|
metadata: Record<string, any>;
|
|
@@ -212,14 +103,15 @@ export interface OrderSummary {
|
|
|
212
103
|
export interface OrderTempOrder {
|
|
213
104
|
order_id: number | null;
|
|
214
105
|
external_sale_number: string;
|
|
215
|
-
order_number: string
|
|
216
|
-
shop_order_number: string
|
|
217
|
-
shop_full_order_number: string
|
|
106
|
+
order_number: string;
|
|
107
|
+
shop_order_number: string;
|
|
108
|
+
shop_full_order_number: string;
|
|
218
109
|
type: string;
|
|
219
|
-
business_code
|
|
110
|
+
business_code: string;
|
|
220
111
|
platform: string;
|
|
221
112
|
sales_channel: string;
|
|
222
113
|
order_sales_channel: string;
|
|
114
|
+
vouchers: any[];
|
|
223
115
|
status: string;
|
|
224
116
|
payment_status: string;
|
|
225
117
|
shipping_status: string;
|
|
@@ -250,7 +142,7 @@ export interface OrderTempOrder {
|
|
|
250
142
|
bookings: any[];
|
|
251
143
|
payments: any[];
|
|
252
144
|
surcharges: any[];
|
|
253
|
-
discount_list
|
|
145
|
+
discount_list: any[];
|
|
254
146
|
relation_forms: any[];
|
|
255
147
|
contacts: any[];
|
|
256
148
|
contacts_info: Record<string, any> | null;
|
|
@@ -266,7 +158,7 @@ export interface OrderSubmitProduct extends Omit<OrderProduct, 'unique_identific
|
|
|
266
158
|
payment_price: string;
|
|
267
159
|
product_sku: Record<string, any>;
|
|
268
160
|
}
|
|
269
|
-
export interface OrderSubmitPayload extends Omit<OrderTempOrder, 'platform' | 'products' | '_extend' | 'customer' | '
|
|
161
|
+
export interface OrderSubmitPayload extends Omit<OrderTempOrder, 'platform' | 'products' | '_extend' | 'customer' | 'shop_full_order_number'> {
|
|
270
162
|
platform: string;
|
|
271
163
|
request_unique_idempotency_token?: string;
|
|
272
164
|
form_record_ids?: Array<{
|
|
@@ -285,32 +177,16 @@ export interface OrderState {
|
|
|
285
177
|
discount: DiscountModule | null;
|
|
286
178
|
rules: RulesModule | null;
|
|
287
179
|
}
|
|
288
|
-
export interface ReplaceTempOrderOptions {
|
|
289
|
-
recalculateSummary?: boolean;
|
|
290
|
-
persist?: boolean;
|
|
291
|
-
saveDraft?: boolean;
|
|
292
|
-
}
|
|
293
|
-
export type AddProductBookingInput = Record<string, any>;
|
|
294
180
|
/** 更新购物车行:仅传 SKU 时命中同 SKU 第一行;多行同 SKU 须传 unique_identification_number / 选项指纹等 */
|
|
295
|
-
export interface
|
|
181
|
+
export interface UpdateProductInOrderParams {
|
|
296
182
|
product_id: number | null;
|
|
297
183
|
product_variant_id: number;
|
|
298
184
|
updates: Partial<OrderProduct>;
|
|
299
185
|
unique_identification_number?: string;
|
|
300
|
-
identity_key?: string;
|
|
301
186
|
product_option_item?: any[];
|
|
302
187
|
product_bundle?: any[];
|
|
303
|
-
booking?: AddProductBookingInput;
|
|
304
|
-
}
|
|
305
|
-
/** 仅更新购物车行数量;行定位语义与 updateOrderProduct / removeProductFromOrder 保持一致 */
|
|
306
|
-
export interface UpdateOrderProductQuantityParams extends OrderProductIdentity {
|
|
307
|
-
num: number;
|
|
308
|
-
identity_key?: string;
|
|
309
|
-
}
|
|
310
|
-
export interface UpdateOrderBookingParams {
|
|
311
|
-
unique_identification_number: string;
|
|
312
|
-
updates: AddProductBookingInput;
|
|
313
188
|
}
|
|
189
|
+
export type AddProductBookingInput = Record<string, any>;
|
|
314
190
|
export interface OrderProductMergeDecisionContext {
|
|
315
191
|
incomingProduct: Partial<OrderProduct> & OrderProductIdentity;
|
|
316
192
|
normalizedIncoming: OrderProduct;
|
|
@@ -361,11 +237,10 @@ export interface SubmitSalesOrderParams {
|
|
|
361
237
|
query: {
|
|
362
238
|
order_id: number | null;
|
|
363
239
|
external_sale_number: string;
|
|
364
|
-
order_number: string
|
|
365
|
-
shop_order_number: string
|
|
366
|
-
shop_full_order_number: string | null;
|
|
240
|
+
order_number: string;
|
|
241
|
+
shop_order_number: string;
|
|
367
242
|
type: string;
|
|
368
|
-
business_code
|
|
243
|
+
business_code: string;
|
|
369
244
|
platform: string;
|
|
370
245
|
request_unique_idempotency_token?: string;
|
|
371
246
|
sales_channel: string;
|
|
@@ -397,6 +272,7 @@ export interface SubmitSalesOrderParams {
|
|
|
397
272
|
bookings: OrderSubmitBooking[];
|
|
398
273
|
payments: any[];
|
|
399
274
|
surcharges?: any[];
|
|
275
|
+
discount_list: any[];
|
|
400
276
|
relation_forms: any[];
|
|
401
277
|
form_record_ids?: OrderSubmitFormRecord[];
|
|
402
278
|
contacts: any[];
|
|
@@ -475,7 +351,6 @@ export interface SyncPaymentsToOrderParams {
|
|
|
475
351
|
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
476
352
|
submitWhenPaid?: boolean;
|
|
477
353
|
smallTicketDataFlag?: number;
|
|
478
|
-
channel?: string;
|
|
479
354
|
}
|
|
480
355
|
export interface SyncPaymentsToOrderResult<T = any> {
|
|
481
356
|
isFullyPaid: boolean;
|
|
@@ -572,7 +447,6 @@ export interface OrderModuleAPI {
|
|
|
572
447
|
}) => void;
|
|
573
448
|
getTempOrder: () => OrderTempOrder | null;
|
|
574
449
|
ensureTempOrder: () => OrderTempOrder;
|
|
575
|
-
replaceTempOrder: (tempOrder: OrderTempOrder, options?: ReplaceTempOrderOptions) => Promise<OrderTempOrder>;
|
|
576
450
|
addNewOrder: () => Promise<OrderTempOrder>;
|
|
577
451
|
restoreOrder: () => OrderTempOrder;
|
|
578
452
|
getOrderProducts: () => OrderProduct[];
|
|
@@ -585,26 +459,15 @@ export interface OrderModuleAPI {
|
|
|
585
459
|
getOrderSyncState: () => OrderSyncState;
|
|
586
460
|
getOrderAmountSnapshot: () => OrderAmountSnapshot | null;
|
|
587
461
|
getTempOrderNote: () => string;
|
|
588
|
-
updateTempOrderNote:
|
|
589
|
-
(note: string): string;
|
|
590
|
-
(note: string, sync: true): Promise<string>;
|
|
591
|
-
(note: string, sync: boolean): string | Promise<string>;
|
|
592
|
-
};
|
|
462
|
+
updateTempOrderNote: (note: string) => string;
|
|
593
463
|
updateTempOrderShopDiscount: (amount: string | number) => string;
|
|
594
464
|
updateTempOrderCustomer: (customer: UpdateTempOrderCustomerInput) => OrderSnapshot['customer'];
|
|
595
465
|
updateTempOrderBuzzer: (buzzer: string) => string;
|
|
596
466
|
updateTempOrderContactsInfo: (contactsInfo: Record<string, any> | null) => Record<string, any> | null;
|
|
597
467
|
addProductToOrder: (product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput) => Promise<OrderProduct[]>;
|
|
598
|
-
|
|
599
|
-
updateOrderProductQuantity: (params: UpdateOrderProductQuantityParams) => Promise<OrderProduct[]>;
|
|
600
|
-
updateOrderBooking: (params: UpdateOrderBookingParams) => any[];
|
|
468
|
+
updateProductInOrder: (params: UpdateProductInOrderParams) => Promise<OrderProduct[]>;
|
|
601
469
|
removeProductFromOrder: (identity: OrderProductIdentity) => Promise<OrderProduct[]>;
|
|
602
|
-
/** @deprecated no-op;OrderModule 不再负责 tempOrder localStorage 持久化。 */
|
|
603
470
|
persistTempOrder: () => void;
|
|
604
|
-
/** @deprecated no-op;OrderModule 不再负责 tempOrder localStorage 持久化。 */
|
|
605
|
-
setEnableTempOrderPersist: (enabled: boolean) => void;
|
|
606
|
-
/** @deprecated 固定返回 false;OrderModule 不再负责 tempOrder localStorage 持久化。 */
|
|
607
|
-
isTempOrderPersistEnabled: () => boolean;
|
|
608
471
|
submitTempOrder: <T = any>(params?: {
|
|
609
472
|
cacheId?: string;
|
|
610
473
|
platform?: string;
|
|
@@ -654,52 +517,10 @@ export interface OrderModuleAPI {
|
|
|
654
517
|
clearOrderCustomer: () => void;
|
|
655
518
|
loadDiscountConfig: (params: {
|
|
656
519
|
customerId: number;
|
|
657
|
-
action?: 'create'
|
|
658
|
-
|
|
659
|
-
apply?: boolean;
|
|
660
|
-
}) => Promise<Discount[]>;
|
|
520
|
+
action?: 'create';
|
|
521
|
+
}) => Promise<void>;
|
|
661
522
|
getDiscountList: () => Discount[];
|
|
662
523
|
applyDiscount: () => void;
|
|
663
|
-
/**
|
|
664
|
-
* 注入促销评估器。
|
|
665
|
-
*
|
|
666
|
-
* SalesSdkProvider 在初始化 bookingTicket 后会自动从 `appHelper.utils.promotionEvaluator`
|
|
667
|
-
* 读取实例并调用本方法注入。host 透明,业务 UI 不感知。
|
|
668
|
-
*
|
|
669
|
-
* @example
|
|
670
|
-
* order.setPromotionEvaluator(appHelper.utils.promotionEvaluator);
|
|
671
|
-
*/
|
|
672
|
-
setPromotionEvaluator: (evaluator: OrderPromotionEvaluator | null) => void;
|
|
673
|
-
/**
|
|
674
|
-
* 注入赠品选择 resolver。OS 在 applyPromotion 内部当需要新增赠品时会 await 调用 resolver。
|
|
675
|
-
*
|
|
676
|
-
* 缺省时 OS 会 `console.warn` 并跳过新增(既有赠品的 reduce/remove 仍会执行)。
|
|
677
|
-
*
|
|
678
|
-
* @example
|
|
679
|
-
* order.setGiftSelectResolver((ctx) => giftSelectBridge.request(ctx));
|
|
680
|
-
*/
|
|
681
|
-
setGiftSelectResolver: (resolver: OrderGiftSelectResolver | null) => void;
|
|
682
|
-
/**
|
|
683
|
-
* 为商品目录追加促销标签。
|
|
684
|
-
*
|
|
685
|
-
* @example
|
|
686
|
-
* const taggedProducts = order.appendPromotionTags(products);
|
|
687
|
-
*/
|
|
688
|
-
appendPromotionTags: <T extends Record<string, any>>(products: T[]) => T[];
|
|
689
|
-
/**
|
|
690
|
-
* 应用购物车促销(评估 → 差异化赠品 → 写回 tempOrder.products → emit onPromotionApplied)。
|
|
691
|
-
*
|
|
692
|
-
* 自动在 addProductToOrder / updateOrderProductQuantity / removeProductFromOrder /
|
|
693
|
-
* clearOrderCartLines / setOrderCustomer 等写路径末尾触发,业务一般无需手动调用。
|
|
694
|
-
*
|
|
695
|
-
* 多选项赠品依赖 giftSelectResolver;如未注入则跳过且 console.warn。
|
|
696
|
-
* 内部以 `_isApplyingPromotion` flag 防递归。
|
|
697
|
-
*/
|
|
698
|
-
applyPromotion: () => Promise<void>;
|
|
699
|
-
/** 读取上次 applyPromotion 产出的未满足促销提示 */
|
|
700
|
-
getUnfulfilledPromotions: () => OrderUnfulfilledPromotion[];
|
|
701
|
-
/** 读取上次 applyPromotion 产出的赠品操作 diff(toAdd / toReduce / toRemove) */
|
|
702
|
-
getLastGiftActions: () => OrderLastGiftActions | null;
|
|
703
524
|
/**
|
|
704
525
|
* 取消订单
|
|
705
526
|
* @param params 取消订单参数
|
|
@@ -28,7 +28,6 @@ var OrderHooks = /* @__PURE__ */ ((OrderHooks2) => {
|
|
|
28
28
|
OrderHooks2["OnOrderCancel"] = "order:onOrderCancel";
|
|
29
29
|
OrderHooks2["OnOrderStatusChange"] = "order:onOrderStatusChange";
|
|
30
30
|
OrderHooks2["OnOrderCustomerChange"] = "order:onOrderCustomerChange";
|
|
31
|
-
OrderHooks2["OnPromotionApplied"] = "order:onPromotionApplied";
|
|
32
31
|
return OrderHooks2;
|
|
33
32
|
})(OrderHooks || {});
|
|
34
33
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Decimal from 'decimal.js';
|
|
2
2
|
import { CartItem } from "../Cart";
|
|
3
|
-
import type {
|
|
3
|
+
import type { OrderSubmitPayload, OrderSubmitProduct, OrderSummary, OrderTempOrder } from './types';
|
|
4
4
|
import type { RulesParamsHooks } from '../Rules/types';
|
|
5
5
|
import type { MapOrderPaymentsOptions, OrderPaymentData, OrderPaymentSource } from './types';
|
|
6
6
|
/**
|
|
@@ -65,37 +65,6 @@ export declare function sumOptionUnitPrice(options?: Array<{
|
|
|
65
65
|
*
|
|
66
66
|
* 导出为纯函数方便单测直接驱动钩子,不依赖 OrderModule 实例。
|
|
67
67
|
*/
|
|
68
|
-
/** Rules calcDiscount 用手动价标记;undefined 表示交给 Rules 用 total/origin_total 推断 */
|
|
69
|
-
export declare function resolveRulesManualDiscountFlag(metadata: Record<string, any> | null | undefined): boolean | undefined;
|
|
70
|
-
/**
|
|
71
|
-
* 商品行折扣只保留后端 OrderProductDiscountItem 协议字段。
|
|
72
|
-
* Rules/券计算过程中的 `_num`、`config` 等运行态字段不应进入 tempOrder 或提交 payload。
|
|
73
|
-
*/
|
|
74
|
-
export declare function normalizeOrderProductDiscountList(discountList?: unknown[] | null): OrderProductDiscountItem[];
|
|
75
|
-
/**
|
|
76
|
-
* 手动改价(price_override)时行级 original_price(composite 单价):
|
|
77
|
-
* 购物车划线价应对齐 metadata.origin._extend.origin_total(改价前单价 composite,如 40),
|
|
78
|
-
* 而非 bundle 子项 catalog 原价合成的 composedOriginalPrice(如 30)。
|
|
79
|
-
*
|
|
80
|
-
* origin_total 与 SkuDetailModal / cacheItem._extend 一致,为单价语义,不再除以 num。
|
|
81
|
-
*/
|
|
82
|
-
export declare function resolveManualOverrideLineOriginalPrice(params: {
|
|
83
|
-
num?: number;
|
|
84
|
-
metadata?: Record<string, any> | null;
|
|
85
|
-
/** 已有行级 original_price(origin 被裁剪时兜底划线价) */
|
|
86
|
-
lineOriginalPrice?: string | number | null;
|
|
87
|
-
}, fallbackCompositeOriginal: string): string;
|
|
88
|
-
/**
|
|
89
|
-
* 计算商品行「每单位有效折扣」:discount_list 合计 + 被 Rules 剥离但仍 inPromotion 的差额。
|
|
90
|
-
*
|
|
91
|
-
* Rules.calcDiscount 会把 type=promotion 从 discount_list 去掉,但 metadata._promotion 仍保留;
|
|
92
|
-
* applyProductDiscountPrices 必须回读 _promotion,否则抬价/降价都会在第二步被 source 原价覆盖。
|
|
93
|
-
*
|
|
94
|
-
* @example
|
|
95
|
-
* resolveEffectivePerUnitDiscount({ metadata: { _promotion: { inPromotion: true, originalPrice: 1, finalPrice: 5 } }, discount_list: [] });
|
|
96
|
-
* // => -4
|
|
97
|
-
*/
|
|
98
|
-
export declare function resolveEffectivePerUnitDiscount(product: Record<string, any>): number;
|
|
99
68
|
export declare function createDefaultOrderRulesHooks(): RulesParamsHooks;
|
|
100
69
|
/**
|
|
101
70
|
* 通过 session 类商品的开始时间结束时间生成商品的时长
|
|
@@ -171,22 +140,4 @@ export declare function formatV1Product(products: OrderSubmitProduct[]): {
|
|
|
171
140
|
session: null;
|
|
172
141
|
unique: string;
|
|
173
142
|
}[];
|
|
174
|
-
/**
|
|
175
|
-
* 判断 holder_id 是否已分配(非空)。
|
|
176
|
-
*
|
|
177
|
-
* @example
|
|
178
|
-
* hasAssignedHolderId(12); // true
|
|
179
|
-
* hasAssignedHolderId([]); // false
|
|
180
|
-
*/
|
|
181
|
-
export declare function hasAssignedHolderId(value: unknown): boolean;
|
|
182
|
-
/**
|
|
183
|
-
* 清空 tempOrder 购物车行上的 holder 分配(products / bookings / runtime origin)。
|
|
184
|
-
* 移除或更换下单客户时调用,与 booking 页换客户清 holder 行为对齐。
|
|
185
|
-
*
|
|
186
|
-
* @example
|
|
187
|
-
* clearTempOrderHolderAssignments(tempOrder);
|
|
188
|
-
*/
|
|
189
|
-
export declare function clearTempOrderHolderAssignments(tempOrder: OrderTempOrder): boolean;
|
|
190
143
|
export { createEmptySummary } from '../../solution/ScanOrder/utils';
|
|
191
|
-
export { buildManualProductDiscountItem, ensureManualProductDiscountList, findManualProductDiscountItem, mergeManualProductDiscountIntoList, resolveManualDiscountMessage, resolveManualDiscountOriginTotal, resolveManualDiscountReasonFromSources, resolveSafeProductNum, shouldBuildManualProductDiscount, syncManualProductDiscountProductNum, stripManualProductDiscountItems, } from './utils/manualProductDiscount';
|
|
192
|
-
export type { ManualProductDiscountItem } from './utils/manualProductDiscount';
|