@pisell/pisellos 2.1.4 → 2.1.5
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/core/index.js +2 -1
- package/dist/effects/index.d.ts +4 -3
- package/dist/effects/index.js +15 -6
- package/dist/modules/AccountList/index.d.ts +7 -1
- package/dist/modules/AccountList/index.js +81 -14
- package/dist/modules/AccountList/types.d.ts +28 -0
- package/dist/modules/AccountList/types.js +8 -0
- package/dist/modules/Cart/index.js +1 -1
- package/dist/modules/Customer/constants.d.ts +7 -0
- package/dist/modules/Customer/constants.js +12 -0
- package/dist/modules/Customer/index.d.ts +122 -0
- package/dist/modules/Customer/index.js +697 -0
- package/dist/modules/Customer/types.d.ts +146 -0
- package/dist/modules/Customer/types.js +41 -0
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Order/index.d.ts +25 -1
- package/dist/modules/Order/index.js +224 -2
- package/dist/modules/Order/types.d.ts +45 -0
- package/dist/modules/Order/types.js +8 -0
- package/dist/modules/Payment/cash.d.ts +19 -0
- package/dist/modules/Payment/cash.js +97 -0
- package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +22 -0
- package/dist/modules/Payment/cashRecommendationAlgorithm.js +423 -0
- package/dist/modules/Payment/eftpos.d.ts +11 -0
- package/dist/modules/Payment/eftpos.js +80 -0
- package/dist/modules/Payment/index.d.ts +184 -9
- package/dist/modules/Payment/index.js +2012 -108
- package/dist/modules/Payment/mx51.d.ts +0 -0
- package/dist/modules/Payment/mx51.js +0 -0
- package/dist/modules/Payment/types.d.ts +750 -30
- package/dist/modules/Payment/types.js +236 -12
- package/dist/modules/Payment/utils.d.ts +17 -0
- package/dist/modules/Payment/utils.js +62 -0
- package/dist/modules/Payment/walletpass.d.ts +99 -0
- package/dist/modules/Payment/walletpass.js +701 -0
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/ProductList/index.d.ts +12 -1
- package/dist/modules/ProductList/index.js +27 -3
- package/dist/modules/Rules/index.d.ts +2 -0
- package/dist/modules/Rules/index.js +39 -17
- package/dist/modules/Rules/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +9 -0
- package/dist/modules/Schedule/index.js +68 -0
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/plugins/app-types/app/app.d.ts +83 -0
- package/dist/plugins/app-types/app/const.d.ts +4 -0
- package/dist/plugins/app-types/app/index.d.ts +14 -0
- package/dist/plugins/app-types/applicationManager/application.d.ts +50 -0
- package/dist/plugins/app-types/applicationManager/index.d.ts +13 -0
- package/dist/plugins/app-types/config.d.ts +3 -0
- package/dist/plugins/app-types/cookie/index.d.ts +13 -0
- package/dist/plugins/app-types/data/index.d.ts +8 -0
- package/dist/plugins/app-types/history/config.d.ts +24 -0
- package/dist/plugins/app-types/history/index.d.ts +20 -0
- package/dist/plugins/app-types/history/type.d.ts +2 -0
- package/dist/plugins/app-types/hooks/index.d.ts +12 -0
- package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
- package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
- package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
- package/dist/plugins/app-types/hooks/useStore/index.d.ts +6 -0
- package/dist/plugins/app-types/index.d.ts +6 -0
- package/dist/plugins/app-types/indexDB/index.d.ts +178 -0
- package/dist/plugins/app-types/locales/en.d.ts +3 -0
- package/dist/plugins/app-types/locales/index.d.ts +37 -0
- package/dist/plugins/app-types/locales/original.d.ts +3 -0
- package/dist/plugins/app-types/locales/type.d.ts +19 -0
- package/dist/plugins/app-types/locales/zh-CN.d.ts +3 -0
- package/dist/plugins/app-types/locales/zh-HK.d.ts +3 -0
- package/dist/plugins/app-types/logger/feishu.d.ts +11 -0
- package/dist/plugins/app-types/logger/index.d.ts +122 -0
- package/dist/plugins/app-types/menuManager/hooks.d.ts +17 -0
- package/dist/plugins/app-types/menuManager/index.d.ts +28 -0
- package/dist/plugins/app-types/models/global.d.ts +32 -0
- package/dist/plugins/app-types/models/index.d.ts +45 -0
- package/dist/plugins/app-types/models/type.d.ts +2 -0
- package/dist/plugins/app-types/package.json +15 -0
- package/dist/plugins/app-types/plugin/index.d.ts +0 -0
- package/dist/plugins/app-types/pubsub/example.d.ts +5 -0
- package/dist/plugins/app-types/pubsub/index.d.ts +63 -0
- package/dist/plugins/app-types/request/cache.d.ts +46 -0
- package/dist/plugins/app-types/request/cancelToken.d.ts +38 -0
- package/dist/plugins/app-types/request/config.d.ts +3 -0
- package/dist/plugins/app-types/request/constants.d.ts +2 -0
- package/dist/plugins/app-types/request/index.d.ts +24 -0
- package/dist/plugins/app-types/request/pisell2Request.d.ts +6 -0
- package/dist/plugins/app-types/request/type.d.ts +41 -0
- package/dist/plugins/app-types/request/utils.d.ts +46 -0
- package/dist/plugins/app-types/routes/config.d.ts +7 -0
- package/dist/plugins/app-types/routes/index.d.ts +28 -0
- package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
- package/dist/plugins/app-types/socket/components/index.d.ts +2 -0
- package/dist/plugins/app-types/socket/constants.d.ts +33 -0
- package/dist/plugins/app-types/socket/events.d.ts +31 -0
- package/dist/plugins/app-types/socket/heartbeat.d.ts +66 -0
- package/dist/plugins/app-types/socket/index.d.ts +61 -0
- package/dist/plugins/app-types/socket/monitor.d.ts +169 -0
- package/dist/plugins/app-types/socket/reconnect.d.ts +61 -0
- package/dist/plugins/app-types/socket/socket.d.ts +129 -0
- package/dist/plugins/app-types/socket/types.d.ts +85 -0
- package/dist/plugins/app-types/storage/index.d.ts +17 -0
- package/dist/plugins/app-types/tasks/index.d.ts +77 -0
- package/dist/plugins/app-types/tasks/type.d.ts +62 -0
- package/dist/plugins/app-types/tasks/useTasks.d.ts +5 -0
- package/dist/plugins/app-types/type.d.ts +2 -0
- package/dist/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
- package/dist/plugins/app-types/variables/config.d.ts +3 -0
- package/dist/plugins/app-types/variables/index.d.ts +6 -0
- package/dist/plugins/app-types/variables/type.d.ts +2 -0
- package/dist/plugins/app-types/website/index.d.ts +6 -0
- package/dist/plugins/app.d.ts +8 -0
- package/dist/plugins/app.js +1 -0
- package/dist/plugins/window.d.ts +1 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +1 -1
- package/dist/solution/BookingTicket/index.d.ts +180 -0
- package/dist/solution/BookingTicket/index.js +689 -0
- package/dist/solution/BookingTicket/types.d.ts +68 -0
- package/dist/solution/BookingTicket/types.js +43 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +159 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +22 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +189 -0
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +81 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +285 -0
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
- package/dist/solution/BookingTicket/utils/scan/scanCache.js +305 -0
- package/dist/solution/Checkout/appointmentDemo.json +1 -0
- package/dist/solution/Checkout/index.d.ts +509 -0
- package/dist/solution/Checkout/index.js +4874 -0
- package/dist/solution/Checkout/types.d.ts +923 -0
- package/dist/solution/Checkout/types.js +148 -0
- package/dist/solution/Checkout/utils/index.d.ts +117 -0
- package/dist/solution/Checkout/utils/index.js +549 -0
- package/dist/solution/ShopDiscount/index.d.ts +4 -9
- package/dist/solution/ShopDiscount/index.js +106 -54
- package/dist/solution/ShopDiscount/types.d.ts +10 -1
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/utils/task.d.ts +40 -0
- package/dist/utils/task.js +171 -0
- package/dist/utils/watch.d.ts +102 -0
- package/dist/utils/watch.js +294 -0
- package/lib/core/index.js +1 -1
- package/lib/effects/index.d.ts +4 -3
- package/lib/effects/index.js +4 -1
- package/lib/modules/AccountList/index.d.ts +7 -1
- package/lib/modules/AccountList/index.js +27 -0
- package/lib/modules/AccountList/types.d.ts +28 -0
- package/lib/modules/Cart/index.js +1 -1
- package/lib/modules/Customer/constants.d.ts +7 -0
- package/lib/modules/Customer/constants.js +39 -0
- package/lib/modules/Customer/index.d.ts +122 -0
- package/lib/modules/Customer/index.js +440 -0
- package/lib/modules/Customer/types.d.ts +146 -0
- package/lib/modules/Customer/types.js +37 -0
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Order/index.d.ts +25 -1
- package/lib/modules/Order/index.js +182 -0
- package/lib/modules/Order/types.d.ts +45 -0
- package/lib/modules/Payment/cash.d.ts +19 -0
- package/lib/modules/Payment/cash.js +64 -0
- package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +22 -0
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +342 -0
- package/lib/modules/Payment/eftpos.d.ts +11 -0
- package/lib/modules/Payment/eftpos.js +51 -0
- package/lib/modules/Payment/index.d.ts +184 -9
- package/lib/modules/Payment/index.js +1044 -50
- package/lib/modules/Payment/mx51.d.ts +0 -0
- package/lib/modules/Payment/mx51.js +0 -0
- package/lib/modules/Payment/types.d.ts +750 -30
- package/lib/modules/Payment/types.js +79 -6
- package/lib/modules/Payment/utils.d.ts +17 -0
- package/lib/modules/Payment/utils.js +67 -0
- package/lib/modules/Payment/walletpass.d.ts +99 -0
- package/lib/modules/Payment/walletpass.js +468 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ProductList/index.d.ts +12 -1
- package/lib/modules/ProductList/index.js +29 -2
- package/lib/modules/Rules/index.d.ts +2 -0
- package/lib/modules/Rules/index.js +32 -15
- package/lib/modules/Rules/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +9 -0
- package/lib/modules/Schedule/index.js +51 -0
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +2 -0
- package/lib/plugins/app-types/app/app.d.ts +83 -0
- package/lib/plugins/app-types/app/const.d.ts +4 -0
- package/lib/plugins/app-types/app/index.d.ts +14 -0
- package/lib/plugins/app-types/applicationManager/application.d.ts +50 -0
- package/lib/plugins/app-types/applicationManager/index.d.ts +13 -0
- package/lib/plugins/app-types/config.d.ts +3 -0
- package/lib/plugins/app-types/cookie/index.d.ts +13 -0
- package/lib/plugins/app-types/data/index.d.ts +8 -0
- package/lib/plugins/app-types/history/config.d.ts +24 -0
- package/lib/plugins/app-types/history/index.d.ts +20 -0
- package/lib/plugins/app-types/history/type.d.ts +2 -0
- package/lib/plugins/app-types/hooks/index.d.ts +12 -0
- package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
- package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
- package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
- package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -0
- package/lib/plugins/app-types/index.d.ts +6 -0
- package/lib/plugins/app-types/indexDB/index.d.ts +178 -0
- package/lib/plugins/app-types/locales/en.d.ts +3 -0
- package/lib/plugins/app-types/locales/index.d.ts +37 -0
- package/lib/plugins/app-types/locales/original.d.ts +3 -0
- package/lib/plugins/app-types/locales/type.d.ts +19 -0
- package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -0
- package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -0
- package/lib/plugins/app-types/logger/feishu.d.ts +11 -0
- package/lib/plugins/app-types/logger/index.d.ts +122 -0
- package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -0
- package/lib/plugins/app-types/menuManager/index.d.ts +28 -0
- package/lib/plugins/app-types/models/global.d.ts +32 -0
- package/lib/plugins/app-types/models/index.d.ts +45 -0
- package/lib/plugins/app-types/models/type.d.ts +2 -0
- package/lib/plugins/app-types/package.json +15 -0
- package/lib/plugins/app-types/plugin/index.d.ts +0 -0
- package/lib/plugins/app-types/pubsub/example.d.ts +5 -0
- package/lib/plugins/app-types/pubsub/index.d.ts +63 -0
- package/lib/plugins/app-types/request/cache.d.ts +46 -0
- package/lib/plugins/app-types/request/cancelToken.d.ts +38 -0
- package/lib/plugins/app-types/request/config.d.ts +3 -0
- package/lib/plugins/app-types/request/constants.d.ts +2 -0
- package/lib/plugins/app-types/request/index.d.ts +24 -0
- package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -0
- package/lib/plugins/app-types/request/type.d.ts +41 -0
- package/lib/plugins/app-types/request/utils.d.ts +46 -0
- package/lib/plugins/app-types/routes/config.d.ts +7 -0
- package/lib/plugins/app-types/routes/index.d.ts +28 -0
- package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
- package/lib/plugins/app-types/socket/components/index.d.ts +2 -0
- package/lib/plugins/app-types/socket/constants.d.ts +33 -0
- package/lib/plugins/app-types/socket/events.d.ts +31 -0
- package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -0
- package/lib/plugins/app-types/socket/index.d.ts +61 -0
- package/lib/plugins/app-types/socket/monitor.d.ts +169 -0
- package/lib/plugins/app-types/socket/reconnect.d.ts +61 -0
- package/lib/plugins/app-types/socket/socket.d.ts +129 -0
- package/lib/plugins/app-types/socket/types.d.ts +85 -0
- package/lib/plugins/app-types/storage/index.d.ts +17 -0
- package/lib/plugins/app-types/tasks/index.d.ts +77 -0
- package/lib/plugins/app-types/tasks/type.d.ts +62 -0
- package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -0
- package/lib/plugins/app-types/type.d.ts +2 -0
- package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
- package/lib/plugins/app-types/variables/config.d.ts +3 -0
- package/lib/plugins/app-types/variables/index.d.ts +6 -0
- package/lib/plugins/app-types/variables/type.d.ts +2 -0
- package/lib/plugins/app-types/website/index.d.ts +6 -0
- package/lib/plugins/app.d.ts +8 -0
- package/lib/plugins/app.js +17 -0
- package/lib/plugins/window.d.ts +1 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1 -2
- package/lib/solution/BookingTicket/index.d.ts +180 -0
- package/lib/solution/BookingTicket/index.js +420 -0
- package/lib/solution/BookingTicket/types.d.ts +68 -0
- package/lib/solution/BookingTicket/types.js +72 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +117 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +22 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +132 -0
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +81 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +210 -0
- package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +231 -0
- package/lib/solution/Checkout/appointmentDemo.json +1 -0
- package/lib/solution/Checkout/index.d.ts +509 -0
- package/lib/solution/Checkout/index.js +3002 -0
- package/lib/solution/Checkout/types.d.ts +923 -0
- package/lib/solution/Checkout/types.js +87 -0
- package/lib/solution/Checkout/utils/index.d.ts +117 -0
- package/lib/solution/Checkout/utils/index.js +403 -0
- package/lib/solution/ShopDiscount/index.d.ts +4 -9
- package/lib/solution/ShopDiscount/index.js +41 -13
- package/lib/solution/ShopDiscount/types.d.ts +10 -1
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +5 -1
- package/lib/types/index.d.ts +3 -1
- package/lib/utils/task.d.ts +40 -0
- package/lib/utils/task.js +109 -0
- package/lib/utils/watch.d.ts +102 -0
- package/lib/utils/watch.js +217 -0
- package/package.json +4 -2
|
@@ -0,0 +1,923 @@
|
|
|
1
|
+
import { Module } from '../../types';
|
|
2
|
+
import { OrderModule } from '../../modules/Order';
|
|
3
|
+
import { PaymentModuleAPI, PaymentOrder, PaymentMethod, PaymentStatus, PaymentItem, PaymentItemInput } from '../../modules/Payment';
|
|
4
|
+
import { CartItem } from '../../modules/Cart/types';
|
|
5
|
+
/**
|
|
6
|
+
* 结账状态枚举
|
|
7
|
+
*/
|
|
8
|
+
export declare enum CheckoutStatus {
|
|
9
|
+
/** 初始化中 */
|
|
10
|
+
Initializing = "initializing",
|
|
11
|
+
/** 准备就绪 */
|
|
12
|
+
Ready = "ready",
|
|
13
|
+
/** 创建订单中 */
|
|
14
|
+
CreatingOrder = "creating_order",
|
|
15
|
+
/** 订单已创建 */
|
|
16
|
+
OrderCreated = "order_created",
|
|
17
|
+
/** 处理支付中 */
|
|
18
|
+
ProcessingPayment = "processing_payment",
|
|
19
|
+
/** 支付完成 */
|
|
20
|
+
PaymentCompleted = "payment_completed",
|
|
21
|
+
/** 结账完成 */
|
|
22
|
+
Completed = "completed",
|
|
23
|
+
/** 已取消 */
|
|
24
|
+
Cancelled = "cancelled",
|
|
25
|
+
/** 错误状态 */
|
|
26
|
+
Error = "error"
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 结账步骤枚举
|
|
30
|
+
*/
|
|
31
|
+
export declare enum CheckoutStep {
|
|
32
|
+
/** 订单确认 */
|
|
33
|
+
OrderConfirmation = "order_confirmation",
|
|
34
|
+
/** 支付方式选择 */
|
|
35
|
+
PaymentMethod = "payment_method",
|
|
36
|
+
/** 支付处理 */
|
|
37
|
+
PaymentProcessing = "payment_processing",
|
|
38
|
+
/** 完成 */
|
|
39
|
+
Complete = "complete"
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 结账错误类型
|
|
43
|
+
*/
|
|
44
|
+
export declare enum CheckoutErrorType {
|
|
45
|
+
/** 订单创建失败 */
|
|
46
|
+
OrderCreationFailed = "order_creation_failed",
|
|
47
|
+
/** 支付失败 */
|
|
48
|
+
PaymentFailed = "payment_failed",
|
|
49
|
+
/** 验证失败 */
|
|
50
|
+
ValidationFailed = "validation_failed",
|
|
51
|
+
/** 网络错误 */
|
|
52
|
+
NetworkError = "network_error",
|
|
53
|
+
/** 未知错误 */
|
|
54
|
+
UnknownError = "unknown_error"
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* 结账错误信息
|
|
58
|
+
*/
|
|
59
|
+
export interface CheckoutError {
|
|
60
|
+
/** 错误类型 */
|
|
61
|
+
type: CheckoutErrorType;
|
|
62
|
+
/** 错误消息 */
|
|
63
|
+
message: string;
|
|
64
|
+
/** 错误详情 */
|
|
65
|
+
details?: any;
|
|
66
|
+
/** 错误时间戳 */
|
|
67
|
+
timestamp: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 结账初始化参数
|
|
71
|
+
*/
|
|
72
|
+
export interface CheckoutInitParams {
|
|
73
|
+
/** 购物车商品 */
|
|
74
|
+
cartItems: CartItem[];
|
|
75
|
+
/** 订单类型 */
|
|
76
|
+
orderType?: 'virtual' | 'appointment_booking';
|
|
77
|
+
/** 平台类型 */
|
|
78
|
+
platform?: 'pc' | 'h5';
|
|
79
|
+
/** 自动进入支付 */
|
|
80
|
+
autoPayment?: boolean;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 购物车小计项
|
|
84
|
+
*/
|
|
85
|
+
export interface CartSummaryItem {
|
|
86
|
+
/** 项目键名 */
|
|
87
|
+
key: string;
|
|
88
|
+
/** 项目值 */
|
|
89
|
+
value: number;
|
|
90
|
+
/** 是否隐藏显示 */
|
|
91
|
+
hidden?: boolean;
|
|
92
|
+
/** 显示标签 */
|
|
93
|
+
label?: string;
|
|
94
|
+
/** 税费详情 (当 key 为 tax 时) */
|
|
95
|
+
tax?: Record<string, any>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* 从购物车小计提取的金额信息
|
|
99
|
+
*/
|
|
100
|
+
export interface ExtractedAmountInfo {
|
|
101
|
+
/** 总金额 (expect_amount) */
|
|
102
|
+
totalAmount: string;
|
|
103
|
+
/** 小计 (sub_total) */
|
|
104
|
+
subTotal: string;
|
|
105
|
+
/** 税费 (tax) */
|
|
106
|
+
taxAmount: string;
|
|
107
|
+
/** 折扣 (discount) */
|
|
108
|
+
discountAmount: string;
|
|
109
|
+
/** 商店折扣 (shop_discount) */
|
|
110
|
+
shopDiscountAmount: string;
|
|
111
|
+
/** 四舍五入金额 (custom_roundingAmount) */
|
|
112
|
+
roundingAmount: string;
|
|
113
|
+
/** 定金金额 (如果是定金订单) */
|
|
114
|
+
depositAmount?: string;
|
|
115
|
+
/** 税费详情 */
|
|
116
|
+
taxDetails?: Record<string, any>;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* 本地订单创建参数
|
|
120
|
+
*/
|
|
121
|
+
export interface CreateLocalOrderParams {
|
|
122
|
+
/** 订单数据 (来自购物车的完整订单参数) */
|
|
123
|
+
orderData: LocalOrderData;
|
|
124
|
+
/** 购物车小计数据 */
|
|
125
|
+
cartSummary: CartSummaryItem[];
|
|
126
|
+
/** 是否自动进入支付流程 */
|
|
127
|
+
autoPayment?: boolean;
|
|
128
|
+
totalInfo: any;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* 手动下单参数
|
|
132
|
+
*/
|
|
133
|
+
export interface PlaceOrderParams {
|
|
134
|
+
/** 订单提交的 URL (可选,默认使用 /order/appointment) */
|
|
135
|
+
url?: string;
|
|
136
|
+
/** 是否自动替换虚拟订单ID为真实订单ID */
|
|
137
|
+
autoReplaceOrderId?: boolean;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* 本地订单数据结构 (基于 appointmentDemo.json)
|
|
141
|
+
*/
|
|
142
|
+
export interface LocalOrderData {
|
|
143
|
+
/** 订单类型 */
|
|
144
|
+
type: 'appointment_booking' | 'virtual';
|
|
145
|
+
/** 平台 */
|
|
146
|
+
platform: 'PC' | 'H5';
|
|
147
|
+
/** 销售渠道 */
|
|
148
|
+
sales_channel: string;
|
|
149
|
+
/** 订单销售渠道 */
|
|
150
|
+
order_sales_channel: string;
|
|
151
|
+
/** 预订信息 */
|
|
152
|
+
bookings: LocalBookingItem[];
|
|
153
|
+
/** 商店备注 */
|
|
154
|
+
shop_note: string;
|
|
155
|
+
/** 预约日期 */
|
|
156
|
+
schedule_date: string;
|
|
157
|
+
/** 是否定金 */
|
|
158
|
+
is_deposit: number;
|
|
159
|
+
/** 关联商品 */
|
|
160
|
+
relation_products: any[];
|
|
161
|
+
/** 关联表单 */
|
|
162
|
+
relation_forms: any[];
|
|
163
|
+
/** 客户ID */
|
|
164
|
+
customer_id?: string;
|
|
165
|
+
/** 客户姓名 */
|
|
166
|
+
customer_name?: string;
|
|
167
|
+
/** 创建时间 (YYYY-MM-DD hh:mm:ss) */
|
|
168
|
+
created_at?: string;
|
|
169
|
+
/** 附加费用 */
|
|
170
|
+
surcharge_fee?: number;
|
|
171
|
+
/** 附加费列表 */
|
|
172
|
+
surcharges?: any[];
|
|
173
|
+
/** 商店折扣金额 */
|
|
174
|
+
shop_discount?: number;
|
|
175
|
+
/** 税费金额 */
|
|
176
|
+
tax_fee?: number;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* 本地预订项
|
|
180
|
+
*/
|
|
181
|
+
export interface LocalBookingItem {
|
|
182
|
+
/** ID */
|
|
183
|
+
id: number;
|
|
184
|
+
/** 数量 */
|
|
185
|
+
number: number;
|
|
186
|
+
/** 注册类型 */
|
|
187
|
+
registration_type: string;
|
|
188
|
+
/** 关联商品 */
|
|
189
|
+
relation_products: any[];
|
|
190
|
+
/** 是否全部 */
|
|
191
|
+
is_all: boolean;
|
|
192
|
+
/** 商品信息 */
|
|
193
|
+
product: LocalProductInfo;
|
|
194
|
+
/** 子类型 */
|
|
195
|
+
sub_type: string;
|
|
196
|
+
/** 时长 */
|
|
197
|
+
duration: number;
|
|
198
|
+
/** 喜好状态 */
|
|
199
|
+
like_status: string;
|
|
200
|
+
/** 资源列表 */
|
|
201
|
+
resources: LocalResourceItem[];
|
|
202
|
+
/** 预约ID */
|
|
203
|
+
schedule_id: number;
|
|
204
|
+
/** 开始日期 */
|
|
205
|
+
start_date: string;
|
|
206
|
+
/** 开始时间 */
|
|
207
|
+
start_time: string;
|
|
208
|
+
/** 选择日期 */
|
|
209
|
+
select_date: string;
|
|
210
|
+
/** 结束时间 */
|
|
211
|
+
end_time: string;
|
|
212
|
+
/** 结束日期 */
|
|
213
|
+
end_date: string;
|
|
214
|
+
/** 元数据 */
|
|
215
|
+
metadata: {
|
|
216
|
+
account?: {
|
|
217
|
+
id: number;
|
|
218
|
+
username: string;
|
|
219
|
+
};
|
|
220
|
+
capacity?: Array<{
|
|
221
|
+
id: number;
|
|
222
|
+
value: number;
|
|
223
|
+
name: string;
|
|
224
|
+
}>;
|
|
225
|
+
};
|
|
226
|
+
/** 持有者 */
|
|
227
|
+
holder: any;
|
|
228
|
+
/** 关联表单 */
|
|
229
|
+
relation_forms: any[];
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* 本地商品信息
|
|
233
|
+
*/
|
|
234
|
+
export interface LocalProductInfo {
|
|
235
|
+
/** 数量 */
|
|
236
|
+
num: number;
|
|
237
|
+
/** 商品ID */
|
|
238
|
+
product_id: number;
|
|
239
|
+
/** 商品变体ID */
|
|
240
|
+
product_variant_id: number;
|
|
241
|
+
/** 商品套装 */
|
|
242
|
+
product_bundle: any[];
|
|
243
|
+
/** 商品选项 */
|
|
244
|
+
product_option_item: any[];
|
|
245
|
+
/** 折扣列表 */
|
|
246
|
+
discount_list: LocalDiscountItem[];
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* 本地折扣项
|
|
250
|
+
*/
|
|
251
|
+
export interface LocalDiscountItem {
|
|
252
|
+
/** 金额 */
|
|
253
|
+
amount: number;
|
|
254
|
+
/** 类型 */
|
|
255
|
+
type: string;
|
|
256
|
+
/** 折扣详情 */
|
|
257
|
+
discount: {
|
|
258
|
+
resource_id: number;
|
|
259
|
+
title: {
|
|
260
|
+
auto: string;
|
|
261
|
+
original: string;
|
|
262
|
+
en?: string;
|
|
263
|
+
'zh-CN'?: string;
|
|
264
|
+
'zh-HK'?: string;
|
|
265
|
+
};
|
|
266
|
+
original_amount: number;
|
|
267
|
+
product_id: number;
|
|
268
|
+
percent: string;
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* 本地资源项
|
|
273
|
+
*/
|
|
274
|
+
export interface LocalResourceItem {
|
|
275
|
+
/** 关联类型 */
|
|
276
|
+
relation_type: string;
|
|
277
|
+
/** 喜好状态 */
|
|
278
|
+
like_status: string;
|
|
279
|
+
/** 表单ID */
|
|
280
|
+
form_id: number;
|
|
281
|
+
/** 关联ID */
|
|
282
|
+
relation_id: number;
|
|
283
|
+
/** 容量 */
|
|
284
|
+
capacity: number;
|
|
285
|
+
/** 元数据 */
|
|
286
|
+
metadata: {
|
|
287
|
+
combined_resource?: {
|
|
288
|
+
status: number;
|
|
289
|
+
resource_ids: number[];
|
|
290
|
+
} | null;
|
|
291
|
+
form_name: string;
|
|
292
|
+
resource_name: string;
|
|
293
|
+
};
|
|
294
|
+
/** 子资源 */
|
|
295
|
+
children?: LocalResourceItem[];
|
|
296
|
+
/** ID (可选) */
|
|
297
|
+
id?: number;
|
|
298
|
+
/** 主字段 (可选) */
|
|
299
|
+
main_field?: string;
|
|
300
|
+
/** 资源类型 (可选) */
|
|
301
|
+
resourceType?: string;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* 订单创建参数
|
|
305
|
+
*/
|
|
306
|
+
export interface CreateOrderParams {
|
|
307
|
+
/** 购物车商品 */
|
|
308
|
+
cartItems: CartItem[];
|
|
309
|
+
/** 订单类型 */
|
|
310
|
+
type?: 'virtual' | 'appointment_booking';
|
|
311
|
+
/** 平台类型 */
|
|
312
|
+
platform?: 'pc' | 'h5';
|
|
313
|
+
/** 额外参数 */
|
|
314
|
+
extra?: Record<string, any>;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* 支付处理参数
|
|
318
|
+
*/
|
|
319
|
+
export interface ProcessPaymentParams {
|
|
320
|
+
/** 订单UUID */
|
|
321
|
+
orderUuid: string;
|
|
322
|
+
/** 支付方式代码 */
|
|
323
|
+
paymentMethodCode: string;
|
|
324
|
+
/** 支付金额 */
|
|
325
|
+
amount: string | number;
|
|
326
|
+
/** 支付元数据 */
|
|
327
|
+
metadata?: Record<string, any>;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* 结账状态信息
|
|
331
|
+
*/
|
|
332
|
+
export interface CheckoutStatusInfo {
|
|
333
|
+
/** 当前状态 */
|
|
334
|
+
status: CheckoutStatus;
|
|
335
|
+
/** 当前步骤 */
|
|
336
|
+
step: CheckoutStep;
|
|
337
|
+
/** 进度百分比 (0-100) */
|
|
338
|
+
progress: number;
|
|
339
|
+
/** 状态消息 */
|
|
340
|
+
message?: string;
|
|
341
|
+
/** 错误信息 */
|
|
342
|
+
error?: CheckoutError;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* 结账摘要信息
|
|
346
|
+
*/
|
|
347
|
+
export interface CheckoutSummary {
|
|
348
|
+
/** 订单信息 */
|
|
349
|
+
order?: PaymentOrder;
|
|
350
|
+
/** 总金额 */
|
|
351
|
+
totalAmount: string;
|
|
352
|
+
/** 已支付金额 */
|
|
353
|
+
paidAmount: string;
|
|
354
|
+
/** 待支付金额 */
|
|
355
|
+
remainingAmount: string;
|
|
356
|
+
/** 支付状态 */
|
|
357
|
+
paymentStatus: PaymentStatus;
|
|
358
|
+
/** 可用支付方式 */
|
|
359
|
+
availablePaymentMethods: PaymentMethod[];
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* 结账事件钩子
|
|
363
|
+
*/
|
|
364
|
+
export declare enum CheckoutHooks {
|
|
365
|
+
/** 结账初始化完成 */
|
|
366
|
+
OnCheckoutInitialized = "checkout:onInitialized",
|
|
367
|
+
/** 状态变更 */
|
|
368
|
+
OnStatusChanged = "checkout:onStatusChanged",
|
|
369
|
+
/** 步骤变更 */
|
|
370
|
+
OnStepChanged = "checkout:onStepChanged",
|
|
371
|
+
/** 订单创建成功 */
|
|
372
|
+
OnOrderCreated = "checkout:onOrderCreated",
|
|
373
|
+
/** 订单创建失败 */
|
|
374
|
+
OnOrderCreationFailed = "checkout:onOrderCreationFailed",
|
|
375
|
+
/** 支付开始 */
|
|
376
|
+
OnPaymentStarted = "checkout:onPaymentStarted",
|
|
377
|
+
/** 支付成功 */
|
|
378
|
+
OnPaymentSuccess = "checkout:onPaymentSuccess",
|
|
379
|
+
/** 支付失败 */
|
|
380
|
+
OnPaymentFailed = "checkout:onPaymentFailed",
|
|
381
|
+
/** 结账完成 */
|
|
382
|
+
OnCheckoutCompleted = "checkout:onCompleted",
|
|
383
|
+
/** 结账取消 */
|
|
384
|
+
OnCheckoutCancelled = "checkout:onCancelled",
|
|
385
|
+
/** 错误发生 */
|
|
386
|
+
OnError = "checkout:onError",
|
|
387
|
+
/** 自定义支付金额变更 */
|
|
388
|
+
OnStateAmountChanged = "checkout:onStateAmountChanged",
|
|
389
|
+
/** 系统计算的待付金额变更 */
|
|
390
|
+
OnBalanceDueAmountChanged = "checkout:onBalanceDueAmountChanged",
|
|
391
|
+
/** 订单支付完成(待付款金额 ≤ 0) */
|
|
392
|
+
OnOrderPaymentCompleted = "checkout:onOrderPaymentCompleted",
|
|
393
|
+
/** 订单同步到后端完成 */
|
|
394
|
+
OnOrderSynced = "checkout:onOrderSynced",
|
|
395
|
+
/** 订单同步到后端失败 */
|
|
396
|
+
OnOrderSyncFailed = "checkout:onOrderSyncFailed",
|
|
397
|
+
/** 订单备注变更 */
|
|
398
|
+
OnOrderNoteChanged = "checkout:onOrderNoteChanged",
|
|
399
|
+
/** 商店折扣变更 */
|
|
400
|
+
OnShopDiscountChanged = "checkout:onShopDiscountChanged",
|
|
401
|
+
/** 订单取消 */
|
|
402
|
+
OnOrderCancelled = "checkout:onOrderCancelled",
|
|
403
|
+
/** 订单状态已清理 */
|
|
404
|
+
OnOrderCleared = "checkout:onOrderCleared",
|
|
405
|
+
/** 下单接口请求开始 */
|
|
406
|
+
OnOrderSubmitStart = "checkout:onOrderSubmitStart",
|
|
407
|
+
/** 下单接口请求完成 */
|
|
408
|
+
OnOrderSubmitEnd = "checkout:onOrderSubmitEnd",
|
|
409
|
+
/** 钱包数据初始化完成 */
|
|
410
|
+
OnWalletDataInitialized = "checkout:onWalletDataInitialized"
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* 结账状态数据
|
|
414
|
+
*/
|
|
415
|
+
export interface CheckoutState {
|
|
416
|
+
/** 当前状态 */
|
|
417
|
+
status: CheckoutStatus;
|
|
418
|
+
/** 当前步骤 */
|
|
419
|
+
step: CheckoutStep;
|
|
420
|
+
/** 当前订单 */
|
|
421
|
+
currentOrder?: PaymentOrder;
|
|
422
|
+
/** 购物车商品 */
|
|
423
|
+
cartItems: CartItem[];
|
|
424
|
+
/** 本地订单数据 */
|
|
425
|
+
localOrderData?: LocalOrderData;
|
|
426
|
+
/** 购物车小计数据 */
|
|
427
|
+
cartSummary?: CartSummaryItem[];
|
|
428
|
+
/** 可用支付方式 */
|
|
429
|
+
paymentMethods: PaymentMethod[];
|
|
430
|
+
/** 错误信息 */
|
|
431
|
+
lastError?: CheckoutError;
|
|
432
|
+
/** UI 自定义支付金额 */
|
|
433
|
+
stateAmount: string;
|
|
434
|
+
/** 系统计算的待付金额(只读,由系统内部计算) */
|
|
435
|
+
balanceDueAmount: string;
|
|
436
|
+
/** 订单是否已同步到后端 */
|
|
437
|
+
isOrderSynced: boolean;
|
|
438
|
+
/** 当前客户信息 */
|
|
439
|
+
currentCustomer?: {
|
|
440
|
+
customer_id?: string;
|
|
441
|
+
customer_name?: string;
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* 当前订单基础信息
|
|
446
|
+
*/
|
|
447
|
+
export interface CurrentOrderInfo {
|
|
448
|
+
/** 订单UUID */
|
|
449
|
+
uuid?: string;
|
|
450
|
+
/** 订单ID */
|
|
451
|
+
orderId?: string;
|
|
452
|
+
/** 订单状态 */
|
|
453
|
+
status?: CheckoutStatus;
|
|
454
|
+
/** 当前步骤 */
|
|
455
|
+
step?: CheckoutStep;
|
|
456
|
+
/** 订单总金额 */
|
|
457
|
+
totalAmount?: string;
|
|
458
|
+
/** 待付金额 */
|
|
459
|
+
remainingAmount?: string;
|
|
460
|
+
/** 支付状态 */
|
|
461
|
+
paymentStatus?: PaymentStatus;
|
|
462
|
+
/** 是否为定金订单 */
|
|
463
|
+
isDeposit?: boolean;
|
|
464
|
+
/** 定金金额 */
|
|
465
|
+
depositAmount?: string;
|
|
466
|
+
/** 订单类型 */
|
|
467
|
+
orderType?: 'virtual' | 'appointment_booking';
|
|
468
|
+
/** 平台类型 */
|
|
469
|
+
platform?: 'pc' | 'h5';
|
|
470
|
+
/** 创建时间 */
|
|
471
|
+
createdAt?: string;
|
|
472
|
+
/** 商品数量 */
|
|
473
|
+
itemCount?: number;
|
|
474
|
+
/** 是否有本地订单数据 */
|
|
475
|
+
hasLocalOrderData?: boolean;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* 结账解决方案 API 接口
|
|
479
|
+
*/
|
|
480
|
+
export interface CheckoutModuleAPI extends Module {
|
|
481
|
+
/**
|
|
482
|
+
* 初始化结账流程
|
|
483
|
+
*/
|
|
484
|
+
initializeCheckoutAsync(params: CheckoutInitParams): Promise<void>;
|
|
485
|
+
/**
|
|
486
|
+
* 创建本地订单 (前端模拟下单流程)
|
|
487
|
+
*/
|
|
488
|
+
createLocalOrderAsync(params: CreateLocalOrderParams): Promise<PaymentOrder>;
|
|
489
|
+
/**
|
|
490
|
+
* 手动下单 (根据虚拟订单生成实际订单)
|
|
491
|
+
*/
|
|
492
|
+
placeOrderAsync(params?: PlaceOrderParams): Promise<{
|
|
493
|
+
success: boolean;
|
|
494
|
+
orderId?: string;
|
|
495
|
+
error?: string;
|
|
496
|
+
}>;
|
|
497
|
+
/**
|
|
498
|
+
* 创建订单
|
|
499
|
+
*/
|
|
500
|
+
createOrderAsync(params: CreateOrderParams): Promise<PaymentOrder>;
|
|
501
|
+
/**
|
|
502
|
+
* 处理支付
|
|
503
|
+
*/
|
|
504
|
+
processPaymentAsync(params: ProcessPaymentParams): Promise<void>;
|
|
505
|
+
/**
|
|
506
|
+
* 完成结账
|
|
507
|
+
*/
|
|
508
|
+
completeCheckoutAsync(): Promise<{
|
|
509
|
+
success: boolean;
|
|
510
|
+
orderId?: string;
|
|
511
|
+
}>;
|
|
512
|
+
/**
|
|
513
|
+
* 取消结账
|
|
514
|
+
*/
|
|
515
|
+
cancelCheckoutAsync(): Promise<void>;
|
|
516
|
+
/**
|
|
517
|
+
* 获取结账状态
|
|
518
|
+
*/
|
|
519
|
+
getCheckoutStatus(): CheckoutStatusInfo;
|
|
520
|
+
/**
|
|
521
|
+
* 获取结账摘要
|
|
522
|
+
*/
|
|
523
|
+
getCheckoutSummaryAsync(): Promise<CheckoutSummary>;
|
|
524
|
+
/**
|
|
525
|
+
* 获取可用支付方式
|
|
526
|
+
*/
|
|
527
|
+
getAvailablePaymentMethodsAsync(): Promise<PaymentMethod[]>;
|
|
528
|
+
/**
|
|
529
|
+
* 刷新支付方式缓存
|
|
530
|
+
*/
|
|
531
|
+
refreshPaymentMethodsAsync(): Promise<PaymentMethod[]>;
|
|
532
|
+
/**
|
|
533
|
+
* 获取当前订单基础信息
|
|
534
|
+
*/
|
|
535
|
+
getCurrentOrderInfo(): CurrentOrderInfo | null;
|
|
536
|
+
/**
|
|
537
|
+
* 获取当前订单的支付项
|
|
538
|
+
*/
|
|
539
|
+
getCurrentOrderPaymentItemsAsync(): Promise<PaymentItem[]>;
|
|
540
|
+
/**
|
|
541
|
+
* 验证结账前置条件
|
|
542
|
+
*/
|
|
543
|
+
validateCheckoutAsync(): Promise<{
|
|
544
|
+
valid: boolean;
|
|
545
|
+
errors: string[];
|
|
546
|
+
}>;
|
|
547
|
+
/**
|
|
548
|
+
* 重试失败的操作
|
|
549
|
+
*/
|
|
550
|
+
retryFailedOperationAsync(): Promise<void>;
|
|
551
|
+
/**
|
|
552
|
+
* 设置当前步骤
|
|
553
|
+
*/
|
|
554
|
+
setCurrentStep(step: CheckoutStep): void;
|
|
555
|
+
/**
|
|
556
|
+
* 获取订单模块
|
|
557
|
+
*/
|
|
558
|
+
getOrderModule(): OrderModule;
|
|
559
|
+
/**
|
|
560
|
+
* 获取支付模块
|
|
561
|
+
*/
|
|
562
|
+
getPaymentModule(): PaymentModuleAPI;
|
|
563
|
+
/**
|
|
564
|
+
* 替换本地订单ID为真实订单ID
|
|
565
|
+
*/
|
|
566
|
+
replaceLocalOrderIdAsync(newOrderId: string): Promise<PaymentOrder | null>;
|
|
567
|
+
/**
|
|
568
|
+
* 设置自定义支付金额
|
|
569
|
+
*/
|
|
570
|
+
setStateAmountAsync(amount: string): Promise<void>;
|
|
571
|
+
/**
|
|
572
|
+
* 获取当前自定义支付金额
|
|
573
|
+
*/
|
|
574
|
+
getStateAmount(): string;
|
|
575
|
+
/**
|
|
576
|
+
* 获取系统计算的待付金额(只读)
|
|
577
|
+
*
|
|
578
|
+
* @returns 当前系统计算的待付金额
|
|
579
|
+
*/
|
|
580
|
+
getBalanceDueAmount(): string;
|
|
581
|
+
/**
|
|
582
|
+
* 刷新 stateAmount 为当前剩余未支付金额
|
|
583
|
+
*/
|
|
584
|
+
refreshStateAmountAsync(): Promise<void>;
|
|
585
|
+
/**
|
|
586
|
+
* 获取购物车小计数据
|
|
587
|
+
*/
|
|
588
|
+
getCartSummary(): CartSummaryItem[] | null;
|
|
589
|
+
/**
|
|
590
|
+
* 获取提取的金额详细信息
|
|
591
|
+
*/
|
|
592
|
+
getExtractedAmountInfo(): ExtractedAmountInfo | null;
|
|
593
|
+
/**
|
|
594
|
+
* 获取支付方式列表(直接调用 Payment 模块)
|
|
595
|
+
*/
|
|
596
|
+
getPaymentMethodsAsync(): Promise<PaymentMethod[]>;
|
|
597
|
+
/**
|
|
598
|
+
* 为当前订单添加支付项
|
|
599
|
+
*/
|
|
600
|
+
addPaymentItemAsync(paymentItem: PaymentItemInput): Promise<void>;
|
|
601
|
+
/**
|
|
602
|
+
* 删除当前订单的支付项
|
|
603
|
+
*/
|
|
604
|
+
deletePaymentItemAsync(paymentUuid: string): Promise<void>;
|
|
605
|
+
/**
|
|
606
|
+
* 批量更新当前订单的代金券支付项(覆盖更新)
|
|
607
|
+
*/
|
|
608
|
+
updateVoucherPaymentItemsAsync(voucherPaymentItems: PaymentItemInput[]): Promise<void>;
|
|
609
|
+
/**
|
|
610
|
+
* 修改当前订单的定金状态
|
|
611
|
+
*/
|
|
612
|
+
updateOrderDepositStatusAsync(isDeposit: number): Promise<void>;
|
|
613
|
+
/**
|
|
614
|
+
* 更新当前订单的客户信息
|
|
615
|
+
*/
|
|
616
|
+
updateOrderCustomerAsync(customer: {
|
|
617
|
+
customer_id?: string;
|
|
618
|
+
customer_name?: string;
|
|
619
|
+
}): Promise<void>;
|
|
620
|
+
/**
|
|
621
|
+
* 获取当前订单的客户信息
|
|
622
|
+
*/
|
|
623
|
+
getCurrentCustomer(): {
|
|
624
|
+
customer_id?: string;
|
|
625
|
+
customer_name?: string;
|
|
626
|
+
} | null;
|
|
627
|
+
/**
|
|
628
|
+
* 手动同步订单到后端
|
|
629
|
+
*
|
|
630
|
+
* 用于强制同步订单到后端,特别适用于纯代金券支付完成的订单
|
|
631
|
+
*/
|
|
632
|
+
manualSyncOrderAsync(): Promise<{
|
|
633
|
+
success: boolean;
|
|
634
|
+
message?: string;
|
|
635
|
+
orderId?: string;
|
|
636
|
+
orderUuid?: string;
|
|
637
|
+
response?: any;
|
|
638
|
+
}>;
|
|
639
|
+
/**
|
|
640
|
+
* 检查订单是否需要手动同步(异步版本)
|
|
641
|
+
*
|
|
642
|
+
* 返回订单是否为纯代金券支付且待付金额<=0但未同步的状态
|
|
643
|
+
* 从 Payment 模块获取最新的支付项数据
|
|
644
|
+
*/
|
|
645
|
+
needsManualSyncAsync(): Promise<boolean>;
|
|
646
|
+
/**
|
|
647
|
+
* 更新订单备注
|
|
648
|
+
*
|
|
649
|
+
* @param note 订单备注内容
|
|
650
|
+
*/
|
|
651
|
+
updateOrderNoteAsync(note: string): Promise<void>;
|
|
652
|
+
/**
|
|
653
|
+
* 获取当前订单备注
|
|
654
|
+
*
|
|
655
|
+
* @returns 当前订单的备注内容,如果没有则返回空字符串
|
|
656
|
+
*/
|
|
657
|
+
getOrderNote(): string;
|
|
658
|
+
/**
|
|
659
|
+
* 获取当前订单ID
|
|
660
|
+
*
|
|
661
|
+
* @returns 当前订单的ID,如果没有订单则返回null
|
|
662
|
+
*/
|
|
663
|
+
getCurrentOrderId(): string | null;
|
|
664
|
+
/**
|
|
665
|
+
* 获取当前订单是否已同步到后端
|
|
666
|
+
*
|
|
667
|
+
* @returns 当前订单是否已同步状态,如果没有订单则返回false
|
|
668
|
+
*/
|
|
669
|
+
isCurrentOrderSynced(): boolean;
|
|
670
|
+
/**
|
|
671
|
+
* 取消当前本地订单
|
|
672
|
+
*
|
|
673
|
+
* 只能取消未同步到后端的本地订单,如果订单已同步则不能取消
|
|
674
|
+
*
|
|
675
|
+
* @param cancelReason 取消原因(可选)
|
|
676
|
+
* @returns 取消结果
|
|
677
|
+
*/
|
|
678
|
+
cancelCurrentOrderAsync(cancelReason?: string): Promise<{
|
|
679
|
+
success: boolean;
|
|
680
|
+
message?: string;
|
|
681
|
+
orderId?: string;
|
|
682
|
+
}>;
|
|
683
|
+
/**
|
|
684
|
+
* 更新订单商店折扣
|
|
685
|
+
*
|
|
686
|
+
* 同时更新cartSummary和localOrderData中的shop_discount值
|
|
687
|
+
*
|
|
688
|
+
* @param discountAmount 商店折扣金额
|
|
689
|
+
*/
|
|
690
|
+
updateShopDiscountAsync(discountAmount: number): Promise<void>;
|
|
691
|
+
/**
|
|
692
|
+
* 获取当前商店折扣金额
|
|
693
|
+
*
|
|
694
|
+
* @returns 当前的商店折扣金额,如果没有则返回0
|
|
695
|
+
*/
|
|
696
|
+
getShopDiscount(): number;
|
|
697
|
+
/**
|
|
698
|
+
* 保存订单并稍后支付
|
|
699
|
+
*
|
|
700
|
+
* 将当前订单保存到后端,但排除代金券类支付项(voucher_id),
|
|
701
|
+
* 适用于用户想要保存订单但稍后完成支付的场景
|
|
702
|
+
*
|
|
703
|
+
* @returns 保存结果,包含订单ID和状态
|
|
704
|
+
*/
|
|
705
|
+
saveForLaterPaymentAsync(): Promise<{
|
|
706
|
+
success: boolean;
|
|
707
|
+
message?: string;
|
|
708
|
+
orderId?: string;
|
|
709
|
+
orderUuid?: string;
|
|
710
|
+
response?: any;
|
|
711
|
+
}>;
|
|
712
|
+
/**
|
|
713
|
+
* 通过订单ID编辑订单备注
|
|
714
|
+
*
|
|
715
|
+
* 用于修改已同步到后端的订单备注,通常在支付成功后的弹窗中使用
|
|
716
|
+
*
|
|
717
|
+
* @param orderId 后端订单ID
|
|
718
|
+
* @param note 新的订单备注
|
|
719
|
+
* @returns 修改结果
|
|
720
|
+
*/
|
|
721
|
+
editOrderNoteByOrderIdAsync(orderId: string | number, note: string): Promise<{
|
|
722
|
+
success: boolean;
|
|
723
|
+
message?: string;
|
|
724
|
+
orderId?: string | number;
|
|
725
|
+
}>;
|
|
726
|
+
/**
|
|
727
|
+
* 发送客户支付链接邮件
|
|
728
|
+
*
|
|
729
|
+
* 向指定邮箱发送订单支付提醒邮件
|
|
730
|
+
*
|
|
731
|
+
* @param params 发送参数
|
|
732
|
+
* @returns 发送结果
|
|
733
|
+
*/
|
|
734
|
+
sendCustomerPayLinkAsync(params: SendCustomerPayLinkParams): Promise<{
|
|
735
|
+
success: boolean;
|
|
736
|
+
message?: string;
|
|
737
|
+
}>;
|
|
738
|
+
/**
|
|
739
|
+
* 金额舍入
|
|
740
|
+
*
|
|
741
|
+
* 根据系统配置的舍入设置对金额进行舍入处理
|
|
742
|
+
*
|
|
743
|
+
* @param amount 原始金额
|
|
744
|
+
* @returns 舍入结果详情,包含原始金额、舍入后金额和舍入差额
|
|
745
|
+
*/
|
|
746
|
+
roundAmountAsync(amount: number): Promise<{
|
|
747
|
+
originalAmount: string;
|
|
748
|
+
roundedAmount: string;
|
|
749
|
+
roundingDifference: string;
|
|
750
|
+
}>;
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* 发送客户支付链接参数
|
|
754
|
+
*/
|
|
755
|
+
export interface SendCustomerPayLinkParams {
|
|
756
|
+
/** 订单ID列表 */
|
|
757
|
+
order_ids: string[];
|
|
758
|
+
/** 通知动作,固定为订单支付提醒 */
|
|
759
|
+
notify_action?: string;
|
|
760
|
+
/** 邮箱地址列表 */
|
|
761
|
+
emails: string[];
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* 结账事件数据类型
|
|
765
|
+
*/
|
|
766
|
+
export interface CheckoutEventData {
|
|
767
|
+
/** 状态变更事件 */
|
|
768
|
+
statusChanged: {
|
|
769
|
+
oldStatus: CheckoutStatus;
|
|
770
|
+
newStatus: CheckoutStatus;
|
|
771
|
+
timestamp: number;
|
|
772
|
+
};
|
|
773
|
+
/** 步骤变更事件 */
|
|
774
|
+
stepChanged: {
|
|
775
|
+
oldStep: CheckoutStep;
|
|
776
|
+
newStep: CheckoutStep;
|
|
777
|
+
timestamp: number;
|
|
778
|
+
};
|
|
779
|
+
/** 订单创建事件 */
|
|
780
|
+
orderCreated: {
|
|
781
|
+
order: PaymentOrder;
|
|
782
|
+
timestamp: number;
|
|
783
|
+
};
|
|
784
|
+
/** 支付事件 */
|
|
785
|
+
paymentEvent: {
|
|
786
|
+
orderUuid: string;
|
|
787
|
+
paymentMethodCode: string;
|
|
788
|
+
amount: string;
|
|
789
|
+
timestamp: number;
|
|
790
|
+
};
|
|
791
|
+
/** 错误事件 */
|
|
792
|
+
error: {
|
|
793
|
+
error: CheckoutError;
|
|
794
|
+
context?: any;
|
|
795
|
+
timestamp: number;
|
|
796
|
+
};
|
|
797
|
+
/** 自定义支付金额变更事件 */
|
|
798
|
+
stateAmountChanged: {
|
|
799
|
+
oldAmount: string;
|
|
800
|
+
newAmount: string;
|
|
801
|
+
timestamp: number;
|
|
802
|
+
};
|
|
803
|
+
/** 系统计算的待付金额变更事件 */
|
|
804
|
+
balanceDueAmountChanged: {
|
|
805
|
+
oldAmount: string;
|
|
806
|
+
newAmount: string;
|
|
807
|
+
timestamp: number;
|
|
808
|
+
};
|
|
809
|
+
/** 订单支付完成事件 */
|
|
810
|
+
orderPaymentCompleted: {
|
|
811
|
+
orderUuid: string;
|
|
812
|
+
orderId: string;
|
|
813
|
+
totalAmount: string;
|
|
814
|
+
paidAmount: string;
|
|
815
|
+
remainingAmount: string;
|
|
816
|
+
timestamp: number;
|
|
817
|
+
};
|
|
818
|
+
/** 订单同步到后端完成事件 */
|
|
819
|
+
orderSynced: {
|
|
820
|
+
orderUuid: string;
|
|
821
|
+
realOrderId: string;
|
|
822
|
+
virtualOrderId: string;
|
|
823
|
+
timestamp: number;
|
|
824
|
+
/** 是否为手动同步 */
|
|
825
|
+
isManual?: boolean;
|
|
826
|
+
/** 后端响应数据 */
|
|
827
|
+
response?: any;
|
|
828
|
+
};
|
|
829
|
+
/** 订单同步到后端失败事件 */
|
|
830
|
+
orderSyncFailed: {
|
|
831
|
+
orderUuid: string;
|
|
832
|
+
/** 操作类型 */
|
|
833
|
+
operation: 'create' | 'update';
|
|
834
|
+
/** 是否为手动同步 */
|
|
835
|
+
isManual: boolean;
|
|
836
|
+
/** 错误信息 */
|
|
837
|
+
error: string;
|
|
838
|
+
/** 错误类型 */
|
|
839
|
+
errorType: 'network_error' | 'api_error' | 'response_invalid' | 'unknown';
|
|
840
|
+
/** 后端响应数据(如果有) */
|
|
841
|
+
response?: any;
|
|
842
|
+
/** 耗时(毫秒) */
|
|
843
|
+
duration?: number;
|
|
844
|
+
timestamp: number;
|
|
845
|
+
};
|
|
846
|
+
/** 订单备注变更事件 */
|
|
847
|
+
orderNoteChanged: {
|
|
848
|
+
orderUuid?: string;
|
|
849
|
+
oldNote: string;
|
|
850
|
+
newNote: string;
|
|
851
|
+
timestamp: number;
|
|
852
|
+
};
|
|
853
|
+
/** 商店折扣变更事件 */
|
|
854
|
+
shopDiscountChanged: {
|
|
855
|
+
orderUuid?: string;
|
|
856
|
+
oldDiscount: number;
|
|
857
|
+
newDiscount: number;
|
|
858
|
+
timestamp: number;
|
|
859
|
+
};
|
|
860
|
+
/** 订单取消事件 */
|
|
861
|
+
orderCancelled: {
|
|
862
|
+
orderUuid?: string;
|
|
863
|
+
orderId?: string;
|
|
864
|
+
cancelReason?: string;
|
|
865
|
+
wasSynced: boolean;
|
|
866
|
+
timestamp: number;
|
|
867
|
+
};
|
|
868
|
+
/** 订单状态清理事件 */
|
|
869
|
+
orderCleared: {
|
|
870
|
+
previousOrder?: {
|
|
871
|
+
uuid: string;
|
|
872
|
+
orderId: string;
|
|
873
|
+
} | null;
|
|
874
|
+
timestamp: number;
|
|
875
|
+
};
|
|
876
|
+
/** 下单接口请求开始事件 */
|
|
877
|
+
orderSubmitStart: {
|
|
878
|
+
/** 订单UUID */
|
|
879
|
+
orderUuid: string;
|
|
880
|
+
/** 操作类型 */
|
|
881
|
+
operation: 'create' | 'update';
|
|
882
|
+
/** 是否手动同步 */
|
|
883
|
+
isManual: boolean;
|
|
884
|
+
/** 支付项数量 */
|
|
885
|
+
paymentItemCount: number;
|
|
886
|
+
timestamp: number;
|
|
887
|
+
};
|
|
888
|
+
/** 下单接口请求完成事件 */
|
|
889
|
+
orderSubmitEnd: {
|
|
890
|
+
/** 是否成功 */
|
|
891
|
+
success: boolean;
|
|
892
|
+
/** 订单UUID */
|
|
893
|
+
orderUuid: string;
|
|
894
|
+
/** 操作类型 */
|
|
895
|
+
operation: 'create' | 'update';
|
|
896
|
+
/** 是否手动同步 */
|
|
897
|
+
isManual: boolean;
|
|
898
|
+
/** 返回的订单ID(成功时) */
|
|
899
|
+
orderId?: string;
|
|
900
|
+
/** 错误信息(失败时) */
|
|
901
|
+
error?: string;
|
|
902
|
+
/** 耗时(毫秒) */
|
|
903
|
+
duration?: number;
|
|
904
|
+
timestamp: number;
|
|
905
|
+
};
|
|
906
|
+
/** 钱包数据初始化完成事件 */
|
|
907
|
+
walletDataInitialized: {
|
|
908
|
+
/** 订单UUID */
|
|
909
|
+
orderUuid?: string;
|
|
910
|
+
/** 客户ID */
|
|
911
|
+
customerId?: number;
|
|
912
|
+
/** 钱包业务数据 */
|
|
913
|
+
walletBusinessData: {
|
|
914
|
+
customer_id?: number;
|
|
915
|
+
amountInfo: {
|
|
916
|
+
totalAmount: string;
|
|
917
|
+
subTotal: string;
|
|
918
|
+
};
|
|
919
|
+
order_wait_pay_amount?: number;
|
|
920
|
+
};
|
|
921
|
+
timestamp: number;
|
|
922
|
+
};
|
|
923
|
+
}
|