@pisell/pisellos 3.0.75 → 3.0.76
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 +5 -3
- package/dist/effects/index.js +40 -8
- package/dist/modules/Account/index.js +2 -3
- 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/BaseModule.d.ts +3 -0
- package/dist/modules/BaseModule.js +15 -0
- package/dist/modules/Cart/index.d.ts +1 -0
- package/dist/modules/Cart/index.js +2 -1
- package/dist/modules/Cart/utils/cartProduct.js +21 -4
- 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 +696 -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/Discount/index.js +3 -3
- package/dist/modules/Discount/types.d.ts +9 -0
- package/dist/modules/Guests/index.js +9 -9
- package/dist/modules/Order/index.d.ts +25 -1
- package/dist/modules/Order/index.js +224 -3
- package/dist/modules/Order/types.d.ts +45 -0
- package/dist/modules/Order/types.js +8 -0
- package/dist/modules/Order/utils.js +1 -1
- 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 +2084 -109
- package/dist/modules/Payment/mx51.d.ts +0 -0
- package/dist/modules/Payment/mx51.js +0 -0
- package/dist/modules/Payment/types.d.ts +772 -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 +711 -0
- package/dist/modules/ProductList/index.d.ts +12 -1
- package/dist/modules/ProductList/index.js +37 -15
- package/dist/modules/Resource/index.js +1 -1
- package/dist/modules/Rules/index.d.ts +2 -1
- package/dist/modules/Rules/index.js +470 -127
- 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/Summary/utils.d.ts +5 -0
- package/dist/modules/Summary/utils.js +36 -1
- 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.js +43 -13
- package/dist/solution/BookingByStep/utils/capacity.js +1 -1
- package/dist/solution/BookingByStep/utils/products.d.ts +6 -0
- package/dist/solution/BookingByStep/utils/products.js +10 -0
- package/dist/solution/BookingTicket/index.d.ts +184 -0
- package/dist/solution/BookingTicket/index.js +698 -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 +85 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +294 -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/BuyTickets/index.js +7 -8
- package/dist/solution/Checkout/appointmentDemo.json +1 -0
- package/dist/solution/Checkout/index.d.ts +432 -0
- package/dist/solution/Checkout/index.js +4452 -0
- package/dist/solution/Checkout/types.d.ts +727 -0
- package/dist/solution/Checkout/types.js +104 -0
- package/dist/solution/Checkout/utils/index.d.ts +121 -0
- package/dist/solution/Checkout/utils/index.js +511 -0
- package/dist/solution/ShopDiscount/index.d.ts +10 -10
- package/dist/solution/ShopDiscount/index.js +111 -60
- package/dist/solution/ShopDiscount/types.d.ts +8 -0
- package/dist/solution/ShopDiscount/utils.d.ts +24 -0
- package/dist/solution/ShopDiscount/utils.js +135 -1
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/dist/types/index.d.ts +4 -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 +5 -3
- package/lib/effects/index.js +17 -1
- package/lib/modules/Account/index.js +2 -3
- 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/BaseModule.d.ts +3 -0
- package/lib/modules/BaseModule.js +9 -0
- package/lib/modules/Cart/index.d.ts +1 -0
- package/lib/modules/Cart/index.js +5 -2
- package/lib/modules/Cart/utils/cartProduct.js +22 -6
- 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 +439 -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/Discount/index.js +3 -3
- package/lib/modules/Discount/types.d.ts +9 -0
- package/lib/modules/Guests/index.js +9 -9
- package/lib/modules/Order/index.d.ts +25 -1
- package/lib/modules/Order/index.js +186 -1
- package/lib/modules/Order/types.d.ts +45 -0
- package/lib/modules/Order/utils.js +1 -1
- 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 +1084 -51
- package/lib/modules/Payment/mx51.d.ts +0 -0
- package/lib/modules/Payment/mx51.js +0 -0
- package/lib/modules/Payment/types.d.ts +772 -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 +484 -0
- package/lib/modules/ProductList/index.d.ts +12 -1
- package/lib/modules/ProductList/index.js +31 -12
- package/lib/modules/Resource/index.js +1 -1
- package/lib/modules/Rules/index.d.ts +2 -1
- package/lib/modules/Rules/index.js +318 -72
- 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/Summary/utils.d.ts +5 -0
- package/lib/modules/Summary/utils.js +27 -3
- 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.js +18 -6
- package/lib/solution/BookingByStep/utils/capacity.js +1 -1
- package/lib/solution/BookingByStep/utils/products.d.ts +6 -0
- package/lib/solution/BookingByStep/utils/products.js +8 -2
- package/lib/solution/BookingTicket/index.d.ts +184 -0
- package/lib/solution/BookingTicket/index.js +426 -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 +85 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +216 -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/BuyTickets/index.js +7 -8
- package/lib/solution/Checkout/appointmentDemo.json +1 -0
- package/lib/solution/Checkout/index.d.ts +432 -0
- package/lib/solution/Checkout/index.js +2776 -0
- package/lib/solution/Checkout/types.d.ts +727 -0
- package/lib/solution/Checkout/types.js +63 -0
- package/lib/solution/Checkout/utils/index.d.ts +121 -0
- package/lib/solution/Checkout/utils/index.js +362 -0
- package/lib/solution/ShopDiscount/index.d.ts +10 -10
- package/lib/solution/ShopDiscount/index.js +53 -27
- package/lib/solution/ShopDiscount/types.d.ts +8 -0
- package/lib/solution/ShopDiscount/utils.d.ts +24 -0
- package/lib/solution/ShopDiscount/utils.js +88 -1
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +5 -1
- package/lib/types/index.d.ts +4 -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 +3 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { ICustomer } from "../AccountList/types";
|
|
2
|
+
export declare enum CustomerHooks {
|
|
3
|
+
OnCustomerListUpdate = "customer:onCustomerListUpdate",
|
|
4
|
+
OnCustomerListError = "customer:onError",
|
|
5
|
+
OnCustomerSelected = "customer:onCustomerSelected",
|
|
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:onCustomerListUpdate";
|
|
3
|
+
CustomerHooks["OnCustomerListError"] = "customer:onError";
|
|
4
|
+
CustomerHooks["OnCustomerSelected"] = "customer:onCustomerSelected";
|
|
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
|
+
*/
|
|
@@ -299,9 +299,9 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
299
299
|
}
|
|
300
300
|
if (discount.appliedProductDetails) {
|
|
301
301
|
return discount.appliedProductDetails.reduce(function (total, product) {
|
|
302
|
-
var _product$discount;
|
|
302
|
+
var _product$discount, _product$metadata;
|
|
303
303
|
var price = new Decimal((product === null || product === void 0 || (_product$discount = product.discount) === null || _product$discount === void 0 ? void 0 : _product$discount.fixed_amount) || 0).mul((product === null || product === void 0 ? void 0 : product._num) || 1);
|
|
304
|
-
return new Decimal(total).plus(price).toNumber();
|
|
304
|
+
return new Decimal(total).plus(price).add((product === null || product === void 0 || (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.product_discount_difference) || 0).toNumber();
|
|
305
305
|
}, 0);
|
|
306
306
|
}
|
|
307
307
|
}
|
|
@@ -315,7 +315,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
315
315
|
this.store.discountList = [];
|
|
316
316
|
this.core.effects.offByModuleDestroy(this.name);
|
|
317
317
|
_context6.next = 4;
|
|
318
|
-
return this.core.effects.emit(
|
|
318
|
+
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
319
319
|
case 4:
|
|
320
320
|
console.log('[Discount] 已销毁');
|
|
321
321
|
case 5:
|
|
@@ -33,6 +33,9 @@ interface ApplicableProductDetails {
|
|
|
33
33
|
title: string;
|
|
34
34
|
original_amount: string;
|
|
35
35
|
num: number;
|
|
36
|
+
metadata?: {
|
|
37
|
+
product_discount_difference?: number;
|
|
38
|
+
};
|
|
36
39
|
discount?: {
|
|
37
40
|
fixed_amount?: number;
|
|
38
41
|
product_id?: number;
|
|
@@ -81,6 +84,10 @@ export interface Discount {
|
|
|
81
84
|
discount_card_type?: 'fixed_amount' | 'percent';
|
|
82
85
|
custom_product_bundle_map_id?: string;
|
|
83
86
|
validity_type?: "custom_schedule_validity" | "fixed_validity";
|
|
87
|
+
discount_calculation_mode: 'item_level' | 'order_level';
|
|
88
|
+
holder: {
|
|
89
|
+
type: "customer" | "custom";
|
|
90
|
+
};
|
|
84
91
|
};
|
|
85
92
|
product: Product;
|
|
86
93
|
type: "product" | 'good_pass';
|
|
@@ -89,7 +96,9 @@ export interface Discount {
|
|
|
89
96
|
isEditMode?: boolean;
|
|
90
97
|
isScan?: boolean;
|
|
91
98
|
discount?: {
|
|
99
|
+
discount_product_id: number;
|
|
92
100
|
resource_id: number;
|
|
101
|
+
discount_calculation_mode: 'item_level' | 'order_level';
|
|
93
102
|
};
|
|
94
103
|
isManualSelect?: boolean;
|
|
95
104
|
isDisabled?: boolean;
|
|
@@ -70,10 +70,10 @@ export var GuestListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
70
70
|
case 0:
|
|
71
71
|
this.state.list.push(guest);
|
|
72
72
|
_context2.next = 3;
|
|
73
|
-
return this.core.effects.emit(
|
|
73
|
+
return this.core.effects.emit("".concat(this.name, ":onGuestAdd"), guest);
|
|
74
74
|
case 3:
|
|
75
75
|
_context2.next = 5;
|
|
76
|
-
return this.core.effects.emit(
|
|
76
|
+
return this.core.effects.emit("".concat(this.name, ":onGuestChange"), this.state.list);
|
|
77
77
|
case 5:
|
|
78
78
|
case "end":
|
|
79
79
|
return _context2.stop();
|
|
@@ -107,7 +107,7 @@ export var GuestListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
107
107
|
return this.core.effects.emit(GuestHooks.OnGuestUpdate, this.state.list[index]);
|
|
108
108
|
case 6:
|
|
109
109
|
_context3.next = 8;
|
|
110
|
-
return this.core.effects.emit(
|
|
110
|
+
return this.core.effects.emit("".concat(this.name, ":onGuestChange"), this.state.list);
|
|
111
111
|
case 8:
|
|
112
112
|
case "end":
|
|
113
113
|
return _context3.stop();
|
|
@@ -138,10 +138,10 @@ export var GuestListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
138
138
|
case 3:
|
|
139
139
|
_this$state$list$spli = this.state.list.splice(index, 1), _this$state$list$spli2 = _slicedToArray(_this$state$list$spli, 1), removed = _this$state$list$spli2[0];
|
|
140
140
|
_context4.next = 6;
|
|
141
|
-
return this.core.effects.emit(
|
|
141
|
+
return this.core.effects.emit("".concat(this.name, ":onGuestRemove"), removed);
|
|
142
142
|
case 6:
|
|
143
143
|
_context4.next = 8;
|
|
144
|
-
return this.core.effects.emit(
|
|
144
|
+
return this.core.effects.emit("".concat(this.name, ":onGuestChange"), this.state.list);
|
|
145
145
|
case 8:
|
|
146
146
|
case "end":
|
|
147
147
|
return _context4.stop();
|
|
@@ -196,10 +196,10 @@ export var GuestListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
196
196
|
case 3:
|
|
197
197
|
guest.items.push(item);
|
|
198
198
|
_context6.next = 6;
|
|
199
|
-
return this.core.effects.emit(
|
|
199
|
+
return this.core.effects.emit("".concat(this.name, ":onGuestUpdate"), guest);
|
|
200
200
|
case 6:
|
|
201
201
|
_context6.next = 8;
|
|
202
|
-
return this.core.effects.emit(
|
|
202
|
+
return this.core.effects.emit("".concat(this.name, ":onGuestChange"), this.state.list);
|
|
203
203
|
case 8:
|
|
204
204
|
case "end":
|
|
205
205
|
return _context6.stop();
|
|
@@ -239,10 +239,10 @@ export var GuestListModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
239
239
|
case 6:
|
|
240
240
|
guest.items.splice(index, 1);
|
|
241
241
|
_context7.next = 9;
|
|
242
|
-
return this.core.effects.emit(
|
|
242
|
+
return this.core.effects.emit("".concat(this.name, ":onGuestUpdate"), guest);
|
|
243
243
|
case 9:
|
|
244
244
|
_context7.next = 11;
|
|
245
|
-
return this.core.effects.emit(
|
|
245
|
+
return this.core.effects.emit("".concat(this.name, ":onGuestChange"), this.state.list);
|
|
246
246
|
case 11:
|
|
247
247
|
case "end":
|
|
248
248
|
return _context7.stop();
|
|
@@ -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
|
}
|
|
@@ -26,30 +26,45 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
26
26
|
import { BaseModule } from "../BaseModule";
|
|
27
27
|
import { generateDuration, getAllDiscountList, mergeRelationForms } from "./utils";
|
|
28
28
|
import { isNormalProduct } from "../Product/utils";
|
|
29
|
+
import dayjs from 'dayjs';
|
|
29
30
|
export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
30
31
|
_inherits(OrderModule, _BaseModule);
|
|
31
32
|
var _super = _createSuper(OrderModule);
|
|
33
|
+
// LoggerManager 实例
|
|
34
|
+
|
|
32
35
|
function OrderModule(name, version) {
|
|
33
36
|
var _this;
|
|
34
37
|
_classCallCheck(this, OrderModule);
|
|
35
|
-
_this = _super.call(this, name, version);
|
|
38
|
+
_this = _super.call(this, name || "order", version);
|
|
36
39
|
_defineProperty(_assertThisInitialized(_this), "defaultName", 'order');
|
|
37
40
|
_defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
|
|
38
41
|
_defineProperty(_assertThisInitialized(_this), "store", void 0);
|
|
39
42
|
_defineProperty(_assertThisInitialized(_this), "request", void 0);
|
|
43
|
+
_defineProperty(_assertThisInitialized(_this), "logger", void 0);
|
|
40
44
|
return _this;
|
|
41
45
|
}
|
|
42
46
|
_createClass(OrderModule, [{
|
|
43
47
|
key: "initialize",
|
|
44
48
|
value: function () {
|
|
45
49
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
50
|
+
var appPlugin, app;
|
|
46
51
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
47
52
|
while (1) switch (_context.prev = _context.next) {
|
|
48
53
|
case 0:
|
|
49
54
|
this.core = core;
|
|
50
55
|
this.store = options.store;
|
|
51
56
|
this.request = this.core.getPlugin('request');
|
|
52
|
-
|
|
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:
|
|
53
68
|
case "end":
|
|
54
69
|
return _context.stop();
|
|
55
70
|
}
|
|
@@ -60,6 +75,50 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
60
75
|
}
|
|
61
76
|
return initialize;
|
|
62
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
|
+
}
|
|
63
122
|
}, {
|
|
64
123
|
key: "createOrder",
|
|
65
124
|
value: function createOrder(params) {
|
|
@@ -122,6 +181,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
122
181
|
}, {
|
|
123
182
|
key: "checkBeforeSubmitOrder",
|
|
124
183
|
value: function checkBeforeSubmitOrder(params) {
|
|
184
|
+
var _params$cartItems;
|
|
185
|
+
this.logInfo('checkBeforeSubmitOrder called', {
|
|
186
|
+
cartItemsCount: ((_params$cartItems = params.cartItems) === null || _params$cartItems === void 0 ? void 0 : _params$cartItems.length) || 0,
|
|
187
|
+
type: params.type
|
|
188
|
+
});
|
|
125
189
|
var cartItems = params.cartItems,
|
|
126
190
|
type = params.type;
|
|
127
191
|
if (type === 'holder') {
|
|
@@ -139,15 +203,31 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
139
203
|
key: "submitOrder",
|
|
140
204
|
value: function () {
|
|
141
205
|
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(order) {
|
|
206
|
+
var _order$query$cartItem, _params$bookings, _params$relation_prod;
|
|
142
207
|
var url, query, fetchUrl, params;
|
|
143
208
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
144
209
|
while (1) switch (_context2.prev = _context2.next) {
|
|
145
210
|
case 0:
|
|
211
|
+
this.logInfo('submitOrder called', {
|
|
212
|
+
url: order.url,
|
|
213
|
+
orderType: order.query.type,
|
|
214
|
+
platform: order.query.platform,
|
|
215
|
+
cartItemsCount: ((_order$query$cartItem = order.query.cartItems) === null || _order$query$cartItem === void 0 ? void 0 : _order$query$cartItem.length) || 0
|
|
216
|
+
});
|
|
146
217
|
url = order.url, query = order.query;
|
|
147
218
|
fetchUrl = url || '/order/appointment';
|
|
148
219
|
params = this.createOrder(query);
|
|
220
|
+
this.logInfo('Calling backend order API', {
|
|
221
|
+
url: fetchUrl,
|
|
222
|
+
orderType: params.type,
|
|
223
|
+
platform: params.platform,
|
|
224
|
+
isDeposit: params.is_deposit,
|
|
225
|
+
bookingsCount: ((_params$bookings = params.bookings) === null || _params$bookings === void 0 ? void 0 : _params$bookings.length) || 0,
|
|
226
|
+
relationProductsCount: ((_params$relation_prod = params.relation_products) === null || _params$relation_prod === void 0 ? void 0 : _params$relation_prod.length) || 0,
|
|
227
|
+
scheduleDate: params.schedule_date
|
|
228
|
+
});
|
|
149
229
|
return _context2.abrupt("return", this.request.post(fetchUrl, params));
|
|
150
|
-
case
|
|
230
|
+
case 6:
|
|
151
231
|
case "end":
|
|
152
232
|
return _context2.stop();
|
|
153
233
|
}
|
|
@@ -158,6 +238,147 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
158
238
|
}
|
|
159
239
|
return submitOrder;
|
|
160
240
|
}()
|
|
241
|
+
/**
|
|
242
|
+
* Checkout 专用:创建订单到后端
|
|
243
|
+
*
|
|
244
|
+
* 专门为 Checkout 模块设计的订单创建方法,
|
|
245
|
+
* 直接调用 /order/checkout 接口创建订单
|
|
246
|
+
* 接收已经处理好的订单数据,无需再处理购物车
|
|
247
|
+
*
|
|
248
|
+
* @param params Checkout 订单参数(已处理的订单数据)
|
|
249
|
+
* @returns 后端返回的订单数据(包含订单ID等)
|
|
250
|
+
*/
|
|
251
|
+
}, {
|
|
252
|
+
key: "createOrderByCheckout",
|
|
253
|
+
value: (function () {
|
|
254
|
+
var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
255
|
+
var _params$bookings2, _params$relation_prod2, _params$payments, _params$payments2, _params$bookings3, _params$relation_prod3, _params$payments3;
|
|
256
|
+
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;
|
|
257
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
258
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
259
|
+
case 0:
|
|
260
|
+
this.logInfo('createOrderByCheckout called', {
|
|
261
|
+
type: params.type,
|
|
262
|
+
platform: params.platform,
|
|
263
|
+
is_deposit: params.is_deposit,
|
|
264
|
+
customer_id: params.customer_id,
|
|
265
|
+
bookingsCount: ((_params$bookings2 = params.bookings) === null || _params$bookings2 === void 0 ? void 0 : _params$bookings2.length) || 0,
|
|
266
|
+
relationProductsCount: ((_params$relation_prod2 = params.relation_products) === null || _params$relation_prod2 === void 0 ? void 0 : _params$relation_prod2.length) || 0,
|
|
267
|
+
paymentsCount: ((_params$payments = params.payments) === null || _params$payments === void 0 ? void 0 : _params$payments.length) || 0,
|
|
268
|
+
depositAmount: params.deposit_amount,
|
|
269
|
+
productTaxFee: params.product_tax_fee,
|
|
270
|
+
note: params.note,
|
|
271
|
+
scheduleDate: params.schedule_date,
|
|
272
|
+
hasOrderId: !!params.order_id,
|
|
273
|
+
orderIdIncluded: params.order_id,
|
|
274
|
+
paymentMethods: ((_params$payments2 = params.payments) === null || _params$payments2 === void 0 ? void 0 : _params$payments2.map(function (p) {
|
|
275
|
+
return p.code;
|
|
276
|
+
})) || []
|
|
277
|
+
});
|
|
278
|
+
console.log('[Order] createOrderByCheckout 开始创建订单:', {
|
|
279
|
+
type: params.type,
|
|
280
|
+
platform: params.platform,
|
|
281
|
+
is_deposit: params.is_deposit,
|
|
282
|
+
customer_id: params.customer_id,
|
|
283
|
+
bookingsCount: ((_params$bookings3 = params.bookings) === null || _params$bookings3 === void 0 ? void 0 : _params$bookings3.length) || 0,
|
|
284
|
+
relationProductsCount: ((_params$relation_prod3 = params.relation_products) === null || _params$relation_prod3 === void 0 ? void 0 : _params$relation_prod3.length) || 0,
|
|
285
|
+
paymentsCount: ((_params$payments3 = params.payments) === null || _params$payments3 === void 0 ? void 0 : _params$payments3.length) || 0
|
|
286
|
+
});
|
|
287
|
+
_context3.prev = 2;
|
|
288
|
+
// 构建订单数据,设置默认值并允许 params 覆盖
|
|
289
|
+
orderData = _objectSpread({
|
|
290
|
+
sales_channel: 'my_pisel',
|
|
291
|
+
order_sales_channel: 'online_store',
|
|
292
|
+
shop_note: '',
|
|
293
|
+
schedule_date: '',
|
|
294
|
+
is_deposit: 0,
|
|
295
|
+
bookings: [],
|
|
296
|
+
relation_products: [],
|
|
297
|
+
relation_forms: [],
|
|
298
|
+
payments: [],
|
|
299
|
+
is_full_overwrite_flag: 1
|
|
300
|
+
}, params);
|
|
301
|
+
if ((_orderData$payments = orderData.payments) !== null && _orderData$payments !== void 0 && _orderData$payments.length) {
|
|
302
|
+
orderData.small_ticket_data_flag = 1;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// 兜底策略,如果是第一次下单,没有 order_id,且没有 schedule_date,则设置为当前时间
|
|
306
|
+
if (!params.order_id && !orderData.schedule_date) {
|
|
307
|
+
orderData.schedule_date = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
308
|
+
}
|
|
309
|
+
console.log('[Order] 调用后端接口创建订单:', {
|
|
310
|
+
url: '/order/checkout',
|
|
311
|
+
orderType: orderData.type,
|
|
312
|
+
platform: orderData.platform,
|
|
313
|
+
isDeposit: orderData.is_deposit,
|
|
314
|
+
customerId: orderData.customer_id,
|
|
315
|
+
bookingsCount: ((_orderData$bookings = orderData.bookings) === null || _orderData$bookings === void 0 ? void 0 : _orderData$bookings.length) || 0,
|
|
316
|
+
relationProductsCount: ((_orderData$relation_p = orderData.relation_products) === null || _orderData$relation_p === void 0 ? void 0 : _orderData$relation_p.length) || 0,
|
|
317
|
+
paymentsCount: ((_orderData$payments2 = orderData.payments) === null || _orderData$payments2 === void 0 ? void 0 : _orderData$payments2.length) || 0,
|
|
318
|
+
paymentsMethods: ((_orderData$payments3 = orderData.payments) === null || _orderData$payments3 === void 0 ? void 0 : _orderData$payments3.map(function (p) {
|
|
319
|
+
return p.code;
|
|
320
|
+
})) || []
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
// 记录接口调用详情
|
|
324
|
+
this.logInfo('Calling backend checkout API', {
|
|
325
|
+
url: '/order/checkout',
|
|
326
|
+
orderType: orderData.type,
|
|
327
|
+
platform: orderData.platform,
|
|
328
|
+
isDeposit: orderData.is_deposit,
|
|
329
|
+
customerId: orderData.customer_id,
|
|
330
|
+
depositAmount: orderData.deposit_amount,
|
|
331
|
+
bookingsCount: ((_orderData$bookings2 = orderData.bookings) === null || _orderData$bookings2 === void 0 ? void 0 : _orderData$bookings2.length) || 0,
|
|
332
|
+
relationProductsCount: ((_orderData$relation_p2 = orderData.relation_products) === null || _orderData$relation_p2 === void 0 ? void 0 : _orderData$relation_p2.length) || 0,
|
|
333
|
+
paymentsCount: ((_orderData$payments4 = orderData.payments) === null || _orderData$payments4 === void 0 ? void 0 : _orderData$payments4.length) || 0,
|
|
334
|
+
paymentMethods: ((_orderData$payments5 = orderData.payments) === null || _orderData$payments5 === void 0 ? void 0 : _orderData$payments5.map(function (p) {
|
|
335
|
+
return {
|
|
336
|
+
code: p.code,
|
|
337
|
+
amount: p.amount,
|
|
338
|
+
type: p.type,
|
|
339
|
+
hasVoucherId: !!p.voucher_id,
|
|
340
|
+
orderPaymentType: p.order_payment_type
|
|
341
|
+
};
|
|
342
|
+
})) || [],
|
|
343
|
+
productTaxFee: orderData.product_tax_fee,
|
|
344
|
+
note: orderData.note,
|
|
345
|
+
scheduleDate: orderData.schedule_date,
|
|
346
|
+
hasOrderId: !!orderData.order_id,
|
|
347
|
+
smallTicketDataFlag: orderData.small_ticket_data_flag
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
// 调用后端接口
|
|
351
|
+
_context3.next = 10;
|
|
352
|
+
return this.request.post('/order/checkout', orderData);
|
|
353
|
+
case 10:
|
|
354
|
+
response = _context3.sent;
|
|
355
|
+
this.logInfo('Order API called successfully', {
|
|
356
|
+
response: response
|
|
357
|
+
});
|
|
358
|
+
console.log('[Order] 订单创建成功,后端响应:', {
|
|
359
|
+
success: !!response,
|
|
360
|
+
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)
|
|
361
|
+
});
|
|
362
|
+
return _context3.abrupt("return", response);
|
|
363
|
+
case 16:
|
|
364
|
+
_context3.prev = 16;
|
|
365
|
+
_context3.t0 = _context3["catch"](2);
|
|
366
|
+
console.error('[Order] createOrderByCheckout 创建订单失败:', _context3.t0);
|
|
367
|
+
this.logInfo('Order API called failed', {
|
|
368
|
+
error: _context3.t0 instanceof Error ? _context3.t0.message : String(_context3.t0)
|
|
369
|
+
});
|
|
370
|
+
throw _context3.t0;
|
|
371
|
+
case 21:
|
|
372
|
+
case "end":
|
|
373
|
+
return _context3.stop();
|
|
374
|
+
}
|
|
375
|
+
}, _callee3, this, [[2, 16]]);
|
|
376
|
+
}));
|
|
377
|
+
function createOrderByCheckout(_x4) {
|
|
378
|
+
return _createOrderByCheckout.apply(this, arguments);
|
|
379
|
+
}
|
|
380
|
+
return createOrderByCheckout;
|
|
381
|
+
}())
|
|
161
382
|
}]);
|
|
162
383
|
return OrderModule;
|
|
163
384
|
}(BaseModule);
|