@pisell/pisellos 2.1.3 → 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/Date/index.d.ts +17 -0
- package/dist/modules/Date/index.js +92 -4
- 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/Date/index.d.ts +17 -0
- package/lib/modules/Date/index.js +64 -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 @@
|
|
|
1
|
+
{"type":"appointment_booking","platform":"PC","sales_channel":"my_pisel","order_sales_channel":"online_store","bookings":[{"id":0,"number":1,"registration_type":"all","relation_products":[],"is_all":false,"product":{"num":1,"product_id":61170,"product_variant_id":0,"product_bundle":[],"product_option_item":[],"discount_list":[{"amount":100,"type":"good_pass","discount":{"resource_id":64523,"title":{"auto":"玄-商品券","original":"玄-商品券","en":null,"zh-CN":null,"zh-HK":null},"original_amount":100,"product_id":61170,"percent":"1.00"}}]},"sub_type":"minutes","duration":480,"like_status":"common","resources":[{"relation_type":"form","like_status":"common","form_id":35,"relation_id":40357,"capacity":1,"metadata":{"combined_resource":{"status":1,"resource_ids":[40262,40263]},"form_name":"桌台","resource_name":"组合资源测试table-0422-01"},"children":[{"relation_type":"form","like_status":"common","id":40262,"main_field":"A01(组合资源-小桌-4 人)","resourceType":"single","form_id":35,"relation_id":40262,"capacity":1,"metadata":{"combined_resource":null,"form_name":"桌台","resource_name":"A01(组合资源-小桌-4 人)"}},{"relation_type":"form","like_status":"common","id":40263,"main_field":"A02(组合资源-小桌-4 人)","resourceType":"single","form_id":35,"relation_id":40263,"capacity":0,"metadata":{"combined_resource":null,"form_name":"桌台","resource_name":"A02(组合资源-小桌-4 人)"}}]},{"relation_type":"form","like_status":"common","form_id":214,"relation_id":38350,"capacity":1,"metadata":{"combined_resource":null,"form_name":"校区2","resource_name":"West Campus"}}],"schedule_id":0,"start_date":"2025-08-22","start_time":"09:00","select_date":"2025-08-22","end_time":"17:00","end_date":"2025-08-22","metadata":{"account":{"id":13433,"username":"a a"},"capacity":[{"id":0,"value":1,"name":""}]},"holder":null,"relation_forms":[]}],"shop_note":"","schedule_date":"2025-08-22 09:00:00","is_deposit":0,"relation_products":[],"relation_forms":[]}
|
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
|
+
import { BaseModule } from '../../modules/BaseModule';
|
|
3
|
+
import { OrderModule } from '../../modules/Order';
|
|
4
|
+
import { PaymentModule } from '../../modules/Payment';
|
|
5
|
+
import { CheckoutModuleAPI, CheckoutStep, CheckoutInitParams, CreateLocalOrderParams, PlaceOrderParams, CreateOrderParams, ProcessPaymentParams, CheckoutStatusInfo, CheckoutSummary, CurrentOrderInfo, CartSummaryItem, ExtractedAmountInfo, SendCustomerPayLinkParams } from './types';
|
|
6
|
+
import { PaymentOrder, PaymentMethod, PaymentItem, PaymentItemInput } from '../../modules/Payment/types';
|
|
7
|
+
export * from './types';
|
|
8
|
+
/**
|
|
9
|
+
* 结账解决方案实现
|
|
10
|
+
*
|
|
11
|
+
* 整合订单处理和支付功能,提供完整的结账流程管理。
|
|
12
|
+
* 支持多种支付方式,提供实时状态跟踪和错误处理。
|
|
13
|
+
*/
|
|
14
|
+
export declare class CheckoutImpl extends BaseModule implements Module, CheckoutModuleAPI {
|
|
15
|
+
protected defaultName: string;
|
|
16
|
+
protected defaultVersion: string;
|
|
17
|
+
isSolution: boolean;
|
|
18
|
+
private request;
|
|
19
|
+
private store;
|
|
20
|
+
private otherParams;
|
|
21
|
+
private logger;
|
|
22
|
+
order: OrderModule;
|
|
23
|
+
payment: PaymentModule;
|
|
24
|
+
constructor(name?: string, version?: string);
|
|
25
|
+
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* 记录信息日志
|
|
28
|
+
*/
|
|
29
|
+
private logInfo;
|
|
30
|
+
/**
|
|
31
|
+
* 记录警告日志
|
|
32
|
+
*/
|
|
33
|
+
private logWarning;
|
|
34
|
+
/**
|
|
35
|
+
* 记录错误日志
|
|
36
|
+
*/
|
|
37
|
+
private logError;
|
|
38
|
+
/**
|
|
39
|
+
* 初始化子模块
|
|
40
|
+
*/
|
|
41
|
+
private initializeSubModules;
|
|
42
|
+
/**
|
|
43
|
+
* 设置支付模块事件监听
|
|
44
|
+
*/
|
|
45
|
+
private setupPaymentEventListeners;
|
|
46
|
+
/**
|
|
47
|
+
* 初始化结账流程
|
|
48
|
+
*/
|
|
49
|
+
initializeCheckoutAsync(params: CheckoutInitParams): Promise<void>;
|
|
50
|
+
getProductListByOrder(): {
|
|
51
|
+
product_id: number;
|
|
52
|
+
product_variant_id: string;
|
|
53
|
+
quantity: number;
|
|
54
|
+
selling_price: number;
|
|
55
|
+
}[];
|
|
56
|
+
initWalletData(params?: {
|
|
57
|
+
order_wait_pay_amount: number;
|
|
58
|
+
}): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* 创建本地订单 (前端模拟下单流程)
|
|
61
|
+
*
|
|
62
|
+
* 此方法用于在前端模拟整个下单流程,创建一个本地的虚拟订单。
|
|
63
|
+
* 用户在购物车点击下单时,会把购物车参数传递给此方法,
|
|
64
|
+
* 方法会记录参数并创建本地虚拟订单,然后用 Payment 模块管理支付流程。
|
|
65
|
+
*/
|
|
66
|
+
createLocalOrderAsync(params: CreateLocalOrderParams): Promise<PaymentOrder>;
|
|
67
|
+
/**
|
|
68
|
+
* 手动下单 (根据虚拟订单生成实际订单)
|
|
69
|
+
*
|
|
70
|
+
* 使用当前存储的本地订单数据调用 Order 模块创建真实订单
|
|
71
|
+
*/
|
|
72
|
+
placeOrderAsync(params?: PlaceOrderParams): Promise<{
|
|
73
|
+
success: boolean;
|
|
74
|
+
orderId?: string;
|
|
75
|
+
error?: string;
|
|
76
|
+
}>;
|
|
77
|
+
/**
|
|
78
|
+
* 创建订单
|
|
79
|
+
*/
|
|
80
|
+
createOrderAsync(params: CreateOrderParams): Promise<PaymentOrder>;
|
|
81
|
+
/**
|
|
82
|
+
* 处理支付
|
|
83
|
+
*/
|
|
84
|
+
processPaymentAsync(params: ProcessPaymentParams): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* 完成结账
|
|
87
|
+
*/
|
|
88
|
+
completeCheckoutAsync(): Promise<{
|
|
89
|
+
success: boolean;
|
|
90
|
+
orderId?: string;
|
|
91
|
+
}>;
|
|
92
|
+
/**
|
|
93
|
+
* 取消结账
|
|
94
|
+
*/
|
|
95
|
+
cancelCheckoutAsync(): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* 获取结账状态
|
|
98
|
+
*/
|
|
99
|
+
getCheckoutStatus(): CheckoutStatusInfo;
|
|
100
|
+
/**
|
|
101
|
+
* 获取结账摘要
|
|
102
|
+
*/
|
|
103
|
+
getCheckoutSummaryAsync(): Promise<CheckoutSummary>;
|
|
104
|
+
/**
|
|
105
|
+
* 获取可用支付方式
|
|
106
|
+
*/
|
|
107
|
+
getAvailablePaymentMethodsAsync(): Promise<PaymentMethod[]>;
|
|
108
|
+
/**
|
|
109
|
+
* 刷新支付方式缓存
|
|
110
|
+
*
|
|
111
|
+
* 强制重新从服务器获取支付方式列表,更新本地缓存
|
|
112
|
+
*/
|
|
113
|
+
refreshPaymentMethodsAsync(): Promise<PaymentMethod[]>;
|
|
114
|
+
/**
|
|
115
|
+
* 获取订单原始数据
|
|
116
|
+
*/
|
|
117
|
+
getOrderOriginalData(): any;
|
|
118
|
+
/**
|
|
119
|
+
* 获取当前订单基础信息
|
|
120
|
+
*
|
|
121
|
+
* 返回当前订单的基础信息,包括订单状态、金额、支付状态等
|
|
122
|
+
*/
|
|
123
|
+
getCurrentOrderInfo(): CurrentOrderInfo | null;
|
|
124
|
+
/**
|
|
125
|
+
* 获取当前订单的支付项
|
|
126
|
+
*
|
|
127
|
+
* 返回当前订单的所有支付项,包括活跃和已撤销的支付项
|
|
128
|
+
*/
|
|
129
|
+
getCurrentOrderPaymentItemsAsync(): Promise<PaymentItem[]>;
|
|
130
|
+
/**
|
|
131
|
+
* 验证结账前置条件
|
|
132
|
+
*/
|
|
133
|
+
validateCheckoutAsync(): Promise<{
|
|
134
|
+
valid: boolean;
|
|
135
|
+
errors: string[];
|
|
136
|
+
}>;
|
|
137
|
+
/**
|
|
138
|
+
* 重试失败的操作
|
|
139
|
+
*/
|
|
140
|
+
retryFailedOperationAsync(): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* 设置当前步骤
|
|
143
|
+
*/
|
|
144
|
+
setCurrentStep(step: CheckoutStep): void;
|
|
145
|
+
/**
|
|
146
|
+
* 获取订单模块
|
|
147
|
+
*/
|
|
148
|
+
getOrderModule(): OrderModule;
|
|
149
|
+
/**
|
|
150
|
+
* 获取支付模块
|
|
151
|
+
*/
|
|
152
|
+
getPaymentModule(): PaymentModule;
|
|
153
|
+
/**
|
|
154
|
+
* 替换本地订单ID为真实订单ID
|
|
155
|
+
*
|
|
156
|
+
* 当后端订单创建完成后,调用此方法将本地虚拟订单ID替换为真实订单ID
|
|
157
|
+
*
|
|
158
|
+
* @param newOrderId 后端返回的真实订单ID
|
|
159
|
+
* @returns 更新后的订单对象,如果当前没有订单则返回null
|
|
160
|
+
*/
|
|
161
|
+
replaceLocalOrderIdAsync(newOrderId: string): Promise<PaymentOrder | null>;
|
|
162
|
+
/**
|
|
163
|
+
* 设置自定义支付金额
|
|
164
|
+
*
|
|
165
|
+
* 允许UI自定义本次支付的金额,通常用于部分支付或调整支付金额场景
|
|
166
|
+
*
|
|
167
|
+
* @param amount 自定义支付金额,必须是有效的数字字符串
|
|
168
|
+
*/
|
|
169
|
+
setStateAmountAsync(amount: string): Promise<void>;
|
|
170
|
+
/**
|
|
171
|
+
* 获取当前自定义支付金额
|
|
172
|
+
*
|
|
173
|
+
* @returns 当前设置的自定义支付金额
|
|
174
|
+
*/
|
|
175
|
+
getStateAmount(): string;
|
|
176
|
+
/**
|
|
177
|
+
* 获取系统计算的待付金额(只读)
|
|
178
|
+
*
|
|
179
|
+
* 此方法返回系统内部计算的实际待付金额,不允许外部修改
|
|
180
|
+
*
|
|
181
|
+
* @returns 当前系统计算的待付金额
|
|
182
|
+
*/
|
|
183
|
+
getBalanceDueAmount(): string;
|
|
184
|
+
/**
|
|
185
|
+
* 刷新 stateAmount 为当前剩余未支付金额
|
|
186
|
+
*
|
|
187
|
+
* UI 可以调用此方法来主动刷新支付金额状态
|
|
188
|
+
*/
|
|
189
|
+
refreshStateAmountAsync(): Promise<void>;
|
|
190
|
+
/**
|
|
191
|
+
* 获取购物车小计数据
|
|
192
|
+
*
|
|
193
|
+
* 返回当前结账流程中的购物车小计项数据,包含各种费用明细
|
|
194
|
+
*
|
|
195
|
+
* @returns 购物车小计数据数组,如果没有则返回 null
|
|
196
|
+
*/
|
|
197
|
+
getCartSummary(): CartSummaryItem[] | null;
|
|
198
|
+
/**
|
|
199
|
+
* 获取提取的金额详细信息
|
|
200
|
+
*
|
|
201
|
+
* 从当前的购物车小计数据中提取结构化的金额信息
|
|
202
|
+
*
|
|
203
|
+
* @returns 提取的金额信息对象,如果没有小计数据则返回 null
|
|
204
|
+
*/
|
|
205
|
+
getExtractedAmountInfo(): ExtractedAmountInfo | null;
|
|
206
|
+
/**
|
|
207
|
+
* 获取支付方式列表
|
|
208
|
+
*
|
|
209
|
+
* 优先使用 store 中的缓存数据,避免重复接口调用。
|
|
210
|
+
* 如果 store 中没有数据,则调用 Payment 模块的方法获取。
|
|
211
|
+
*
|
|
212
|
+
* @returns 支付方式列表
|
|
213
|
+
*/
|
|
214
|
+
getPaymentMethodsAsync(): Promise<PaymentMethod[]>;
|
|
215
|
+
/**
|
|
216
|
+
* 为当前订单添加支付项
|
|
217
|
+
*
|
|
218
|
+
* 向当前活跃订单添加一个支付项,支付项包含支付方式信息和金额
|
|
219
|
+
*
|
|
220
|
+
* @param paymentItem 支付项数据
|
|
221
|
+
* @throws 当前没有活跃订单时抛出错误
|
|
222
|
+
*/
|
|
223
|
+
addPaymentItemAsync(paymentItem: PaymentItemInput): Promise<void>;
|
|
224
|
+
/**
|
|
225
|
+
* 删除当前订单的支付项
|
|
226
|
+
*
|
|
227
|
+
* 从当前活跃订单中删除指定的支付项,支付项将被标记为已撤销状态
|
|
228
|
+
*
|
|
229
|
+
* @param paymentUuid 要删除的支付项UUID
|
|
230
|
+
* @throws 当前没有活跃订单时抛出错误
|
|
231
|
+
* @throws 支付项不存在时抛出错误
|
|
232
|
+
*/
|
|
233
|
+
deletePaymentItemAsync(paymentUuid: string): Promise<void>;
|
|
234
|
+
/**
|
|
235
|
+
* 批量更新当前订单的代金券支付项(覆盖更新)
|
|
236
|
+
*
|
|
237
|
+
* 删除所有现有的代金券支付项,然后添加新的代金券支付项。
|
|
238
|
+
* 这是一个覆盖式更新操作,确保代金券支付项的一致性。
|
|
239
|
+
*
|
|
240
|
+
* @param voucherPaymentItems 新的代金券支付项列表,每个都必须包含 voucher_id
|
|
241
|
+
* @throws 当前没有活跃订单时抛出错误
|
|
242
|
+
* @throws 支付项缺少 voucher_id 时抛出错误
|
|
243
|
+
*/
|
|
244
|
+
updateVoucherPaymentItemsAsync(voucherPaymentItems: PaymentItemInput[]): Promise<void>;
|
|
245
|
+
/**
|
|
246
|
+
* 修改当前订单的定金状态
|
|
247
|
+
*
|
|
248
|
+
* 更新当前订单的 is_deposit 字段,用于标识订单是否为定金订单
|
|
249
|
+
*
|
|
250
|
+
* @param isDeposit 定金状态 (1: 定金订单, 0: 全款订单)
|
|
251
|
+
* @throws 当前没有活跃订单时抛出错误
|
|
252
|
+
*/
|
|
253
|
+
updateOrderDepositStatusAsync(isDeposit: number): Promise<void>;
|
|
254
|
+
/**
|
|
255
|
+
* 更新当前订单的客户信息
|
|
256
|
+
*
|
|
257
|
+
* 更新当前订单关联的客户信息,用于标识订单的所属客户
|
|
258
|
+
*
|
|
259
|
+
* @param customer 客户信息 (customer_id 和/或 customer_name)
|
|
260
|
+
* @throws 当前没有活跃订单时抛出错误
|
|
261
|
+
*/
|
|
262
|
+
updateOrderCustomerAsync(customer: {
|
|
263
|
+
customer_id?: string;
|
|
264
|
+
customer_name?: string;
|
|
265
|
+
}): Promise<void>;
|
|
266
|
+
/**
|
|
267
|
+
* 获取当前订单的客户信息
|
|
268
|
+
*
|
|
269
|
+
* @returns 当前客户信息,如果没有则返回 null
|
|
270
|
+
*/
|
|
271
|
+
getCurrentCustomer(): {
|
|
272
|
+
customer_id?: string;
|
|
273
|
+
customer_name?: string;
|
|
274
|
+
} | null;
|
|
275
|
+
/**
|
|
276
|
+
* 检查订单是否需要手动同步(异步版本)
|
|
277
|
+
*
|
|
278
|
+
* 返回订单是否为纯代金券支付且待付金额<=0但未同步的状态
|
|
279
|
+
* 从 Payment 模块获取最新的支付项数据
|
|
280
|
+
*/
|
|
281
|
+
needsManualSyncAsync(): Promise<boolean>;
|
|
282
|
+
/**
|
|
283
|
+
* 手动同步订单到后端
|
|
284
|
+
*
|
|
285
|
+
* 用于强制同步订单到后端,特别适用于纯代金券支付完成的订单
|
|
286
|
+
*/
|
|
287
|
+
manualSyncOrderAsync(): Promise<{
|
|
288
|
+
success: boolean;
|
|
289
|
+
message?: string;
|
|
290
|
+
orderId?: string;
|
|
291
|
+
orderUuid?: string;
|
|
292
|
+
response?: any;
|
|
293
|
+
}>;
|
|
294
|
+
/**
|
|
295
|
+
* 获取当前订单备注
|
|
296
|
+
*
|
|
297
|
+
* @returns 当前订单的备注内容,如果没有则返回空字符串
|
|
298
|
+
*/
|
|
299
|
+
getOrderNote(): string;
|
|
300
|
+
/**
|
|
301
|
+
* 获取当前订单ID
|
|
302
|
+
*
|
|
303
|
+
* @returns 当前订单的ID,如果没有订单则返回null
|
|
304
|
+
*/
|
|
305
|
+
getCurrentOrderId(): string | null;
|
|
306
|
+
/**
|
|
307
|
+
* 获取当前订单是否已同步到后端
|
|
308
|
+
*
|
|
309
|
+
* @returns 当前订单是否已同步状态,如果没有订单则返回false
|
|
310
|
+
*/
|
|
311
|
+
isCurrentOrderSynced(): boolean;
|
|
312
|
+
/**
|
|
313
|
+
* 取消当前本地订单
|
|
314
|
+
*
|
|
315
|
+
* 只能取消未同步到后端的本地订单,如果订单已同步则不能取消
|
|
316
|
+
*
|
|
317
|
+
* @param cancelReason 取消原因(可选)
|
|
318
|
+
* @returns 取消结果
|
|
319
|
+
*/
|
|
320
|
+
cancelCurrentOrderAsync(cancelReason?: string): Promise<{
|
|
321
|
+
success: boolean;
|
|
322
|
+
message?: string;
|
|
323
|
+
orderId?: string;
|
|
324
|
+
}>;
|
|
325
|
+
/**
|
|
326
|
+
* 保存订单并稍后支付
|
|
327
|
+
*
|
|
328
|
+
* 将当前订单保存到后端,但排除代金券类支付项(voucher_id),
|
|
329
|
+
* 适用于用户想要保存订单但稍后完成支付的场景
|
|
330
|
+
*/
|
|
331
|
+
saveForLaterPaymentAsync(): Promise<{
|
|
332
|
+
success: boolean;
|
|
333
|
+
message?: string;
|
|
334
|
+
orderId?: string;
|
|
335
|
+
orderUuid?: string;
|
|
336
|
+
response?: any;
|
|
337
|
+
}>;
|
|
338
|
+
/**
|
|
339
|
+
* 获取当前商店折扣金额
|
|
340
|
+
*
|
|
341
|
+
* @returns 当前的商店折扣金额,如果没有则返回0
|
|
342
|
+
*/
|
|
343
|
+
getShopDiscount(): number;
|
|
344
|
+
/**
|
|
345
|
+
* 更新订单商店折扣
|
|
346
|
+
*
|
|
347
|
+
* 同时更新cartSummary和localOrderData中的shop_discount值
|
|
348
|
+
*
|
|
349
|
+
* @param discountAmount 商店折扣金额
|
|
350
|
+
*/
|
|
351
|
+
updateShopDiscountAsync(discountAmount: number): Promise<void>;
|
|
352
|
+
/**
|
|
353
|
+
* 更新订单备注
|
|
354
|
+
*
|
|
355
|
+
* @param note 订单备注内容
|
|
356
|
+
*/
|
|
357
|
+
updateOrderNoteAsync(note: string): Promise<void>;
|
|
358
|
+
/**
|
|
359
|
+
* 设置状态
|
|
360
|
+
*/
|
|
361
|
+
private setStatus;
|
|
362
|
+
/**
|
|
363
|
+
* 设置步骤
|
|
364
|
+
*/
|
|
365
|
+
private setStep;
|
|
366
|
+
/**
|
|
367
|
+
* 处理错误
|
|
368
|
+
*/
|
|
369
|
+
private handleError;
|
|
370
|
+
/**
|
|
371
|
+
* 处理支付成功
|
|
372
|
+
*/
|
|
373
|
+
private handlePaymentSuccess;
|
|
374
|
+
/**
|
|
375
|
+
* 处理支付错误
|
|
376
|
+
*/
|
|
377
|
+
private handlePaymentError;
|
|
378
|
+
/**
|
|
379
|
+
* 验证结账参数
|
|
380
|
+
*/
|
|
381
|
+
private validateCheckoutParams;
|
|
382
|
+
/**
|
|
383
|
+
* 处理现金支付项的找零逻辑
|
|
384
|
+
*
|
|
385
|
+
* @param paymentItem 原始支付项
|
|
386
|
+
* @returns 处理后的支付项(包含找零信息)
|
|
387
|
+
*/
|
|
388
|
+
private processCashPaymentItem;
|
|
389
|
+
/**
|
|
390
|
+
* 判断是否为现金支付
|
|
391
|
+
*
|
|
392
|
+
* @param paymentCode 支付代码
|
|
393
|
+
* @param paymentType 支付类型
|
|
394
|
+
* @returns 是否为现金支付
|
|
395
|
+
*/
|
|
396
|
+
private isCashPayment;
|
|
397
|
+
/**
|
|
398
|
+
* 预加载支付方式(在初始化时调用)
|
|
399
|
+
*/
|
|
400
|
+
private preloadPaymentMethods;
|
|
401
|
+
/**
|
|
402
|
+
* 清理过期的已同步订单数据
|
|
403
|
+
*
|
|
404
|
+
* 删除本地 IndexDB 中超过指定天数且已同步到后端的订单数据
|
|
405
|
+
*/
|
|
406
|
+
private cleanupExpiredOrdersAsync;
|
|
407
|
+
/**
|
|
408
|
+
* 计算已支付金额(从 Payment 模块获取最新数据)
|
|
409
|
+
*/
|
|
410
|
+
private calculatePaidAmountAsync;
|
|
411
|
+
/**
|
|
412
|
+
* 计算剩余未支付金额(从 Payment 模块获取最新数据)
|
|
413
|
+
*/
|
|
414
|
+
private calculateRemainingAmountAsync;
|
|
415
|
+
/**
|
|
416
|
+
* 更新 balanceDueAmount 为当前剩余未支付金额(系统内部计算)
|
|
417
|
+
*/
|
|
418
|
+
private updateBalanceDueAmount;
|
|
419
|
+
/**
|
|
420
|
+
* 更新 stateAmount 为当前剩余未支付金额
|
|
421
|
+
*/
|
|
422
|
+
private updateStateAmountToRemaining;
|
|
423
|
+
/**
|
|
424
|
+
* 检查订单支付是否完成
|
|
425
|
+
*
|
|
426
|
+
* 当剩余待付款金额 <= 0 时,触发订单支付完成事件
|
|
427
|
+
*/
|
|
428
|
+
private checkOrderPaymentCompletion;
|
|
429
|
+
/**
|
|
430
|
+
* 同步订单到后端
|
|
431
|
+
*
|
|
432
|
+
* 调用后端 /order/checkout 接口创建真实订单
|
|
433
|
+
*/
|
|
434
|
+
/**
|
|
435
|
+
* 同步订单到后端并返回真实订单ID
|
|
436
|
+
*
|
|
437
|
+
* @param isManual 是否为手动同步,默认为 false
|
|
438
|
+
* @param customPaymentItems 自定义支付项列表,如果提供则使用此列表而不是从数据库获取
|
|
439
|
+
* @returns 包含订单ID、UUID和完整后端响应的对象
|
|
440
|
+
*/
|
|
441
|
+
private syncOrderToBackendWithReturn;
|
|
442
|
+
private syncOrderToBackend;
|
|
443
|
+
/**
|
|
444
|
+
* 获取状态消息
|
|
445
|
+
*/
|
|
446
|
+
private getStatusMessage;
|
|
447
|
+
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
448
|
+
cover?: boolean;
|
|
449
|
+
}): Promise<void>;
|
|
450
|
+
/**
|
|
451
|
+
* 通过订单ID编辑订单备注
|
|
452
|
+
*
|
|
453
|
+
* 用于修改已同步到后端的订单备注,通常在支付成功后的弹窗中使用
|
|
454
|
+
*
|
|
455
|
+
* @param orderId 后端订单ID
|
|
456
|
+
* @param note 新的订单备注
|
|
457
|
+
* @returns 修改结果
|
|
458
|
+
*/
|
|
459
|
+
editOrderNoteByOrderIdAsync(orderId: string | number, note: string): Promise<{
|
|
460
|
+
success: boolean;
|
|
461
|
+
message?: string;
|
|
462
|
+
orderId?: string | number;
|
|
463
|
+
}>;
|
|
464
|
+
/**
|
|
465
|
+
* 发送客户支付链接邮件
|
|
466
|
+
*
|
|
467
|
+
* 向指定邮箱发送订单支付提醒邮件
|
|
468
|
+
*
|
|
469
|
+
* @param params 发送参数
|
|
470
|
+
* @returns 发送结果
|
|
471
|
+
*/
|
|
472
|
+
sendCustomerPayLinkAsync(params: SendCustomerPayLinkParams): Promise<{
|
|
473
|
+
success: boolean;
|
|
474
|
+
message?: string;
|
|
475
|
+
}>;
|
|
476
|
+
/**
|
|
477
|
+
* 金额舍入
|
|
478
|
+
*
|
|
479
|
+
* @param amount 原始金额
|
|
480
|
+
* @returns 舍入结果详情,包含原始金额、舍入后金额和舍入差额
|
|
481
|
+
*/
|
|
482
|
+
roundAmountAsync(amount: number): Promise<{
|
|
483
|
+
originalAmount: string;
|
|
484
|
+
roundedAmount: string;
|
|
485
|
+
roundingDifference: string;
|
|
486
|
+
}>;
|
|
487
|
+
destroy(): Promise<void>;
|
|
488
|
+
/**
|
|
489
|
+
* 重置 store 状态
|
|
490
|
+
*
|
|
491
|
+
* 在创建新订单前调用,确保状态完全干净
|
|
492
|
+
*/
|
|
493
|
+
private resetStoreStateAsync;
|
|
494
|
+
/**
|
|
495
|
+
* 手动清理已完成的订单状态(公开方法)
|
|
496
|
+
*
|
|
497
|
+
* 供UI层调用的公开方法,用于手动清理订单状态
|
|
498
|
+
*
|
|
499
|
+
* @returns 清理结果
|
|
500
|
+
*/
|
|
501
|
+
clearCompletedOrderAsync(): Promise<{
|
|
502
|
+
success: boolean;
|
|
503
|
+
message?: string;
|
|
504
|
+
clearedOrder?: {
|
|
505
|
+
uuid: string;
|
|
506
|
+
orderId: string;
|
|
507
|
+
} | null;
|
|
508
|
+
}>;
|
|
509
|
+
}
|