@pisell/pisellos 0.0.229 → 0.0.231
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/modules/Order/index.d.ts +13 -2
- package/dist/modules/Order/index.js +84 -1
- package/dist/modules/Order/types.d.ts +43 -0
- package/dist/modules/Order/types.js +8 -0
- package/dist/modules/Payment/cash.d.ts +8 -0
- package/dist/modules/Payment/cash.js +20 -1
- package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +22 -0
- package/dist/modules/Payment/cashRecommendationAlgorithm.js +423 -0
- package/dist/modules/Payment/eftpos.js +1 -1
- package/dist/modules/Payment/index.d.ts +57 -94
- package/dist/modules/Payment/index.js +810 -1109
- package/dist/modules/Payment/mx51.d.ts +0 -0
- package/dist/modules/Payment/mx51.js +0 -0
- package/dist/modules/Payment/types.d.ts +358 -50
- package/dist/modules/Payment/types.js +103 -4
- package/dist/modules/Payment/utils.d.ts +17 -0
- package/dist/modules/Payment/utils.js +62 -0
- package/dist/modules/Payment/walletpass.d.ts +96 -0
- package/dist/modules/Payment/walletpass.js +492 -0
- package/dist/modules/Schedule/index.d.ts +9 -0
- package/dist/modules/Schedule/index.js +60 -0
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Checkout/appointmentDemo.json +1 -0
- package/dist/solution/Checkout/index.d.ts +415 -0
- package/dist/solution/Checkout/index.js +3622 -0
- package/dist/solution/Checkout/types.d.ts +737 -0
- package/dist/solution/Checkout/types.js +137 -0
- package/dist/solution/Checkout/utils/index.d.ts +73 -0
- package/dist/{modules/Payment/wallet.js → solution/Checkout/utils/index.js} +363 -70
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/lib/modules/Order/index.d.ts +13 -2
- package/lib/modules/Order/index.js +58 -1
- package/lib/modules/Order/types.d.ts +43 -0
- package/lib/modules/Payment/cash.d.ts +8 -0
- package/lib/modules/Payment/cash.js +14 -1
- package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +22 -0
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +342 -0
- package/lib/modules/Payment/eftpos.js +1 -1
- package/lib/modules/Payment/index.d.ts +57 -94
- package/lib/modules/Payment/index.js +363 -525
- package/lib/modules/Payment/mx51.d.ts +0 -0
- package/lib/modules/Payment/mx51.js +0 -0
- package/lib/modules/Payment/types.d.ts +358 -50
- package/lib/modules/Payment/types.js +37 -2
- package/lib/modules/Payment/utils.d.ts +17 -0
- package/lib/modules/Payment/utils.js +67 -0
- package/lib/modules/Payment/walletpass.d.ts +96 -0
- package/lib/modules/Payment/walletpass.js +304 -0
- package/lib/modules/Schedule/index.d.ts +9 -0
- package/lib/modules/Schedule/index.js +36 -0
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Checkout/appointmentDemo.json +1 -0
- package/lib/solution/Checkout/index.d.ts +415 -0
- package/lib/solution/Checkout/index.js +2107 -0
- package/lib/solution/Checkout/types.d.ts +737 -0
- package/lib/solution/Checkout/types.js +80 -0
- package/lib/solution/Checkout/utils/index.d.ts +73 -0
- package/lib/solution/Checkout/utils/index.js +266 -0
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/package.json +1 -1
- package/dist/modules/Payment/wallet.d.ts +0 -11
- package/lib/modules/Payment/wallet.d.ts +0 -11
- package/lib/modules/Payment/wallet.js +0 -51
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { WalletPassPayment, WalletDeductionRecommendParams, WalletRecommendItem, UserIdentificationCodeParams, UserIdentificationCodeItem, SearchIdentificationCodeParams, SearchIdentificationCodeItem, WalletInitBusinessData } from './types';
|
|
2
|
+
import type { PaymentModule } from './index';
|
|
3
|
+
/**
|
|
4
|
+
* 钱包支付实现
|
|
5
|
+
*/
|
|
6
|
+
export declare class WalletPassPaymentImpl implements WalletPassPayment {
|
|
7
|
+
private paymentModule;
|
|
8
|
+
private walletRecommendList;
|
|
9
|
+
private userIdentificationCodes;
|
|
10
|
+
private searchResults;
|
|
11
|
+
private walletParams;
|
|
12
|
+
constructor(paymentModule: PaymentModule);
|
|
13
|
+
/**
|
|
14
|
+
* 发送事件的辅助方法
|
|
15
|
+
* 支持使用WalletPassHooks或PaymentHooks
|
|
16
|
+
*/
|
|
17
|
+
private emitEvent;
|
|
18
|
+
/**
|
|
19
|
+
* 生成钱包API默认参数
|
|
20
|
+
* 根据业务数据生成标准的钱包API参数,并存储在模块中
|
|
21
|
+
*/
|
|
22
|
+
generateWalletParams(businessData: WalletInitBusinessData): WalletDeductionRecommendParams;
|
|
23
|
+
/**
|
|
24
|
+
* 获取已存储的钱包参数
|
|
25
|
+
* 返回之前生成并存储的钱包参数
|
|
26
|
+
*/
|
|
27
|
+
getStoredWalletParams(): WalletDeductionRecommendParams | null;
|
|
28
|
+
/**
|
|
29
|
+
* 清理已存储的钱包参数
|
|
30
|
+
* 清除之前存储的钱包参数
|
|
31
|
+
*/
|
|
32
|
+
clearStoredWalletParams(): void;
|
|
33
|
+
/**
|
|
34
|
+
* 从业务数据初始化钱包数据
|
|
35
|
+
* 内部生成参数,然后调用标准的初始化流程
|
|
36
|
+
*/
|
|
37
|
+
initializeWalletDataFromBusinessAsync(businessData: WalletInitBusinessData): Promise<{
|
|
38
|
+
walletRecommendList: WalletRecommendItem[];
|
|
39
|
+
userIdentificationCodes: UserIdentificationCodeItem[];
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* 初始化钱包数据
|
|
43
|
+
* 先获取推荐列表,再获取用户识别码列表(顺序执行)
|
|
44
|
+
*/
|
|
45
|
+
initializeWalletDataAsync(baseParams: WalletDeductionRecommendParams): Promise<{
|
|
46
|
+
walletRecommendList: WalletRecommendItem[];
|
|
47
|
+
userIdentificationCodes: UserIdentificationCodeItem[];
|
|
48
|
+
}>;
|
|
49
|
+
getWalletPassRecommendListAsync(params: WalletDeductionRecommendParams): Promise<WalletRecommendItem[]>;
|
|
50
|
+
formatWalletPassList2PreparePayments(list: WalletRecommendItem[]): {
|
|
51
|
+
voucher_id: number;
|
|
52
|
+
amount: number;
|
|
53
|
+
tag: string;
|
|
54
|
+
}[];
|
|
55
|
+
getUserIdentificationCodeListAsync(params: UserIdentificationCodeParams): Promise<UserIdentificationCodeItem[]>;
|
|
56
|
+
/**
|
|
57
|
+
* 搜索识别码信息
|
|
58
|
+
* 通过识别码搜索相关的钱包通行证信息
|
|
59
|
+
* 基于 WalletDeductionRecommendParams 参数结构
|
|
60
|
+
*/
|
|
61
|
+
searchIdentificationCodeAsync(params: SearchIdentificationCodeParams): Promise<SearchIdentificationCodeItem[]>;
|
|
62
|
+
processWalletPayment(amount: number, orderUuid: string, voucherId?: string): Promise<void>;
|
|
63
|
+
getWalletBalance(voucherId: string): Promise<number>;
|
|
64
|
+
/**
|
|
65
|
+
* 获取缓存的钱包推荐列表
|
|
66
|
+
*/
|
|
67
|
+
getWalletRecommendList(): WalletRecommendItem[];
|
|
68
|
+
/**
|
|
69
|
+
* 获取缓存的用户识别码列表
|
|
70
|
+
*/
|
|
71
|
+
getUserIdentificationCodes(): UserIdentificationCodeItem[];
|
|
72
|
+
/**
|
|
73
|
+
* 清除钱包推荐列表
|
|
74
|
+
*/
|
|
75
|
+
clearWalletRecommendList(): void;
|
|
76
|
+
/**
|
|
77
|
+
* 清除用户识别码列表
|
|
78
|
+
*/
|
|
79
|
+
clearUserIdentificationCodes(): void;
|
|
80
|
+
/**
|
|
81
|
+
* 获取缓存的搜索结果列表
|
|
82
|
+
*/
|
|
83
|
+
getSearchResults(): SearchIdentificationCodeItem[];
|
|
84
|
+
/**
|
|
85
|
+
* 根据识别码查找搜索结果
|
|
86
|
+
*/
|
|
87
|
+
findSearchResultByCode(code: string): SearchIdentificationCodeItem | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* 清除搜索结果缓存
|
|
90
|
+
*/
|
|
91
|
+
clearSearchResults(): void;
|
|
92
|
+
/**
|
|
93
|
+
* 清除所有缓存数据
|
|
94
|
+
*/
|
|
95
|
+
clearAllCache(): void;
|
|
96
|
+
}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/modules/Payment/walletpass.ts
|
|
20
|
+
var walletpass_exports = {};
|
|
21
|
+
__export(walletpass_exports, {
|
|
22
|
+
WalletPassPaymentImpl: () => WalletPassPaymentImpl
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(walletpass_exports);
|
|
25
|
+
var import_types = require("./types");
|
|
26
|
+
var import_utils = require("./utils");
|
|
27
|
+
var WalletPassPaymentImpl = class {
|
|
28
|
+
constructor(paymentModule) {
|
|
29
|
+
this.paymentModule = paymentModule;
|
|
30
|
+
this.walletRecommendList = [];
|
|
31
|
+
this.userIdentificationCodes = [];
|
|
32
|
+
this.searchResults = [];
|
|
33
|
+
this.walletParams = null;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 发送事件的辅助方法
|
|
37
|
+
* 支持使用WalletPassHooks或PaymentHooks
|
|
38
|
+
*/
|
|
39
|
+
emitEvent(hook, data) {
|
|
40
|
+
try {
|
|
41
|
+
this.paymentModule.core.effects.emit(hook, data);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error("[WalletPass] 发送事件失败:", hook, error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* 生成钱包API默认参数
|
|
48
|
+
* 根据业务数据生成标准的钱包API参数,并存储在模块中
|
|
49
|
+
*/
|
|
50
|
+
generateWalletParams(businessData) {
|
|
51
|
+
const { customer_id, amountInfo, products } = businessData;
|
|
52
|
+
const totalAmount = Number(amountInfo.subTotal) || Number(amountInfo.totalAmount);
|
|
53
|
+
const walletParams = {
|
|
54
|
+
sale_channel: "kiosk",
|
|
55
|
+
customer_id: 9752,
|
|
56
|
+
order_expect_amount: totalAmount,
|
|
57
|
+
order_product_amount: totalAmount,
|
|
58
|
+
order_wait_pay_amount: totalAmount,
|
|
59
|
+
order_behavior_count_customer_id: 1,
|
|
60
|
+
products,
|
|
61
|
+
prepare_payments: []
|
|
62
|
+
};
|
|
63
|
+
this.walletParams = walletParams;
|
|
64
|
+
console.log("[WalletPass] 钱包默认参数已生成并存储:", walletParams);
|
|
65
|
+
return walletParams;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 获取已存储的钱包参数
|
|
69
|
+
* 返回之前生成并存储的钱包参数
|
|
70
|
+
*/
|
|
71
|
+
getStoredWalletParams() {
|
|
72
|
+
return this.walletParams;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 清理已存储的钱包参数
|
|
76
|
+
* 清除之前存储的钱包参数
|
|
77
|
+
*/
|
|
78
|
+
clearStoredWalletParams() {
|
|
79
|
+
this.walletParams = null;
|
|
80
|
+
console.log("[WalletPass] 已存储的钱包参数已清理");
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 从业务数据初始化钱包数据
|
|
84
|
+
* 内部生成参数,然后调用标准的初始化流程
|
|
85
|
+
*/
|
|
86
|
+
async initializeWalletDataFromBusinessAsync(businessData) {
|
|
87
|
+
try {
|
|
88
|
+
const walletParams = this.generateWalletParams(businessData);
|
|
89
|
+
return await this.initializeWalletDataAsync(walletParams);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
console.error("[WalletPass] 从业务数据初始化钱包数据失败:", error);
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* 初始化钱包数据
|
|
97
|
+
* 先获取推荐列表,再获取用户识别码列表(顺序执行)
|
|
98
|
+
*/
|
|
99
|
+
async initializeWalletDataAsync(baseParams) {
|
|
100
|
+
try {
|
|
101
|
+
const walletRecommendList = await this.getWalletPassRecommendListAsync(baseParams);
|
|
102
|
+
const identificationParams = {
|
|
103
|
+
...baseParams,
|
|
104
|
+
available: 2,
|
|
105
|
+
prepare_payments: this.formatWalletPassList2PreparePayments(walletRecommendList),
|
|
106
|
+
other_exact_codes: [],
|
|
107
|
+
filter_prepare_wallet_pass: 1
|
|
108
|
+
};
|
|
109
|
+
const userIdentificationCodes = await this.getUserIdentificationCodeListAsync(identificationParams);
|
|
110
|
+
return {
|
|
111
|
+
walletRecommendList,
|
|
112
|
+
userIdentificationCodes
|
|
113
|
+
};
|
|
114
|
+
} catch (error) {
|
|
115
|
+
console.error("[WalletPass] 初始化钱包数据失败:", error);
|
|
116
|
+
throw error;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
async getWalletPassRecommendListAsync(params) {
|
|
120
|
+
try {
|
|
121
|
+
const response = await this.paymentModule.request.post(
|
|
122
|
+
"/machinecode/prepare/deduction/recommend",
|
|
123
|
+
params
|
|
124
|
+
// 将 params 作为请求体数据
|
|
125
|
+
);
|
|
126
|
+
this.walletRecommendList = (response == null ? void 0 : response.data) || [];
|
|
127
|
+
this.emitEvent(import_types.WalletPassHooks.OnWalletRecommendListUpdated, {
|
|
128
|
+
walletRecommendList: this.walletRecommendList
|
|
129
|
+
});
|
|
130
|
+
console.log(
|
|
131
|
+
"[WalletPass] 钱包推荐列表已更新:",
|
|
132
|
+
this.walletRecommendList.length,
|
|
133
|
+
"项"
|
|
134
|
+
);
|
|
135
|
+
return this.walletRecommendList;
|
|
136
|
+
} catch (error) {
|
|
137
|
+
console.error("获取钱包推荐列表失败:", error);
|
|
138
|
+
throw error;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
formatWalletPassList2PreparePayments(list) {
|
|
142
|
+
return (0, import_utils.formatWalletPassList2PreparePayments)(list);
|
|
143
|
+
}
|
|
144
|
+
async getUserIdentificationCodeListAsync(params) {
|
|
145
|
+
try {
|
|
146
|
+
const newParams = {
|
|
147
|
+
...this.walletParams,
|
|
148
|
+
...params
|
|
149
|
+
};
|
|
150
|
+
const response = await this.paymentModule.request.post(
|
|
151
|
+
"/machinecode/prepare/deduction",
|
|
152
|
+
newParams
|
|
153
|
+
);
|
|
154
|
+
const sortedData = (0, import_utils.sortUserIdentificationCodeList)((response == null ? void 0 : response.data) || []);
|
|
155
|
+
this.userIdentificationCodes = sortedData;
|
|
156
|
+
this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesUpdated, {
|
|
157
|
+
userIdentificationCodes: this.userIdentificationCodes
|
|
158
|
+
});
|
|
159
|
+
console.log(
|
|
160
|
+
"[WalletPass] 用户识别码列表已更新:",
|
|
161
|
+
this.userIdentificationCodes.length,
|
|
162
|
+
"项"
|
|
163
|
+
);
|
|
164
|
+
return this.userIdentificationCodes;
|
|
165
|
+
} catch (error) {
|
|
166
|
+
console.error("获取用户识别码列表失败:", error);
|
|
167
|
+
throw error;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* 搜索识别码信息
|
|
172
|
+
* 通过识别码搜索相关的钱包通行证信息
|
|
173
|
+
* 基于 WalletDeductionRecommendParams 参数结构
|
|
174
|
+
*/
|
|
175
|
+
async searchIdentificationCodeAsync(params) {
|
|
176
|
+
try {
|
|
177
|
+
const baseWalletParams = this.walletParams;
|
|
178
|
+
const searchParams = {
|
|
179
|
+
// 基础钱包参数
|
|
180
|
+
sale_channel: params.sale_channel || (baseWalletParams == null ? void 0 : baseWalletParams.sale_channel),
|
|
181
|
+
customer_id: params.customer_id || (baseWalletParams == null ? void 0 : baseWalletParams.customer_id),
|
|
182
|
+
order_expect_amount: params.order_expect_amount || (baseWalletParams == null ? void 0 : baseWalletParams.order_expect_amount),
|
|
183
|
+
order_product_amount: params.order_product_amount || (baseWalletParams == null ? void 0 : baseWalletParams.order_product_amount),
|
|
184
|
+
order_wait_pay_amount: params.order_wait_pay_amount || (baseWalletParams == null ? void 0 : baseWalletParams.order_wait_pay_amount),
|
|
185
|
+
order_behavior_count_customer_id: params.order_behavior_count_customer_id || (baseWalletParams == null ? void 0 : baseWalletParams.order_behavior_count_customer_id),
|
|
186
|
+
products: params.products || (baseWalletParams == null ? void 0 : baseWalletParams.products),
|
|
187
|
+
prepare_payments: params.prepare_payments || (baseWalletParams == null ? void 0 : baseWalletParams.prepare_payments),
|
|
188
|
+
multiple: 1,
|
|
189
|
+
// 搜索特有参数
|
|
190
|
+
code: params.code
|
|
191
|
+
};
|
|
192
|
+
const response = await this.paymentModule.request.post(
|
|
193
|
+
"/machinecode/prepare/deduction/search",
|
|
194
|
+
searchParams
|
|
195
|
+
);
|
|
196
|
+
const searchResults = (response == null ? void 0 : response.data) || [];
|
|
197
|
+
if (searchResults.length > 0) {
|
|
198
|
+
const existingCodes = new Set(
|
|
199
|
+
this.searchResults.map((item) => item.code)
|
|
200
|
+
);
|
|
201
|
+
const newResults = searchResults.filter(
|
|
202
|
+
(item) => !existingCodes.has(item.code)
|
|
203
|
+
);
|
|
204
|
+
this.searchResults.push(...newResults);
|
|
205
|
+
}
|
|
206
|
+
this.emitEvent(import_types.WalletPassHooks.OnSearchIdentificationCodeCompleted, {
|
|
207
|
+
searchCode: params.code,
|
|
208
|
+
currentSearchResults: searchResults,
|
|
209
|
+
cachedSearchResults: [...this.searchResults],
|
|
210
|
+
searchParams: params
|
|
211
|
+
});
|
|
212
|
+
return searchResults;
|
|
213
|
+
} catch (error) {
|
|
214
|
+
console.error("[WalletPass] 搜索识别码信息失败:", error);
|
|
215
|
+
throw error;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
async processWalletPayment(amount, orderUuid, voucherId) {
|
|
219
|
+
const walletMethod = await this.paymentModule.getWalletPaymentMethod();
|
|
220
|
+
if (!walletMethod) {
|
|
221
|
+
throw new Error("钱包支付方式未找到");
|
|
222
|
+
}
|
|
223
|
+
const paymentItem = {
|
|
224
|
+
amount: amount.toString(),
|
|
225
|
+
code: walletMethod.code,
|
|
226
|
+
id: walletMethod.id,
|
|
227
|
+
name: walletMethod.name,
|
|
228
|
+
type: walletMethod.type,
|
|
229
|
+
voucher_id: voucherId || ""
|
|
230
|
+
};
|
|
231
|
+
await this.paymentModule.addPaymentItemAsync(orderUuid, paymentItem);
|
|
232
|
+
}
|
|
233
|
+
async getWalletBalance(voucherId) {
|
|
234
|
+
return 0;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* 获取缓存的钱包推荐列表
|
|
238
|
+
*/
|
|
239
|
+
getWalletRecommendList() {
|
|
240
|
+
return this.walletRecommendList;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* 获取缓存的用户识别码列表
|
|
244
|
+
*/
|
|
245
|
+
getUserIdentificationCodes() {
|
|
246
|
+
return this.userIdentificationCodes;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* 清除钱包推荐列表
|
|
250
|
+
*/
|
|
251
|
+
clearWalletRecommendList() {
|
|
252
|
+
this.walletRecommendList = [];
|
|
253
|
+
this.emitEvent(import_types.WalletPassHooks.OnWalletRecommendListCleared, {
|
|
254
|
+
clearedTypes: ["walletRecommendList"]
|
|
255
|
+
});
|
|
256
|
+
console.log("[WalletPass] 钱包推荐列表已清除");
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* 清除用户识别码列表
|
|
260
|
+
*/
|
|
261
|
+
clearUserIdentificationCodes() {
|
|
262
|
+
this.userIdentificationCodes = [];
|
|
263
|
+
this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesCleared, {
|
|
264
|
+
clearedTypes: ["userIdentificationCodes"]
|
|
265
|
+
});
|
|
266
|
+
console.log("[WalletPass] 用户识别码列表已清除");
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* 获取缓存的搜索结果列表
|
|
270
|
+
*/
|
|
271
|
+
getSearchResults() {
|
|
272
|
+
return this.searchResults;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* 根据识别码查找搜索结果
|
|
276
|
+
*/
|
|
277
|
+
findSearchResultByCode(code) {
|
|
278
|
+
return this.searchResults.find((item) => item.code === code);
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* 清除搜索结果缓存
|
|
282
|
+
*/
|
|
283
|
+
clearSearchResults() {
|
|
284
|
+
this.searchResults = [];
|
|
285
|
+
console.log("[WalletPass] 搜索结果缓存已清除");
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* 清除所有缓存数据
|
|
289
|
+
*/
|
|
290
|
+
clearAllCache() {
|
|
291
|
+
this.walletRecommendList = [];
|
|
292
|
+
this.userIdentificationCodes = [];
|
|
293
|
+
this.searchResults = [];
|
|
294
|
+
this.walletParams = null;
|
|
295
|
+
this.emitEvent(import_types.WalletPassHooks.OnWalletCacheCleared, {
|
|
296
|
+
clearedTypes: ["all"]
|
|
297
|
+
});
|
|
298
|
+
console.log("[WalletPass] 所有缓存数据已清除(包括钱包参数和搜索结果)");
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
302
|
+
0 && (module.exports = {
|
|
303
|
+
WalletPassPaymentImpl
|
|
304
|
+
});
|
|
@@ -25,4 +25,13 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
|
|
|
25
25
|
setOtherProductsIds(ids: number[]): void;
|
|
26
26
|
getOtherProductsIds(): number[];
|
|
27
27
|
storeChange(): void;
|
|
28
|
+
/**
|
|
29
|
+
* 传入一个时间, 判断改时间是否在schedule 内
|
|
30
|
+
* @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
static isInScheduleByDate({ date, schedule }: {
|
|
34
|
+
date: string;
|
|
35
|
+
schedule: any;
|
|
36
|
+
}): true | undefined;
|
|
28
37
|
}
|
|
@@ -38,6 +38,7 @@ var import_dayjs = __toESM(require("dayjs"));
|
|
|
38
38
|
var import_isSameOrBefore = __toESM(require("dayjs/plugin/isSameOrBefore"));
|
|
39
39
|
var import_isSameOrAfter = __toESM(require("dayjs/plugin/isSameOrAfter"));
|
|
40
40
|
var import_utils = require("../Date/utils");
|
|
41
|
+
var import_utils2 = require("./utils");
|
|
41
42
|
import_dayjs.default.extend(import_isSameOrBefore.default);
|
|
42
43
|
import_dayjs.default.extend(import_isSameOrAfter.default);
|
|
43
44
|
var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
@@ -158,6 +159,41 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
|
158
159
|
});
|
|
159
160
|
}
|
|
160
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* 传入一个时间, 判断改时间是否在schedule 内
|
|
164
|
+
* @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
|
|
165
|
+
* @returns
|
|
166
|
+
*/
|
|
167
|
+
static isInScheduleByDate({ date, schedule }) {
|
|
168
|
+
var _a, _b, _c, _d;
|
|
169
|
+
let _schedule = {
|
|
170
|
+
...schedule,
|
|
171
|
+
// 开始时间向前推一天
|
|
172
|
+
start_time: (0, import_dayjs.default)(date).subtract(1, "day").format("YYYY-MM-DD HH:mm:ss"),
|
|
173
|
+
end_time: (0, import_dayjs.default)(date).add(1, "day").format("YYYY-MM-DD HH:mm:ss")
|
|
174
|
+
};
|
|
175
|
+
if (((_b = (_a = _schedule.repeat_rule) == null ? void 0 : _a.end) == null ? void 0 : _b.type) === "never") {
|
|
176
|
+
_schedule.repeat_rule.end = {
|
|
177
|
+
type: "date",
|
|
178
|
+
end_date: _schedule.end_time,
|
|
179
|
+
occurrence: null
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
if (((_d = (_c = _schedule.repeat_rule) == null ? void 0 : _c.end) == null ? void 0 : _d.type) === "date") {
|
|
183
|
+
_schedule.repeat_rule.end = {
|
|
184
|
+
..._schedule.repeat_rule.end,
|
|
185
|
+
end_date: _schedule.end_time
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
const dateRanges = (0, import_utils2.calcScheduleDateRange)({ ..._schedule });
|
|
189
|
+
for (const range of dateRanges) {
|
|
190
|
+
const startTime = (0, import_dayjs.default)(range.start);
|
|
191
|
+
const endTime = (0, import_dayjs.default)(range.end);
|
|
192
|
+
if ((0, import_dayjs.default)(date).isSameOrAfter(startTime) && (0, import_dayjs.default)(date).isSameOrBefore(endTime)) {
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
161
197
|
};
|
|
162
198
|
// Annotate the CommonJS export names for ESM import in node:
|
|
163
199
|
0 && (module.exports = {
|
|
@@ -111,7 +111,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
111
111
|
* 获取当前的客户搜索条件
|
|
112
112
|
* @returns 当前搜索条件
|
|
113
113
|
*/
|
|
114
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
114
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
115
115
|
/**
|
|
116
116
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
117
117
|
* @returns 客户状态
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"appointment_booking","platform":"PC","sales_channel":"my_pisel","order_sales_channel":"online_store","bookings":[{"id":0,"number":1,"registration_type":"all","relation_products":[],"is_all":false,"product":{"num":1,"product_id":61170,"product_variant_id":0,"product_bundle":[],"product_option_item":[],"discount_list":[{"amount":100,"type":"good_pass","discount":{"resource_id":64523,"title":{"auto":"玄-商品券","original":"玄-商品券","en":null,"zh-CN":null,"zh-HK":null},"original_amount":100,"product_id":61170,"percent":"1.00"}}]},"sub_type":"minutes","duration":480,"like_status":"common","resources":[{"relation_type":"form","like_status":"common","form_id":35,"relation_id":40357,"capacity":1,"metadata":{"combined_resource":{"status":1,"resource_ids":[40262,40263]},"form_name":"桌台","resource_name":"组合资源测试table-0422-01"},"children":[{"relation_type":"form","like_status":"common","id":40262,"main_field":"A01(组合资源-小桌-4 人)","resourceType":"single","form_id":35,"relation_id":40262,"capacity":1,"metadata":{"combined_resource":null,"form_name":"桌台","resource_name":"A01(组合资源-小桌-4 人)"}},{"relation_type":"form","like_status":"common","id":40263,"main_field":"A02(组合资源-小桌-4 人)","resourceType":"single","form_id":35,"relation_id":40263,"capacity":0,"metadata":{"combined_resource":null,"form_name":"桌台","resource_name":"A02(组合资源-小桌-4 人)"}}]},{"relation_type":"form","like_status":"common","form_id":214,"relation_id":38350,"capacity":1,"metadata":{"combined_resource":null,"form_name":"校区2","resource_name":"West Campus"}}],"schedule_id":0,"start_date":"2025-08-22","start_time":"09:00","select_date":"2025-08-22","end_time":"17:00","end_date":"2025-08-22","metadata":{"account":{"id":13433,"username":"a a"},"capacity":[{"id":0,"value":1,"name":""}]},"holder":null,"relation_forms":[]}],"shop_note":"","schedule_date":"2025-08-22 09:00:00","is_deposit":0,"relation_products":[],"relation_forms":[]}
|