@pisell/pisellos 0.10.43 → 0.10.44
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/itemRule/adapter.d.ts +4 -1
- package/dist/model/strategy/adapter/itemRule/adapter.js +135 -35
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
- package/dist/model/strategy/adapter/itemRule/evaluator.js +25 -1
- package/dist/model/strategy/adapter/itemRule/type.d.ts +44 -0
- package/dist/model/strategy/adapter/itemRule/type.js +19 -1
- package/dist/modules/Order/index.d.ts +41 -9
- package/dist/modules/Order/index.js +1438 -878
- package/dist/modules/Order/salesNotes.d.ts +31 -0
- package/dist/modules/Order/salesNotes.js +492 -0
- package/dist/modules/Order/types.d.ts +105 -8
- package/dist/modules/Order/types.js +6 -1
- package/dist/modules/Order/utils.d.ts +3 -1
- package/dist/modules/Order/utils.js +191 -71
- package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +4 -5
- package/dist/modules/Payment/cashRecommendationAlgorithm.js +17 -367
- package/dist/modules/ProductList/index.d.ts +2 -1
- package/dist/modules/ProductList/index.js +100 -20
- package/dist/modules/ProductList/types.d.ts +10 -0
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.js +45 -3
- package/dist/server/modules/order/index.js +6 -0
- package/dist/server/modules/order/types.d.ts +9 -0
- package/dist/server/utils/small-ticket.d.ts +1 -0
- package/dist/server/utils/small-ticket.js +142 -14
- package/dist/solution/BaseSales/index.d.ts +15 -1
- package/dist/solution/BaseSales/index.js +1240 -877
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -0
- package/dist/solution/BookingTicket/index.js +37 -16
- package/dist/solution/BookingTicket/utils/orderCustomer.js +3 -2
- package/dist/solution/RegisterAndLogin/config.d.ts +9 -3
- package/dist/solution/RegisterAndLogin/config.js +95 -40
- package/dist/solution/RegisterAndLogin/index.js +4 -1
- package/dist/solution/ScanOrder/index.d.ts +1 -0
- package/dist/solution/ScanOrder/index.js +31 -27
- package/dist/solution/ScanOrder/utils.d.ts +1 -0
- package/dist/solution/ScanOrder/utils.js +2 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +15 -2
- package/dist/solution/UnifiedBookingSales/index.js +777 -510
- package/dist/solution/UnifiedBookingSales/types.d.ts +14 -1
- package/dist/solution/VenueBooking/index.d.ts +1 -0
- package/dist/solution/VenueBooking/index.js +8 -4
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
- package/lib/model/strategy/adapter/itemRule/adapter.js +73 -4
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
- package/lib/model/strategy/adapter/itemRule/evaluator.js +23 -1
- package/lib/model/strategy/adapter/itemRule/type.d.ts +44 -0
- package/lib/model/strategy/adapter/itemRule/type.js +19 -1
- package/lib/modules/Order/index.d.ts +41 -9
- package/lib/modules/Order/index.js +434 -61
- package/lib/modules/Order/salesNotes.d.ts +31 -0
- package/lib/modules/Order/salesNotes.js +382 -0
- package/lib/modules/Order/types.d.ts +105 -8
- package/lib/modules/Order/types.js +5 -1
- package/lib/modules/Order/utils.d.ts +3 -1
- package/lib/modules/Order/utils.js +114 -1
- package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +4 -5
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +9 -354
- package/lib/modules/ProductList/index.d.ts +2 -1
- package/lib/modules/ProductList/index.js +47 -2
- package/lib/modules/ProductList/types.d.ts +10 -0
- package/lib/server/index.d.ts +7 -0
- package/lib/server/index.js +39 -3
- package/lib/server/modules/order/index.js +6 -0
- package/lib/server/modules/order/types.d.ts +9 -0
- package/lib/server/utils/small-ticket.d.ts +1 -0
- package/lib/server/utils/small-ticket.js +136 -12
- package/lib/solution/BaseSales/index.d.ts +15 -1
- package/lib/solution/BaseSales/index.js +192 -22
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -0
- package/lib/solution/BookingTicket/index.js +23 -5
- package/lib/solution/BookingTicket/utils/orderCustomer.js +2 -1
- package/lib/solution/RegisterAndLogin/config.d.ts +9 -3
- package/lib/solution/RegisterAndLogin/config.js +49 -8
- package/lib/solution/RegisterAndLogin/index.js +4 -1
- package/lib/solution/ScanOrder/index.d.ts +1 -0
- package/lib/solution/ScanOrder/index.js +5 -1
- package/lib/solution/ScanOrder/utils.d.ts +1 -0
- package/lib/solution/ScanOrder/utils.js +1 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +15 -2
- package/lib/solution/UnifiedBookingSales/index.js +125 -1
- package/lib/solution/UnifiedBookingSales/types.d.ts +14 -1
- package/lib/solution/VenueBooking/index.d.ts +1 -0
- package/lib/solution/VenueBooking/index.js +5 -1
- package/package.json +1 -1
|
@@ -8,6 +8,13 @@ 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
|
export type { OrderProductDiscountItem } from '../../server/modules/order/types';
|
|
11
|
+
export type PickupReferenceMode = 'counter_pickup' | 'table_service';
|
|
12
|
+
export type ShopServiceType = 'dine_in' | 'takeaway';
|
|
13
|
+
export interface ShopServiceData {
|
|
14
|
+
pickup_reference_mode?: PickupReferenceMode;
|
|
15
|
+
service_type?: ShopServiceType | '';
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}
|
|
11
18
|
export declare enum OrderHooks {
|
|
12
19
|
OnOrderCreate = "order:onOrderCreate",
|
|
13
20
|
OnOrderUpdate = "order:onOrderUpdate",
|
|
@@ -110,7 +117,7 @@ export interface OrderLastGiftActions {
|
|
|
110
117
|
}>;
|
|
111
118
|
toRemove: string[];
|
|
112
119
|
}
|
|
113
|
-
/** onPromotionApplied
|
|
120
|
+
/** onPromotionApplied 稳定态事件 payload(促销、折扣与 summary 均已完成)。 */
|
|
114
121
|
export interface OrderPromotionAppliedPayload {
|
|
115
122
|
unfulfilledPromotions: OrderUnfulfilledPromotion[];
|
|
116
123
|
giftActions: OrderLastGiftActions;
|
|
@@ -124,7 +131,7 @@ export interface OrderPromotionAppliedPayload {
|
|
|
124
131
|
product_variant_id: number;
|
|
125
132
|
}>;
|
|
126
133
|
}>;
|
|
127
|
-
/**
|
|
134
|
+
/** 折扣重算后的最终商品列表 */
|
|
128
135
|
products: OrderProduct[];
|
|
129
136
|
}
|
|
130
137
|
/**
|
|
@@ -196,8 +203,18 @@ export interface PointCardSnapshotItem {
|
|
|
196
203
|
par_value: string;
|
|
197
204
|
used_par_value: string;
|
|
198
205
|
}
|
|
206
|
+
export interface VirtualCurrencySnapshotItem {
|
|
207
|
+
id: number | string;
|
|
208
|
+
tag: 'virtual_currency';
|
|
209
|
+
product_id?: number | string;
|
|
210
|
+
product_name: string;
|
|
211
|
+
par_value: string;
|
|
212
|
+
used_par_value: string;
|
|
213
|
+
name: Record<string, string>;
|
|
214
|
+
}
|
|
199
215
|
export interface OrderMetaList {
|
|
200
216
|
point_cards_snapshot?: PointCardSnapshotItem[];
|
|
217
|
+
virtual_currency_snapshot?: VirtualCurrencySnapshotItem[];
|
|
201
218
|
}
|
|
202
219
|
export interface OrderProduct extends OrderProductIdentity {
|
|
203
220
|
order_detail_id: number | null;
|
|
@@ -250,6 +267,72 @@ export interface OrderSummary {
|
|
|
250
267
|
tax_title?: string;
|
|
251
268
|
tax_rate?: number;
|
|
252
269
|
}
|
|
270
|
+
export type SalesNoteRelationType = 'about' | 'related_to';
|
|
271
|
+
export type SalesNoteTargetType = 'order' | 'order_detail';
|
|
272
|
+
export type SalesNoteLocalizedText = string | Record<string, string>;
|
|
273
|
+
export interface SalesNoteLocalizedSelection {
|
|
274
|
+
id: string;
|
|
275
|
+
label: SalesNoteLocalizedText;
|
|
276
|
+
}
|
|
277
|
+
export type SalesNoteTextInput = {
|
|
278
|
+
kind: 'localizedSelections';
|
|
279
|
+
selections: SalesNoteLocalizedSelection[];
|
|
280
|
+
locale: string;
|
|
281
|
+
input?: string;
|
|
282
|
+
} | {
|
|
283
|
+
kind: 'plain';
|
|
284
|
+
input: string;
|
|
285
|
+
} | {
|
|
286
|
+
kind: 'resolved';
|
|
287
|
+
text: Record<string, string>;
|
|
288
|
+
};
|
|
289
|
+
export interface SalesNoteRelation {
|
|
290
|
+
uuid: string;
|
|
291
|
+
relation_type: SalesNoteRelationType;
|
|
292
|
+
target_type: SalesNoteTargetType;
|
|
293
|
+
target_uuid: string;
|
|
294
|
+
is_primary: 0 | 1;
|
|
295
|
+
}
|
|
296
|
+
export interface SalesNote {
|
|
297
|
+
uuid: string;
|
|
298
|
+
note_type: string;
|
|
299
|
+
content: {
|
|
300
|
+
text: Record<string, string>;
|
|
301
|
+
};
|
|
302
|
+
importance: string;
|
|
303
|
+
note_relations: SalesNoteRelation[];
|
|
304
|
+
}
|
|
305
|
+
export interface SalesNoteTarget {
|
|
306
|
+
target_type: 'order_detail';
|
|
307
|
+
target_uuid: string;
|
|
308
|
+
}
|
|
309
|
+
export interface SetSalesNoteInput {
|
|
310
|
+
note_type: string;
|
|
311
|
+
target: SalesNoteTarget;
|
|
312
|
+
text: SalesNoteTextInput;
|
|
313
|
+
}
|
|
314
|
+
export interface SalesNoteDraftInput {
|
|
315
|
+
note_type: string;
|
|
316
|
+
text: SalesNoteTextInput;
|
|
317
|
+
}
|
|
318
|
+
export interface SalesNotesRuntimeState {
|
|
319
|
+
loaded: boolean;
|
|
320
|
+
dirty: boolean;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Sales Notes 乐观写入前的可恢复快照。
|
|
324
|
+
* 该对象应视为 opaque token,只用于原样传回 restoreSalesNotesMutationSnapshot。
|
|
325
|
+
*/
|
|
326
|
+
export interface SalesNotesMutationSnapshot {
|
|
327
|
+
orderIdentity: {
|
|
328
|
+
orderId: number | string | null;
|
|
329
|
+
externalSaleNumber: string;
|
|
330
|
+
};
|
|
331
|
+
notes: SalesNote[];
|
|
332
|
+
state: SalesNotesRuntimeState;
|
|
333
|
+
}
|
|
334
|
+
export type SalesNoteProtocolRelation = SalesNoteRelation;
|
|
335
|
+
export type SalesNoteProtocol = SalesNote;
|
|
253
336
|
export interface OrderTempOrder {
|
|
254
337
|
order_id: number | null;
|
|
255
338
|
external_sale_number: string;
|
|
@@ -289,6 +372,7 @@ export interface OrderTempOrder {
|
|
|
289
372
|
created_at: string | undefined;
|
|
290
373
|
request_unique_idempotency_token?: string;
|
|
291
374
|
products: OrderProduct[];
|
|
375
|
+
notes: SalesNote[];
|
|
292
376
|
bookings: any[];
|
|
293
377
|
payments: any[];
|
|
294
378
|
refunds?: any[];
|
|
@@ -303,6 +387,7 @@ export interface OrderTempOrder {
|
|
|
303
387
|
summary?: OrderSummary;
|
|
304
388
|
_extend?: {
|
|
305
389
|
productsByUid?: Record<string, Record<string, any>>;
|
|
390
|
+
salesNotesState?: SalesNotesRuntimeState;
|
|
306
391
|
[key: string]: any;
|
|
307
392
|
};
|
|
308
393
|
}
|
|
@@ -311,7 +396,7 @@ export interface OrderSubmitProduct extends Omit<OrderProduct, 'unique_identific
|
|
|
311
396
|
payment_price: string;
|
|
312
397
|
product_sku: OrderProductSku;
|
|
313
398
|
}
|
|
314
|
-
export interface OrderSubmitPayload extends Omit<OrderTempOrder, 'platform' | 'products' | '_extend' | 'customer' | 'discount_list' | 'created_at' | 'payment_status'> {
|
|
399
|
+
export interface OrderSubmitPayload extends Omit<OrderTempOrder, 'platform' | 'products' | 'notes' | '_extend' | 'customer' | 'discount_list' | 'created_at' | 'payment_status'> {
|
|
315
400
|
platform: string;
|
|
316
401
|
payment_status?: string;
|
|
317
402
|
created_at?: string | undefined;
|
|
@@ -321,6 +406,7 @@ export interface OrderSubmitPayload extends Omit<OrderTempOrder, 'platform' | 'p
|
|
|
321
406
|
form_record_id: number | string;
|
|
322
407
|
}>;
|
|
323
408
|
products: OrderSubmitProduct[];
|
|
409
|
+
notes?: SalesNoteProtocol[];
|
|
324
410
|
summary?: OrderSummary;
|
|
325
411
|
small_ticket_data_flag?: number;
|
|
326
412
|
}
|
|
@@ -350,6 +436,8 @@ export interface AddProductToOrderOptions {
|
|
|
350
436
|
insertAfterProductUid?: string;
|
|
351
437
|
/** 跳过同商品/规格匹配,始终新增购物车行。 */
|
|
352
438
|
disableMerge?: boolean;
|
|
439
|
+
/** 商品行 UID 落定后,由 OrderModule 原子绑定到该行的 Sales Notes 草稿。 */
|
|
440
|
+
salesNotes?: SalesNoteDraftInput[];
|
|
353
441
|
}
|
|
354
442
|
/**
|
|
355
443
|
* 删除商品后的可选位置保持策略。
|
|
@@ -768,9 +856,17 @@ export interface OrderModuleAPI {
|
|
|
768
856
|
updateTempOrderShopDiscount: (amount: string | number) => string;
|
|
769
857
|
updateTempOrderDepositAmount: (amount: string | number) => OrderSummary;
|
|
770
858
|
updateTempOrderCustomer: (customer: UpdateTempOrderCustomerInput) => OrderSnapshot['customer'];
|
|
859
|
+
updateTempOrderPickupReferenceMode: (mode: PickupReferenceMode) => ShopServiceData;
|
|
860
|
+
updateTempOrderServiceType: (serviceType: ShopServiceType) => ShopServiceData;
|
|
771
861
|
updateTempOrderBuzzer: (buzzer: string) => string;
|
|
772
862
|
updateTempOrderContactsInfo: (contactsInfo: Record<string, any> | null) => Record<string, any> | null;
|
|
773
863
|
addProductToOrder: (product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions) => Promise<OrderProduct[]>;
|
|
864
|
+
getSalesNotes: () => SalesNote[];
|
|
865
|
+
createSalesNotesMutationSnapshot: () => SalesNotesMutationSnapshot;
|
|
866
|
+
restoreSalesNotesMutationSnapshot: (snapshot: SalesNotesMutationSnapshot) => void;
|
|
867
|
+
setSalesNote: (input: SetSalesNoteInput) => Promise<SalesNote>;
|
|
868
|
+
removeSalesNote: (uuid: string) => Promise<void>;
|
|
869
|
+
clearSalesNotes: () => Promise<void>;
|
|
774
870
|
updateOrderProduct: (params: UpdateOrderProductParams) => Promise<OrderProduct[]>;
|
|
775
871
|
/** 批量更新购物车行,末尾仅触发一次促销重算与 summary 刷新 */
|
|
776
872
|
updateOrderProducts: (paramsList: UpdateOrderProductParams[]) => Promise<OrderProduct[]>;
|
|
@@ -878,6 +974,7 @@ export interface OrderModuleAPI {
|
|
|
878
974
|
}) => Promise<Discount[]>;
|
|
879
975
|
getDiscountList: () => Discount[];
|
|
880
976
|
getAvailableWalletIds: () => number[];
|
|
977
|
+
getCustomerWalletPrepareConfigEpoch: () => number;
|
|
881
978
|
applyDiscount: () => void;
|
|
882
979
|
/**
|
|
883
980
|
* 注入促销评估器。
|
|
@@ -906,7 +1003,7 @@ export interface OrderModuleAPI {
|
|
|
906
1003
|
*/
|
|
907
1004
|
appendPromotionTags: <T extends Record<string, any>>(products: T[]) => T[];
|
|
908
1005
|
/**
|
|
909
|
-
* 应用购物车促销(评估 → 差异化赠品 →
|
|
1006
|
+
* 应用购物车促销(评估 → 差异化赠品 → 折扣/summary 重算 → emit onPromotionApplied)。
|
|
910
1007
|
*
|
|
911
1008
|
* 自动在 addProductToOrder / updateOrderProductQuantity / removeProductFromOrder /
|
|
912
1009
|
* clearOrderCartLines / setOrderCustomer 等写路径末尾触发,业务一般无需手动调用。
|
|
@@ -920,10 +1017,10 @@ export interface OrderModuleAPI {
|
|
|
920
1017
|
/** 读取上次 applyPromotion 产出的赠品操作 diff(toAdd / toReduce / toRemove) */
|
|
921
1018
|
getLastGiftActions: () => OrderLastGiftActions | null;
|
|
922
1019
|
/**
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
1020
|
+
* 取消订单
|
|
1021
|
+
* @param params 取消订单参数
|
|
1022
|
+
* @returns 后端返回结果
|
|
1023
|
+
*/
|
|
927
1024
|
cancelOrder: (params: CancelOrderParams) => Promise<any>;
|
|
928
1025
|
/**
|
|
929
1026
|
* 变更预约状态
|
|
@@ -41,7 +41,7 @@ export var OrderHooks = /*#__PURE__*/function (OrderHooks) {
|
|
|
41
41
|
|
|
42
42
|
/** 上一次 applyPromotion 计算出的赠品操作(仅供调试/读取使用) */
|
|
43
43
|
|
|
44
|
-
/** onPromotionApplied
|
|
44
|
+
/** onPromotionApplied 稳定态事件 payload(促销、折扣与 summary 均已完成)。 */
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* tempOrder 上的下单客户协议字段视图。
|
|
@@ -64,6 +64,11 @@ export var OrderHooks = /*#__PURE__*/function (OrderHooks) {
|
|
|
64
64
|
* 清空时整个 payload 为 null。
|
|
65
65
|
*/
|
|
66
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Sales Notes 乐观写入前的可恢复快照。
|
|
69
|
+
* 该对象应视为 opaque token,只用于原样传回 restoreSalesNotesMutationSnapshot。
|
|
70
|
+
*/
|
|
71
|
+
|
|
67
72
|
/**
|
|
68
73
|
* 添加商品行时的顺序控制。
|
|
69
74
|
* 默认追加到 products 尾部;预约数量同步可插入到既有预约组的最新行之后,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Decimal from 'decimal.js';
|
|
2
2
|
import type { CartItem } from '../Cart';
|
|
3
|
-
import type { OrderProductDiscountItem, OrderMetaList, OrderProduct, OrderSubmitPayload, OrderSubmitProduct, OrderSummary, OrderTempOrder, PointCardSnapshotItem } from './types';
|
|
3
|
+
import type { OrderProductDiscountItem, OrderMetaList, OrderProduct, OrderSubmitPayload, OrderSubmitProduct, OrderSummary, OrderTempOrder, PointCardSnapshotItem, VirtualCurrencySnapshotItem } from './types';
|
|
4
4
|
import type { RulesParamsHooks } from '../Rules/types';
|
|
5
5
|
import type { MapOrderPaymentsOptions, OrderPaymentData, OrderPaymentSource } from './types';
|
|
6
6
|
import { createUuidV4 } from './utils/orderCollectionIdentity';
|
|
@@ -18,6 +18,8 @@ export interface OrderProductsDepositSummary {
|
|
|
18
18
|
import type { WindowPlugin } from '../../plugins';
|
|
19
19
|
export declare function normalizePointCardSnapshotItem(value: unknown): PointCardSnapshotItem | null;
|
|
20
20
|
export declare function buildPointCardSnapshotFromWalletPassList(value: unknown): PointCardSnapshotItem[];
|
|
21
|
+
export declare function normalizeVirtualCurrencySnapshotItem(value: unknown): VirtualCurrencySnapshotItem | null;
|
|
22
|
+
export declare function buildVirtualCurrencySnapshotFromList(value: unknown): VirtualCurrencySnapshotItem[];
|
|
21
23
|
export declare function normalizeOrderMetaList(value: unknown): OrderMetaList | undefined;
|
|
22
24
|
/**
|
|
23
25
|
* 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
|