@pisell/pisellos 0.0.567 → 0.0.568
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.js +6 -9
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/example.js +3 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +0 -3
- package/dist/model/strategy/strategy-example.js +5 -19
- package/dist/modules/Cart/index.js +0 -3
- package/dist/modules/Cart/utils/cartProduct.js +0 -1
- package/dist/modules/Date/index.js +1 -5
- package/dist/modules/Discount/index.js +1 -4
- package/dist/modules/OpenData/index.js +0 -2
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +14 -41
- package/dist/modules/Payment/index.js +142 -270
- package/dist/modules/Payment/walletpass.js +4 -5
- package/dist/modules/Rules/index.js +0 -7
- package/dist/modules/Schedule/utils.js +0 -1
- package/dist/modules/Step/index.js +0 -1
- package/dist/plugins/request.js +1 -4
- package/dist/plugins/window.js +2 -6
- package/dist/server/index.js +88 -121
- package/dist/server/modules/menu/index.js +32 -41
- package/dist/server/modules/products/index.js +29 -49
- package/dist/server/modules/quotation/index.js +29 -38
- package/dist/server/modules/resource/index.js +3 -4
- package/dist/server/modules/schedule/index.js +32 -40
- package/dist/server/utils/product.js +0 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +7 -59
- package/dist/solution/BookingByStep/utils/capacity.js +1 -11
- package/dist/solution/BookingByStep/utils/resources.js +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +5 -7
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
- package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
- package/dist/solution/BuyTickets/index.js +9 -12
- package/dist/solution/Checkout/index.js +177 -246
- package/dist/solution/Checkout/utils/index.js +4 -16
- package/dist/solution/RegisterAndLogin/index.js +30 -76
- package/dist/solution/ScanOrder/index.js +50 -60
- package/dist/solution/ShopDiscount/index.js +2 -7
- package/dist/solution/VenueBooking/index.d.ts +5 -0
- package/dist/solution/VenueBooking/index.js +364 -327
- package/dist/utils/task.js +15 -18
- package/dist/utils/watch.js +0 -1
- package/lib/apis/picoding.js +2 -0
- package/lib/core/index.js +130 -131
- package/lib/effects/index.js +46 -57
- package/lib/index.js +92 -53
- package/lib/model/index.js +14 -21
- package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
- package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
- package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
- package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
- package/lib/model/strategy/adapter/index.js +100 -64
- package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
- package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
- package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
- package/lib/model/strategy/adapter/itemRule/index.js +83 -57
- package/lib/model/strategy/adapter/itemRule/type.js +97 -36
- package/lib/model/strategy/adapter/promotion/adapter.js +84 -63
- package/lib/model/strategy/adapter/promotion/evaluator.js +381 -231
- package/lib/model/strategy/adapter/promotion/examples.js +139 -159
- package/lib/model/strategy/adapter/promotion/index.js +1 -49
- package/lib/model/strategy/adapter/promotion/type.js +199 -35
- package/lib/model/strategy/adapter/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -152
- package/lib/model/strategy/adapter/walletPass/example.js +217 -190
- package/lib/model/strategy/adapter/walletPass/index.js +75 -51
- package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
- package/lib/model/strategy/adapter/walletPass/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/utils.js +652 -402
- package/lib/model/strategy/engine.js +270 -168
- package/lib/model/strategy/index.js +49 -34
- package/lib/model/strategy/strategy-example.js +243 -239
- package/lib/model/strategy/type.js +100 -40
- package/lib/modules/Account/index.js +39 -53
- package/lib/modules/Account/types.js +20 -33
- package/lib/modules/AccountList/index.js +116 -154
- package/lib/modules/AccountList/types.js +30 -31
- package/lib/modules/AccountList/utils.js +18 -30
- package/lib/modules/BaseModule.js +22 -45
- package/lib/modules/Cart/index.js +170 -124
- package/lib/modules/Cart/types.js +46 -51
- package/lib/modules/Cart/utils/cartAccount.js +40 -39
- package/lib/modules/Cart/utils/cartDate.js +56 -61
- package/lib/modules/Cart/utils/cartDiscount.js +28 -33
- package/lib/modules/Cart/utils/cartNote.js +27 -32
- package/lib/modules/Cart/utils/cartProduct.js +306 -241
- package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
- package/lib/modules/Cart/utils/cartResource.js +72 -78
- package/lib/modules/Cart/utils/changePrice.js +26 -62
- package/lib/modules/Cart/utils/index.js +106 -48
- package/lib/modules/Customer/constants.js +13 -34
- package/lib/modules/Customer/index.js +216 -153
- package/lib/modules/Customer/types.js +38 -35
- package/lib/modules/Date/index.js +116 -115
- package/lib/modules/Date/types.js +16 -28
- package/lib/modules/Date/utils.js +174 -123
- package/lib/modules/Discount/index.js +117 -113
- package/lib/modules/Discount/types.js +9 -31
- package/lib/modules/Guests/index.js +30 -56
- package/lib/modules/Guests/types.js +23 -33
- package/lib/modules/Holder/index.js +209 -189
- package/lib/modules/Holder/types.js +4 -16
- package/lib/modules/Holder/utils.js +20 -49
- package/lib/modules/OpenData/index.js +63 -74
- package/lib/modules/OpenData/types.js +4 -16
- package/lib/modules/OpenData/utils.js +44 -78
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +332 -320
- package/lib/modules/Order/types.js +24 -33
- package/lib/modules/Order/utils.js +350 -284
- package/lib/modules/Payment/cash.js +20 -33
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
- package/lib/modules/Payment/eftpos.js +16 -30
- package/lib/modules/Payment/index.js +566 -432
- package/lib/modules/Payment/mx51.js +1 -0
- package/lib/modules/Payment/types.js +216 -107
- package/lib/modules/Payment/utils.js +50 -47
- package/lib/modules/Payment/walletpass.js +221 -203
- package/lib/modules/Product/index.js +51 -46
- package/lib/modules/Product/types.js +4 -16
- package/lib/modules/Product/utils.js +32 -33
- package/lib/modules/ProductList/index.js +111 -110
- package/lib/modules/ProductList/types.js +9 -31
- package/lib/modules/Quotation/index.js +60 -82
- package/lib/modules/Quotation/types.js +4 -16
- package/lib/modules/Resource/index.js +27 -59
- package/lib/modules/Resource/types.js +22 -32
- package/lib/modules/Resource/utils.js +30 -38
- package/lib/modules/Rules/index.js +1172 -872
- package/lib/modules/Rules/types.js +17 -40
- package/lib/modules/SalesSummary/index.js +59 -68
- package/lib/modules/SalesSummary/types.js +4 -16
- package/lib/modules/SalesSummary/utils.js +176 -193
- package/lib/modules/ScanOrderLogger/index.js +59 -79
- package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
- package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
- package/lib/modules/ScanOrderLogger/types.js +4 -16
- package/lib/modules/Schedule/getDateIsInSchedule.js +334 -167
- package/lib/modules/Schedule/index.js +97 -107
- package/lib/modules/Schedule/type.js +4 -16
- package/lib/modules/Schedule/types.js +4 -16
- package/lib/modules/Schedule/utils.js +433 -291
- package/lib/modules/Step/index.js +40 -52
- package/lib/modules/Step/tyeps.js +4 -16
- package/lib/modules/Summary/index.js +66 -70
- package/lib/modules/Summary/types.js +4 -16
- package/lib/modules/Summary/utils.js +782 -429
- package/lib/modules/index.js +212 -57
- package/lib/plugins/app.js +4 -16
- package/lib/plugins/index.js +36 -25
- package/lib/plugins/request.js +137 -126
- package/lib/plugins/shopStore.js +4 -16
- package/lib/plugins/user.js +4 -16
- package/lib/plugins/window.js +171 -179
- package/lib/server/index.js +882 -623
- package/lib/server/modules/index.js +85 -59
- package/lib/server/modules/menu/index.js +146 -122
- package/lib/server/modules/menu/types.js +18 -31
- package/lib/server/modules/order/index.js +195 -231
- package/lib/server/modules/order/types.js +107 -32
- package/lib/server/modules/order/utils/filterBookings.js +174 -140
- package/lib/server/modules/order/utils/filterOrders.js +89 -60
- package/lib/server/modules/products/index.js +430 -335
- package/lib/server/modules/products/types.js +41 -34
- package/lib/server/modules/quotation/index.js +76 -77
- package/lib/server/modules/quotation/types.js +21 -31
- package/lib/server/modules/resource/index.js +216 -187
- package/lib/server/modules/resource/types.js +42 -33
- package/lib/server/modules/schedule/index.js +134 -119
- package/lib/server/modules/schedule/types.js +14 -21
- package/lib/server/modules/schedule/utils.js +334 -163
- package/lib/server/types.js +4 -16
- package/lib/server/utils/index.js +25 -23
- package/lib/server/utils/product.js +196 -139
- package/lib/server/utils/schedule.js +34 -41
- package/lib/server/utils/time.js +40 -49
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1530 -1343
- package/lib/solution/BookingByStep/types.js +40 -99
- package/lib/solution/BookingByStep/utils/capacity.js +192 -160
- package/lib/solution/BookingByStep/utils/products.js +42 -52
- package/lib/solution/BookingByStep/utils/resources.js +527 -330
- package/lib/solution/BookingByStep/utils/stock.js +65 -44
- package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +147 -122
- package/lib/solution/BookingTicket/types.js +38 -64
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +64 -80
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +82 -80
- package/lib/solution/BookingTicket/utils/scan/index.js +90 -94
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
- package/lib/solution/BuyTickets/index.js +67 -70
- package/lib/solution/BuyTickets/types.js +22 -38
- package/lib/solution/Checkout/index.js +1451 -1158
- package/lib/solution/Checkout/types.js +91 -61
- package/lib/solution/Checkout/utils/index.js +227 -158
- package/lib/solution/PlaceOrder/index.js +55 -0
- package/lib/solution/RegisterAndLogin/config.js +493 -460
- package/lib/solution/RegisterAndLogin/index.js +633 -630
- package/lib/solution/RegisterAndLogin/types.js +189 -76
- package/lib/solution/RegisterAndLogin/utils.js +183 -125
- package/lib/solution/Sales/index.js +218 -200
- package/lib/solution/Sales/types.js +27 -33
- package/lib/solution/ScanOrder/index.js +803 -840
- package/lib/solution/ScanOrder/types.js +34 -34
- package/lib/solution/ScanOrder/utils.js +372 -331
- package/lib/solution/ShopDiscount/index.js +230 -236
- package/lib/solution/ShopDiscount/types.js +15 -37
- package/lib/solution/ShopDiscount/utils.js +309 -172
- package/lib/solution/VenueBooking/index.d.ts +5 -0
- package/lib/solution/VenueBooking/index.js +886 -929
- package/lib/solution/VenueBooking/types.js +20 -40
- package/lib/solution/VenueBooking/utils/dateSummary.js +22 -54
- package/lib/solution/VenueBooking/utils/resource.js +31 -54
- package/lib/solution/VenueBooking/utils/slotMerge.js +88 -106
- package/lib/solution/VenueBooking/utils/smartPricing.js +112 -100
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -132
- package/lib/solution/VenueBooking/utils.js +130 -67
- package/lib/solution/index.js +102 -37
- package/lib/store/createStore.js +32 -29
- package/lib/types/index.js +4 -16
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +81 -47
- package/package.json +2 -1
|
@@ -155,9 +155,7 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
155
155
|
app = appPlugin.getApp();
|
|
156
156
|
this.dbManager = app.dbManager;
|
|
157
157
|
this.logger = app.logger;
|
|
158
|
-
if (this.dbManager) {
|
|
159
|
-
console.log('[Schedule] IndexDB Manager 已初始化');
|
|
160
|
-
} else {
|
|
158
|
+
if (this.dbManager) {} else {
|
|
161
159
|
console.warn('[Schedule] IndexDB Manager 未找到');
|
|
162
160
|
}
|
|
163
161
|
}
|
|
@@ -308,7 +306,6 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
308
306
|
} finally {
|
|
309
307
|
_iterator2.f();
|
|
310
308
|
}
|
|
311
|
-
console.log("[Schedule] Map \u7F13\u5B58\u5DF2\u540C\u6B65\uFF0C\u5171 ".concat(this.store.map.size, " \u4E2A\u65E5\u7A0B"));
|
|
312
309
|
}
|
|
313
310
|
|
|
314
311
|
/**
|
|
@@ -329,32 +326,31 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
329
326
|
this.store.map.clear();
|
|
330
327
|
// 同时清空 IndexDB 中的数据
|
|
331
328
|
if (!this.dbManager) {
|
|
332
|
-
_context3.next =
|
|
329
|
+
_context3.next = 15;
|
|
333
330
|
break;
|
|
334
331
|
}
|
|
335
332
|
_context3.prev = 4;
|
|
336
333
|
_context3.next = 7;
|
|
337
334
|
return this.dbManager.clear(INDEXDB_STORE_NAME);
|
|
338
335
|
case 7:
|
|
339
|
-
console.log('[Schedule] IndexDB 缓存已清空');
|
|
340
336
|
this.logInfo('IndexDB 缓存已清空');
|
|
341
|
-
_context3.next =
|
|
337
|
+
_context3.next = 15;
|
|
342
338
|
break;
|
|
343
|
-
case
|
|
344
|
-
_context3.prev =
|
|
339
|
+
case 10:
|
|
340
|
+
_context3.prev = 10;
|
|
345
341
|
_context3.t0 = _context3["catch"](4);
|
|
346
342
|
errorMessage = _context3.t0 instanceof Error ? _context3.t0.message : String(_context3.t0);
|
|
347
343
|
console.error('[Schedule] 清空 IndexDB 缓存失败:', _context3.t0);
|
|
348
344
|
this.logError('清空 IndexDB 缓存失败', {
|
|
349
345
|
error: errorMessage
|
|
350
346
|
});
|
|
351
|
-
case
|
|
347
|
+
case 15:
|
|
352
348
|
this.logInfo('缓存清空完成');
|
|
353
|
-
case
|
|
349
|
+
case 16:
|
|
354
350
|
case "end":
|
|
355
351
|
return _context3.stop();
|
|
356
352
|
}
|
|
357
|
-
}, _callee3, this, [[4,
|
|
353
|
+
}, _callee3, this, [[4, 10]]);
|
|
358
354
|
}));
|
|
359
355
|
function clear() {
|
|
360
356
|
return _clear.apply(this, arguments);
|
|
@@ -472,14 +468,13 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
472
468
|
_context5.next = 10;
|
|
473
469
|
return Promise.all(savePromises);
|
|
474
470
|
case 10:
|
|
475
|
-
console.log("[Schedule] \u5DF2\u5C06 ".concat(scheduleList.length, " \u6761\u65E5\u7A0B\u6570\u636E\u4FDD\u5B58\u5230 IndexDB"));
|
|
476
471
|
this.logInfo('日程数据已保存到 IndexDB', {
|
|
477
472
|
scheduleCount: scheduleList.length
|
|
478
473
|
});
|
|
479
|
-
_context5.next =
|
|
474
|
+
_context5.next = 18;
|
|
480
475
|
break;
|
|
481
|
-
case
|
|
482
|
-
_context5.prev =
|
|
476
|
+
case 13:
|
|
477
|
+
_context5.prev = 13;
|
|
483
478
|
_context5.t0 = _context5["catch"](4);
|
|
484
479
|
errorMessage = _context5.t0 instanceof Error ? _context5.t0.message : String(_context5.t0);
|
|
485
480
|
console.error('[Schedule] 保存数据到 IndexDB 失败:', _context5.t0);
|
|
@@ -487,11 +482,11 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
487
482
|
scheduleCount: scheduleList.length,
|
|
488
483
|
error: errorMessage
|
|
489
484
|
});
|
|
490
|
-
case
|
|
485
|
+
case 18:
|
|
491
486
|
case "end":
|
|
492
487
|
return _context5.stop();
|
|
493
488
|
}
|
|
494
|
-
}, _callee5, this, [[4,
|
|
489
|
+
}, _callee5, this, [[4, 13]]);
|
|
495
490
|
}));
|
|
496
491
|
function saveScheduleToIndexDB(_x3) {
|
|
497
492
|
return _saveScheduleToIndexDB.apply(this, arguments);
|
|
@@ -511,19 +506,17 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
511
506
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
512
507
|
while (1) switch (_context6.prev = _context6.next) {
|
|
513
508
|
case 0:
|
|
514
|
-
console.log('[Schedule] 开始预加载数据...');
|
|
515
509
|
startTime = Date.now();
|
|
516
510
|
this.logInfo('开始预加载数据');
|
|
517
|
-
_context6.prev =
|
|
518
|
-
_context6.next =
|
|
511
|
+
_context6.prev = 2;
|
|
512
|
+
_context6.next = 5;
|
|
519
513
|
return this.loadScheduleFromIndexDB();
|
|
520
|
-
case
|
|
514
|
+
case 5:
|
|
521
515
|
cachedData = _context6.sent;
|
|
522
516
|
if (!(cachedData && cachedData.length > 0)) {
|
|
523
|
-
_context6.next =
|
|
517
|
+
_context6.next = 12;
|
|
524
518
|
break;
|
|
525
519
|
}
|
|
526
|
-
console.log("[Schedule] \u4ECE IndexDB \u52A0\u8F7D\u4E86 ".concat(cachedData.length, " \u6761\u65E5\u7A0B\u6570\u636E"));
|
|
527
520
|
// 将缓存数据放入 store
|
|
528
521
|
this.store.scheduleList = cloneDeep(cachedData);
|
|
529
522
|
// 同步更新 Map 缓存
|
|
@@ -535,31 +528,30 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
535
528
|
source: 'IndexDB'
|
|
536
529
|
});
|
|
537
530
|
return _context6.abrupt("return");
|
|
538
|
-
case
|
|
539
|
-
console.log('[Schedule] IndexDB 中没有缓存数据,从服务器加载...');
|
|
531
|
+
case 12:
|
|
540
532
|
this.logInfo('IndexDB 中没有缓存数据,准备从服务器加载');
|
|
541
|
-
_context6.next =
|
|
533
|
+
_context6.next = 20;
|
|
542
534
|
break;
|
|
543
|
-
case
|
|
544
|
-
_context6.prev =
|
|
545
|
-
_context6.t0 = _context6["catch"](
|
|
535
|
+
case 15:
|
|
536
|
+
_context6.prev = 15;
|
|
537
|
+
_context6.t0 = _context6["catch"](2);
|
|
546
538
|
errorMessage = _context6.t0 instanceof Error ? _context6.t0.message : String(_context6.t0);
|
|
547
539
|
console.warn('[Schedule] 从 IndexDB 加载数据失败:', _context6.t0);
|
|
548
540
|
this.logWarning('从 IndexDB 加载数据失败,准备从服务器加载', {
|
|
549
541
|
error: errorMessage
|
|
550
542
|
});
|
|
551
|
-
case
|
|
552
|
-
_context6.next =
|
|
543
|
+
case 20:
|
|
544
|
+
_context6.next = 22;
|
|
553
545
|
return this.loadAllSchedule();
|
|
554
|
-
case
|
|
546
|
+
case 22:
|
|
555
547
|
scheduleList = _context6.sent;
|
|
556
548
|
if (!(scheduleList && scheduleList.length > 0)) {
|
|
557
|
-
_context6.next =
|
|
549
|
+
_context6.next = 32;
|
|
558
550
|
break;
|
|
559
551
|
}
|
|
560
|
-
_context6.next =
|
|
552
|
+
_context6.next = 26;
|
|
561
553
|
return this.saveScheduleToIndexDB(scheduleList);
|
|
562
|
-
case
|
|
554
|
+
case 26:
|
|
563
555
|
this.store.scheduleList = cloneDeep(scheduleList);
|
|
564
556
|
// 同步更新 Map 缓存
|
|
565
557
|
this.syncScheduleMap();
|
|
@@ -569,18 +561,18 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
569
561
|
duration: "".concat(_duration2, "ms"),
|
|
570
562
|
source: 'Server'
|
|
571
563
|
});
|
|
572
|
-
_context6.next =
|
|
564
|
+
_context6.next = 34;
|
|
573
565
|
break;
|
|
574
|
-
case
|
|
566
|
+
case 32:
|
|
575
567
|
_duration3 = Date.now() - startTime;
|
|
576
568
|
this.logWarning('预加载完成但未获取到数据', {
|
|
577
569
|
duration: "".concat(_duration3, "ms")
|
|
578
570
|
});
|
|
579
|
-
case
|
|
571
|
+
case 34:
|
|
580
572
|
case "end":
|
|
581
573
|
return _context6.stop();
|
|
582
574
|
}
|
|
583
|
-
}, _callee6, this, [[
|
|
575
|
+
}, _callee6, this, [[2, 15]]);
|
|
584
576
|
}));
|
|
585
577
|
function preload() {
|
|
586
578
|
return _preload.apply(this, arguments);
|
|
@@ -82,7 +82,6 @@ function buildPriceIndexMap(priceData) {
|
|
|
82
82
|
export function applyPriceDataToProducts(products, priceData) {
|
|
83
83
|
var t0 = performance.now();
|
|
84
84
|
if (!priceData || priceData.length === 0) {
|
|
85
|
-
console.log('[applyPriceDataToProducts] 没有价格数据,返回原商品');
|
|
86
85
|
return products;
|
|
87
86
|
}
|
|
88
87
|
var t1 = performance.now();
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 | 2 | 1 | 3 |
|
|
329
|
+
weekNum: 0 | 2 | 1 | 3 | 5 | 4 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -87,23 +87,22 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
87
87
|
this.core = core;
|
|
88
88
|
this.store = options.store || {};
|
|
89
89
|
this.otherParams = options.otherParams || {};
|
|
90
|
-
console.log('[BookingByStep] 初始化完成');
|
|
91
90
|
// 获取依赖的插件
|
|
92
91
|
this.request = core.getPlugin('request');
|
|
93
92
|
this.window = core.getPlugin('window');
|
|
94
93
|
this.shopStore = core.getPlugin('shopStore');
|
|
95
94
|
if (this.request) {
|
|
96
|
-
_context.next =
|
|
95
|
+
_context.next = 8;
|
|
97
96
|
break;
|
|
98
97
|
}
|
|
99
98
|
throw new Error('bookingByStep解决方案需要 request 插件支持');
|
|
100
|
-
case
|
|
99
|
+
case 8:
|
|
101
100
|
if (this.shopStore) {
|
|
102
|
-
_context.next =
|
|
101
|
+
_context.next = 10;
|
|
103
102
|
break;
|
|
104
103
|
}
|
|
105
104
|
throw new Error('SummaryModule 需要 shopStore 插件支持');
|
|
106
|
-
case
|
|
105
|
+
case 10:
|
|
107
106
|
// 如果有传 cacheid,默认需要收集上面这些模块里用户操作选中的数据
|
|
108
107
|
// 并且在上面 registerModule 的时候,读取 sessionStroage 里的数据,塞进默认值
|
|
109
108
|
targetCacheData = {};
|
|
@@ -138,7 +137,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
138
137
|
});
|
|
139
138
|
this.store.schedule.loadAllSchedule();
|
|
140
139
|
this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
141
|
-
case
|
|
140
|
+
case 18:
|
|
142
141
|
case "end":
|
|
143
142
|
return _context.stop();
|
|
144
143
|
}
|
|
@@ -3190,8 +3189,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3190
3189
|
key: "findCommonAvailableTimeSlots",
|
|
3191
3190
|
value: function findCommonAvailableTimeSlots(resources) {
|
|
3192
3191
|
if (resources.length === 0) return [];
|
|
3193
|
-
console.log("\u8BA1\u7B97 ".concat(resources.length, " \u4E2A\u8D44\u6E90\u7684\u516C\u5171\u65F6\u95F4\u6BB5"));
|
|
3194
|
-
|
|
3195
3192
|
// 收集所有资源的时间段,转换为统一的时间格式
|
|
3196
3193
|
var allTimeSlots = resources.map(function (resource) {
|
|
3197
3194
|
return resource.times.map(function (time) {
|
|
@@ -3201,19 +3198,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3201
3198
|
};
|
|
3202
3199
|
});
|
|
3203
3200
|
});
|
|
3204
|
-
console.log('所有资源的时间段:', allTimeSlots.map(function (slots) {
|
|
3205
|
-
return slots.map(function (slot) {
|
|
3206
|
-
return "".concat(slot.start.format('HH:mm'), "-").concat(slot.end.format('HH:mm'));
|
|
3207
|
-
});
|
|
3208
|
-
}));
|
|
3209
|
-
|
|
3210
3201
|
// 找到公共时间段的交集
|
|
3211
3202
|
var commonSlots = allTimeSlots[0]; // 从第一个资源的时间段开始
|
|
3212
|
-
console.log('初始公共时间段:', commonSlots.map(function (slot) {
|
|
3213
|
-
return "".concat(slot.start.format('HH:mm'), "-").concat(slot.end.format('HH:mm'));
|
|
3214
|
-
}));
|
|
3215
|
-
|
|
3216
|
-
// 与其他资源的时间段求交集
|
|
3217
3203
|
var _loop3 = function _loop3() {
|
|
3218
3204
|
var currentResourceSlots = allTimeSlots[i];
|
|
3219
3205
|
var intersections = [];
|
|
@@ -3234,14 +3220,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3234
3220
|
});
|
|
3235
3221
|
});
|
|
3236
3222
|
if (intersections.length === 0) {
|
|
3237
|
-
console.log("\u8D44\u6E90".concat(i, "\u4E0E\u5F53\u524D\u516C\u5171\u65F6\u95F4\u6BB5\u65E0\u4EA4\u96C6\uFF0C\u8DF3\u8FC7\u8BE5\u8D44\u6E90"));
|
|
3238
3223
|
return 1; // continue
|
|
3239
3224
|
}
|
|
3240
3225
|
commonSlots = intersections;
|
|
3241
|
-
console.log("\u4E0E\u8D44\u6E90".concat(i, "\u6C42\u4EA4\u96C6\u540E\u7684\u516C\u5171\u65F6\u95F4\u6BB5:"), commonSlots.map(function (slot) {
|
|
3242
|
-
return "".concat(slot.start.format('HH:mm'), "-").concat(slot.end.format('HH:mm'));
|
|
3243
|
-
}));
|
|
3244
3226
|
};
|
|
3227
|
+
// 与其他资源的时间段求交集
|
|
3245
3228
|
for (var i = 1; i < allTimeSlots.length; i++) {
|
|
3246
3229
|
if (_loop3()) continue;
|
|
3247
3230
|
}
|
|
@@ -3253,7 +3236,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3253
3236
|
endTime: slot.end.format('HH:mm')
|
|
3254
3237
|
};
|
|
3255
3238
|
});
|
|
3256
|
-
console.log('最终公共时间段:', result);
|
|
3257
3239
|
return result;
|
|
3258
3240
|
}
|
|
3259
3241
|
}, {
|
|
@@ -3363,7 +3345,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3363
3345
|
// 获取该资源类型对应的 form_id
|
|
3364
3346
|
var targetFormId = resourceCodeToFormIdMap[resourceCode];
|
|
3365
3347
|
if (!targetFormId) {
|
|
3366
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u627E\u4E0D\u5230\u5BF9\u5E94\u7684 form_id"));
|
|
3367
3348
|
return {
|
|
3368
3349
|
v: {
|
|
3369
3350
|
success: false,
|
|
@@ -3390,7 +3371,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3390
3371
|
});
|
|
3391
3372
|
});
|
|
3392
3373
|
if (resourcesOfThisType.length === 0) {
|
|
3393
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u6CA1\u6709\u627E\u5230\u53EF\u7528\u8D44\u6E90"));
|
|
3394
3374
|
return {
|
|
3395
3375
|
v: {
|
|
3396
3376
|
success: false,
|
|
@@ -3457,24 +3437,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3457
3437
|
// 检查是否有容量问题
|
|
3458
3438
|
if (requiredAmount > totalAvailable) {
|
|
3459
3439
|
hasCapacityIssue = true;
|
|
3460
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " ").concat(isMultipleBooking ? '容量' : '资源数量', "\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredAmount, ", \u603B\u5171 ").concat(totalAvailable));
|
|
3461
3440
|
}
|
|
3462
3441
|
|
|
3463
3442
|
// 为通过检测的商品分配一个公共可用时间段
|
|
3464
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u7684\u8D44\u6E90\u65F6\u95F4\u4FE1\u606F:"), resourcesOfThisType.map(function (r) {
|
|
3465
|
-
return {
|
|
3466
|
-
id: r.id,
|
|
3467
|
-
times: r.times.map(function (t) {
|
|
3468
|
-
return "".concat(t.start_at, " - ").concat(t.end_at);
|
|
3469
|
-
})
|
|
3470
|
-
};
|
|
3471
|
-
}));
|
|
3472
3443
|
|
|
3473
3444
|
// 找到所有资源都可用的时间段
|
|
3474
3445
|
var commonTimeSlots = _this16.findCommonAvailableTimeSlots(resourcesOfThisType);
|
|
3475
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u7684\u516C\u5171\u65F6\u95F4\u6BB5:"), commonTimeSlots);
|
|
3476
3446
|
if (commonTimeSlots.length === 0) {
|
|
3477
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u6CA1\u6709\u516C\u5171\u53EF\u7528\u65F6\u95F4\u6BB5"));
|
|
3478
3447
|
return {
|
|
3479
3448
|
v: {
|
|
3480
3449
|
success: false,
|
|
@@ -3485,7 +3454,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3485
3454
|
|
|
3486
3455
|
// 使用第一个公共可用时间段,但只处理未处理过的商品
|
|
3487
3456
|
var firstCommonSlot = commonTimeSlots[0];
|
|
3488
|
-
console.log("\u4F7F\u7528\u516C\u5171\u65F6\u95F4\u6BB5: ".concat(firstCommonSlot.startTime, " - ").concat(firstCommonSlot.endTime));
|
|
3489
3457
|
items.forEach(function (cartItem) {
|
|
3490
3458
|
// 只处理未处理过的商品,避免重复添加
|
|
3491
3459
|
if (!processedCartItemIds.has(cartItem._id)) {
|
|
@@ -3796,7 +3764,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3796
3764
|
// 获取该资源类型对应的 form_id
|
|
3797
3765
|
var targetFormId = resourceCodeToFormIdMap[resourceCode];
|
|
3798
3766
|
if (!targetFormId) {
|
|
3799
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u627E\u4E0D\u5230\u5BF9\u5E94\u7684 form_id"));
|
|
3800
3767
|
return {
|
|
3801
3768
|
v: {
|
|
3802
3769
|
success: false,
|
|
@@ -3823,7 +3790,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3823
3790
|
});
|
|
3824
3791
|
});
|
|
3825
3792
|
if (resourcesOfThisType.length === 0) {
|
|
3826
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u6CA1\u6709\u627E\u5230\u53EF\u7528\u8D44\u6E90"));
|
|
3827
3793
|
return {
|
|
3828
3794
|
v: {
|
|
3829
3795
|
success: false,
|
|
@@ -3890,24 +3856,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3890
3856
|
// 检查是否有容量问题
|
|
3891
3857
|
if (requiredAmount > totalAvailable) {
|
|
3892
3858
|
hasCapacityIssue = true;
|
|
3893
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " ").concat(isMultipleBooking ? '容量' : '资源数量', "\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredAmount, ", \u603B\u5171 ").concat(totalAvailable));
|
|
3894
3859
|
}
|
|
3895
3860
|
|
|
3896
3861
|
// 为通过检测的商品分配一个公共可用时间段
|
|
3897
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u7684\u8D44\u6E90\u65F6\u95F4\u4FE1\u606F:"), resourcesOfThisType.map(function (r) {
|
|
3898
|
-
return {
|
|
3899
|
-
id: r.id,
|
|
3900
|
-
times: r.times.map(function (t) {
|
|
3901
|
-
return "".concat(t.start_at, " - ").concat(t.end_at);
|
|
3902
|
-
})
|
|
3903
|
-
};
|
|
3904
|
-
}));
|
|
3905
3862
|
|
|
3906
3863
|
// 找到所有资源都可用的时间段
|
|
3907
3864
|
var commonTimeSlots = _this17.findCommonAvailableTimeSlots(resourcesOfThisType);
|
|
3908
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u7684\u516C\u5171\u65F6\u95F4\u6BB5:"), commonTimeSlots);
|
|
3909
3865
|
if (commonTimeSlots.length === 0) {
|
|
3910
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u6CA1\u6709\u516C\u5171\u53EF\u7528\u65F6\u95F4\u6BB5"));
|
|
3911
3866
|
return {
|
|
3912
3867
|
v: {
|
|
3913
3868
|
success: false,
|
|
@@ -3918,7 +3873,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3918
3873
|
|
|
3919
3874
|
// 使用第一个公共可用时间段,但只处理未处理过的商品
|
|
3920
3875
|
var firstCommonSlot = commonTimeSlots[0];
|
|
3921
|
-
console.log("\u4F7F\u7528\u516C\u5171\u65F6\u95F4\u6BB5: ".concat(firstCommonSlot.startTime, " - ").concat(firstCommonSlot.endTime));
|
|
3922
3876
|
items.forEach(function (cartItem) {
|
|
3923
3877
|
// 只处理未处理过的商品,避免重复添加
|
|
3924
3878
|
if (!processedCartItemIds.has(cartItem._id)) {
|
|
@@ -4228,12 +4182,6 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4228
4182
|
while (1) switch (_context29.prev = _context29.next) {
|
|
4229
4183
|
case 0:
|
|
4230
4184
|
startDate = _ref16.startDate, endDate = _ref16.endDate, scheduleIds = _ref16.scheduleIds, resources = _ref16.resources;
|
|
4231
|
-
console.log('appoimentBooking-session-date-getTimeslotsScheduleByDateRange', {
|
|
4232
|
-
startDate: startDate,
|
|
4233
|
-
endDate: endDate,
|
|
4234
|
-
scheduleIds: scheduleIds,
|
|
4235
|
-
resources: resources
|
|
4236
|
-
});
|
|
4237
4185
|
// 生成日期范围内的所有日期
|
|
4238
4186
|
dates = [];
|
|
4239
4187
|
currentDate = dayjs(startDate);
|
|
@@ -4253,7 +4201,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4253
4201
|
});
|
|
4254
4202
|
}
|
|
4255
4203
|
return _context29.abrupt("return", results);
|
|
4256
|
-
case
|
|
4204
|
+
case 8:
|
|
4257
4205
|
case "end":
|
|
4258
4206
|
return _context29.stop();
|
|
4259
4207
|
}
|
|
@@ -293,7 +293,7 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
|
|
|
293
293
|
|
|
294
294
|
// 检查每种资源类型是否有足够的容量
|
|
295
295
|
var _loop = function _loop() {
|
|
296
|
-
var _resourceTypeConfig
|
|
296
|
+
var _resourceTypeConfig;
|
|
297
297
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
298
298
|
formId = _Object$entries$_i[0],
|
|
299
299
|
requiredCapacity = _Object$entries$_i[1];
|
|
@@ -324,12 +324,6 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
|
|
|
324
324
|
_iterator2.f();
|
|
325
325
|
}
|
|
326
326
|
var isMultipleBooking = ((_resourceTypeConfig = resourceTypeConfig) === null || _resourceTypeConfig === void 0 ? void 0 : _resourceTypeConfig.type) === 'multiple';
|
|
327
|
-
console.log("capacity.ts - \u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u914D\u7F6E:"), {
|
|
328
|
-
resourceTypeConfig: resourceTypeConfig,
|
|
329
|
-
type: (_resourceTypeConfig2 = resourceTypeConfig) === null || _resourceTypeConfig2 === void 0 ? void 0 : _resourceTypeConfig2.type,
|
|
330
|
-
isMultipleBooking: isMultipleBooking,
|
|
331
|
-
requiredCapacity: requiredCapacity
|
|
332
|
-
});
|
|
333
327
|
if (isMultipleBooking) {
|
|
334
328
|
// 多个预约:计算总可用容量
|
|
335
329
|
var totalAvailableCapacity = 0;
|
|
@@ -343,9 +337,7 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
|
|
|
343
337
|
totalAvailableCapacity += resource.capacity || 0;
|
|
344
338
|
}
|
|
345
339
|
});
|
|
346
|
-
console.log("capacity.ts - \u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u591A\u4E2A\u9884\u7EA6\u68C0\u67E5: \u603B\u5BB9\u91CF ").concat(totalAvailableCapacity, ", \u9700\u6C42 ").concat(requiredCapacity));
|
|
347
340
|
if (totalAvailableCapacity < requiredCapacity) {
|
|
348
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u5BB9\u91CF\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredCapacity, ", \u53EF\u7528 ").concat(totalAvailableCapacity));
|
|
349
341
|
return {
|
|
350
342
|
v: {
|
|
351
343
|
success: false,
|
|
@@ -366,9 +358,7 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
|
|
|
366
358
|
availableResourceCount++;
|
|
367
359
|
}
|
|
368
360
|
});
|
|
369
|
-
console.log("capacity.ts - \u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u5355\u4E2A\u9884\u7EA6\u68C0\u67E5: \u53EF\u7528\u8D44\u6E90\u6570 ").concat(availableResourceCount, ", \u9700\u6C42 ").concat(requiredCapacity));
|
|
370
361
|
if (availableResourceCount < requiredCapacity) {
|
|
371
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u6570\u91CF\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredCapacity, ", \u53EF\u7528 ").concat(availableResourceCount));
|
|
372
362
|
return {
|
|
373
363
|
v: {
|
|
374
364
|
success: false,
|
|
@@ -101,13 +101,6 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
101
101
|
var isTargetDayToday = targetDay.isSame(currentTime, 'day');
|
|
102
102
|
var fastestTime = null;
|
|
103
103
|
var fastestResources = [];
|
|
104
|
-
console.log('[TimeslotUtils] 查找最快可用资源:', {
|
|
105
|
-
currentTime: currentTime.format('YYYY-MM-DD HH:mm:ss'),
|
|
106
|
-
resourceCount: resources.length,
|
|
107
|
-
currentCapacity: currentCapacity,
|
|
108
|
-
countMap: countMap
|
|
109
|
-
});
|
|
110
|
-
|
|
111
104
|
// 遍历所有资源,找到最快可用的时间点
|
|
112
105
|
var _iterator2 = _createForOfIteratorHelper(resources),
|
|
113
106
|
_step2;
|
|
@@ -122,28 +115,21 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
122
115
|
return dayjs(time.end_at).isAfter(currentTime);
|
|
123
116
|
});
|
|
124
117
|
if (targetDayTimes.length === 0) {
|
|
125
|
-
console.log("[TimeslotUtils] \u8D44\u6E90 ".concat(_resource.id, "(").concat(_resource.main_field, ") \u4ECA\u65E5\u65E0\u53EF\u7528\u65F6\u95F4\u6BB5"));
|
|
126
118
|
continue;
|
|
127
119
|
}
|
|
128
120
|
var _iterator4 = _createForOfIteratorHelper(targetDayTimes),
|
|
129
121
|
_step4;
|
|
130
122
|
try {
|
|
131
123
|
var _loop = function _loop() {
|
|
132
|
-
var _time$event_list
|
|
124
|
+
var _time$event_list;
|
|
133
125
|
var time = _step4.value;
|
|
134
126
|
var workStartTime = dayjs(time.start_at);
|
|
135
127
|
var workEndTime = dayjs(time.end_at);
|
|
136
128
|
|
|
137
129
|
// 确定检查的起始时间(当前时间 vs 工作开始时间)
|
|
138
130
|
var nextAvailableTime = isTargetDayToday && currentTime.isAfter(workStartTime) ? currentTime : workStartTime;
|
|
139
|
-
console.log("[TimeslotUtils] \u68C0\u67E5\u8D44\u6E90 ".concat(_resource.id, "(").concat(_resource.main_field, "):"), {
|
|
140
|
-
workTime: "".concat(workStartTime.format('HH:mm'), "-").concat(workEndTime.format('HH:mm')),
|
|
141
|
-
checkStartTime: nextAvailableTime.format('HH:mm:ss'),
|
|
142
|
-
eventCount: ((_time$event_list = time.event_list) === null || _time$event_list === void 0 ? void 0 : _time$event_list.length) || 0
|
|
143
|
-
});
|
|
144
|
-
|
|
145
131
|
// 获取所有影响的预约事件(当前时间之后的)
|
|
146
|
-
var relevantEvents = ((_time$
|
|
132
|
+
var relevantEvents = ((_time$event_list = time.event_list) === null || _time$event_list === void 0 ? void 0 : _time$event_list.filter(function (event) {
|
|
147
133
|
var eventEnd = dayjs(event.end_at);
|
|
148
134
|
return eventEnd.isAfter(nextAvailableTime);
|
|
149
135
|
})) || [];
|
|
@@ -162,20 +148,12 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
162
148
|
var _event = _step5.value;
|
|
163
149
|
var _eventStart = dayjs(_event.start_at);
|
|
164
150
|
var _eventEnd = dayjs(_event.end_at);
|
|
165
|
-
console.log("[TimeslotUtils] \u68C0\u67E5\u4E8B\u4EF6\u51B2\u7A81:", {
|
|
166
|
-
resourceId: _resource.id,
|
|
167
|
-
eventTime: "".concat(_eventStart.format('HH:mm'), "-").concat(_eventEnd.format('HH:mm')),
|
|
168
|
-
checkTime: finalAvailableTime.format('HH:mm:ss'),
|
|
169
|
-
pax: _event.pax || 1
|
|
170
|
-
});
|
|
171
|
-
|
|
172
151
|
// 检查资源类型和容量
|
|
173
152
|
if (_resource.resourceType === 'single' || (_resource.capacity || 1) === 1) {
|
|
174
153
|
// 单人预约资源:检查时间冲突
|
|
175
154
|
if (finalAvailableTime.isBefore(_eventEnd) && _eventStart.isBefore(finalAvailableTime.add(resolvedDuration, 'minute'))) {
|
|
176
155
|
// 有冲突,使用事件结束时间
|
|
177
156
|
finalAvailableTime = _eventEnd;
|
|
178
|
-
console.log("[TimeslotUtils] \u53D1\u73B0\u65F6\u95F4\u51B2\u7A81\uFF0C\u8C03\u6574\u5230: ".concat(finalAvailableTime.format('HH:mm:ss')));
|
|
179
157
|
}
|
|
180
158
|
} else {
|
|
181
159
|
// 多人预约资源:检查容量
|
|
@@ -189,7 +167,6 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
189
167
|
if (totalRequiredCapacity > totalCapacity) {
|
|
190
168
|
// 容量不足,使用事件结束时间
|
|
191
169
|
finalAvailableTime = _eventEnd;
|
|
192
|
-
console.log("[TimeslotUtils] \u5BB9\u91CF\u4E0D\u8DB3\uFF0C\u8C03\u6574\u5230: ".concat(finalAvailableTime.format('HH:mm:ss')));
|
|
193
170
|
}
|
|
194
171
|
}
|
|
195
172
|
}
|
|
@@ -202,19 +179,14 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
202
179
|
_iterator5.f();
|
|
203
180
|
}
|
|
204
181
|
if (finalAvailableTime.add(resolvedDuration, 'minute').isAfter(workEndTime)) {
|
|
205
|
-
console.log("[TimeslotUtils] \u8D44\u6E90 ".concat(_resource.id, " \u53EF\u7528\u65F6\u95F4\u8D85\u51FA\u5DE5\u4F5C\u65F6\u95F4\uFF0C\u8DF3\u8FC7"));
|
|
206
182
|
return 0; // continue
|
|
207
183
|
}
|
|
208
|
-
console.log("[TimeslotUtils] \u8D44\u6E90 ".concat(_resource.id, "(").concat(_resource.main_field, ") \u6700\u5FEB\u53EF\u7528\u65F6\u95F4: ").concat(finalAvailableTime.format('HH:mm:ss')));
|
|
209
|
-
|
|
210
184
|
// 更新最快可用时间和资源
|
|
211
185
|
if (!fastestTime || finalAvailableTime.isBefore(fastestTime)) {
|
|
212
186
|
fastestTime = finalAvailableTime;
|
|
213
187
|
fastestResources = [_resource];
|
|
214
|
-
console.log("[TimeslotUtils] \u66F4\u65B0\u6700\u5FEB\u65F6\u95F4: ".concat(fastestTime.format('HH:mm:ss'), ", \u8D44\u6E90: ").concat(_resource.main_field));
|
|
215
188
|
} else if (finalAvailableTime.isSame(fastestTime)) {
|
|
216
189
|
fastestResources.push(_resource);
|
|
217
|
-
console.log("[TimeslotUtils] \u6DFB\u52A0\u76F8\u540C\u65F6\u95F4\u8D44\u6E90: ".concat(_resource.main_field));
|
|
218
190
|
}
|
|
219
191
|
return 1; // break
|
|
220
192
|
// 每个资源只需要计算一次
|
|
@@ -239,21 +211,16 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
239
211
|
_iterator2.f();
|
|
240
212
|
}
|
|
241
213
|
if (!fastestTime || fastestResources.length === 0) {
|
|
242
|
-
console.log('[TimeslotUtils] 未找到可用资源');
|
|
243
214
|
return null;
|
|
244
215
|
}
|
|
245
|
-
console.log("[TimeslotUtils] \u627E\u5230 ".concat(fastestResources.length, " \u4E2A\u6700\u5FEB\u53EF\u7528\u8D44\u6E90\uFF0C\u65F6\u95F4: ").concat(fastestTime.format('HH:mm:ss')));
|
|
246
|
-
|
|
247
216
|
// 如果只有一个最快可用的资源,直接返回
|
|
248
217
|
if (fastestResources.length === 1) {
|
|
249
|
-
console.log("[TimeslotUtils] \u8FD4\u56DE\u552F\u4E00\u6700\u5FEB\u8D44\u6E90: ".concat(fastestResources[0].main_field));
|
|
250
218
|
return fastestResources[0];
|
|
251
219
|
}
|
|
252
220
|
|
|
253
221
|
// 如果有多个最快可用的资源,选择空闲时间最长的资源
|
|
254
222
|
var selectedResource = fastestResources[0];
|
|
255
223
|
var maxIdleTime = 0;
|
|
256
|
-
console.log("[TimeslotUtils] \u6BD4\u8F83 ".concat(fastestResources.length, " \u4E2A\u8D44\u6E90\u7684\u7A7A\u95F2\u65F6\u95F4:"));
|
|
257
224
|
for (var _i2 = 0, _fastestResources = fastestResources; _i2 < _fastestResources.length; _i2++) {
|
|
258
225
|
var _workingTime$event_li;
|
|
259
226
|
var resource = _fastestResources[_i2];
|
|
@@ -291,19 +258,11 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
291
258
|
} finally {
|
|
292
259
|
_iterator3.f();
|
|
293
260
|
}
|
|
294
|
-
console.log("[TimeslotUtils] \u8D44\u6E90 ".concat(resource.id, "(").concat(resource.main_field, "):"), {
|
|
295
|
-
工作结束时间: workEndTime.format('HH:mm'),
|
|
296
|
-
总工作时长: workEndTime.diff(fastestTime, 'minute') + '分钟',
|
|
297
|
-
预约占用时长: workEndTime.diff(fastestTime, 'minute') - totalIdleTime + '分钟',
|
|
298
|
-
实际空闲时长: totalIdleTime + '分钟'
|
|
299
|
-
});
|
|
300
261
|
if (totalIdleTime > maxIdleTime) {
|
|
301
262
|
maxIdleTime = totalIdleTime;
|
|
302
263
|
selectedResource = resource;
|
|
303
|
-
console.log("[TimeslotUtils] \u66F4\u65B0\u6700\u4F73\u9009\u62E9: ".concat(resource.main_field, " (\u7A7A\u95F2").concat(totalIdleTime, "\u5206\u949F)"));
|
|
304
264
|
}
|
|
305
265
|
}
|
|
306
|
-
console.log("[TimeslotUtils] \u6700\u7EC8\u9009\u62E9\u8D44\u6E90: ".concat(selectedResource.main_field, " (\u6700\u957F\u7A7A\u95F2").concat(maxIdleTime, "\u5206\u949F)"));
|
|
307
266
|
return selectedResource;
|
|
308
267
|
}
|
|
309
268
|
|
|
@@ -131,7 +131,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
131
131
|
* 获取当前的客户搜索条件
|
|
132
132
|
* @returns 当前搜索条件
|
|
133
133
|
*/
|
|
134
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
134
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
135
135
|
/**
|
|
136
136
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
137
137
|
* @returns 客户状态
|
|
@@ -61,24 +61,22 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
61
61
|
this.core = core;
|
|
62
62
|
this.store = options.store || {};
|
|
63
63
|
this.otherParams = options.otherParams || {};
|
|
64
|
-
console.log('[BookingTicket] 初始化完成');
|
|
65
|
-
|
|
66
64
|
// 获取依赖的插件
|
|
67
65
|
this.request = core.getPlugin('request');
|
|
68
66
|
this.window = core.getPlugin('window');
|
|
69
67
|
this.shopStore = core.getPlugin('shopStore');
|
|
70
68
|
if (this.request) {
|
|
71
|
-
_context.next =
|
|
69
|
+
_context.next = 8;
|
|
72
70
|
break;
|
|
73
71
|
}
|
|
74
72
|
throw new Error('bookingTicket解决方案需要 request 插件支持');
|
|
75
|
-
case
|
|
73
|
+
case 8:
|
|
76
74
|
if (this.shopStore) {
|
|
77
|
-
_context.next =
|
|
75
|
+
_context.next = 10;
|
|
78
76
|
break;
|
|
79
77
|
}
|
|
80
78
|
throw new Error('bookingTicket解决方案需要 shopStore 插件支持');
|
|
81
|
-
case
|
|
79
|
+
case 10:
|
|
82
80
|
// 如果有传 cacheid,默认需要收集上面这些模块里用户操作选中的数据
|
|
83
81
|
targetCacheData = {};
|
|
84
82
|
this.cacheId = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.cacheId;
|
|
@@ -110,7 +108,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
110
108
|
}
|
|
111
109
|
});
|
|
112
110
|
this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
113
|
-
case
|
|
111
|
+
case 18:
|
|
114
112
|
case "end":
|
|
115
113
|
return _context.stop();
|
|
116
114
|
}
|