@pisell/pisellos 3.0.57 → 3.0.58
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 +1 -2
- package/dist/effects/index.d.ts +3 -4
- package/dist/effects/index.js +6 -15
- package/dist/modules/AccountList/index.d.ts +1 -7
- package/dist/modules/AccountList/index.js +14 -81
- package/dist/modules/AccountList/types.d.ts +0 -28
- package/dist/modules/AccountList/types.js +0 -8
- package/dist/modules/Cart/index.js +1 -1
- package/dist/modules/Payment/index.d.ts +9 -273
- package/dist/modules/Payment/index.js +109 -2525
- package/dist/modules/Payment/types.d.ts +30 -382
- package/dist/modules/Payment/types.js +14 -116
- package/dist/modules/ProductList/index.d.ts +1 -12
- package/dist/modules/ProductList/index.js +3 -27
- package/dist/modules/Rules/index.js +14 -27
- package/dist/modules/Rules/types.d.ts +0 -1
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +0 -1
- package/dist/plugins/window.d.ts +0 -1
- package/dist/solution/BookingByStep/index.js +1 -9
- package/dist/solution/ShopDiscount/index.js +2 -4
- package/dist/solution/index.d.ts +0 -2
- package/dist/solution/index.js +1 -3
- package/dist/types/index.d.ts +1 -3
- package/lib/core/index.js +1 -1
- package/lib/effects/index.d.ts +3 -4
- package/lib/effects/index.js +1 -4
- package/lib/modules/AccountList/index.d.ts +1 -7
- package/lib/modules/AccountList/index.js +0 -27
- package/lib/modules/AccountList/types.d.ts +0 -28
- package/lib/modules/Cart/index.js +1 -1
- package/lib/modules/Payment/index.d.ts +9 -273
- package/lib/modules/Payment/index.js +50 -1285
- package/lib/modules/Payment/types.d.ts +30 -382
- package/lib/modules/Payment/types.js +6 -41
- package/lib/modules/ProductList/index.d.ts +1 -12
- package/lib/modules/ProductList/index.js +2 -29
- package/lib/modules/Rules/index.js +12 -20
- package/lib/modules/Rules/types.d.ts +0 -1
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +0 -2
- package/lib/plugins/window.d.ts +0 -1
- package/lib/solution/BookingByStep/index.js +2 -1
- package/lib/solution/ShopDiscount/index.js +1 -2
- package/lib/solution/index.d.ts +0 -2
- package/lib/solution/index.js +1 -5
- package/lib/types/index.d.ts +1 -3
- package/package.json +2 -4
- package/dist/modules/Customer/constants.d.ts +0 -7
- package/dist/modules/Customer/constants.js +0 -12
- package/dist/modules/Customer/index.d.ts +0 -122
- package/dist/modules/Customer/index.js +0 -697
- package/dist/modules/Customer/types.d.ts +0 -146
- package/dist/modules/Customer/types.js +0 -41
- package/dist/modules/Payment/cash.d.ts +0 -11
- package/dist/modules/Payment/cash.js +0 -78
- package/dist/modules/Payment/eftpos.d.ts +0 -11
- package/dist/modules/Payment/eftpos.js +0 -80
- package/dist/modules/Payment/wallet.d.ts +0 -11
- package/dist/modules/Payment/wallet.js +0 -78
- package/dist/modules/Payment/walletpass.d.ts +0 -0
- package/dist/modules/Payment/walletpass.js +0 -0
- package/dist/plugins/app-types/app/app.d.ts +0 -83
- package/dist/plugins/app-types/app/const.d.ts +0 -4
- package/dist/plugins/app-types/app/index.d.ts +0 -14
- package/dist/plugins/app-types/applicationManager/application.d.ts +0 -50
- package/dist/plugins/app-types/applicationManager/index.d.ts +0 -13
- package/dist/plugins/app-types/config.d.ts +0 -3
- package/dist/plugins/app-types/cookie/index.d.ts +0 -13
- package/dist/plugins/app-types/data/index.d.ts +0 -8
- package/dist/plugins/app-types/history/config.d.ts +0 -24
- package/dist/plugins/app-types/history/index.d.ts +0 -20
- package/dist/plugins/app-types/history/type.d.ts +0 -2
- package/dist/plugins/app-types/hooks/index.d.ts +0 -12
- package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
- package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
- package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
- package/dist/plugins/app-types/hooks/useStore/index.d.ts +0 -6
- package/dist/plugins/app-types/index.d.ts +0 -6
- package/dist/plugins/app-types/indexDB/index.d.ts +0 -178
- package/dist/plugins/app-types/locales/en.d.ts +0 -3
- package/dist/plugins/app-types/locales/index.d.ts +0 -37
- package/dist/plugins/app-types/locales/original.d.ts +0 -3
- package/dist/plugins/app-types/locales/type.d.ts +0 -19
- package/dist/plugins/app-types/locales/zh-CN.d.ts +0 -3
- package/dist/plugins/app-types/locales/zh-HK.d.ts +0 -3
- package/dist/plugins/app-types/logger/feishu.d.ts +0 -11
- package/dist/plugins/app-types/logger/index.d.ts +0 -122
- package/dist/plugins/app-types/menuManager/hooks.d.ts +0 -17
- package/dist/plugins/app-types/menuManager/index.d.ts +0 -28
- package/dist/plugins/app-types/models/global.d.ts +0 -32
- package/dist/plugins/app-types/models/index.d.ts +0 -45
- package/dist/plugins/app-types/models/type.d.ts +0 -2
- package/dist/plugins/app-types/package.json +0 -15
- package/dist/plugins/app-types/plugin/index.d.ts +0 -0
- package/dist/plugins/app-types/pubsub/example.d.ts +0 -5
- package/dist/plugins/app-types/pubsub/index.d.ts +0 -63
- package/dist/plugins/app-types/request/cache.d.ts +0 -46
- package/dist/plugins/app-types/request/cancelToken.d.ts +0 -38
- package/dist/plugins/app-types/request/config.d.ts +0 -3
- package/dist/plugins/app-types/request/constants.d.ts +0 -2
- package/dist/plugins/app-types/request/index.d.ts +0 -24
- package/dist/plugins/app-types/request/pisell2Request.d.ts +0 -6
- package/dist/plugins/app-types/request/type.d.ts +0 -41
- package/dist/plugins/app-types/request/utils.d.ts +0 -46
- package/dist/plugins/app-types/routes/config.d.ts +0 -7
- package/dist/plugins/app-types/routes/index.d.ts +0 -28
- package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
- package/dist/plugins/app-types/socket/components/index.d.ts +0 -2
- package/dist/plugins/app-types/socket/constants.d.ts +0 -33
- package/dist/plugins/app-types/socket/events.d.ts +0 -31
- package/dist/plugins/app-types/socket/heartbeat.d.ts +0 -66
- package/dist/plugins/app-types/socket/index.d.ts +0 -61
- package/dist/plugins/app-types/socket/monitor.d.ts +0 -169
- package/dist/plugins/app-types/socket/reconnect.d.ts +0 -61
- package/dist/plugins/app-types/socket/socket.d.ts +0 -129
- package/dist/plugins/app-types/socket/types.d.ts +0 -85
- package/dist/plugins/app-types/storage/index.d.ts +0 -17
- package/dist/plugins/app-types/tasks/index.d.ts +0 -77
- package/dist/plugins/app-types/tasks/type.d.ts +0 -62
- package/dist/plugins/app-types/tasks/useTasks.d.ts +0 -5
- package/dist/plugins/app-types/type.d.ts +0 -2
- package/dist/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
- package/dist/plugins/app-types/variables/config.d.ts +0 -3
- package/dist/plugins/app-types/variables/index.d.ts +0 -6
- package/dist/plugins/app-types/variables/type.d.ts +0 -2
- package/dist/plugins/app-types/website/index.d.ts +0 -6
- package/dist/plugins/app.d.ts +0 -8
- package/dist/plugins/app.js +0 -1
- package/dist/solution/BookingTicket/index.d.ts +0 -172
- package/dist/solution/BookingTicket/index.js +0 -665
- package/dist/solution/BookingTicket/types.d.ts +0 -68
- package/dist/solution/BookingTicket/types.js +0 -43
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -159
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +0 -174
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -81
- package/dist/solution/BookingTicket/utils/scan/index.js +0 -285
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/dist/solution/BookingTicket/utils/scan/scanCache.js +0 -305
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/dist/solution/Checkout/index.d.ts +0 -181
- package/dist/solution/Checkout/index.js +0 -1596
- package/dist/solution/Checkout/types.d.ts +0 -550
- package/dist/solution/Checkout/types.js +0 -132
- package/dist/solution/Checkout/utils/index.d.ts +0 -73
- package/dist/solution/Checkout/utils/index.js +0 -371
- package/dist/utils/task.d.ts +0 -40
- package/dist/utils/task.js +0 -171
- package/dist/utils/watch.d.ts +0 -102
- package/dist/utils/watch.js +0 -294
- package/lib/modules/Customer/constants.d.ts +0 -7
- package/lib/modules/Customer/constants.js +0 -39
- package/lib/modules/Customer/index.d.ts +0 -122
- package/lib/modules/Customer/index.js +0 -440
- package/lib/modules/Customer/types.d.ts +0 -146
- package/lib/modules/Customer/types.js +0 -37
- package/lib/modules/Payment/cash.d.ts +0 -11
- package/lib/modules/Payment/cash.js +0 -51
- package/lib/modules/Payment/eftpos.d.ts +0 -11
- package/lib/modules/Payment/eftpos.js +0 -51
- package/lib/modules/Payment/wallet.d.ts +0 -11
- package/lib/modules/Payment/wallet.js +0 -51
- package/lib/modules/Payment/walletpass.d.ts +0 -0
- package/lib/modules/Payment/walletpass.js +0 -0
- package/lib/plugins/app-types/app/app.d.ts +0 -83
- package/lib/plugins/app-types/app/const.d.ts +0 -4
- package/lib/plugins/app-types/app/index.d.ts +0 -14
- package/lib/plugins/app-types/applicationManager/application.d.ts +0 -50
- package/lib/plugins/app-types/applicationManager/index.d.ts +0 -13
- package/lib/plugins/app-types/config.d.ts +0 -3
- package/lib/plugins/app-types/cookie/index.d.ts +0 -13
- package/lib/plugins/app-types/data/index.d.ts +0 -8
- package/lib/plugins/app-types/history/config.d.ts +0 -24
- package/lib/plugins/app-types/history/index.d.ts +0 -20
- package/lib/plugins/app-types/history/type.d.ts +0 -2
- package/lib/plugins/app-types/hooks/index.d.ts +0 -12
- package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +0 -2
- package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +0 -2
- package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +0 -13
- package/lib/plugins/app-types/hooks/useStore/index.d.ts +0 -6
- package/lib/plugins/app-types/index.d.ts +0 -6
- package/lib/plugins/app-types/indexDB/index.d.ts +0 -178
- package/lib/plugins/app-types/locales/en.d.ts +0 -3
- package/lib/plugins/app-types/locales/index.d.ts +0 -37
- package/lib/plugins/app-types/locales/original.d.ts +0 -3
- package/lib/plugins/app-types/locales/type.d.ts +0 -19
- package/lib/plugins/app-types/locales/zh-CN.d.ts +0 -3
- package/lib/plugins/app-types/locales/zh-HK.d.ts +0 -3
- package/lib/plugins/app-types/logger/feishu.d.ts +0 -11
- package/lib/plugins/app-types/logger/index.d.ts +0 -122
- package/lib/plugins/app-types/menuManager/hooks.d.ts +0 -17
- package/lib/plugins/app-types/menuManager/index.d.ts +0 -28
- package/lib/plugins/app-types/models/global.d.ts +0 -32
- package/lib/plugins/app-types/models/index.d.ts +0 -45
- package/lib/plugins/app-types/models/type.d.ts +0 -2
- package/lib/plugins/app-types/package.json +0 -15
- package/lib/plugins/app-types/plugin/index.d.ts +0 -0
- package/lib/plugins/app-types/pubsub/example.d.ts +0 -5
- package/lib/plugins/app-types/pubsub/index.d.ts +0 -63
- package/lib/plugins/app-types/request/cache.d.ts +0 -46
- package/lib/plugins/app-types/request/cancelToken.d.ts +0 -38
- package/lib/plugins/app-types/request/config.d.ts +0 -3
- package/lib/plugins/app-types/request/constants.d.ts +0 -2
- package/lib/plugins/app-types/request/index.d.ts +0 -24
- package/lib/plugins/app-types/request/pisell2Request.d.ts +0 -6
- package/lib/plugins/app-types/request/type.d.ts +0 -41
- package/lib/plugins/app-types/request/utils.d.ts +0 -46
- package/lib/plugins/app-types/routes/config.d.ts +0 -7
- package/lib/plugins/app-types/routes/index.d.ts +0 -28
- package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +0 -6
- package/lib/plugins/app-types/socket/components/index.d.ts +0 -2
- package/lib/plugins/app-types/socket/constants.d.ts +0 -33
- package/lib/plugins/app-types/socket/events.d.ts +0 -31
- package/lib/plugins/app-types/socket/heartbeat.d.ts +0 -66
- package/lib/plugins/app-types/socket/index.d.ts +0 -61
- package/lib/plugins/app-types/socket/monitor.d.ts +0 -169
- package/lib/plugins/app-types/socket/reconnect.d.ts +0 -61
- package/lib/plugins/app-types/socket/socket.d.ts +0 -129
- package/lib/plugins/app-types/socket/types.d.ts +0 -85
- package/lib/plugins/app-types/storage/index.d.ts +0 -17
- package/lib/plugins/app-types/tasks/index.d.ts +0 -77
- package/lib/plugins/app-types/tasks/type.d.ts +0 -62
- package/lib/plugins/app-types/tasks/useTasks.d.ts +0 -5
- package/lib/plugins/app-types/type.d.ts +0 -2
- package/lib/plugins/app-types/variables/VariablesProvider.d.ts +0 -7
- package/lib/plugins/app-types/variables/config.d.ts +0 -3
- package/lib/plugins/app-types/variables/index.d.ts +0 -6
- package/lib/plugins/app-types/variables/type.d.ts +0 -2
- package/lib/plugins/app-types/website/index.d.ts +0 -6
- package/lib/plugins/app.d.ts +0 -8
- package/lib/plugins/app.js +0 -17
- package/lib/solution/BookingTicket/index.d.ts +0 -172
- package/lib/solution/BookingTicket/index.js +0 -399
- package/lib/solution/BookingTicket/types.d.ts +0 -68
- package/lib/solution/BookingTicket/types.js +0 -72
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -117
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +0 -125
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -81
- package/lib/solution/BookingTicket/utils/scan/index.js +0 -210
- package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +0 -231
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/Checkout/index.d.ts +0 -181
- package/lib/solution/Checkout/index.js +0 -864
- package/lib/solution/Checkout/types.d.ts +0 -550
- package/lib/solution/Checkout/types.js +0 -75
- package/lib/solution/Checkout/utils/index.d.ts +0 -73
- package/lib/solution/Checkout/utils/index.js +0 -266
- package/lib/utils/task.d.ts +0 -40
- package/lib/utils/task.js +0 -109
- package/lib/utils/watch.d.ts +0 -102
- package/lib/utils/watch.js +0 -217
|
@@ -1,399 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
export declare enum PaymentMethodType {
|
|
8
|
-
Cash = "CASHMANUAL",
|
|
9
|
-
Eftpos = "EFTPOS",
|
|
10
|
-
Wallet = "WALLET"
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* 支付状态枚举
|
|
14
|
-
*/
|
|
15
|
-
export declare enum PaymentStatus {
|
|
16
|
-
/** 支付处理中 - 订单正在进行支付操作 */
|
|
17
|
-
Processing = "payment_processing",
|
|
18
|
-
/** 同步中 - 暂时不使用,为了向后兼容保留 */
|
|
19
|
-
Sync = "sync",
|
|
20
|
-
/** 部分支付 - 支付金额不足订单总金额 */
|
|
21
|
-
PartiallyPaid = "partially_paid",
|
|
22
|
-
/** 已完成 - 本地支付完成,后台自动同步到服务器 */
|
|
23
|
-
Finished = "finish"
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* 任务状态枚举
|
|
27
|
-
*/
|
|
28
|
-
export declare enum TaskRunStatus {
|
|
29
|
-
Pending = "pending",
|
|
30
|
-
Running = "running",
|
|
31
|
-
Success = "success",
|
|
32
|
-
Failed = "failed"
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* 支付方式信息
|
|
36
|
-
*/
|
|
37
|
-
export interface PaymentMethod {
|
|
38
|
-
/** 支付方式ID */
|
|
39
|
-
id: number;
|
|
40
|
-
/** 支付方式代码 */
|
|
41
|
-
code: string;
|
|
42
|
-
/** 支付方式名称 */
|
|
43
|
-
name: string;
|
|
44
|
-
/** 支付方式类型 */
|
|
45
|
-
type: string;
|
|
46
|
-
/** 是否启用 */
|
|
47
|
-
enabled: boolean;
|
|
48
|
-
/** 其他配置信息 */
|
|
49
|
-
[key: string]: any;
|
|
1
|
+
export declare enum PaymentHooks {
|
|
2
|
+
OnPaymentInit = "payment:onPaymentInit",
|
|
3
|
+
OnPaymentSuccess = "payment:onPaymentSuccess",
|
|
4
|
+
OnPaymentFailure = "payment:onPaymentFailure",
|
|
5
|
+
OnPaymentRefund = "payment:onPaymentRefund"
|
|
50
6
|
}
|
|
51
7
|
/**
|
|
52
|
-
*
|
|
8
|
+
* 支付方式
|
|
53
9
|
*/
|
|
54
|
-
export
|
|
55
|
-
/** 当前支付项的唯一 ID */
|
|
56
|
-
uuid: string;
|
|
57
|
-
/** 当前支付方式付出去多少钱 */
|
|
58
|
-
amount: string;
|
|
59
|
-
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
|
60
|
-
code: string;
|
|
61
|
-
/** 支付类型id,跟支付列表上对应的支付方式保持一致 */
|
|
62
|
-
id: number;
|
|
63
|
-
/** 支付类型名称,跟支付列表上对应的支付方式保持一致 */
|
|
64
|
-
name: string;
|
|
65
|
-
/** 支付类型type,跟支付列表上对应的支付方式保持一致 */
|
|
66
|
-
type: string;
|
|
67
|
-
/** 代金券、充值卡、积分卡等wallet pass id */
|
|
68
|
-
voucher_id?: string;
|
|
69
|
-
/** 拓展参数字段 */
|
|
70
|
-
metadata?: {
|
|
71
|
-
/** 钱箱 ID */
|
|
72
|
-
shop_wallet_pass_id?: string;
|
|
73
|
-
/** 唯一支付号 */
|
|
74
|
-
unique_payment_number?: string;
|
|
75
|
-
/** rouding规则 */
|
|
76
|
-
rounding_rule?: any;
|
|
77
|
-
};
|
|
78
|
-
/** rouding金额 */
|
|
79
|
-
rounding_amount?: string;
|
|
80
|
-
/** 三方支付手续费 */
|
|
81
|
-
service_charge?: {
|
|
82
|
-
percentage: string;
|
|
83
|
-
amount: string;
|
|
84
|
-
};
|
|
85
|
-
/** 该支付项是否已经同步给后端服务器(只有网络请求成功后才为true) */
|
|
86
|
-
isSynced?: boolean;
|
|
87
|
-
/** 同步错误信息(业务错误时记录错误信息,用于区分"未同步"和"同步失败") */
|
|
88
|
-
syncError?: {
|
|
89
|
-
error: string;
|
|
90
|
-
errorCode?: string;
|
|
91
|
-
statusCode?: number;
|
|
92
|
-
timestamp: number;
|
|
93
|
-
};
|
|
94
|
-
}
|
|
10
|
+
export type PaymentMethod = 'credit_card' | 'debit_card' | 'paypal' | 'alipay' | 'wechat_pay' | 'bank_transfer';
|
|
95
11
|
/**
|
|
96
|
-
*
|
|
12
|
+
* 支付状态
|
|
97
13
|
*/
|
|
98
|
-
export
|
|
99
|
-
/** 订单 id */
|
|
100
|
-
order_id: number;
|
|
101
|
-
/** 订单总金额 */
|
|
102
|
-
total_amount: string;
|
|
103
|
-
/** 是否是定金订单 */
|
|
104
|
-
is_deposit: number;
|
|
105
|
-
/** 定金金额 */
|
|
106
|
-
deposit_amount: string;
|
|
107
|
-
}
|
|
14
|
+
export type PaymentStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'refunded';
|
|
108
15
|
/**
|
|
109
|
-
*
|
|
16
|
+
* 支付信息
|
|
110
17
|
*/
|
|
111
|
-
export interface
|
|
112
|
-
/** 当前订单的唯一 ID */
|
|
113
|
-
uuid: string;
|
|
114
|
-
/** 订单ID(字符串类型,支持本地虚拟ID) */
|
|
18
|
+
export interface Payment {
|
|
115
19
|
id: string;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
expect_amount: string;
|
|
126
|
-
/** 支付状态 */
|
|
127
|
-
payment_status: PaymentStatus;
|
|
128
|
-
/** 是否是定金订单 */
|
|
129
|
-
is_deposit: number;
|
|
130
|
-
/** 定金金额 */
|
|
131
|
-
deposit_amount: string;
|
|
132
|
-
/** 总税费 */
|
|
133
|
-
tax_fee: string;
|
|
134
|
-
/** 原始订单数据(由 Checkout 模块传入) */
|
|
135
|
-
order_info?: any;
|
|
20
|
+
orderId: string;
|
|
21
|
+
amount: number;
|
|
22
|
+
currency: string;
|
|
23
|
+
method: PaymentMethod;
|
|
24
|
+
status: PaymentStatus;
|
|
25
|
+
transactionId?: string;
|
|
26
|
+
createdAt: Date;
|
|
27
|
+
updatedAt: Date;
|
|
28
|
+
metadata?: Record<string, any>;
|
|
136
29
|
}
|
|
137
30
|
/**
|
|
138
|
-
*
|
|
31
|
+
* 支付模块状态
|
|
139
32
|
*/
|
|
140
33
|
export interface PaymentState {
|
|
34
|
+
currentPayment: Payment | null;
|
|
35
|
+
paymentHistory: Payment[];
|
|
141
36
|
}
|
|
142
37
|
/**
|
|
143
|
-
*
|
|
144
|
-
*/
|
|
145
|
-
export interface PushOrderParams {
|
|
146
|
-
/** 订单ID */
|
|
147
|
-
order_id: string;
|
|
148
|
-
/** 总金额 */
|
|
149
|
-
total_amount: string;
|
|
150
|
-
/** 是否是定金订单 */
|
|
151
|
-
is_deposit?: number;
|
|
152
|
-
/** 定金金额 */
|
|
153
|
-
deposit_amount?: string;
|
|
154
|
-
/** 原始订单数据(可选,由 Checkout 模块传入) */
|
|
155
|
-
order_info?: any;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* 更新订单参数
|
|
159
|
-
*/
|
|
160
|
-
export interface UpdateOrderParams {
|
|
161
|
-
/** 订单UUID */
|
|
162
|
-
uuid: string;
|
|
163
|
-
/** 更新的字段 */
|
|
164
|
-
[key: string]: any;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* 支付项输入类型(允许 amount 为数字)
|
|
168
|
-
*/
|
|
169
|
-
export interface PaymentItemInput {
|
|
170
|
-
/** 当前支付方式付出去多少钱 */
|
|
171
|
-
amount: string | number;
|
|
172
|
-
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
|
173
|
-
code: string;
|
|
174
|
-
/** 支付类型id,跟支付列表上对应的支付方式保持一致 */
|
|
175
|
-
id: number;
|
|
176
|
-
/** 支付类型名称,跟支付列表上对应的支付方式保持一致 */
|
|
177
|
-
name: string;
|
|
178
|
-
/** 支付类型type,跟支付列表上对应的支付方式保持一致 */
|
|
179
|
-
type: string;
|
|
180
|
-
/** 代金券、充值卡、积分卡等wallet pass id */
|
|
181
|
-
voucher_id?: string;
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* 推送支付项参数
|
|
185
|
-
*/
|
|
186
|
-
export interface PushPaymentParams {
|
|
187
|
-
/** 订单UUID */
|
|
188
|
-
orderUuid: string;
|
|
189
|
-
/** 支付项信息 */
|
|
190
|
-
paymentItem: PaymentItemInput;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* 更新支付项参数中的字段类型(允许 amount 为数字)
|
|
194
|
-
*/
|
|
195
|
-
export interface PaymentUpdateFields {
|
|
196
|
-
/** 当前支付项的唯一 ID */
|
|
197
|
-
uuid?: string;
|
|
198
|
-
/** 当前支付方式付出去多少钱 */
|
|
199
|
-
amount?: string | number;
|
|
200
|
-
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
|
201
|
-
code?: string;
|
|
202
|
-
/** 支付类型id,跟支付列表上对应的支付方式保持一致 */
|
|
203
|
-
id?: number;
|
|
204
|
-
/** 支付类型名称,跟支付列表上对应的支付方式保持一致 */
|
|
205
|
-
name?: string;
|
|
206
|
-
/** 支付类型type,跟支付列表上对应的支付方式保持一致 */
|
|
207
|
-
type?: string;
|
|
208
|
-
/** 代金券、充值卡、积分卡等wallet pass id */
|
|
209
|
-
voucher_id?: string;
|
|
210
|
-
/** 该支付项是否已经同步给后端服务器(只有网络请求成功后才为true) */
|
|
211
|
-
isSynced?: boolean;
|
|
212
|
-
/** 同步错误信息(业务错误时记录错误信息,用于区分"未同步"和"同步失败") */
|
|
213
|
-
syncError?: {
|
|
214
|
-
error: string;
|
|
215
|
-
errorCode?: string;
|
|
216
|
-
statusCode?: number;
|
|
217
|
-
timestamp: number;
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* 更新支付项参数
|
|
222
|
-
*/
|
|
223
|
-
export interface UpdatePaymentParams {
|
|
224
|
-
/** 订单UUID */
|
|
225
|
-
orderUuid: string;
|
|
226
|
-
/** 支付项UUID */
|
|
227
|
-
paymentUuid: string;
|
|
228
|
-
/** 更新的字段 */
|
|
229
|
-
params: PaymentUpdateFields;
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* 删除支付项参数
|
|
233
|
-
*/
|
|
234
|
-
export interface DeletePaymentParams {
|
|
235
|
-
/** 订单UUID */
|
|
236
|
-
orderUuid: string;
|
|
237
|
-
/** 支付项UUID */
|
|
238
|
-
paymentUuid: string;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* 现金支付接口
|
|
242
|
-
*/
|
|
243
|
-
export interface CashPayment {
|
|
244
|
-
/** 处理现金支付 */
|
|
245
|
-
processCashPayment: (amount: number, orderUuid: string) => Promise<void>;
|
|
246
|
-
/** 获取现金余额 */
|
|
247
|
-
getCashBalance: () => Promise<number>;
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Eftpos支付接口
|
|
251
|
-
*/
|
|
252
|
-
export interface EftposPayment {
|
|
253
|
-
/** 处理Eftpos支付 */
|
|
254
|
-
processEftposPayment: (amount: number, orderUuid: string) => Promise<void>;
|
|
255
|
-
/** 检查Eftpos设备状态 */
|
|
256
|
-
checkDeviceStatus: () => Promise<boolean>;
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* 钱包支付接口
|
|
260
|
-
*/
|
|
261
|
-
export interface WalletPayment {
|
|
262
|
-
/** 处理钱包支付 */
|
|
263
|
-
processWalletPayment: (amount: number, orderUuid: string, voucherId?: string) => Promise<void>;
|
|
264
|
-
/** 获取钱包余额 */
|
|
265
|
-
getWalletBalance: (voucherId: string) => Promise<number>;
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* 支付模块API接口
|
|
38
|
+
* 支付模块 API
|
|
269
39
|
*/
|
|
270
40
|
export interface PaymentModuleAPI {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
/** 获取支付方式列表 */
|
|
278
|
-
getPayMethodListAsync: () => Promise<PaymentMethod[]>;
|
|
279
|
-
/** 创建支付订单(仅保存支付相关信息) */
|
|
280
|
-
createPaymentOrderAsync: (params: PushOrderParams) => Promise<PaymentOrder>;
|
|
281
|
-
/** 根据订单UUID获取支付订单 */
|
|
282
|
-
getPaymentOrderByUuidAsync: (orderUuid: string) => Promise<PaymentOrder | null>;
|
|
283
|
-
/** 基于UUID替换订单ID */
|
|
284
|
-
replaceOrderIdByUuidAsync: (orderUuid: string, newOrderId: string) => Promise<PaymentOrder | null>;
|
|
285
|
-
/** 删除支付订单 */
|
|
286
|
-
deletePaymentOrderAsync: (orderUuid: string) => Promise<void>;
|
|
287
|
-
/** 获取支付项 */
|
|
288
|
-
getPaymentItemsAsync: (orderUuid: string) => Promise<PaymentItem[]>;
|
|
289
|
-
/** 为某个订单添加支付项 */
|
|
290
|
-
addPaymentItemAsync: (orderUuid: string, paymentItem: PaymentItemInput) => Promise<void>;
|
|
291
|
-
/** 删除支付项 */
|
|
292
|
-
deletePaymentItemAsync: (orderUuid: string, paymentUuid: string) => Promise<void>;
|
|
293
|
-
/** 更新支付项 */
|
|
294
|
-
updatePaymentItemAsync: (orderUuid: string, paymentUuid: string, params: PaymentUpdateFields) => Promise<void>;
|
|
295
|
-
/** 获取订单剩余待付金额 */
|
|
296
|
-
getRemainingAmountAsync: (orderUuid: string) => Promise<number>;
|
|
297
|
-
/** 获取订单剩余待付金额(基于用户输入的金额) */
|
|
298
|
-
getRemainingAmountWithInputAsync: (inputAmount: string | number, orderUuid: string) => Promise<number>;
|
|
299
|
-
/** 提交支付 */
|
|
300
|
-
submitPaymentAsync: (orderUuid: string) => Promise<{
|
|
301
|
-
status: 'success' | 'failed';
|
|
302
|
-
}>;
|
|
303
|
-
/** 获取部分支付的订单 */
|
|
304
|
-
getPartiallyPaidOrdersAsync: () => Promise<PaymentOrder[]>;
|
|
305
|
-
/** 获取未同步到服务器的订单 */
|
|
306
|
-
getUnsyncedOrdersAsync: () => Promise<PaymentOrder[]>;
|
|
307
|
-
/** 检测未同步的订单并重新加入任务队列 */
|
|
308
|
-
recheckAndRequeueUnsyncedOrders: () => Promise<number>;
|
|
309
|
-
/** 手动执行支付同步队列 */
|
|
310
|
-
runPaymentSyncQueue: () => Promise<void>;
|
|
311
|
-
/** @deprecated 使用 createPaymentOrderAsync 替代 */
|
|
312
|
-
pushOrderAsync: (params: PushOrderParams) => Promise<PaymentOrder>;
|
|
313
|
-
/** @deprecated 使用 getPaymentItemsAsync 替代 */
|
|
314
|
-
getPaymentAsync: (orderUuid: string) => Promise<PaymentItem[]>;
|
|
315
|
-
/** @deprecated 使用 addPaymentItemAsync 替代 */
|
|
316
|
-
pushPaymentAsync: (orderUuid: string, paymentItem: PaymentItemInput) => Promise<void>;
|
|
317
|
-
/** @deprecated 使用 deletePaymentItemAsync 替代 */
|
|
318
|
-
deletePaymentAsync: (orderUuid: string, paymentUuid: string) => Promise<void>;
|
|
319
|
-
/** @deprecated 使用 updatePaymentItemAsync 替代 */
|
|
320
|
-
updatePaymentAsync: (orderUuid: string, paymentUuid: string, params: PaymentUpdateFields) => Promise<void>;
|
|
321
|
-
/** @deprecated 使用 submitPaymentAsync 替代 */
|
|
322
|
-
submitPayAsync: (orderUuid?: string) => Promise<{
|
|
323
|
-
status: 'success' | 'failed';
|
|
324
|
-
}>;
|
|
325
|
-
/** @deprecated 使用 getRemainingAmountAsync 替代 */
|
|
326
|
-
getRemainingOrderAmountAsync: (orderUuid: string) => Promise<number>;
|
|
327
|
-
/** @deprecated 使用 getRemainingAmountWithInputAsync 替代 */
|
|
328
|
-
getRemainingOrderAmountWithInputAsync: (inputAmount: string | number, orderUuid: string) => Promise<number>;
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* 订单变化事件数据
|
|
332
|
-
*/
|
|
333
|
-
export interface OnOrderChangedEventData {
|
|
334
|
-
/** 操作类型 */
|
|
335
|
-
action: 'add' | 'delete' | 'update' | 'payment_add' | 'payment_delete' | 'payment_update' | 'submit';
|
|
336
|
-
/** 当前订单 */
|
|
337
|
-
order: PaymentOrder;
|
|
338
|
-
/** 原始订单(仅在 update 操作时提供) */
|
|
339
|
-
originalOrder?: PaymentOrder;
|
|
340
|
-
/** 相关的支付项(仅在 payment_* 操作时提供) */
|
|
341
|
-
paymentItem?: PaymentItem;
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* 支付方式变化事件数据
|
|
345
|
-
*/
|
|
346
|
-
export interface OnPaymentMethodsChangedEventData {
|
|
347
|
-
/** 旧的支付方式列表 */
|
|
348
|
-
oldMethods: PaymentMethod[];
|
|
349
|
-
/** 新的支付方式列表 */
|
|
350
|
-
newMethods: PaymentMethod[];
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* 支付同步错误事件数据
|
|
354
|
-
*/
|
|
355
|
-
export interface OnPaymentSyncErrorEventData {
|
|
356
|
-
/** 订单UUID */
|
|
357
|
-
orderUuid: string;
|
|
358
|
-
/** 订单ID */
|
|
359
|
-
orderId: number;
|
|
360
|
-
/** 错误信息 */
|
|
361
|
-
error: string;
|
|
362
|
-
/** 错误代码 */
|
|
363
|
-
errorCode?: string;
|
|
364
|
-
/** HTTP状态码 */
|
|
365
|
-
statusCode?: number;
|
|
366
|
-
/** 错误发生时间 */
|
|
367
|
-
timestamp: number;
|
|
368
|
-
/** 响应数据(当HTTP请求成功但业务失败时) */
|
|
369
|
-
responseData?: any;
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* 支付同步成功事件数据
|
|
373
|
-
*/
|
|
374
|
-
export interface OnPaymentSyncSuccessEventData {
|
|
375
|
-
/** 订单UUID */
|
|
376
|
-
orderUuid: string;
|
|
377
|
-
/** 订单ID */
|
|
378
|
-
orderId: number;
|
|
379
|
-
/** 成功时间 */
|
|
380
|
-
timestamp: number;
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* 支付钩子事件
|
|
384
|
-
*/
|
|
385
|
-
export declare enum PaymentHooks {
|
|
386
|
-
OnPaymentMethodsLoaded = "payment:onPaymentMethodsLoaded",
|
|
387
|
-
OnPaymentMethodsChanged = "payment:onPaymentMethodsChanged",
|
|
388
|
-
OnOrderChanged = "payment:onOrderChanged",
|
|
389
|
-
OnOrderAdded = "payment:onOrderAdded",
|
|
390
|
-
OnOrderUpdated = "payment:onOrderUpdated",
|
|
391
|
-
OnOrderDeleted = "payment:onOrderDeleted",
|
|
392
|
-
OnPaymentAdded = "payment:onPaymentAdded",
|
|
393
|
-
OnPaymentUpdated = "payment:onPaymentUpdated",
|
|
394
|
-
OnPaymentDeleted = "payment:onPaymentDeleted",
|
|
395
|
-
OnPaymentSubmitted = "payment:onPaymentSubmitted",
|
|
396
|
-
OnOrderAmountChanged = "payment:onOrderAmountChanged",
|
|
397
|
-
OnPaymentSyncError = "payment:onPaymentSyncError",
|
|
398
|
-
OnPaymentSyncSuccess = "payment:onPaymentSyncSuccess"
|
|
41
|
+
processPayment: (paymentId: string) => Promise<void>;
|
|
42
|
+
getPayment: (paymentId: string) => Promise<Payment>;
|
|
43
|
+
getPaymentHistory: () => Promise<Payment[]>;
|
|
44
|
+
refund: (paymentId: string) => Promise<void>;
|
|
45
|
+
getAvailablePaymentMethods: () => PaymentMethod[];
|
|
46
|
+
checkPaymentStatus: (paymentId: string) => Promise<PaymentStatus>;
|
|
399
47
|
}
|
|
@@ -19,52 +19,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
// src/modules/Payment/types.ts
|
|
20
20
|
var types_exports = {};
|
|
21
21
|
__export(types_exports, {
|
|
22
|
-
PaymentHooks: () => PaymentHooks
|
|
23
|
-
PaymentMethodType: () => PaymentMethodType,
|
|
24
|
-
PaymentStatus: () => PaymentStatus,
|
|
25
|
-
TaskRunStatus: () => TaskRunStatus
|
|
22
|
+
PaymentHooks: () => PaymentHooks
|
|
26
23
|
});
|
|
27
24
|
module.exports = __toCommonJS(types_exports);
|
|
28
|
-
var PaymentMethodType = /* @__PURE__ */ ((PaymentMethodType2) => {
|
|
29
|
-
PaymentMethodType2["Cash"] = "CASHMANUAL";
|
|
30
|
-
PaymentMethodType2["Eftpos"] = "EFTPOS";
|
|
31
|
-
PaymentMethodType2["Wallet"] = "WALLET";
|
|
32
|
-
return PaymentMethodType2;
|
|
33
|
-
})(PaymentMethodType || {});
|
|
34
|
-
var PaymentStatus = /* @__PURE__ */ ((PaymentStatus2) => {
|
|
35
|
-
PaymentStatus2["Processing"] = "payment_processing";
|
|
36
|
-
PaymentStatus2["Sync"] = "sync";
|
|
37
|
-
PaymentStatus2["PartiallyPaid"] = "partially_paid";
|
|
38
|
-
PaymentStatus2["Finished"] = "finish";
|
|
39
|
-
return PaymentStatus2;
|
|
40
|
-
})(PaymentStatus || {});
|
|
41
|
-
var TaskRunStatus = /* @__PURE__ */ ((TaskRunStatus2) => {
|
|
42
|
-
TaskRunStatus2["Pending"] = "pending";
|
|
43
|
-
TaskRunStatus2["Running"] = "running";
|
|
44
|
-
TaskRunStatus2["Success"] = "success";
|
|
45
|
-
TaskRunStatus2["Failed"] = "failed";
|
|
46
|
-
return TaskRunStatus2;
|
|
47
|
-
})(TaskRunStatus || {});
|
|
48
25
|
var PaymentHooks = /* @__PURE__ */ ((PaymentHooks2) => {
|
|
49
|
-
PaymentHooks2["
|
|
50
|
-
PaymentHooks2["
|
|
51
|
-
PaymentHooks2["
|
|
52
|
-
PaymentHooks2["
|
|
53
|
-
PaymentHooks2["OnOrderUpdated"] = "payment:onOrderUpdated";
|
|
54
|
-
PaymentHooks2["OnOrderDeleted"] = "payment:onOrderDeleted";
|
|
55
|
-
PaymentHooks2["OnPaymentAdded"] = "payment:onPaymentAdded";
|
|
56
|
-
PaymentHooks2["OnPaymentUpdated"] = "payment:onPaymentUpdated";
|
|
57
|
-
PaymentHooks2["OnPaymentDeleted"] = "payment:onPaymentDeleted";
|
|
58
|
-
PaymentHooks2["OnPaymentSubmitted"] = "payment:onPaymentSubmitted";
|
|
59
|
-
PaymentHooks2["OnOrderAmountChanged"] = "payment:onOrderAmountChanged";
|
|
60
|
-
PaymentHooks2["OnPaymentSyncError"] = "payment:onPaymentSyncError";
|
|
61
|
-
PaymentHooks2["OnPaymentSyncSuccess"] = "payment:onPaymentSyncSuccess";
|
|
26
|
+
PaymentHooks2["OnPaymentInit"] = "payment:onPaymentInit";
|
|
27
|
+
PaymentHooks2["OnPaymentSuccess"] = "payment:onPaymentSuccess";
|
|
28
|
+
PaymentHooks2["OnPaymentFailure"] = "payment:onPaymentFailure";
|
|
29
|
+
PaymentHooks2["OnPaymentRefund"] = "payment:onPaymentRefund";
|
|
62
30
|
return PaymentHooks2;
|
|
63
31
|
})(PaymentHooks || {});
|
|
64
32
|
// Annotate the CommonJS export names for ESM import in node:
|
|
65
33
|
0 && (module.exports = {
|
|
66
|
-
PaymentHooks
|
|
67
|
-
PaymentMethodType,
|
|
68
|
-
PaymentStatus,
|
|
69
|
-
TaskRunStatus
|
|
34
|
+
PaymentHooks
|
|
70
35
|
});
|
|
@@ -11,17 +11,12 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
11
11
|
constructor(name?: string, version?: string);
|
|
12
12
|
initialize(core: PisellCore, options: any): Promise<void>;
|
|
13
13
|
storeChange(path?: string, value?: any): Promise<void>;
|
|
14
|
-
loadProducts({ category_ids, product_ids, collection,
|
|
14
|
+
loadProducts({ category_ids, product_ids, collection, schedule_date, cacheId }: {
|
|
15
15
|
category_ids?: number[];
|
|
16
16
|
product_ids?: number[];
|
|
17
17
|
collection?: number | string[];
|
|
18
18
|
schedule_date?: string;
|
|
19
19
|
cacheId?: string;
|
|
20
|
-
customer_id?: number;
|
|
21
|
-
menu_list_ids?: number[];
|
|
22
|
-
schedule_datetime?: string;
|
|
23
|
-
with_count?: string[];
|
|
24
|
-
with_schedule?: number;
|
|
25
20
|
}): Promise<any>;
|
|
26
21
|
loadProductsPrice({ ids, customer_id, schedule_date, channel, }: {
|
|
27
22
|
ids?: number[];
|
|
@@ -33,10 +28,4 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
33
28
|
getProduct(id: number): Promise<ProductData | undefined>;
|
|
34
29
|
addProduct(products: ProductData[]): Promise<void>;
|
|
35
30
|
selectProducts(products: ProductData[]): Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* 根据商品编码或条码搜索商品
|
|
38
|
-
* @param code 商品编码或条码
|
|
39
|
-
* @returns 匹配的商品列表,如果没有匹配则返回空数组
|
|
40
|
-
*/
|
|
41
|
-
findProductsByCodeOrBarcode(code: string): ProductData[];
|
|
42
31
|
}
|
|
@@ -54,19 +54,14 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
54
54
|
category_ids = [],
|
|
55
55
|
product_ids = [],
|
|
56
56
|
collection = [],
|
|
57
|
-
menu_list_ids = [],
|
|
58
|
-
customer_id: paramsCustomerId,
|
|
59
|
-
with_count = [],
|
|
60
|
-
schedule_datetime,
|
|
61
57
|
schedule_date,
|
|
62
|
-
cacheId
|
|
63
|
-
with_schedule
|
|
58
|
+
cacheId
|
|
64
59
|
}) {
|
|
65
60
|
var _a, _b;
|
|
66
61
|
let userPlugin = this.core.getPlugin("user");
|
|
67
62
|
let customer_id = void 0;
|
|
68
63
|
try {
|
|
69
|
-
customer_id =
|
|
64
|
+
customer_id = (_a = userPlugin == null ? void 0 : userPlugin.get()) == null ? void 0 : _a.id;
|
|
70
65
|
} catch (error) {
|
|
71
66
|
console.error(error);
|
|
72
67
|
}
|
|
@@ -92,12 +87,8 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
92
87
|
ids: product_ids,
|
|
93
88
|
collection,
|
|
94
89
|
front_end_cache_id: cacheId,
|
|
95
|
-
menu_list_ids,
|
|
96
|
-
with_count,
|
|
97
90
|
// client_schedule_ids: schedule_ids,
|
|
98
91
|
schedule_date,
|
|
99
|
-
with_schedule,
|
|
100
|
-
schedule_datetime,
|
|
101
92
|
application_code: (_b = this.otherParams) == null ? void 0 : _b.channel
|
|
102
93
|
},
|
|
103
94
|
{ useCache: true }
|
|
@@ -157,24 +148,6 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
157
148
|
async selectProducts(products) {
|
|
158
149
|
this.store.selectProducts = products;
|
|
159
150
|
}
|
|
160
|
-
/**
|
|
161
|
-
* 根据商品编码或条码搜索商品
|
|
162
|
-
* @param code 商品编码或条码
|
|
163
|
-
* @returns 匹配的商品列表,如果没有匹配则返回空数组
|
|
164
|
-
*/
|
|
165
|
-
findProductsByCodeOrBarcode(code) {
|
|
166
|
-
if (!code || typeof code !== "string") {
|
|
167
|
-
return [];
|
|
168
|
-
}
|
|
169
|
-
const trimmedCode = code.trim();
|
|
170
|
-
if (!trimmedCode) {
|
|
171
|
-
return [];
|
|
172
|
-
}
|
|
173
|
-
const matchingProducts = this.store.list.filter((product) => {
|
|
174
|
-
return product.code && product.code.trim() === trimmedCode || product.barcode && product.barcode.trim() === trimmedCode;
|
|
175
|
-
});
|
|
176
|
-
return (0, import_lodash_es.cloneDeep)(matchingProducts);
|
|
177
|
-
}
|
|
178
151
|
};
|
|
179
152
|
// Annotate the CommonJS export names for ESM import in node:
|
|
180
153
|
0 && (module.exports = {
|
|
@@ -37,7 +37,6 @@ var import_types = require("./types");
|
|
|
37
37
|
var import_utils = require("../../solution/ShopDiscount/utils");
|
|
38
38
|
var import_utils2 = require("../Cart/utils");
|
|
39
39
|
var import_decimal = __toESM(require("decimal.js"));
|
|
40
|
-
var import_lodash_es = require("lodash-es");
|
|
41
40
|
var RulesModule = class extends import_BaseModule.BaseModule {
|
|
42
41
|
constructor(name, version) {
|
|
43
42
|
super(name, version);
|
|
@@ -189,23 +188,19 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
189
188
|
if (isAvailableProduct && isLimitedProduct) {
|
|
190
189
|
(_c = discountApplicability.get(discount.id)) == null ? void 0 : _c.push(product.id);
|
|
191
190
|
const applicableProducts = discountApplicableProducts.get(discount.id) || [];
|
|
192
|
-
|
|
193
|
-
const productData = {
|
|
191
|
+
applicableProducts.push({
|
|
194
192
|
amount: product.price,
|
|
195
|
-
type:
|
|
196
|
-
tag:
|
|
193
|
+
type: discount.tag || discount.type,
|
|
194
|
+
tag: discount.tag || discount.type,
|
|
197
195
|
discount: {
|
|
198
196
|
resource_id: discount.id,
|
|
199
197
|
title: discount.format_title,
|
|
200
198
|
original_amount: product.origin_total,
|
|
201
199
|
pre_value: discount.par_value,
|
|
202
200
|
product_id: originProduct.id
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
productData.num = product.num || 1;
|
|
207
|
-
}
|
|
208
|
-
applicableProducts.push(productData);
|
|
201
|
+
},
|
|
202
|
+
num: product.num || 1
|
|
203
|
+
});
|
|
209
204
|
discountApplicableProducts.set(discount.id, applicableProducts);
|
|
210
205
|
}
|
|
211
206
|
});
|
|
@@ -220,9 +215,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
220
215
|
}
|
|
221
216
|
const applicableDiscounts = sortedDiscountList.filter((discount) => {
|
|
222
217
|
var _a2;
|
|
223
|
-
if ((Number(product.price)
|
|
218
|
+
if ((Number(product.price) === 0 || !product.price) && (discount.tag || discount.type) === "good_pass")
|
|
224
219
|
return false;
|
|
225
|
-
if ((Number(product.total)
|
|
220
|
+
if ((Number(product.total) === 0 || !product.total) && !((_a2 = product.discount_list) == null ? void 0 : _a2.find((n) => {
|
|
226
221
|
var _a3;
|
|
227
222
|
return ((_a3 = n.discount) == null ? void 0 : _a3.resource_id) === discount.id;
|
|
228
223
|
})) && (discount.tag || discount.type) !== "good_pass")
|
|
@@ -247,7 +242,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
247
242
|
}))) {
|
|
248
243
|
isManualDiscount = false;
|
|
249
244
|
}
|
|
250
|
-
if (applicableDiscounts.length === 0 || isManualDiscount
|
|
245
|
+
if (applicableDiscounts.length === 0 || isManualDiscount) {
|
|
251
246
|
if (product.isClient) {
|
|
252
247
|
processedProductsMap.set(
|
|
253
248
|
product._id,
|
|
@@ -314,21 +309,18 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
314
309
|
productOriginTotal = product.total;
|
|
315
310
|
}
|
|
316
311
|
const targetProductTotal = selectedDiscount2.tag === "good_pass" ? new import_decimal.default(productOriginTotal).minus(new import_decimal.default(product.price || 0)).toNumber() : new import_decimal.default(100).minus(selectedDiscount2.par_value || 0).div(100).mul(new import_decimal.default(productOriginTotal)).toNumber();
|
|
317
|
-
const discountType = selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag;
|
|
318
312
|
const discountDetail = {
|
|
319
313
|
amount: new import_decimal.default(productOriginTotal).minus(new import_decimal.default(targetProductTotal)).toNumber(),
|
|
320
|
-
type:
|
|
314
|
+
type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag,
|
|
321
315
|
discount: {
|
|
322
316
|
resource_id: selectedDiscount2.id,
|
|
323
317
|
title: selectedDiscount2.format_title,
|
|
324
318
|
original_amount: productOriginTotal,
|
|
325
319
|
product_id: originProduct.id,
|
|
326
320
|
percent: selectedDiscount2.par_value
|
|
327
|
-
}
|
|
321
|
+
},
|
|
322
|
+
num: product.num || 1
|
|
328
323
|
};
|
|
329
|
-
if ((selectedDiscount2.tag || selectedDiscount2.type) !== "good_pass") {
|
|
330
|
-
discountDetail.num = product.num || 1;
|
|
331
|
-
}
|
|
332
324
|
appliedProducts.push(discountDetail);
|
|
333
325
|
appliedDiscountProducts.set(selectedDiscount2.id, appliedProducts);
|
|
334
326
|
if (product.isClient) {
|