@pisell/pisellos 0.0.321 → 0.0.324
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/ProductList/index.js +2 -1
- package/dist/modules/Rules/types.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/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 +11 -9
- 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 +80 -69
- 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 +7 -4
- package/lib/modules/Resource/index.js +8 -12
- package/lib/modules/Rules/index.js +12 -17
- package/lib/modules/Rules/types.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/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 +70 -104
- package/lib/solution/BookingByStep/utils/capacity.js +10 -15
- 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 +206 -199
- package/lib/solution/Checkout/utils/index.js +18 -22
- package/lib/solution/ShopDiscount/index.js +15 -11
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- 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 +1 -1
|
@@ -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
|
|
@@ -40,7 +40,7 @@ var WalletPassPaymentImpl = class {
|
|
|
40
40
|
try {
|
|
41
41
|
this.paymentModule.core.effects.emit(hook, data);
|
|
42
42
|
} catch (error) {
|
|
43
|
-
this.paymentModule.logError("[WalletPass]
|
|
43
|
+
this.paymentModule.logError("[WalletPass] \u53D1\u9001\u4E8B\u4EF6\u5931\u8D25", error, { hook });
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
@@ -67,7 +67,7 @@ var WalletPassPaymentImpl = class {
|
|
|
67
67
|
payment_order_id
|
|
68
68
|
};
|
|
69
69
|
this.walletParams = walletParams;
|
|
70
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
70
|
+
this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u9ED8\u8BA4\u53C2\u6570\u5DF2\u751F\u6210\u5E76\u5B58\u50A8", {
|
|
71
71
|
customer_id: walletParams.customer_id,
|
|
72
72
|
order_expect_amount: walletParams.order_expect_amount,
|
|
73
73
|
order_product_amount: walletParams.order_product_amount,
|
|
@@ -89,7 +89,7 @@ var WalletPassPaymentImpl = class {
|
|
|
89
89
|
*/
|
|
90
90
|
clearStoredWalletParams() {
|
|
91
91
|
this.walletParams = null;
|
|
92
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
92
|
+
this.paymentModule.logInfo("[WalletPass] \u5DF2\u5B58\u50A8\u7684\u94B1\u5305\u53C2\u6570\u5DF2\u6E05\u7406");
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
95
|
* 从业务数据初始化钱包数据
|
|
@@ -109,7 +109,7 @@ var WalletPassPaymentImpl = class {
|
|
|
109
109
|
businessData,
|
|
110
110
|
startTime
|
|
111
111
|
});
|
|
112
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
112
|
+
this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E", {
|
|
113
113
|
customer_id: businessData.customer_id,
|
|
114
114
|
totalAmount: (_c = businessData.amountInfo) == null ? void 0 : _c.totalAmount,
|
|
115
115
|
subTotal: (_d = businessData.amountInfo) == null ? void 0 : _d.subTotal,
|
|
@@ -127,7 +127,7 @@ var WalletPassPaymentImpl = class {
|
|
|
127
127
|
endTime,
|
|
128
128
|
duration
|
|
129
129
|
});
|
|
130
|
-
this.paymentModule.logInfo(`[WalletPass]
|
|
130
|
+
this.paymentModule.logInfo(`[WalletPass] \u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u6210\u529F`, {
|
|
131
131
|
duration: `${duration}ms`,
|
|
132
132
|
walletRecommendList_count: ((_f = result.walletRecommendList) == null ? void 0 : _f.length) || 0,
|
|
133
133
|
userIdentificationCodes_count: ((_g = result.userIdentificationCodes) == null ? void 0 : _g.length) || 0
|
|
@@ -143,7 +143,7 @@ var WalletPassPaymentImpl = class {
|
|
|
143
143
|
endTime,
|
|
144
144
|
duration
|
|
145
145
|
});
|
|
146
|
-
this.paymentModule.logError(`[WalletPass]
|
|
146
|
+
this.paymentModule.logError(`[WalletPass] \u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u5931\u8D25`, error, {
|
|
147
147
|
duration: `${duration}ms`,
|
|
148
148
|
customer_id: businessData.customer_id,
|
|
149
149
|
totalAmount: (_h = businessData.amountInfo) == null ? void 0 : _h.totalAmount
|
|
@@ -171,7 +171,7 @@ var WalletPassPaymentImpl = class {
|
|
|
171
171
|
userIdentificationCodes
|
|
172
172
|
};
|
|
173
173
|
} catch (error) {
|
|
174
|
-
this.paymentModule.logError("[WalletPass]
|
|
174
|
+
this.paymentModule.logError("[WalletPass] \u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u5931\u8D25", error, {
|
|
175
175
|
customer_id: baseParams.customer_id,
|
|
176
176
|
order_expect_amount: baseParams.order_expect_amount
|
|
177
177
|
});
|
|
@@ -181,7 +181,7 @@ var WalletPassPaymentImpl = class {
|
|
|
181
181
|
async getWalletPassRecommendListAsync(params) {
|
|
182
182
|
var _a;
|
|
183
183
|
try {
|
|
184
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
184
|
+
this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u83B7\u53D6\u94B1\u5305\u63A8\u8350\u5217\u8868", {
|
|
185
185
|
customer_id: params.customer_id,
|
|
186
186
|
order_expect_amount: params.order_expect_amount,
|
|
187
187
|
sale_channel: params.sale_channel,
|
|
@@ -196,7 +196,7 @@ var WalletPassPaymentImpl = class {
|
|
|
196
196
|
this.emitEvent(import_types.WalletPassHooks.OnWalletRecommendListUpdated, {
|
|
197
197
|
walletRecommendList: this.walletRecommendList
|
|
198
198
|
});
|
|
199
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
199
|
+
this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u63A8\u8350\u5217\u8868\u5DF2\u66F4\u65B0", {
|
|
200
200
|
count: this.walletRecommendList.length,
|
|
201
201
|
items: this.walletRecommendList.map((item) => ({
|
|
202
202
|
voucher_id: item.voucher_id,
|
|
@@ -207,7 +207,7 @@ var WalletPassPaymentImpl = class {
|
|
|
207
207
|
});
|
|
208
208
|
return this.walletRecommendList;
|
|
209
209
|
} catch (error) {
|
|
210
|
-
this.paymentModule.logError("[WalletPass]
|
|
210
|
+
this.paymentModule.logError("[WalletPass] \u83B7\u53D6\u94B1\u5305\u63A8\u8350\u5217\u8868\u5931\u8D25", error, {
|
|
211
211
|
customer_id: params.customer_id,
|
|
212
212
|
order_expect_amount: params.order_expect_amount,
|
|
213
213
|
sale_channel: params.sale_channel
|
|
@@ -225,7 +225,7 @@ var WalletPassPaymentImpl = class {
|
|
|
225
225
|
...this.walletParams,
|
|
226
226
|
...params
|
|
227
227
|
};
|
|
228
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
228
|
+
this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u83B7\u53D6\u7528\u6237\u8BC6\u522B\u7801\u5217\u8868", {
|
|
229
229
|
customer_id: newParams.customer_id,
|
|
230
230
|
available: newParams.available,
|
|
231
231
|
prepare_payments_count: ((_a = newParams.prepare_payments) == null ? void 0 : _a.length) || 0,
|
|
@@ -241,7 +241,7 @@ var WalletPassPaymentImpl = class {
|
|
|
241
241
|
this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesUpdated, {
|
|
242
242
|
userIdentificationCodes: this.userIdentificationCodes
|
|
243
243
|
});
|
|
244
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
244
|
+
this.paymentModule.logInfo("[WalletPass] \u7528\u6237\u8BC6\u522B\u7801\u5217\u8868\u5DF2\u66F4\u65B0", {
|
|
245
245
|
count: this.userIdentificationCodes.length,
|
|
246
246
|
sorted_items: this.userIdentificationCodes.slice(0, 5).map((item) => ({
|
|
247
247
|
code: item.code,
|
|
@@ -251,7 +251,7 @@ var WalletPassPaymentImpl = class {
|
|
|
251
251
|
});
|
|
252
252
|
return this.userIdentificationCodes;
|
|
253
253
|
} catch (error) {
|
|
254
|
-
this.paymentModule.logError("[WalletPass]
|
|
254
|
+
this.paymentModule.logError("[WalletPass] \u83B7\u53D6\u7528\u6237\u8BC6\u522B\u7801\u5217\u8868\u5931\u8D25", error, {
|
|
255
255
|
customer_id: params.customer_id,
|
|
256
256
|
available: params.available
|
|
257
257
|
});
|
|
@@ -267,7 +267,7 @@ var WalletPassPaymentImpl = class {
|
|
|
267
267
|
async searchIdentificationCodeAsync(params, config = {}) {
|
|
268
268
|
try {
|
|
269
269
|
const { code } = params;
|
|
270
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
270
|
+
this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u641C\u7D22\u8BC6\u522B\u7801", {
|
|
271
271
|
code,
|
|
272
272
|
code_length: code.length,
|
|
273
273
|
noCache: config.noCache || false
|
|
@@ -279,7 +279,7 @@ var WalletPassPaymentImpl = class {
|
|
|
279
279
|
with_customer: 1,
|
|
280
280
|
with: ["wallet"]
|
|
281
281
|
};
|
|
282
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
282
|
+
this.paymentModule.logInfo("[WalletPass] \u641C\u7D22\u94B1\u5305\u8BC6\u522B\u7801", {
|
|
283
283
|
code,
|
|
284
284
|
with_customer: walletDetailParams.with_customer,
|
|
285
285
|
with: walletDetailParams.with
|
|
@@ -289,7 +289,7 @@ var WalletPassPaymentImpl = class {
|
|
|
289
289
|
walletDetailParams
|
|
290
290
|
);
|
|
291
291
|
const searchResults2 = (response2 == null ? void 0 : response2.data) || [];
|
|
292
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
292
|
+
this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u8BC6\u522B\u7801\u641C\u7D22\u5B8C\u6210", {
|
|
293
293
|
code,
|
|
294
294
|
results_count: searchResults2.length,
|
|
295
295
|
type: "walletCode"
|
|
@@ -315,7 +315,7 @@ var WalletPassPaymentImpl = class {
|
|
|
315
315
|
code: params.code,
|
|
316
316
|
payment_order_id: baseWalletParams == null ? void 0 : baseWalletParams.payment_order_id
|
|
317
317
|
};
|
|
318
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
318
|
+
this.paymentModule.logInfo("[WalletPass] \u641C\u7D22\u666E\u901A\u8BC6\u522B\u7801", {
|
|
319
319
|
code: searchParams.code,
|
|
320
320
|
customer_id: searchParams.customer_id,
|
|
321
321
|
order_expect_amount: searchParams.order_expect_amount,
|
|
@@ -348,7 +348,7 @@ var WalletPassPaymentImpl = class {
|
|
|
348
348
|
cachedSearchResults: [...this.searchResults],
|
|
349
349
|
searchParams: params
|
|
350
350
|
});
|
|
351
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
351
|
+
this.paymentModule.logInfo("[WalletPass] \u666E\u901A\u8BC6\u522B\u7801\u641C\u7D22\u5B8C\u6210", {
|
|
352
352
|
code: params.code,
|
|
353
353
|
results_count: searchResults.length,
|
|
354
354
|
cached_results_count: this.searchResults.length,
|
|
@@ -359,7 +359,7 @@ var WalletPassPaymentImpl = class {
|
|
|
359
359
|
data: searchResults
|
|
360
360
|
};
|
|
361
361
|
} catch (error) {
|
|
362
|
-
this.paymentModule.logError("[WalletPass]
|
|
362
|
+
this.paymentModule.logError("[WalletPass] \u641C\u7D22\u8BC6\u522B\u7801\u4FE1\u606F\u5931\u8D25", error, {
|
|
363
363
|
code: params.code,
|
|
364
364
|
customer_id: params.customer_id,
|
|
365
365
|
order_expect_amount: params.order_expect_amount
|
|
@@ -368,19 +368,19 @@ var WalletPassPaymentImpl = class {
|
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
370
|
async processWalletPayment(amount, orderUuid, voucherId) {
|
|
371
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
371
|
+
this.paymentModule.logInfo("[WalletPass] \u5F00\u59CB\u5904\u7406\u94B1\u5305\u652F\u4ED8", {
|
|
372
372
|
amount,
|
|
373
373
|
orderUuid,
|
|
374
374
|
voucherId: voucherId || "none"
|
|
375
375
|
});
|
|
376
376
|
const walletMethod = await this.paymentModule.getWalletPaymentMethod();
|
|
377
377
|
if (!walletMethod) {
|
|
378
|
-
this.paymentModule.logError("[WalletPass]
|
|
378
|
+
this.paymentModule.logError("[WalletPass] \u94B1\u5305\u652F\u4ED8\u65B9\u5F0F\u672A\u627E\u5230", null, {
|
|
379
379
|
amount,
|
|
380
380
|
orderUuid,
|
|
381
381
|
voucherId
|
|
382
382
|
});
|
|
383
|
-
throw new Error("
|
|
383
|
+
throw new Error("\u94B1\u5305\u652F\u4ED8\u65B9\u5F0F\u672A\u627E\u5230");
|
|
384
384
|
}
|
|
385
385
|
const paymentItem = {
|
|
386
386
|
amount: amount.toString(),
|
|
@@ -391,7 +391,7 @@ var WalletPassPaymentImpl = class {
|
|
|
391
391
|
voucher_id: voucherId || ""
|
|
392
392
|
};
|
|
393
393
|
await this.paymentModule.addPaymentItemAsync(orderUuid, paymentItem);
|
|
394
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
394
|
+
this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u652F\u4ED8\u5904\u7406\u5B8C\u6210", {
|
|
395
395
|
amount,
|
|
396
396
|
orderUuid,
|
|
397
397
|
voucherId: voucherId || "none",
|
|
@@ -421,7 +421,7 @@ var WalletPassPaymentImpl = class {
|
|
|
421
421
|
this.emitEvent(import_types.WalletPassHooks.OnWalletRecommendListCleared, {
|
|
422
422
|
clearedTypes: ["walletRecommendList"]
|
|
423
423
|
});
|
|
424
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
424
|
+
this.paymentModule.logInfo("[WalletPass] \u94B1\u5305\u63A8\u8350\u5217\u8868\u5DF2\u6E05\u9664");
|
|
425
425
|
}
|
|
426
426
|
/**
|
|
427
427
|
* 清除用户识别码列表
|
|
@@ -431,7 +431,7 @@ var WalletPassPaymentImpl = class {
|
|
|
431
431
|
this.emitEvent(import_types.WalletPassHooks.OnUserIdentificationCodesCleared, {
|
|
432
432
|
clearedTypes: ["userIdentificationCodes"]
|
|
433
433
|
});
|
|
434
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
434
|
+
this.paymentModule.logInfo("[WalletPass] \u7528\u6237\u8BC6\u522B\u7801\u5217\u8868\u5DF2\u6E05\u9664");
|
|
435
435
|
}
|
|
436
436
|
/**
|
|
437
437
|
* 获取缓存的搜索结果列表
|
|
@@ -450,7 +450,7 @@ var WalletPassPaymentImpl = class {
|
|
|
450
450
|
*/
|
|
451
451
|
clearSearchResults() {
|
|
452
452
|
this.searchResults = [];
|
|
453
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
453
|
+
this.paymentModule.logInfo("[WalletPass] \u641C\u7D22\u7ED3\u679C\u7F13\u5B58\u5DF2\u6E05\u9664");
|
|
454
454
|
}
|
|
455
455
|
/**
|
|
456
456
|
* 清除所有缓存数据
|
|
@@ -463,7 +463,7 @@ var WalletPassPaymentImpl = class {
|
|
|
463
463
|
this.emitEvent(import_types.WalletPassHooks.OnWalletCacheCleared, {
|
|
464
464
|
clearedTypes: ["all"]
|
|
465
465
|
});
|
|
466
|
-
this.paymentModule.logInfo("[WalletPass]
|
|
466
|
+
this.paymentModule.logInfo("[WalletPass] \u6240\u6709\u7F13\u5B58\u6570\u636E\u5DF2\u6E05\u9664", {
|
|
467
467
|
cleared_types: ["walletRecommendList", "userIdentificationCodes", "searchResults", "walletParams"]
|
|
468
468
|
});
|
|
469
469
|
}
|
|
@@ -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;
|
|
@@ -28,11 +28,13 @@ var import_types = require("./types");
|
|
|
28
28
|
var import_lodash_es = require("lodash-es");
|
|
29
29
|
__reExport(ProductList_exports, require("./types"), module.exports);
|
|
30
30
|
var ProductList = class extends import_BaseModule.BaseModule {
|
|
31
|
+
defaultName = "productList";
|
|
32
|
+
defaultVersion = "1.0.0";
|
|
33
|
+
store;
|
|
34
|
+
request;
|
|
35
|
+
otherParams = {};
|
|
31
36
|
constructor(name, version) {
|
|
32
37
|
super(name, version);
|
|
33
|
-
this.defaultName = "productList";
|
|
34
|
-
this.defaultVersion = "1.0.0";
|
|
35
|
-
this.otherParams = {};
|
|
36
38
|
}
|
|
37
39
|
async initialize(core, options) {
|
|
38
40
|
var _a;
|
|
@@ -98,7 +100,8 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
98
100
|
schedule_date,
|
|
99
101
|
with_schedule,
|
|
100
102
|
schedule_datetime,
|
|
101
|
-
application_code: (_b = this.otherParams) == null ? void 0 : _b.channel
|
|
103
|
+
application_code: (_b = this.otherParams) == null ? void 0 : _b.channel,
|
|
104
|
+
is_eject: 1
|
|
102
105
|
},
|
|
103
106
|
{ useCache: true }
|
|
104
107
|
);
|
|
@@ -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(import_types.ResourceHooks.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
|
|
@@ -39,10 +39,12 @@ var import_utils2 = require("../Cart/utils");
|
|
|
39
39
|
var import_decimal = __toESM(require("decimal.js"));
|
|
40
40
|
var import_lodash_es = require("lodash-es");
|
|
41
41
|
var RulesModule = class extends import_BaseModule.BaseModule {
|
|
42
|
+
defaultName = "rules";
|
|
43
|
+
defaultVersion = "1.0.0";
|
|
44
|
+
store;
|
|
45
|
+
hooks;
|
|
42
46
|
constructor(name, version) {
|
|
43
47
|
super(name, version);
|
|
44
|
-
this.defaultName = "rules";
|
|
45
|
-
this.defaultVersion = "1.0.0";
|
|
46
48
|
this.hooks = {};
|
|
47
49
|
}
|
|
48
50
|
async initialize(core, options) {
|
|
@@ -133,19 +135,15 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
133
135
|
});
|
|
134
136
|
const sortedDiscountList = [...filteredDiscountList].sort((a, b) => {
|
|
135
137
|
var _a, _b;
|
|
136
|
-
if (a.tag === "good_pass" && b.tag !== "good_pass")
|
|
137
|
-
|
|
138
|
-
if (b.tag === "good_pass" && a.tag !== "good_pass")
|
|
139
|
-
return 1;
|
|
138
|
+
if (a.tag === "good_pass" && b.tag !== "good_pass") return -1;
|
|
139
|
+
if (b.tag === "good_pass" && a.tag !== "good_pass") return 1;
|
|
140
140
|
if (a.tag === "good_pass" && b.tag === "good_pass") {
|
|
141
141
|
return compareByExpireTime(a, b);
|
|
142
142
|
} else if (a.tag === "product_discount_card" && b.tag === "product_discount_card") {
|
|
143
143
|
const typeA = ((_a = a.metadata) == null ? void 0 : _a.discount_card_type) || "percent";
|
|
144
144
|
const typeB = ((_b = b.metadata) == null ? void 0 : _b.discount_card_type) || "percent";
|
|
145
|
-
if (typeA === "fixed_amount" && typeB === "percent")
|
|
146
|
-
|
|
147
|
-
if (typeA === "percent" && typeB === "fixed_amount")
|
|
148
|
-
return 1;
|
|
145
|
+
if (typeA === "fixed_amount" && typeB === "percent") return -1;
|
|
146
|
+
if (typeA === "percent" && typeB === "fixed_amount") return 1;
|
|
149
147
|
if (typeA === "fixed_amount" && typeB === "fixed_amount") {
|
|
150
148
|
if (a.par_value !== b.par_value) {
|
|
151
149
|
const valueA = new import_decimal.default(a.par_value || 0);
|
|
@@ -238,16 +236,13 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
238
236
|
}
|
|
239
237
|
const applicableDiscounts = sortedDiscountList.filter((discount) => {
|
|
240
238
|
var _a2;
|
|
241
|
-
if ((Number(product.price) <= 0 || !product.price) && (discount.tag || discount.type) === "good_pass")
|
|
242
|
-
return false;
|
|
239
|
+
if ((Number(product.price) <= 0 || !product.price) && (discount.tag || discount.type) === "good_pass") return false;
|
|
243
240
|
if ((Number(product.total) <= 0 || !product.total) && !((_a2 = product.discount_list) == null ? void 0 : _a2.find((n) => {
|
|
244
241
|
var _a3;
|
|
245
242
|
return ((_a3 = n.discount) == null ? void 0 : _a3.resource_id) === discount.id;
|
|
246
|
-
})) && (discount.tag || discount.type) !== "good_pass")
|
|
247
|
-
return false;
|
|
243
|
+
})) && (discount.tag || discount.type) !== "good_pass") return false;
|
|
248
244
|
const targetUsedDiscounts = usedDiscounts.get(discount.id);
|
|
249
|
-
if (targetUsedDiscounts && (discount.tag || discount.type) === "good_pass")
|
|
250
|
-
return false;
|
|
245
|
+
if (targetUsedDiscounts && (discount.tag || discount.type) === "good_pass") return false;
|
|
251
246
|
const limitedData = discount.limited_relation_product_data;
|
|
252
247
|
if (limitedData.type === "product_all") {
|
|
253
248
|
return true;
|
|
@@ -490,7 +485,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
490
485
|
async destroy() {
|
|
491
486
|
this.core.effects.offByModuleDestroy(this.name);
|
|
492
487
|
await this.core.effects.emit(import_types.RulesHooks.OnDestroy, {});
|
|
493
|
-
console.log("[Rules]
|
|
488
|
+
console.log("[Rules] \u5DF2\u9500\u6BC1");
|
|
494
489
|
}
|
|
495
490
|
async clear() {
|
|
496
491
|
console.log("[Rules] clear");
|
|
@@ -42,19 +42,22 @@ var import_utils2 = require("./utils");
|
|
|
42
42
|
import_dayjs.default.extend(import_isSameOrBefore.default);
|
|
43
43
|
import_dayjs.default.extend(import_isSameOrAfter.default);
|
|
44
44
|
var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
45
|
+
defaultName = "schedule";
|
|
46
|
+
defaultVersion = "1.0.0";
|
|
47
|
+
request;
|
|
48
|
+
store = {};
|
|
49
|
+
cacheId;
|
|
50
|
+
openCache = false;
|
|
51
|
+
fatherModule;
|
|
45
52
|
constructor(name, version) {
|
|
46
53
|
super(name, version);
|
|
47
|
-
this.defaultName = "schedule";
|
|
48
|
-
this.defaultVersion = "1.0.0";
|
|
49
|
-
this.store = {};
|
|
50
|
-
this.openCache = false;
|
|
51
54
|
}
|
|
52
55
|
async initialize(core, options) {
|
|
53
56
|
var _a, _b;
|
|
54
57
|
this.core = core;
|
|
55
58
|
this.request = core.getPlugin("request");
|
|
56
59
|
if (!this.request) {
|
|
57
|
-
throw new Error("ScheduleModule
|
|
60
|
+
throw new Error("ScheduleModule \u9700\u8981 request \u63D2\u4EF6\u652F\u6301");
|
|
58
61
|
}
|
|
59
62
|
this.store = options == null ? void 0 : options.store;
|
|
60
63
|
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;
|
|
@@ -24,11 +24,14 @@ __export(Step_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(Step_exports);
|
|
25
25
|
var import_BaseModule = require("../BaseModule");
|
|
26
26
|
var StepModule = class extends import_BaseModule.BaseModule {
|
|
27
|
+
defaultName = "step";
|
|
28
|
+
defaultVersion = "1.0.0";
|
|
29
|
+
store;
|
|
30
|
+
cacheId;
|
|
31
|
+
openCache = false;
|
|
32
|
+
fatherModule;
|
|
27
33
|
constructor(name, version) {
|
|
28
34
|
super(name, version);
|
|
29
|
-
this.defaultName = "step";
|
|
30
|
-
this.defaultVersion = "1.0.0";
|
|
31
|
-
this.openCache = false;
|
|
32
35
|
}
|
|
33
36
|
async initialize(core, options) {
|
|
34
37
|
var _a, _b;
|
|
@@ -113,7 +116,7 @@ var StepModule = class extends import_BaseModule.BaseModule {
|
|
|
113
116
|
let stepList = this.store.stepList;
|
|
114
117
|
const index = stepList.findIndex((n) => n.key === step.key);
|
|
115
118
|
if (index !== -1) {
|
|
116
|
-
console.log("[StepModule]
|
|
119
|
+
console.log("[StepModule] \u6B65\u9AA4\u5DF2\u5B58\u5728\uFF0C\u6DFB\u52A0\u5931\u8D25");
|
|
117
120
|
return;
|
|
118
121
|
}
|
|
119
122
|
if (key) {
|
|
@@ -25,11 +25,16 @@ module.exports = __toCommonJS(Summary_exports);
|
|
|
25
25
|
var import_BaseModule = require("../BaseModule");
|
|
26
26
|
var import_utils = require("./utils");
|
|
27
27
|
var SummaryModule = class extends import_BaseModule.BaseModule {
|
|
28
|
+
defaultName = "summary";
|
|
29
|
+
defaultVersion = "1.0.0";
|
|
30
|
+
shopStore;
|
|
31
|
+
store;
|
|
32
|
+
request;
|
|
33
|
+
cacheId;
|
|
34
|
+
openCache = false;
|
|
35
|
+
fatherModule;
|
|
28
36
|
constructor(name, version) {
|
|
29
37
|
super(name, version);
|
|
30
|
-
this.defaultName = "summary";
|
|
31
|
-
this.defaultVersion = "1.0.0";
|
|
32
|
-
this.openCache = false;
|
|
33
38
|
}
|
|
34
39
|
async initialize(core, options) {
|
|
35
40
|
var _a, _b;
|
|
@@ -48,7 +53,7 @@ var SummaryModule = class extends import_BaseModule.BaseModule {
|
|
|
48
53
|
this.fatherModule = options.otherParams.fatherModule;
|
|
49
54
|
}
|
|
50
55
|
if (!this.shopStore) {
|
|
51
|
-
throw new Error("SummaryModule
|
|
56
|
+
throw new Error("SummaryModule \u9700\u8981 shopStore \u63D2\u4EF6\u652F\u6301");
|
|
52
57
|
}
|
|
53
58
|
}
|
|
54
59
|
async getSummary(cartItems) {
|