@pisell/pisellos 2.1.98 → 2.1.100
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/effects/index.d.ts +2 -2
- package/dist/modules/Customer/types.d.ts +1 -1
- package/dist/modules/Payment/types.d.ts +7 -7
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Rules/types.d.ts +1 -1
- package/dist/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
- package/dist/modules/Schedule/type.d.ts +7 -7
- package/dist/modules/Schedule/types.d.ts +9 -9
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/dist/solution/ShopDiscount/types.d.ts +1 -1
- package/dist/solution/ShopDiscount/utils.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/task.d.ts +2 -2
- package/dist/utils/watch.d.ts +2 -2
- package/lib/core/index.js +27 -28
- package/lib/effects/index.d.ts +2 -2
- package/lib/effects/index.js +3 -7
- package/lib/modules/Account/index.js +9 -10
- package/lib/modules/AccountList/index.js +14 -11
- package/lib/modules/BaseModule.js +6 -3
- package/lib/modules/Cart/index.js +14 -9
- package/lib/modules/Cart/utils/cartProduct.js +3 -6
- package/lib/modules/Customer/constants.js +1 -1
- package/lib/modules/Customer/index.js +18 -15
- package/lib/modules/Customer/types.d.ts +1 -1
- package/lib/modules/Date/index.js +10 -6
- package/lib/modules/Date/types.js +1 -0
- package/lib/modules/Discount/index.js +11 -6
- package/lib/modules/Guests/index.js +10 -15
- package/lib/modules/Order/index.js +10 -7
- package/lib/modules/Payment/cash.js +1 -1
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +1 -1
- package/lib/modules/Payment/eftpos.js +1 -1
- package/lib/modules/Payment/index.js +84 -73
- package/lib/modules/Payment/types.d.ts +7 -7
- package/lib/modules/Payment/utils.js +3 -6
- package/lib/modules/Payment/walletpass.js +31 -31
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/index.js +6 -5
- package/lib/modules/ProductList/index.js +5 -3
- package/lib/modules/Resource/index.js +8 -12
- package/lib/modules/Rules/index.js +21 -35
- package/lib/modules/Rules/types.d.ts +1 -1
- package/lib/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
- package/lib/modules/Schedule/index.js +8 -5
- package/lib/modules/Schedule/type.d.ts +7 -7
- package/lib/modules/Schedule/types.d.ts +9 -9
- package/lib/modules/Schedule/utils.js +2 -4
- package/lib/modules/Step/index.js +7 -4
- package/lib/modules/Summary/index.js +9 -4
- package/lib/modules/Summary/utils.js +8 -16
- package/lib/plugins/request.js +34 -33
- package/lib/plugins/window.js +101 -113
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +110 -177
- package/lib/solution/BookingByStep/utils/capacity.js +11 -16
- package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/lib/solution/BookingByStep/utils/resources.js +4 -8
- package/lib/solution/BookingByStep/utils/stock.js +3 -6
- package/lib/solution/BookingByStep/utils/timeslots.js +24 -27
- package/lib/solution/BookingTicket/index.js +19 -14
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +3 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +6 -6
- package/lib/solution/BookingTicket/utils/scan/index.js +3 -1
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +10 -9
- package/lib/solution/BuyTickets/index.js +15 -15
- package/lib/solution/Checkout/index.js +216 -211
- package/lib/solution/Checkout/utils/index.js +18 -22
- package/lib/solution/RegisterAndLogin/config.js +2 -2
- package/lib/solution/RegisterAndLogin/index.js +114 -110
- package/lib/solution/RegisterAndLogin/utils.js +9 -9
- package/lib/solution/ShopDiscount/index.js +16 -13
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- package/lib/solution/ShopDiscount/utils.d.ts +2 -2
- package/lib/solution/ShopDiscount/utils.js +1 -2
- package/lib/types/index.d.ts +1 -1
- package/lib/utils/task.d.ts +2 -2
- package/lib/utils/task.js +3 -3
- package/lib/utils/watch.d.ts +2 -2
- package/lib/utils/watch.js +5 -7
- package/package.json +16 -17
|
@@ -27,11 +27,11 @@ var import_utils = require("./utils");
|
|
|
27
27
|
var WalletPassPaymentImpl = class {
|
|
28
28
|
constructor(paymentModule) {
|
|
29
29
|
this.paymentModule = paymentModule;
|
|
30
|
-
this.walletRecommendList = [];
|
|
31
|
-
this.userIdentificationCodes = [];
|
|
32
|
-
this.searchResults = [];
|
|
33
|
-
this.walletParams = null;
|
|
34
30
|
}
|
|
31
|
+
walletRecommendList = [];
|
|
32
|
+
userIdentificationCodes = [];
|
|
33
|
+
searchResults = [];
|
|
34
|
+
walletParams = null;
|
|
35
35
|
/**
|
|
36
36
|
* 发送事件的辅助方法
|
|
37
37
|
* 支持使用WalletPassHooks或PaymentHooks
|
|
@@ -42,7 +42,7 @@ var WalletPassPaymentImpl = class {
|
|
|
42
42
|
const fullEventName = `${this.paymentModule.name}:${eventName}`;
|
|
43
43
|
this.paymentModule.core.effects.emit(fullEventName, data);
|
|
44
44
|
} catch (error) {
|
|
45
|
-
this.paymentModule.logError("[WalletPass]
|
|
45
|
+
this.paymentModule.logError("[WalletPass] \u53D1\u9001\u4E8B\u4EF6\u5931\u8D25", error, { hook });
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
@@ -77,7 +77,7 @@ var WalletPassPaymentImpl = class {
|
|
|
77
77
|
payment_order_id
|
|
78
78
|
};
|
|
79
79
|
this.walletParams = walletParams;
|
|
80
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
80
|
+
this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u9ED8\u8BA4\u53C2\u6570\u5DF2\u751F\u6210\u5E76\u5B58\u50A8", {
|
|
81
81
|
customer_id: walletParams.customer_id,
|
|
82
82
|
order_expect_amount: walletParams.order_expect_amount,
|
|
83
83
|
order_product_amount: walletParams.order_product_amount,
|
|
@@ -99,7 +99,7 @@ var WalletPassPaymentImpl = class {
|
|
|
99
99
|
*/
|
|
100
100
|
clearStoredWalletParams() {
|
|
101
101
|
this.walletParams = null;
|
|
102
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
102
|
+
this.paymentModule.logInfo("[WalletPass] \u5DF2\u5B58\u50A8\u7684\u94B1\u5305\u53C2\u6570\u5DF2\u6E05\u7406");
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
105
|
* 从业务数据初始化钱包数据
|
|
@@ -119,7 +119,7 @@ var WalletPassPaymentImpl = class {
|
|
|
119
119
|
businessData,
|
|
120
120
|
startTime
|
|
121
121
|
});
|
|
122
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
122
|
+
this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E", {
|
|
123
123
|
customer_id: businessData.customer_id,
|
|
124
124
|
totalAmount: (_c = businessData.amountInfo) == null ? void 0 : _c.totalAmount,
|
|
125
125
|
subTotal: (_d = businessData.amountInfo) == null ? void 0 : _d.subTotal,
|
|
@@ -137,7 +137,7 @@ var WalletPassPaymentImpl = class {
|
|
|
137
137
|
endTime,
|
|
138
138
|
duration
|
|
139
139
|
});
|
|
140
|
-
this.paymentModule.logInfo(`[WalletPass]
|
|
140
|
+
this.paymentModule.logInfo(`[WalletPass] \u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u6210\u529F`, {
|
|
141
141
|
duration: `${duration}ms`,
|
|
142
142
|
walletRecommendList_count: ((_f = result.walletRecommendList) == null ? void 0 : _f.length) || 0,
|
|
143
143
|
userIdentificationCodes_count: ((_g = result.userIdentificationCodes) == null ? void 0 : _g.length) || 0
|
|
@@ -153,7 +153,7 @@ var WalletPassPaymentImpl = class {
|
|
|
153
153
|
endTime,
|
|
154
154
|
duration
|
|
155
155
|
});
|
|
156
|
-
this.paymentModule.logError(`[WalletPass]
|
|
156
|
+
this.paymentModule.logError(`[WalletPass] \u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u5931\u8D25`, error, {
|
|
157
157
|
duration: `${duration}ms`,
|
|
158
158
|
customer_id: businessData.customer_id,
|
|
159
159
|
totalAmount: (_h = businessData.amountInfo) == null ? void 0 : _h.totalAmount
|
|
@@ -181,7 +181,7 @@ var WalletPassPaymentImpl = class {
|
|
|
181
181
|
userIdentificationCodes
|
|
182
182
|
};
|
|
183
183
|
} catch (error) {
|
|
184
|
-
this.paymentModule.logError("[WalletPass]
|
|
184
|
+
this.paymentModule.logError("[WalletPass] \u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u5931\u8D25", error, {
|
|
185
185
|
customer_id: baseParams.customer_id,
|
|
186
186
|
order_expect_amount: baseParams.order_expect_amount
|
|
187
187
|
});
|
|
@@ -191,7 +191,7 @@ var WalletPassPaymentImpl = class {
|
|
|
191
191
|
async getWalletPassRecommendListAsync(params) {
|
|
192
192
|
var _a;
|
|
193
193
|
try {
|
|
194
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
194
|
+
this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u83B7\u53D6\u94B1\u5305\u63A8\u8350\u5217\u8868", {
|
|
195
195
|
customer_id: params.customer_id,
|
|
196
196
|
order_expect_amount: params.order_expect_amount,
|
|
197
197
|
sale_channel: params.sale_channel,
|
|
@@ -206,7 +206,7 @@ var WalletPassPaymentImpl = class {
|
|
|
206
206
|
this.emitEvent(import_types.WalletPassHooks.OnWalletRecommendListUpdated, {
|
|
207
207
|
walletRecommendList: this.walletRecommendList
|
|
208
208
|
});
|
|
209
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
209
|
+
this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u63A8\u8350\u5217\u8868\u5DF2\u66F4\u65B0", {
|
|
210
210
|
count: this.walletRecommendList.length,
|
|
211
211
|
items: this.walletRecommendList.map((item) => ({
|
|
212
212
|
voucher_id: item.voucher_id,
|
|
@@ -217,7 +217,7 @@ var WalletPassPaymentImpl = class {
|
|
|
217
217
|
});
|
|
218
218
|
return this.walletRecommendList;
|
|
219
219
|
} catch (error) {
|
|
220
|
-
this.paymentModule.logError("[WalletPass]
|
|
220
|
+
this.paymentModule.logError("[WalletPass] \u83B7\u53D6\u94B1\u5305\u63A8\u8350\u5217\u8868\u5931\u8D25", error, {
|
|
221
221
|
customer_id: params.customer_id,
|
|
222
222
|
order_expect_amount: params.order_expect_amount,
|
|
223
223
|
sale_channel: params.sale_channel
|
|
@@ -235,7 +235,7 @@ var WalletPassPaymentImpl = class {
|
|
|
235
235
|
...this.walletParams,
|
|
236
236
|
...params
|
|
237
237
|
};
|
|
238
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
238
|
+
this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u83B7\u53D6\u7528\u6237\u8BC6\u522B\u7801\u5217\u8868", {
|
|
239
239
|
customer_id: newParams.customer_id,
|
|
240
240
|
available: newParams.available,
|
|
241
241
|
prepare_payments_count: ((_a = newParams.prepare_payments) == null ? void 0 : _a.length) || 0,
|
|
@@ -251,7 +251,7 @@ var WalletPassPaymentImpl = class {
|
|
|
251
251
|
this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesUpdated, {
|
|
252
252
|
userIdentificationCodes: this.userIdentificationCodes
|
|
253
253
|
});
|
|
254
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
254
|
+
this.paymentModule.logInfo("[WalletPass] \u7528\u6237\u8BC6\u522B\u7801\u5217\u8868\u5DF2\u66F4\u65B0", {
|
|
255
255
|
count: this.userIdentificationCodes.length,
|
|
256
256
|
sorted_items: this.userIdentificationCodes.slice(0, 5).map((item) => ({
|
|
257
257
|
code: item.code,
|
|
@@ -261,7 +261,7 @@ var WalletPassPaymentImpl = class {
|
|
|
261
261
|
});
|
|
262
262
|
return this.userIdentificationCodes;
|
|
263
263
|
} catch (error) {
|
|
264
|
-
this.paymentModule.logError("[WalletPass]
|
|
264
|
+
this.paymentModule.logError("[WalletPass] \u83B7\u53D6\u7528\u6237\u8BC6\u522B\u7801\u5217\u8868\u5931\u8D25", error, {
|
|
265
265
|
customer_id: params.customer_id,
|
|
266
266
|
available: params.available
|
|
267
267
|
});
|
|
@@ -277,7 +277,7 @@ var WalletPassPaymentImpl = class {
|
|
|
277
277
|
async searchIdentificationCodeAsync(params, config = {}) {
|
|
278
278
|
try {
|
|
279
279
|
const { code } = params;
|
|
280
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
280
|
+
this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u641C\u7D22\u8BC6\u522B\u7801", {
|
|
281
281
|
code,
|
|
282
282
|
code_length: code.length,
|
|
283
283
|
noCache: config.noCache || false
|
|
@@ -289,7 +289,7 @@ var WalletPassPaymentImpl = class {
|
|
|
289
289
|
with_customer: 1,
|
|
290
290
|
with: ["wallet"]
|
|
291
291
|
};
|
|
292
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
292
|
+
this.paymentModule.logInfo("[WalletPass] \u641C\u7D22\u94B1\u5305\u8BC6\u522B\u7801", {
|
|
293
293
|
code,
|
|
294
294
|
with_customer: walletDetailParams.with_customer,
|
|
295
295
|
with: walletDetailParams.with
|
|
@@ -299,7 +299,7 @@ var WalletPassPaymentImpl = class {
|
|
|
299
299
|
walletDetailParams
|
|
300
300
|
);
|
|
301
301
|
const searchResults2 = (response2 == null ? void 0 : response2.data) || [];
|
|
302
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
302
|
+
this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u8BC6\u522B\u7801\u641C\u7D22\u5B8C\u6210", {
|
|
303
303
|
code,
|
|
304
304
|
results_count: searchResults2.length,
|
|
305
305
|
type: "walletCode"
|
|
@@ -325,7 +325,7 @@ var WalletPassPaymentImpl = class {
|
|
|
325
325
|
code: params.code,
|
|
326
326
|
payment_order_id: baseWalletParams == null ? void 0 : baseWalletParams.payment_order_id
|
|
327
327
|
};
|
|
328
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
328
|
+
this.paymentModule.logInfo("[WalletPass] \u641C\u7D22\u666E\u901A\u8BC6\u522B\u7801", {
|
|
329
329
|
code: searchParams.code,
|
|
330
330
|
customer_id: searchParams.customer_id,
|
|
331
331
|
order_expect_amount: searchParams.order_expect_amount,
|
|
@@ -358,7 +358,7 @@ var WalletPassPaymentImpl = class {
|
|
|
358
358
|
cachedSearchResults: [...this.searchResults],
|
|
359
359
|
searchParams: params
|
|
360
360
|
});
|
|
361
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
361
|
+
this.paymentModule.logInfo("[WalletPass] \u666E\u901A\u8BC6\u522B\u7801\u641C\u7D22\u5B8C\u6210", {
|
|
362
362
|
code: params.code,
|
|
363
363
|
results_count: searchResults.length,
|
|
364
364
|
cached_results_count: this.searchResults.length,
|
|
@@ -369,7 +369,7 @@ var WalletPassPaymentImpl = class {
|
|
|
369
369
|
data: searchResults
|
|
370
370
|
};
|
|
371
371
|
} catch (error) {
|
|
372
|
-
this.paymentModule.logError("[WalletPass]
|
|
372
|
+
this.paymentModule.logError("[WalletPass] \u641C\u7D22\u8BC6\u522B\u7801\u4FE1\u606F\u5931\u8D25", error, {
|
|
373
373
|
code: params.code,
|
|
374
374
|
customer_id: params.customer_id,
|
|
375
375
|
order_expect_amount: params.order_expect_amount
|
|
@@ -378,19 +378,19 @@ var WalletPassPaymentImpl = class {
|
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
380
|
async processWalletPayment(amount, orderUuid, voucherId) {
|
|
381
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
381
|
+
this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u5904\u7406\u94B1\u5305\u652F\u4ED8", {
|
|
382
382
|
amount,
|
|
383
383
|
orderUuid,
|
|
384
384
|
voucherId: voucherId || "none"
|
|
385
385
|
});
|
|
386
386
|
const walletMethod = await this.paymentModule.getWalletPaymentMethod();
|
|
387
387
|
if (!walletMethod) {
|
|
388
|
-
this.paymentModule.logError("[WalletPass]
|
|
388
|
+
this.paymentModule.logError("[WalletPass] \u94B1\u5305\u652F\u4ED8\u65B9\u5F0F\u672A\u627E\u5230", null, {
|
|
389
389
|
amount,
|
|
390
390
|
orderUuid,
|
|
391
391
|
voucherId
|
|
392
392
|
});
|
|
393
|
-
throw new Error("
|
|
393
|
+
throw new Error("\u94B1\u5305\u652F\u4ED8\u65B9\u5F0F\u672A\u627E\u5230");
|
|
394
394
|
}
|
|
395
395
|
const paymentItem = {
|
|
396
396
|
amount: amount.toString(),
|
|
@@ -401,7 +401,7 @@ var WalletPassPaymentImpl = class {
|
|
|
401
401
|
voucher_id: voucherId || ""
|
|
402
402
|
};
|
|
403
403
|
await this.paymentModule.addPaymentItemAsync(orderUuid, paymentItem);
|
|
404
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
404
|
+
this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u652F\u4ED8\u5904\u7406\u5B8C\u6210", {
|
|
405
405
|
amount,
|
|
406
406
|
orderUuid,
|
|
407
407
|
voucherId: voucherId || "none",
|
|
@@ -431,7 +431,7 @@ var WalletPassPaymentImpl = class {
|
|
|
431
431
|
this.emitEvent(import_types.WalletPassHooks.OnWalletRecommendListCleared, {
|
|
432
432
|
clearedTypes: ["walletRecommendList"]
|
|
433
433
|
});
|
|
434
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
434
|
+
this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u63A8\u8350\u5217\u8868\u5DF2\u6E05\u9664");
|
|
435
435
|
}
|
|
436
436
|
/**
|
|
437
437
|
* 清除用户识别码列表
|
|
@@ -441,7 +441,7 @@ var WalletPassPaymentImpl = class {
|
|
|
441
441
|
this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesCleared, {
|
|
442
442
|
clearedTypes: ["userIdentificationCodes"]
|
|
443
443
|
});
|
|
444
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
444
|
+
this.paymentModule.logInfo("[WalletPass] \u7528\u6237\u8BC6\u522B\u7801\u5217\u8868\u5DF2\u6E05\u9664");
|
|
445
445
|
}
|
|
446
446
|
/**
|
|
447
447
|
* 获取缓存的搜索结果列表
|
|
@@ -460,7 +460,7 @@ var WalletPassPaymentImpl = class {
|
|
|
460
460
|
*/
|
|
461
461
|
clearSearchResults() {
|
|
462
462
|
this.searchResults = [];
|
|
463
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
463
|
+
this.paymentModule.logInfo("[WalletPass] \u641C\u7D22\u7ED3\u679C\u7F13\u5B58\u5DF2\u6E05\u9664");
|
|
464
464
|
}
|
|
465
465
|
/**
|
|
466
466
|
* 清除所有缓存数据
|
|
@@ -473,7 +473,7 @@ var WalletPassPaymentImpl = class {
|
|
|
473
473
|
this.emitEvent(import_types.WalletPassHooks.OnWalletCacheCleared, {
|
|
474
474
|
clearedTypes: ["all"]
|
|
475
475
|
});
|
|
476
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
476
|
+
this.paymentModule.logInfo("[WalletPass] \u6240\u6709\u7F13\u5B58\u6570\u636E\u5DF2\u6E05\u9664", {
|
|
477
477
|
cleared_types: ["walletRecommendList", "userIdentificationCodes", "searchResults", "walletParams"]
|
|
478
478
|
});
|
|
479
479
|
}
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "duration" | "session" | "normal";
|
|
53
53
|
}
|
|
@@ -26,13 +26,14 @@ module.exports = __toCommonJS(Product_exports);
|
|
|
26
26
|
var import_BaseModule = require("../BaseModule");
|
|
27
27
|
__reExport(Product_exports, require("./types"), module.exports);
|
|
28
28
|
var Product = class extends import_BaseModule.BaseModule {
|
|
29
|
+
defaultName = "product";
|
|
30
|
+
defaultVersion = "1.0.0";
|
|
31
|
+
store;
|
|
32
|
+
otherParams = {
|
|
33
|
+
scheduler: []
|
|
34
|
+
};
|
|
29
35
|
constructor(name, version) {
|
|
30
36
|
super(name, version);
|
|
31
|
-
this.defaultName = "product";
|
|
32
|
-
this.defaultVersion = "1.0.0";
|
|
33
|
-
this.otherParams = {
|
|
34
|
-
scheduler: []
|
|
35
|
-
};
|
|
36
37
|
}
|
|
37
38
|
async initialize(core, options) {
|
|
38
39
|
this.core = core;
|
|
@@ -27,11 +27,13 @@ var import_BaseModule = require("../BaseModule");
|
|
|
27
27
|
var import_lodash_es = require("lodash-es");
|
|
28
28
|
__reExport(ProductList_exports, require("./types"), module.exports);
|
|
29
29
|
var ProductList = class extends import_BaseModule.BaseModule {
|
|
30
|
+
defaultName = "productList";
|
|
31
|
+
defaultVersion = "1.0.0";
|
|
32
|
+
store;
|
|
33
|
+
request;
|
|
34
|
+
otherParams = {};
|
|
30
35
|
constructor(name, version) {
|
|
31
36
|
super(name, version);
|
|
32
|
-
this.defaultName = "productList";
|
|
33
|
-
this.defaultVersion = "1.0.0";
|
|
34
|
-
this.otherParams = {};
|
|
35
37
|
}
|
|
36
38
|
async initialize(core, options) {
|
|
37
39
|
var _a;
|
|
@@ -25,10 +25,11 @@ module.exports = __toCommonJS(Resource_exports);
|
|
|
25
25
|
var import_BaseModule = require("../BaseModule");
|
|
26
26
|
var import_types = require("./types");
|
|
27
27
|
var ResourceListModule = class extends import_BaseModule.BaseModule {
|
|
28
|
+
defaultName = "resourceList";
|
|
29
|
+
defaultVersion = "1.0.0";
|
|
30
|
+
store;
|
|
28
31
|
constructor(name, version) {
|
|
29
32
|
super(name, version);
|
|
30
|
-
this.defaultName = "resourceList";
|
|
31
|
-
this.defaultVersion = "1.0.0";
|
|
32
33
|
}
|
|
33
34
|
async initialize(core, options) {
|
|
34
35
|
this.core = core;
|
|
@@ -39,8 +40,7 @@ var ResourceListModule = class extends import_BaseModule.BaseModule {
|
|
|
39
40
|
}
|
|
40
41
|
async selectResource(resourceId) {
|
|
41
42
|
const resource = this.store.list.find((r) => r.id === resourceId);
|
|
42
|
-
if (!resource)
|
|
43
|
-
return;
|
|
43
|
+
if (!resource) return;
|
|
44
44
|
this.store.selectedResource = resource;
|
|
45
45
|
await this.core.effects.emit(`${this.name}:onResourceSelect`, resource);
|
|
46
46
|
}
|
|
@@ -49,22 +49,19 @@ var ResourceListModule = class extends import_BaseModule.BaseModule {
|
|
|
49
49
|
}
|
|
50
50
|
async checkAvailability(resourceId, start, end) {
|
|
51
51
|
const resource = this.store.list.find((r) => r.id === resourceId);
|
|
52
|
-
if (!resource)
|
|
53
|
-
return false;
|
|
52
|
+
if (!resource) return false;
|
|
54
53
|
return resource.timeSlots.some(
|
|
55
54
|
(slot) => slot.start.getTime() <= start.getTime() && slot.end.getTime() >= end.getTime() && slot.availableCapacity > 0
|
|
56
55
|
);
|
|
57
56
|
}
|
|
58
57
|
async getAvailableTimeSlots(resourceId) {
|
|
59
58
|
const resource = this.store.list.find((r) => r.id === resourceId);
|
|
60
|
-
if (!resource)
|
|
61
|
-
return [];
|
|
59
|
+
if (!resource) return [];
|
|
62
60
|
return resource.timeSlots.filter((slot) => slot.availableCapacity > 0);
|
|
63
61
|
}
|
|
64
62
|
getAvailableCapacity(resourceId, timeSlot) {
|
|
65
63
|
const resource = this.store.list.find((r) => r.id === resourceId);
|
|
66
|
-
if (!resource)
|
|
67
|
-
return 0;
|
|
64
|
+
if (!resource) return 0;
|
|
68
65
|
const slot = resource.timeSlots.find(
|
|
69
66
|
(s) => s.start.getTime() === timeSlot.start.getTime() && s.end.getTime() === timeSlot.end.getTime()
|
|
70
67
|
);
|
|
@@ -72,8 +69,7 @@ var ResourceListModule = class extends import_BaseModule.BaseModule {
|
|
|
72
69
|
}
|
|
73
70
|
async updateResource(resourceId, updates) {
|
|
74
71
|
const index = this.store.list.findIndex((r) => r.id === resourceId);
|
|
75
|
-
if (index === -1)
|
|
76
|
-
return;
|
|
72
|
+
if (index === -1) return;
|
|
77
73
|
this.store.list[index] = {
|
|
78
74
|
...this.store.list[index],
|
|
79
75
|
...updates
|
|
@@ -40,10 +40,12 @@ var import_decimal = __toESM(require("decimal.js"));
|
|
|
40
40
|
var import_lodash_es = require("lodash-es");
|
|
41
41
|
var import_dayjs = __toESM(require("dayjs"));
|
|
42
42
|
var RulesModule = class extends import_BaseModule.BaseModule {
|
|
43
|
+
defaultName = "rules";
|
|
44
|
+
defaultVersion = "1.0.0";
|
|
45
|
+
store;
|
|
46
|
+
hooks;
|
|
43
47
|
constructor(name, version) {
|
|
44
48
|
super(name, version);
|
|
45
|
-
this.defaultName = "rules";
|
|
46
|
-
this.defaultVersion = "1.0.0";
|
|
47
49
|
this.hooks = {};
|
|
48
50
|
}
|
|
49
51
|
async initialize(core, options) {
|
|
@@ -61,14 +63,11 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
61
63
|
// 商品不需要holder,则不需要判断,直接返回true,商品需要holder但是还没填写,那么暂时不使用带有holder的券,直到填写才去匹配
|
|
62
64
|
checkHolderMatch(discount, product, holders) {
|
|
63
65
|
var _a;
|
|
64
|
-
if (((_a = discount.holder) == null ? void 0 : _a.holder_type) !== "form")
|
|
65
|
-
return true;
|
|
66
|
+
if (((_a = discount.holder) == null ? void 0 : _a.holder_type) !== "form") return true;
|
|
66
67
|
const orderHolderId = Array.isArray(holders) && holders.length > 0 ? holders[0].form_record_id : void 0;
|
|
67
68
|
const productHolderId = Array.isArray(product.holder_id) ? product.holder_id[0] : product.holder_id;
|
|
68
|
-
if (!product.isNeedHolder)
|
|
69
|
-
|
|
70
|
-
if (!orderHolderId && !productHolderId)
|
|
71
|
-
return false;
|
|
69
|
+
if (!product.isNeedHolder) return true;
|
|
70
|
+
if (!orderHolderId && !productHolderId) return false;
|
|
72
71
|
return (productHolderId || orderHolderId) === discount.holder.holder_id;
|
|
73
72
|
}
|
|
74
73
|
// 判断discountList 是否可以对当前productList生效
|
|
@@ -272,19 +271,13 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
272
271
|
const getPriority = (discount) => {
|
|
273
272
|
const isHolder = isHolderDiscount(discount);
|
|
274
273
|
if (isHolder) {
|
|
275
|
-
if (isGoodPass(discount))
|
|
276
|
-
|
|
277
|
-
if (
|
|
278
|
-
return 2;
|
|
279
|
-
if (isOrderLevelDiscount(discount))
|
|
280
|
-
return 3;
|
|
274
|
+
if (isGoodPass(discount)) return 1;
|
|
275
|
+
if (isItemLevelDiscount(discount)) return 2;
|
|
276
|
+
if (isOrderLevelDiscount(discount)) return 3;
|
|
281
277
|
} else {
|
|
282
|
-
if (isGoodPass(discount))
|
|
283
|
-
|
|
284
|
-
if (
|
|
285
|
-
return 5;
|
|
286
|
-
if (isOrderLevelDiscount(discount))
|
|
287
|
-
return 6;
|
|
278
|
+
if (isGoodPass(discount)) return 4;
|
|
279
|
+
if (isItemLevelDiscount(discount)) return 5;
|
|
280
|
+
if (isOrderLevelDiscount(discount)) return 6;
|
|
288
281
|
}
|
|
289
282
|
return 7;
|
|
290
283
|
};
|
|
@@ -300,10 +293,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
300
293
|
var _a, _b;
|
|
301
294
|
const typeA = ((_a = itemA.metadata) == null ? void 0 : _a.discount_card_type) || "percent";
|
|
302
295
|
const typeB = ((_b = itemB.metadata) == null ? void 0 : _b.discount_card_type) || "percent";
|
|
303
|
-
if (typeA === "fixed_amount" && typeB === "percent")
|
|
304
|
-
|
|
305
|
-
if (typeA === "percent" && typeB === "fixed_amount")
|
|
306
|
-
return 1;
|
|
296
|
+
if (typeA === "fixed_amount" && typeB === "percent") return -1;
|
|
297
|
+
if (typeA === "percent" && typeB === "fixed_amount") return 1;
|
|
307
298
|
if (typeA === "fixed_amount" && typeB === "fixed_amount") {
|
|
308
299
|
if (itemA.par_value !== itemB.par_value) {
|
|
309
300
|
const valueA = new import_decimal.default(itemA.par_value || 0);
|
|
@@ -330,8 +321,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
330
321
|
}
|
|
331
322
|
if (a.tag === "product_discount_card" && b.tag === "product_discount_card") {
|
|
332
323
|
const valueCompare = compareDiscountCardValue(a, b);
|
|
333
|
-
if (valueCompare !== 0)
|
|
334
|
-
return valueCompare;
|
|
324
|
+
if (valueCompare !== 0) return valueCompare;
|
|
335
325
|
return compareByExpireTime(a, b);
|
|
336
326
|
}
|
|
337
327
|
return compareByExpireTime(a, b);
|
|
@@ -604,16 +594,13 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
604
594
|
}
|
|
605
595
|
const applicableDiscounts = sortedDiscountList.filter((discount) => {
|
|
606
596
|
var _a2, _b2;
|
|
607
|
-
if ((Number(product.price) <= 0 || !product.price) && !((_a2 = product.discount_list) == null ? void 0 : _a2.length) && (discount.tag || discount.type) === "good_pass")
|
|
608
|
-
return false;
|
|
597
|
+
if ((Number(product.price) <= 0 || !product.price) && !((_a2 = product.discount_list) == null ? void 0 : _a2.length) && (discount.tag || discount.type) === "good_pass") return false;
|
|
609
598
|
if ((Number(product.price) <= 0 || !product.price) && !((_b2 = product.discount_list) == null ? void 0 : _b2.find((n) => {
|
|
610
599
|
var _a3;
|
|
611
600
|
return ((_a3 = n.discount) == null ? void 0 : _a3.resource_id) === discount.id;
|
|
612
|
-
})) && (discount.tag || discount.type) !== "good_pass")
|
|
613
|
-
return false;
|
|
601
|
+
})) && (discount.tag || discount.type) !== "good_pass") return false;
|
|
614
602
|
const targetUsedDiscounts = usedDiscounts.get(discount.id);
|
|
615
|
-
if (targetUsedDiscounts && (discount.tag || discount.type) === "good_pass")
|
|
616
|
-
return false;
|
|
603
|
+
if (targetUsedDiscounts && (discount.tag || discount.type) === "good_pass") return false;
|
|
617
604
|
const limitedData = discount.limited_relation_product_data;
|
|
618
605
|
const _tempVar = (flatItem == null ? void 0 : flatItem.type) === "bundle" ? flatItem == null ? void 0 : flatItem.parentProduct : flatItem == null ? void 0 : flatItem.product;
|
|
619
606
|
const isHolderMatch = this.checkHolderMatch(
|
|
@@ -624,8 +611,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
624
611
|
},
|
|
625
612
|
holders
|
|
626
613
|
);
|
|
627
|
-
if (!isHolderMatch)
|
|
628
|
-
return false;
|
|
614
|
+
if (!isHolderMatch) return false;
|
|
629
615
|
let timeLimit = true;
|
|
630
616
|
timeLimit = !!(0, import_utils.filterDiscountListByBookingTime)([discount], (product.startDate || (0, import_dayjs.default)()).format("YYYY-MM-DD HH:mm:ss")).length;
|
|
631
617
|
if (!timeLimit) {
|
|
@@ -1452,7 +1438,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1452
1438
|
async destroy() {
|
|
1453
1439
|
this.core.effects.offByModuleDestroy(this.name);
|
|
1454
1440
|
await this.core.effects.emit(`${this.name}:onDestroy`, {});
|
|
1455
|
-
console.log("[Rules]
|
|
1441
|
+
console.log("[Rules] \u5DF2\u9500\u6BC1");
|
|
1456
1442
|
}
|
|
1457
1443
|
async clear() {
|
|
1458
1444
|
console.log("[Rules] clear");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import dayjs from "dayjs";
|
|
2
2
|
import { ScheduleItem } from "./types";
|
|
3
3
|
export declare const getDateIsInSchedule: (dateTime: string, scheduleList: ScheduleItem[]) => boolean;
|
|
4
|
-
export type ScheduleTimeSlot = {
|
|
4
|
+
export declare type ScheduleTimeSlot = {
|
|
5
5
|
/** 开始时间 HH:mm */
|
|
6
6
|
start_time: string;
|
|
7
7
|
/** 结束时间 HH:mm */
|
|
@@ -43,19 +43,22 @@ var import_getDateIsInSchedule = require("./getDateIsInSchedule");
|
|
|
43
43
|
import_dayjs.default.extend(import_isSameOrBefore.default);
|
|
44
44
|
import_dayjs.default.extend(import_isSameOrAfter.default);
|
|
45
45
|
var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
46
|
+
defaultName = "schedule";
|
|
47
|
+
defaultVersion = "1.0.0";
|
|
48
|
+
request;
|
|
49
|
+
store = {};
|
|
50
|
+
cacheId;
|
|
51
|
+
openCache = false;
|
|
52
|
+
fatherModule;
|
|
46
53
|
constructor(name, version) {
|
|
47
54
|
super(name, version);
|
|
48
|
-
this.defaultName = "schedule";
|
|
49
|
-
this.defaultVersion = "1.0.0";
|
|
50
|
-
this.store = {};
|
|
51
|
-
this.openCache = false;
|
|
52
55
|
}
|
|
53
56
|
async initialize(core, options) {
|
|
54
57
|
var _a, _b;
|
|
55
58
|
this.core = core;
|
|
56
59
|
this.request = core.getPlugin("request");
|
|
57
60
|
if (!this.request) {
|
|
58
|
-
throw new Error("ScheduleModule
|
|
61
|
+
throw new Error("ScheduleModule \u9700\u8981 request \u63D2\u4EF6\u652F\u6301");
|
|
59
62
|
}
|
|
60
63
|
this.store = options == null ? void 0 : options.store;
|
|
61
64
|
if (options.initialState) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ScheduleItem = {
|
|
1
|
+
export declare type ScheduleItem = {
|
|
2
2
|
/** 颜色 */
|
|
3
3
|
color: string;
|
|
4
4
|
/** 创建时间 */
|
|
@@ -65,7 +65,7 @@ export type ScheduleItem = {
|
|
|
65
65
|
schedule_id: number;
|
|
66
66
|
}[];
|
|
67
67
|
};
|
|
68
|
-
export type ScheduleFormOtherValue = {
|
|
68
|
+
export declare type ScheduleFormOtherValue = {
|
|
69
69
|
/** 截止模式
|
|
70
70
|
* 1: 永不截止
|
|
71
71
|
* 2: 按日期截止
|
|
@@ -79,11 +79,11 @@ export type ScheduleFormOtherValue = {
|
|
|
79
79
|
includeStatus: boolean;
|
|
80
80
|
type: 'standard' | 'time-slots' | 'designation';
|
|
81
81
|
};
|
|
82
|
-
export type ExcIncDate = {
|
|
82
|
+
export declare type ExcIncDate = {
|
|
83
83
|
start: string;
|
|
84
84
|
end: string;
|
|
85
85
|
};
|
|
86
|
-
export type ScheduleFormData = {
|
|
86
|
+
export declare type ScheduleFormData = {
|
|
87
87
|
/** 颜色 */
|
|
88
88
|
color: string;
|
|
89
89
|
/** 日程名称 */
|
|
@@ -131,20 +131,20 @@ export type ScheduleFormData = {
|
|
|
131
131
|
start_time: any;
|
|
132
132
|
end_time: any;
|
|
133
133
|
};
|
|
134
|
-
export type CalendarDataItem = {
|
|
134
|
+
export declare type CalendarDataItem = {
|
|
135
135
|
date: string;
|
|
136
136
|
color: string[];
|
|
137
137
|
isExcluded: boolean;
|
|
138
138
|
schedule_ids?: number[];
|
|
139
139
|
[key: string]: any;
|
|
140
140
|
};
|
|
141
|
-
export type RequestData<Data> = {
|
|
141
|
+
export declare type RequestData<Data> = {
|
|
142
142
|
data: Data;
|
|
143
143
|
status: boolean;
|
|
144
144
|
message: string;
|
|
145
145
|
code: number;
|
|
146
146
|
};
|
|
147
|
-
export type ResponseListData<Data> = {
|
|
147
|
+
export declare type ResponseListData<Data> = {
|
|
148
148
|
status: boolean;
|
|
149
149
|
message: string;
|
|
150
150
|
code: number;
|
|
@@ -4,7 +4,7 @@ export interface ScheduleState {
|
|
|
4
4
|
availabilityDateList: ScheduleAvailabilityDateItem[];
|
|
5
5
|
otherProductsIds: number[];
|
|
6
6
|
}
|
|
7
|
-
export type ScheduleAvailabilityDateItem = {
|
|
7
|
+
export declare type ScheduleAvailabilityDateItem = {
|
|
8
8
|
date: string;
|
|
9
9
|
schedule_id: number[];
|
|
10
10
|
product_ids: number[];
|
|
@@ -24,7 +24,7 @@ export interface LoadScheduleAvailableDateParams {
|
|
|
24
24
|
}
|
|
25
25
|
export interface ScheduleModuleAPI {
|
|
26
26
|
}
|
|
27
|
-
export type ScheduleItem = {
|
|
27
|
+
export declare type ScheduleItem = {
|
|
28
28
|
/** 颜色 */
|
|
29
29
|
color: string;
|
|
30
30
|
/** 创建时间 */
|
|
@@ -91,7 +91,7 @@ export type ScheduleItem = {
|
|
|
91
91
|
schedule_id: number;
|
|
92
92
|
}[];
|
|
93
93
|
};
|
|
94
|
-
export type ScheduleFormOtherValue = {
|
|
94
|
+
export declare type ScheduleFormOtherValue = {
|
|
95
95
|
/** 截止模式
|
|
96
96
|
* 1: 永不截止
|
|
97
97
|
* 2: 按日期截止
|
|
@@ -105,11 +105,11 @@ export type ScheduleFormOtherValue = {
|
|
|
105
105
|
includeStatus: boolean;
|
|
106
106
|
type: 'standard' | 'time-slots' | 'designation';
|
|
107
107
|
};
|
|
108
|
-
export type ExcIncDate = {
|
|
108
|
+
export declare type ExcIncDate = {
|
|
109
109
|
start: string;
|
|
110
110
|
end: string;
|
|
111
111
|
};
|
|
112
|
-
export type ScheduleFormData = {
|
|
112
|
+
export declare type ScheduleFormData = {
|
|
113
113
|
/** 颜色 */
|
|
114
114
|
color: string;
|
|
115
115
|
/** 日程名称 */
|
|
@@ -157,20 +157,20 @@ export type ScheduleFormData = {
|
|
|
157
157
|
start_time: any;
|
|
158
158
|
end_time: any;
|
|
159
159
|
};
|
|
160
|
-
export type CalendarDataItem = {
|
|
160
|
+
export declare type CalendarDataItem = {
|
|
161
161
|
date: string;
|
|
162
162
|
color: string[];
|
|
163
163
|
isExcluded: boolean;
|
|
164
164
|
schedule_ids?: number[];
|
|
165
165
|
[key: string]: any;
|
|
166
166
|
};
|
|
167
|
-
export type RequestData<Data> = {
|
|
167
|
+
export declare type RequestData<Data> = {
|
|
168
168
|
data: Data;
|
|
169
169
|
status: boolean;
|
|
170
170
|
message: string;
|
|
171
171
|
code: number;
|
|
172
172
|
};
|
|
173
|
-
export type ResponseListData<Data> = {
|
|
173
|
+
export declare type ResponseListData<Data> = {
|
|
174
174
|
status: boolean;
|
|
175
175
|
message: string;
|
|
176
176
|
code: number;
|
|
@@ -181,7 +181,7 @@ export type ResponseListData<Data> = {
|
|
|
181
181
|
skip: number;
|
|
182
182
|
};
|
|
183
183
|
};
|
|
184
|
-
export type ScheduleAllMap = Record<string, {
|
|
184
|
+
export declare type ScheduleAllMap = Record<string, {
|
|
185
185
|
minTime: dayjs.Dayjs | null;
|
|
186
186
|
maxTime: dayjs.Dayjs | null;
|
|
187
187
|
minTimeStr: string | null;
|
|
@@ -346,8 +346,7 @@ var calcCalendarDataByTimeSlots = (values, others, isGetRange) => {
|
|
|
346
346
|
time_slot
|
|
347
347
|
} = values;
|
|
348
348
|
const { endRadio, excludedStatus, includeStatus } = others;
|
|
349
|
-
if (!start_time)
|
|
350
|
-
return [];
|
|
349
|
+
if (!start_time) return [];
|
|
351
350
|
const start = (0, import_dayjs.default)(start_time);
|
|
352
351
|
const end = (0, import_dayjs.default)(start_time);
|
|
353
352
|
return processDateRange(
|
|
@@ -581,8 +580,7 @@ function getAllSortedDateRanges(schedules) {
|
|
|
581
580
|
}
|
|
582
581
|
let sortedDateRanges = allDateRanges.sort((a, b) => {
|
|
583
582
|
const startTimeCompare = (0, import_dayjs.default)(a.start).valueOf() - (0, import_dayjs.default)(b.start).valueOf();
|
|
584
|
-
if (startTimeCompare !== 0)
|
|
585
|
-
return startTimeCompare;
|
|
583
|
+
if (startTimeCompare !== 0) return startTimeCompare;
|
|
586
584
|
const durationA = (0, import_dayjs.default)(a.end).valueOf() - (0, import_dayjs.default)(a.start).valueOf();
|
|
587
585
|
const durationB = (0, import_dayjs.default)(b.end).valueOf() - (0, import_dayjs.default)(b.start).valueOf();
|
|
588
586
|
return durationA - durationB;
|