@pisell/pisellos 2.1.4 → 2.1.6
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 +77 -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 +60 -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,146 @@
|
|
|
1
|
+
import { ICustomer } from "../AccountList/types";
|
|
2
|
+
export declare enum CustomerHooks {
|
|
3
|
+
OnCustomerListUpdate = "customer:onUpdate",
|
|
4
|
+
OnCustomerListError = "customer:onError",
|
|
5
|
+
OnCustomerSelected = "customer:onSelected",
|
|
6
|
+
OnPaginationChange = "customer:onPaginationChange",
|
|
7
|
+
OnScrollLoadMore = "customer:onScrollLoadMore",
|
|
8
|
+
OnScrollLoadComplete = "customer:onScrollLoadComplete"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 客户数据
|
|
12
|
+
*/
|
|
13
|
+
export interface ShopCustomer extends ICustomer {
|
|
14
|
+
/** 客户ID */
|
|
15
|
+
id: string | number;
|
|
16
|
+
/** 客户姓名 */
|
|
17
|
+
name: string;
|
|
18
|
+
/** 客户电话 */
|
|
19
|
+
phone?: string;
|
|
20
|
+
/** 客户邮箱 */
|
|
21
|
+
email?: string;
|
|
22
|
+
/** 客户创建时间 */
|
|
23
|
+
created_at?: string;
|
|
24
|
+
/** 客户更新时间 */
|
|
25
|
+
updated_at?: string;
|
|
26
|
+
/** 其他客户信息 */
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 客户列表关联查询参数
|
|
31
|
+
*
|
|
32
|
+
* formRecord: 用户表单记录
|
|
33
|
+
* walletDetails.wallet: 用户所有wallet
|
|
34
|
+
* latestWalletDetail.wallet: 用户最新wallet
|
|
35
|
+
*/
|
|
36
|
+
type CustomerWith = 'formRecord' | 'walletDetails.wallet' | 'latestWalletDetail.wallet';
|
|
37
|
+
/**
|
|
38
|
+
* 获取客户列表参数
|
|
39
|
+
*/
|
|
40
|
+
export interface ShopGetCustomerListParams {
|
|
41
|
+
/** 页码 */
|
|
42
|
+
skip?: number;
|
|
43
|
+
/** 每页数量 */
|
|
44
|
+
num?: number;
|
|
45
|
+
/** 搜索关键词 */
|
|
46
|
+
search?: string;
|
|
47
|
+
/** 关联查询参数 */
|
|
48
|
+
with?: CustomerWith[];
|
|
49
|
+
/** wallet搜索标识 */
|
|
50
|
+
search_wallet_flag?: 0 | 1;
|
|
51
|
+
/** wallet pass搜索标识 */
|
|
52
|
+
search_wallet_pass_flag?: 0 | 1;
|
|
53
|
+
/** 其他筛选参数 */
|
|
54
|
+
[key: string]: any;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* 分页信息
|
|
58
|
+
*/
|
|
59
|
+
export interface IPaginationInfo {
|
|
60
|
+
/** 当前页码 */
|
|
61
|
+
page: number;
|
|
62
|
+
/** 每页数量 */
|
|
63
|
+
pageSize: number;
|
|
64
|
+
/** 总数 */
|
|
65
|
+
total: number;
|
|
66
|
+
/** 总页数 */
|
|
67
|
+
totalPages: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 客户列表响应
|
|
71
|
+
*/
|
|
72
|
+
export interface ICustomerListResponse {
|
|
73
|
+
/** 客户列表 */
|
|
74
|
+
list: ShopCustomer[];
|
|
75
|
+
/** 总数 */
|
|
76
|
+
total: number;
|
|
77
|
+
/** 当前页 */
|
|
78
|
+
page?: number;
|
|
79
|
+
/** 每页数量 */
|
|
80
|
+
pageSize?: number;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 客户列表状态
|
|
84
|
+
*/
|
|
85
|
+
export interface CustomerState {
|
|
86
|
+
/** 客户列表 */
|
|
87
|
+
customerList: ShopCustomer[];
|
|
88
|
+
/** 当前选择的客户 */
|
|
89
|
+
selectedCustomer: ShopCustomer | null;
|
|
90
|
+
/** 列表总数 */
|
|
91
|
+
total: number;
|
|
92
|
+
/** 当前页码 */
|
|
93
|
+
currentPage: number;
|
|
94
|
+
/** 每页数量 */
|
|
95
|
+
pageSize: number;
|
|
96
|
+
/** 加载状态 */
|
|
97
|
+
loading: boolean;
|
|
98
|
+
/** 错误信息 */
|
|
99
|
+
error: string | null;
|
|
100
|
+
/** 是否支持滚动加载更多 */
|
|
101
|
+
hasMore: boolean;
|
|
102
|
+
/** 滚动加载状态 */
|
|
103
|
+
loadingMore: boolean;
|
|
104
|
+
/** 当前搜索条件 */
|
|
105
|
+
searchParams: Omit<ShopGetCustomerListParams, 'skip' | 'num'>;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 客户模块 API
|
|
109
|
+
*/
|
|
110
|
+
export interface CustomerModuleAPI {
|
|
111
|
+
/** 获取客户列表 */
|
|
112
|
+
getCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
|
|
113
|
+
/** 设置客户列表 */
|
|
114
|
+
setCustomerList: (customers: ShopCustomer[], total?: number) => void;
|
|
115
|
+
/** 设置当前选择的客户 */
|
|
116
|
+
setSelectedCustomer: (customer: ShopCustomer | null) => void;
|
|
117
|
+
/** 获取当前选择的客户 */
|
|
118
|
+
getSelectedCustomer: () => ShopCustomer | null;
|
|
119
|
+
/** 获取客户列表 */
|
|
120
|
+
getCustomers: () => ShopCustomer[];
|
|
121
|
+
/** 根据ID查找客户 */
|
|
122
|
+
getCustomerById: (id: string | number) => ShopCustomer | null;
|
|
123
|
+
/** 清空客户列表 */
|
|
124
|
+
clearCustomers: () => void;
|
|
125
|
+
/** 添加客户到列表第一位 */
|
|
126
|
+
addCustomerToFirst: (customer: ShopCustomer) => void;
|
|
127
|
+
/** 获取当前状态 */
|
|
128
|
+
getState: () => CustomerState;
|
|
129
|
+
/** 获取分页信息 */
|
|
130
|
+
getPaginationInfo: () => IPaginationInfo;
|
|
131
|
+
/** 触发分页变化事件 */
|
|
132
|
+
triggerPaginationChange: (pagination: IPaginationInfo) => void;
|
|
133
|
+
/** 设置分页信息 */
|
|
134
|
+
setPaginationInfo: (page: number, pageSize: number) => void;
|
|
135
|
+
/** 便捷方法:切换分页并自动获取数据 */
|
|
136
|
+
changeCustomerPage: (page: number, pageSize?: number) => Promise<ICustomerListResponse>;
|
|
137
|
+
/** 滚动加载更多客户数据 */
|
|
138
|
+
loadMoreCustomers: () => Promise<ICustomerListResponse>;
|
|
139
|
+
/** 重置并重新开始滚动加载 */
|
|
140
|
+
resetAndLoadCustomers: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
|
|
141
|
+
/** 检查是否还有更多数据可以加载 */
|
|
142
|
+
hasMoreCustomers: () => boolean;
|
|
143
|
+
/** 获取当前的搜索条件 */
|
|
144
|
+
getCurrentSearchParams: () => Omit<ShopGetCustomerListParams, 'skip' | 'num'>;
|
|
145
|
+
}
|
|
146
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export var CustomerHooks = /*#__PURE__*/function (CustomerHooks) {
|
|
2
|
+
CustomerHooks["OnCustomerListUpdate"] = "customer:onUpdate";
|
|
3
|
+
CustomerHooks["OnCustomerListError"] = "customer:onError";
|
|
4
|
+
CustomerHooks["OnCustomerSelected"] = "customer:onSelected";
|
|
5
|
+
CustomerHooks["OnPaginationChange"] = "customer:onPaginationChange";
|
|
6
|
+
CustomerHooks["OnScrollLoadMore"] = "customer:onScrollLoadMore";
|
|
7
|
+
CustomerHooks["OnScrollLoadComplete"] = "customer:onScrollLoadComplete";
|
|
8
|
+
return CustomerHooks;
|
|
9
|
+
}({});
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 客户数据
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 客户列表关联查询参数
|
|
17
|
+
*
|
|
18
|
+
* formRecord: 用户表单记录
|
|
19
|
+
* walletDetails.wallet: 用户所有wallet
|
|
20
|
+
* latestWalletDetail.wallet: 用户最新wallet
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 获取客户列表参数
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 分页信息
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 客户列表响应
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 客户列表状态
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 客户模块 API
|
|
41
|
+
*/
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { OrderModuleAPI, CommitOrderParams } from './types';
|
|
3
|
+
import { OrderModuleAPI, CommitOrderParams, CheckoutOrderParams } from './types';
|
|
4
4
|
import { CartItem } from '../Cart/types';
|
|
5
5
|
export declare class OrderModule extends BaseModule implements Module, OrderModuleAPI {
|
|
6
6
|
protected defaultName: string;
|
|
7
7
|
protected defaultVersion: string;
|
|
8
8
|
private store;
|
|
9
9
|
private request;
|
|
10
|
+
private logger;
|
|
10
11
|
constructor(name?: string, version?: string);
|
|
11
12
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* 记录信息日志
|
|
15
|
+
*/
|
|
16
|
+
private logInfo;
|
|
17
|
+
/**
|
|
18
|
+
* 记录警告日志
|
|
19
|
+
*/
|
|
20
|
+
private logWarning;
|
|
21
|
+
/**
|
|
22
|
+
* 记录错误日志
|
|
23
|
+
*/
|
|
24
|
+
private logError;
|
|
12
25
|
createOrder(params: CommitOrderParams['query']): {
|
|
13
26
|
type: "virtual" | "appointment_booking";
|
|
14
27
|
platform: string;
|
|
@@ -26,4 +39,15 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
26
39
|
type: 'holder' | 'account';
|
|
27
40
|
}): boolean;
|
|
28
41
|
submitOrder(order: CommitOrderParams): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Checkout 专用:创建订单到后端
|
|
44
|
+
*
|
|
45
|
+
* 专门为 Checkout 模块设计的订单创建方法,
|
|
46
|
+
* 直接调用 /order/checkout 接口创建订单
|
|
47
|
+
* 接收已经处理好的订单数据,无需再处理购物车
|
|
48
|
+
*
|
|
49
|
+
* @param params Checkout 订单参数(已处理的订单数据)
|
|
50
|
+
* @returns 后端返回的订单数据(包含订单ID等)
|
|
51
|
+
*/
|
|
52
|
+
createOrderByCheckout(params: CheckoutOrderParams): Promise<any>;
|
|
29
53
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2
4
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
5
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
6
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -24,9 +26,12 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
24
26
|
import { BaseModule } from "../BaseModule";
|
|
25
27
|
import { generateDuration, mergeRelationForms } from "./utils";
|
|
26
28
|
import { isNormalProduct } from "../Product/utils";
|
|
29
|
+
import dayjs from 'dayjs';
|
|
27
30
|
export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
28
31
|
_inherits(OrderModule, _BaseModule);
|
|
29
32
|
var _super = _createSuper(OrderModule);
|
|
33
|
+
// LoggerManager 实例
|
|
34
|
+
|
|
30
35
|
function OrderModule(name, version) {
|
|
31
36
|
var _this;
|
|
32
37
|
_classCallCheck(this, OrderModule);
|
|
@@ -35,19 +40,31 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
35
40
|
_defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
|
|
36
41
|
_defineProperty(_assertThisInitialized(_this), "store", void 0);
|
|
37
42
|
_defineProperty(_assertThisInitialized(_this), "request", void 0);
|
|
43
|
+
_defineProperty(_assertThisInitialized(_this), "logger", void 0);
|
|
38
44
|
return _this;
|
|
39
45
|
}
|
|
40
46
|
_createClass(OrderModule, [{
|
|
41
47
|
key: "initialize",
|
|
42
48
|
value: function () {
|
|
43
49
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
50
|
+
var appPlugin, app;
|
|
44
51
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
45
52
|
while (1) switch (_context.prev = _context.next) {
|
|
46
53
|
case 0:
|
|
47
54
|
this.core = core;
|
|
48
55
|
this.store = options.store;
|
|
49
56
|
this.request = this.core.getPlugin('request');
|
|
50
|
-
|
|
57
|
+
appPlugin = this.core.getPlugin('app');
|
|
58
|
+
if (appPlugin) {
|
|
59
|
+
_context.next = 6;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
throw new Error('Order 模块需要 app 插件支持');
|
|
63
|
+
case 6:
|
|
64
|
+
app = appPlugin.getApp();
|
|
65
|
+
this.logger = app.logger;
|
|
66
|
+
this.logInfo('OrderModule initialized successfully');
|
|
67
|
+
case 9:
|
|
51
68
|
case "end":
|
|
52
69
|
return _context.stop();
|
|
53
70
|
}
|
|
@@ -58,6 +75,50 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
58
75
|
}
|
|
59
76
|
return initialize;
|
|
60
77
|
}()
|
|
78
|
+
/**
|
|
79
|
+
* 记录信息日志
|
|
80
|
+
*/
|
|
81
|
+
}, {
|
|
82
|
+
key: "logInfo",
|
|
83
|
+
value: function logInfo(title, metadata) {
|
|
84
|
+
if (this.logger) {
|
|
85
|
+
this.logger.addLog({
|
|
86
|
+
type: 'info',
|
|
87
|
+
title: "[OrderModule] ".concat(title),
|
|
88
|
+
metadata: metadata || {}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* 记录警告日志
|
|
95
|
+
*/
|
|
96
|
+
}, {
|
|
97
|
+
key: "logWarning",
|
|
98
|
+
value: function logWarning(title, metadata) {
|
|
99
|
+
if (this.logger) {
|
|
100
|
+
this.logger.addLog({
|
|
101
|
+
type: 'warning',
|
|
102
|
+
title: "[OrderModule] ".concat(title),
|
|
103
|
+
metadata: metadata || {}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* 记录错误日志
|
|
110
|
+
*/
|
|
111
|
+
}, {
|
|
112
|
+
key: "logError",
|
|
113
|
+
value: function logError(title, metadata) {
|
|
114
|
+
if (this.logger) {
|
|
115
|
+
this.logger.addLog({
|
|
116
|
+
type: 'error',
|
|
117
|
+
title: "[OrderModule] ".concat(title),
|
|
118
|
+
metadata: metadata || {}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
61
122
|
}, {
|
|
62
123
|
key: "createOrder",
|
|
63
124
|
value: function createOrder(params) {
|
|
@@ -117,6 +178,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
117
178
|
}, {
|
|
118
179
|
key: "checkBeforeSubmitOrder",
|
|
119
180
|
value: function checkBeforeSubmitOrder(params) {
|
|
181
|
+
var _params$cartItems;
|
|
182
|
+
this.logInfo('checkBeforeSubmitOrder called', {
|
|
183
|
+
cartItemsCount: ((_params$cartItems = params.cartItems) === null || _params$cartItems === void 0 ? void 0 : _params$cartItems.length) || 0,
|
|
184
|
+
type: params.type
|
|
185
|
+
});
|
|
120
186
|
var cartItems = params.cartItems,
|
|
121
187
|
type = params.type;
|
|
122
188
|
if (type === 'holder') {
|
|
@@ -134,15 +200,31 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
134
200
|
key: "submitOrder",
|
|
135
201
|
value: function () {
|
|
136
202
|
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(order) {
|
|
203
|
+
var _order$query$cartItem, _params$bookings, _params$relation_prod;
|
|
137
204
|
var url, query, fetchUrl, params;
|
|
138
205
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
139
206
|
while (1) switch (_context2.prev = _context2.next) {
|
|
140
207
|
case 0:
|
|
208
|
+
this.logInfo('submitOrder called', {
|
|
209
|
+
url: order.url,
|
|
210
|
+
orderType: order.query.type,
|
|
211
|
+
platform: order.query.platform,
|
|
212
|
+
cartItemsCount: ((_order$query$cartItem = order.query.cartItems) === null || _order$query$cartItem === void 0 ? void 0 : _order$query$cartItem.length) || 0
|
|
213
|
+
});
|
|
141
214
|
url = order.url, query = order.query;
|
|
142
215
|
fetchUrl = url || '/order/appointment';
|
|
143
216
|
params = this.createOrder(query);
|
|
217
|
+
this.logInfo('Calling backend order API', {
|
|
218
|
+
url: fetchUrl,
|
|
219
|
+
orderType: params.type,
|
|
220
|
+
platform: params.platform,
|
|
221
|
+
isDeposit: params.is_deposit,
|
|
222
|
+
bookingsCount: ((_params$bookings = params.bookings) === null || _params$bookings === void 0 ? void 0 : _params$bookings.length) || 0,
|
|
223
|
+
relationProductsCount: ((_params$relation_prod = params.relation_products) === null || _params$relation_prod === void 0 ? void 0 : _params$relation_prod.length) || 0,
|
|
224
|
+
scheduleDate: params.schedule_date
|
|
225
|
+
});
|
|
144
226
|
return _context2.abrupt("return", this.request.post(fetchUrl, params));
|
|
145
|
-
case
|
|
227
|
+
case 6:
|
|
146
228
|
case "end":
|
|
147
229
|
return _context2.stop();
|
|
148
230
|
}
|
|
@@ -153,6 +235,146 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
153
235
|
}
|
|
154
236
|
return submitOrder;
|
|
155
237
|
}()
|
|
238
|
+
/**
|
|
239
|
+
* Checkout 专用:创建订单到后端
|
|
240
|
+
*
|
|
241
|
+
* 专门为 Checkout 模块设计的订单创建方法,
|
|
242
|
+
* 直接调用 /order/checkout 接口创建订单
|
|
243
|
+
* 接收已经处理好的订单数据,无需再处理购物车
|
|
244
|
+
*
|
|
245
|
+
* @param params Checkout 订单参数(已处理的订单数据)
|
|
246
|
+
* @returns 后端返回的订单数据(包含订单ID等)
|
|
247
|
+
*/
|
|
248
|
+
}, {
|
|
249
|
+
key: "createOrderByCheckout",
|
|
250
|
+
value: (function () {
|
|
251
|
+
var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
252
|
+
var _params$bookings2, _params$relation_prod2, _params$payments, _params$payments2, _params$bookings3, _params$relation_prod3, _params$payments3;
|
|
253
|
+
var _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3, _orderData$bookings2, _orderData$relation_p2, _orderData$payments4, _orderData$payments5, _response$data, orderData, response;
|
|
254
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
255
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
256
|
+
case 0:
|
|
257
|
+
this.logInfo('createOrderByCheckout called', {
|
|
258
|
+
type: params.type,
|
|
259
|
+
platform: params.platform,
|
|
260
|
+
is_deposit: params.is_deposit,
|
|
261
|
+
customer_id: params.customer_id,
|
|
262
|
+
bookingsCount: ((_params$bookings2 = params.bookings) === null || _params$bookings2 === void 0 ? void 0 : _params$bookings2.length) || 0,
|
|
263
|
+
relationProductsCount: ((_params$relation_prod2 = params.relation_products) === null || _params$relation_prod2 === void 0 ? void 0 : _params$relation_prod2.length) || 0,
|
|
264
|
+
paymentsCount: ((_params$payments = params.payments) === null || _params$payments === void 0 ? void 0 : _params$payments.length) || 0,
|
|
265
|
+
depositAmount: params.deposit_amount,
|
|
266
|
+
productTaxFee: params.product_tax_fee,
|
|
267
|
+
note: params.note,
|
|
268
|
+
scheduleDate: params.schedule_date,
|
|
269
|
+
hasOrderId: !!params.order_id,
|
|
270
|
+
orderIdIncluded: params.order_id,
|
|
271
|
+
paymentMethods: ((_params$payments2 = params.payments) === null || _params$payments2 === void 0 ? void 0 : _params$payments2.map(function (p) {
|
|
272
|
+
return p.code;
|
|
273
|
+
})) || []
|
|
274
|
+
});
|
|
275
|
+
console.log('[Order] createOrderByCheckout 开始创建订单:', {
|
|
276
|
+
type: params.type,
|
|
277
|
+
platform: params.platform,
|
|
278
|
+
is_deposit: params.is_deposit,
|
|
279
|
+
customer_id: params.customer_id,
|
|
280
|
+
bookingsCount: ((_params$bookings3 = params.bookings) === null || _params$bookings3 === void 0 ? void 0 : _params$bookings3.length) || 0,
|
|
281
|
+
relationProductsCount: ((_params$relation_prod3 = params.relation_products) === null || _params$relation_prod3 === void 0 ? void 0 : _params$relation_prod3.length) || 0,
|
|
282
|
+
paymentsCount: ((_params$payments3 = params.payments) === null || _params$payments3 === void 0 ? void 0 : _params$payments3.length) || 0
|
|
283
|
+
});
|
|
284
|
+
_context3.prev = 2;
|
|
285
|
+
// 构建订单数据,设置默认值并允许 params 覆盖
|
|
286
|
+
orderData = _objectSpread({
|
|
287
|
+
sales_channel: 'my_pisel',
|
|
288
|
+
order_sales_channel: 'online_store',
|
|
289
|
+
shop_note: '',
|
|
290
|
+
schedule_date: '',
|
|
291
|
+
is_deposit: 0,
|
|
292
|
+
bookings: [],
|
|
293
|
+
relation_products: [],
|
|
294
|
+
relation_forms: [],
|
|
295
|
+
payments: []
|
|
296
|
+
}, params);
|
|
297
|
+
if ((_orderData$payments = orderData.payments) !== null && _orderData$payments !== void 0 && _orderData$payments.length) {
|
|
298
|
+
orderData.small_ticket_data_flag = 1;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// 如果进来的order_id 是真实的,则不需要再传递 bookings 和 relation_products
|
|
302
|
+
if (params.order_id) {
|
|
303
|
+
orderData.bookings = [];
|
|
304
|
+
orderData.relation_products = [];
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// 兜底策略,如果是第一次下单,没有 order_id,且没有 schedule_date,则设置为当前时间
|
|
308
|
+
if (!params.order_id && !orderData.schedule_date) {
|
|
309
|
+
orderData.schedule_date = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
310
|
+
}
|
|
311
|
+
console.log('[Order] 调用后端接口创建订单:', {
|
|
312
|
+
url: '/order/checkout',
|
|
313
|
+
orderType: orderData.type,
|
|
314
|
+
platform: orderData.platform,
|
|
315
|
+
isDeposit: orderData.is_deposit,
|
|
316
|
+
customerId: orderData.customer_id,
|
|
317
|
+
bookingsCount: ((_orderData$bookings = orderData.bookings) === null || _orderData$bookings === void 0 ? void 0 : _orderData$bookings.length) || 0,
|
|
318
|
+
relationProductsCount: ((_orderData$relation_p = orderData.relation_products) === null || _orderData$relation_p === void 0 ? void 0 : _orderData$relation_p.length) || 0,
|
|
319
|
+
paymentsCount: ((_orderData$payments2 = orderData.payments) === null || _orderData$payments2 === void 0 ? void 0 : _orderData$payments2.length) || 0,
|
|
320
|
+
paymentsMethods: ((_orderData$payments3 = orderData.payments) === null || _orderData$payments3 === void 0 ? void 0 : _orderData$payments3.map(function (p) {
|
|
321
|
+
return p.code;
|
|
322
|
+
})) || []
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
// 记录接口调用详情
|
|
326
|
+
this.logInfo('Calling backend checkout API', {
|
|
327
|
+
url: '/order/checkout',
|
|
328
|
+
orderType: orderData.type,
|
|
329
|
+
platform: orderData.platform,
|
|
330
|
+
isDeposit: orderData.is_deposit,
|
|
331
|
+
customerId: orderData.customer_id,
|
|
332
|
+
depositAmount: orderData.deposit_amount,
|
|
333
|
+
bookingsCount: ((_orderData$bookings2 = orderData.bookings) === null || _orderData$bookings2 === void 0 ? void 0 : _orderData$bookings2.length) || 0,
|
|
334
|
+
relationProductsCount: ((_orderData$relation_p2 = orderData.relation_products) === null || _orderData$relation_p2 === void 0 ? void 0 : _orderData$relation_p2.length) || 0,
|
|
335
|
+
paymentsCount: ((_orderData$payments4 = orderData.payments) === null || _orderData$payments4 === void 0 ? void 0 : _orderData$payments4.length) || 0,
|
|
336
|
+
paymentMethods: ((_orderData$payments5 = orderData.payments) === null || _orderData$payments5 === void 0 ? void 0 : _orderData$payments5.map(function (p) {
|
|
337
|
+
return {
|
|
338
|
+
code: p.code,
|
|
339
|
+
amount: p.amount,
|
|
340
|
+
type: p.type,
|
|
341
|
+
hasVoucherId: !!p.voucher_id,
|
|
342
|
+
orderPaymentType: p.order_payment_type
|
|
343
|
+
};
|
|
344
|
+
})) || [],
|
|
345
|
+
productTaxFee: orderData.product_tax_fee,
|
|
346
|
+
note: orderData.note,
|
|
347
|
+
scheduleDate: orderData.schedule_date,
|
|
348
|
+
hasOrderId: !!orderData.order_id,
|
|
349
|
+
smallTicketDataFlag: orderData.small_ticket_data_flag
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
// 调用后端接口
|
|
353
|
+
_context3.next = 11;
|
|
354
|
+
return this.request.post('/order/checkout', orderData);
|
|
355
|
+
case 11:
|
|
356
|
+
response = _context3.sent;
|
|
357
|
+
console.log('[Order] 订单创建成功,后端响应:', {
|
|
358
|
+
success: !!response,
|
|
359
|
+
hasOrderId: !!(response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.order_id || response !== null && response !== void 0 && response.order_id)
|
|
360
|
+
});
|
|
361
|
+
return _context3.abrupt("return", response);
|
|
362
|
+
case 16:
|
|
363
|
+
_context3.prev = 16;
|
|
364
|
+
_context3.t0 = _context3["catch"](2);
|
|
365
|
+
console.error('[Order] createOrderByCheckout 创建订单失败:', _context3.t0);
|
|
366
|
+
throw _context3.t0;
|
|
367
|
+
case 20:
|
|
368
|
+
case "end":
|
|
369
|
+
return _context3.stop();
|
|
370
|
+
}
|
|
371
|
+
}, _callee3, this, [[2, 16]]);
|
|
372
|
+
}));
|
|
373
|
+
function createOrderByCheckout(_x4) {
|
|
374
|
+
return _createOrderByCheckout.apply(this, arguments);
|
|
375
|
+
}
|
|
376
|
+
return createOrderByCheckout;
|
|
377
|
+
}())
|
|
156
378
|
}]);
|
|
157
379
|
return OrderModule;
|
|
158
380
|
}(BaseModule);
|
|
@@ -18,6 +18,45 @@ export interface CommitOrderParams {
|
|
|
18
18
|
platform?: 'pc' | 'h5';
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* 支付项数据
|
|
23
|
+
*/
|
|
24
|
+
export interface PaymentItemData {
|
|
25
|
+
/** 当前支付项的唯一 ID */
|
|
26
|
+
uuid: string;
|
|
27
|
+
/** 当前支付方式付出去多少钱 */
|
|
28
|
+
amount: string;
|
|
29
|
+
/** 支付类型代码 */
|
|
30
|
+
code: string;
|
|
31
|
+
/** 支付类型id */
|
|
32
|
+
id: number;
|
|
33
|
+
/** 支付类型名称 */
|
|
34
|
+
name: string;
|
|
35
|
+
/** 支付类型 */
|
|
36
|
+
type: string;
|
|
37
|
+
/** 是否已同步到后端 */
|
|
38
|
+
isSynced?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Checkout 专用订单创建参数
|
|
42
|
+
*/
|
|
43
|
+
export interface CheckoutOrderParams {
|
|
44
|
+
type: 'virtual' | 'appointment_booking';
|
|
45
|
+
platform: 'PC' | 'H5';
|
|
46
|
+
sales_channel?: string;
|
|
47
|
+
order_sales_channel?: string;
|
|
48
|
+
bookings?: any[];
|
|
49
|
+
shop_note?: string;
|
|
50
|
+
schedule_date?: string;
|
|
51
|
+
is_deposit?: number;
|
|
52
|
+
relation_products?: any[];
|
|
53
|
+
relation_forms?: any[];
|
|
54
|
+
payments?: PaymentItemData[];
|
|
55
|
+
customer_id?: string;
|
|
56
|
+
/** 小票数据标记,当有支付项时设置为1 */
|
|
57
|
+
small_ticket_data_flag?: number;
|
|
58
|
+
[key: string]: any;
|
|
59
|
+
}
|
|
21
60
|
/**
|
|
22
61
|
* 订单模块 API
|
|
23
62
|
*/
|
|
@@ -40,4 +79,10 @@ export interface OrderModuleAPI {
|
|
|
40
79
|
* @param params 订单信息
|
|
41
80
|
*/
|
|
42
81
|
submitOrder: (params: CommitOrderParams) => Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Checkout 专用:创建订单到后端
|
|
84
|
+
* @param params 订单参数
|
|
85
|
+
* @returns 后端返回的订单数据
|
|
86
|
+
*/
|
|
87
|
+
createOrderByCheckout: (params: CheckoutOrderParams) => Promise<any>;
|
|
43
88
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CashPayment } from './types';
|
|
2
|
+
import type { PaymentModule } from './index';
|
|
3
|
+
/**
|
|
4
|
+
* 现金支付实现
|
|
5
|
+
*/
|
|
6
|
+
export declare class CashPaymentImpl implements CashPayment {
|
|
7
|
+
private paymentModule;
|
|
8
|
+
constructor(paymentModule: PaymentModule);
|
|
9
|
+
processCashPayment(amount: number, orderUuid: string): Promise<void>;
|
|
10
|
+
getCashBalance(): Promise<number>;
|
|
11
|
+
/**
|
|
12
|
+
* 获取推荐支付金额
|
|
13
|
+
* 基于目标金额和货币类型,返回最优支付金额建议
|
|
14
|
+
* @param money 目标支付金额
|
|
15
|
+
* @param currency 货币代码 (如: 'CNY', 'USD', 'EUR' 等)
|
|
16
|
+
* @returns 推荐支付金额数组
|
|
17
|
+
*/
|
|
18
|
+
getRecommendedAmount(money: number, currency: string): number[];
|
|
19
|
+
}
|