@pisell/pisellos 0.0.569 → 0.10.2
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 +10 -6
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -3
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +7 -5
- package/dist/model/strategy/adapter/walletPass/example.js +26 -3
- package/dist/model/strategy/adapter/walletPass/index.js +5 -5
- package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +17 -92
- package/dist/model/strategy/strategy-example.js +19 -5
- package/dist/modules/BaseModule.d.ts +1 -1
- package/dist/modules/BaseModule.js +8 -10
- package/dist/modules/Cart/index.js +3 -0
- package/dist/modules/Cart/utils/cartProduct.js +1 -0
- package/dist/modules/Cart/utils/cartResource.js +0 -2
- package/dist/modules/Cart/utils/changePrice.js +9 -16
- package/dist/modules/Date/index.js +5 -1
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +7 -22
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.js +2 -0
- package/dist/modules/Order/index.js +70 -40
- package/dist/modules/Payment/index.js +162 -97
- package/dist/modules/Payment/types.d.ts +4 -8
- package/dist/modules/Payment/walletpass.d.ts +0 -2
- package/dist/modules/Payment/walletpass.js +5 -4
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +3 -12
- package/dist/modules/ProductList/types.d.ts +0 -1
- package/dist/modules/Rules/index.js +126 -427
- package/dist/modules/SalesSummary/utils.js +1 -2
- package/dist/modules/Schedule/getDateIsInSchedule.js +0 -5
- package/dist/modules/Schedule/index.js +1 -0
- package/dist/modules/Schedule/utils.js +1 -0
- package/dist/modules/Step/index.js +1 -0
- package/dist/modules/Summary/utils.js +22 -43
- package/dist/plugins/request.js +4 -1
- package/dist/plugins/window.js +6 -2
- package/dist/server/index.js +129 -97
- package/dist/server/modules/menu/index.js +41 -32
- package/dist/server/modules/order/index.js +4 -2
- package/dist/server/modules/products/index.js +42 -24
- package/dist/server/modules/quotation/index.js +38 -29
- package/dist/server/modules/resource/index.js +4 -3
- package/dist/server/modules/schedule/index.js +35 -27
- package/dist/server/utils/product.js +1 -0
- package/dist/solution/BaseSales/index.js +41 -38
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +60 -11
- package/dist/solution/BookingByStep/utils/capacity.js +11 -1
- package/dist/solution/BookingByStep/utils/resources.js +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +43 -2
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +2 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +7 -6
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +31 -25
- package/dist/solution/BookingTicket/utils/scan/index.js +10 -6
- package/dist/solution/BuyTickets/index.js +12 -9
- package/dist/solution/Checkout/index.js +252 -177
- package/dist/solution/Checkout/utils/index.js +16 -4
- package/dist/solution/RegisterAndLogin/index.js +76 -30
- package/dist/solution/ScanOrder/index.js +60 -50
- package/dist/solution/ShopDiscount/index.js +14 -15
- package/dist/solution/ShopDiscount/types.d.ts +4 -5
- package/dist/solution/ShopDiscount/utils.d.ts +0 -9
- package/dist/solution/ShopDiscount/utils.js +0 -9
- package/dist/solution/VenueBooking/index.d.ts +3 -31
- package/dist/solution/VenueBooking/index.js +496 -651
- package/dist/solution/VenueBooking/types.d.ts +1 -3
- package/dist/solution/VenueBooking/types.js +0 -1
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/dist/solution/VenueBooking/utils/dateSummary.js +25 -12
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/dist/solution/VenueBooking/utils/timeSlot.js +4 -9
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/task.js +18 -15
- package/dist/utils/watch.js +1 -0
- package/lib/apis/picoding.js +0 -2
- package/lib/core/index.js +132 -130
- package/lib/effects/index.js +57 -46
- package/lib/index.d.ts +0 -1
- package/lib/index.js +50 -92
- package/lib/model/index.js +21 -14
- package/lib/model/strategy/adapter/dataVariant/adapter.js +50 -38
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +236 -162
- package/lib/model/strategy/adapter/dataVariant/examples.js +237 -229
- package/lib/model/strategy/adapter/dataVariant/index.js +34 -39
- package/lib/model/strategy/adapter/dataVariant/type.js +28 -57
- package/lib/model/strategy/adapter/index.js +64 -100
- package/lib/model/strategy/adapter/itemRule/adapter.js +144 -156
- package/lib/model/strategy/adapter/itemRule/evaluator.js +48 -36
- package/lib/model/strategy/adapter/itemRule/examples.js +225 -295
- package/lib/model/strategy/adapter/itemRule/index.js +57 -83
- package/lib/model/strategy/adapter/itemRule/type.js +36 -97
- package/lib/model/strategy/adapter/promotion/adapter.js +63 -84
- package/lib/model/strategy/adapter/promotion/evaluator.js +231 -381
- package/lib/model/strategy/adapter/promotion/examples.js +159 -139
- package/lib/model/strategy/adapter/promotion/index.js +49 -1
- package/lib/model/strategy/adapter/promotion/type.js +35 -199
- package/lib/model/strategy/adapter/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/evaluator.js +152 -180
- package/lib/model/strategy/adapter/walletPass/example.js +190 -217
- package/lib/model/strategy/adapter/walletPass/index.js +51 -75
- package/lib/model/strategy/adapter/walletPass/locales.js +58 -36
- package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/lib/model/strategy/adapter/walletPass/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/lib/model/strategy/adapter/walletPass/utils.js +383 -678
- package/lib/model/strategy/engine.js +168 -270
- package/lib/model/strategy/index.js +34 -49
- package/lib/model/strategy/strategy-example.js +239 -243
- package/lib/model/strategy/type.js +40 -100
- package/lib/modules/Account/index.js +53 -39
- package/lib/modules/Account/types.js +33 -20
- package/lib/modules/AccountList/index.js +154 -116
- package/lib/modules/AccountList/types.js +31 -30
- package/lib/modules/AccountList/utils.js +30 -18
- package/lib/modules/BaseModule.d.ts +1 -1
- package/lib/modules/BaseModule.js +46 -25
- package/lib/modules/BookingContext/index.js +136 -158
- package/lib/modules/BookingContext/types.js +32 -46
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +143 -131
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +82 -75
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +150 -170
- package/lib/modules/BookingContext/utils/flexible.js +55 -38
- package/lib/modules/BookingContext/utils/formatResourceList.js +34 -19
- package/lib/modules/BookingContext/utils/index.js +41 -124
- package/lib/modules/BookingContext/utils/noResource.js +70 -58
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +41 -14
- package/lib/modules/BookingContext/utils/productExtend.js +155 -202
- package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
- package/lib/modules/BookingContext/utils/resourceSelection.js +41 -19
- package/lib/modules/BookingContext/utils/resources.js +167 -209
- package/lib/modules/BookingContext/utils/serviceTimes.js +116 -115
- package/lib/modules/BookingContext/utils/timeSlices.js +80 -70
- package/lib/modules/Cart/index.js +124 -170
- package/lib/modules/Cart/types.js +51 -46
- package/lib/modules/Cart/utils/cartAccount.js +39 -40
- package/lib/modules/Cart/utils/cartDate.js +61 -56
- package/lib/modules/Cart/utils/cartDiscount.js +33 -28
- package/lib/modules/Cart/utils/cartNote.js +32 -27
- package/lib/modules/Cart/utils/cartProduct.js +251 -321
- package/lib/modules/Cart/utils/cartRelationForms.js +35 -29
- package/lib/modules/Cart/utils/cartResource.js +78 -72
- package/lib/modules/Cart/utils/changePrice.js +50 -28
- package/lib/modules/Cart/utils/index.js +48 -106
- package/lib/modules/Customer/constants.js +34 -13
- package/lib/modules/Customer/index.js +169 -232
- package/lib/modules/Customer/types.js +35 -38
- package/lib/modules/Date/index.js +115 -116
- package/lib/modules/Date/types.js +28 -16
- package/lib/modules/Date/utils.js +123 -174
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +128 -130
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/Discount/types.js +31 -9
- package/lib/modules/Guests/index.js +56 -30
- package/lib/modules/Guests/types.js +33 -23
- package/lib/modules/Holder/index.js +189 -209
- package/lib/modules/Holder/types.js +16 -4
- package/lib/modules/Holder/utils.js +49 -20
- package/lib/modules/OpenData/index.js +76 -69
- package/lib/modules/OpenData/types.js +16 -4
- package/lib/modules/OpenData/utils.js +78 -44
- package/lib/modules/Order/index.js +1909 -1572
- package/lib/modules/Order/types.js +35 -78
- package/lib/modules/Order/utils/bundleDiscountHydration.js +74 -41
- package/lib/modules/Order/utils/manualProductDiscount.js +123 -124
- package/lib/modules/Order/utils/orderCollectionIdentity.js +210 -148
- package/lib/modules/Order/utils.js +634 -799
- package/lib/modules/Payment/cash.js +33 -20
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +76 -145
- package/lib/modules/Payment/eftpos.js +30 -16
- package/lib/modules/Payment/index.js +378 -518
- package/lib/modules/Payment/mx51.js +0 -1
- package/lib/modules/Payment/types.d.ts +4 -8
- package/lib/modules/Payment/types.js +107 -216
- package/lib/modules/Payment/utils.js +48 -51
- package/lib/modules/Payment/walletpass.d.ts +0 -2
- package/lib/modules/Payment/walletpass.js +211 -226
- package/lib/modules/Product/index.js +46 -51
- package/lib/modules/Product/types.js +16 -4
- package/lib/modules/Product/utils.js +33 -32
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +117 -117
- package/lib/modules/ProductList/types.d.ts +0 -1
- package/lib/modules/ProductList/types.js +31 -9
- package/lib/modules/Quotation/index.js +100 -66
- package/lib/modules/Quotation/types.js +16 -4
- package/lib/modules/Resource/index.js +59 -27
- package/lib/modules/Resource/types.js +32 -22
- package/lib/modules/Resource/utils.js +38 -30
- package/lib/modules/ResourcePlanner/index.js +61 -60
- package/lib/modules/ResourcePlanner/planner.js +384 -346
- package/lib/modules/ResourcePlanner/types.js +16 -4
- package/lib/modules/Rules/index.js +903 -1475
- package/lib/modules/Rules/types.js +40 -17
- package/lib/modules/SalesSummary/index.js +90 -85
- package/lib/modules/SalesSummary/types.js +16 -4
- package/lib/modules/SalesSummary/utils.js +427 -351
- package/lib/modules/ScanOrderLogger/index.js +79 -59
- package/lib/modules/ScanOrderLogger/providers/feishu.js +78 -54
- package/lib/modules/ScanOrderLogger/providers/grafana.js +36 -13
- package/lib/modules/ScanOrderLogger/types.js +16 -4
- package/lib/modules/Schedule/getDateIsInSchedule.js +163 -339
- package/lib/modules/Schedule/index.js +114 -100
- package/lib/modules/Schedule/type.js +16 -4
- package/lib/modules/Schedule/types.js +16 -4
- package/lib/modules/Schedule/utils.js +291 -433
- package/lib/modules/Step/index.js +52 -40
- package/lib/modules/Step/tyeps.js +16 -4
- package/lib/modules/Summary/index.js +71 -66
- package/lib/modules/Summary/types.js +16 -4
- package/lib/modules/Summary/utils.js +418 -791
- package/lib/modules/SurchargeList/index.js +60 -46
- package/lib/modules/SurchargeList/types.js +16 -4
- package/lib/modules/index.js +63 -245
- package/lib/plugins/app.js +16 -4
- package/lib/plugins/index.js +25 -36
- package/lib/plugins/request.js +126 -137
- package/lib/plugins/shopStore.js +16 -4
- package/lib/plugins/user.js +16 -4
- package/lib/plugins/window.js +179 -171
- package/lib/server/index.js +2337 -2675
- package/lib/server/modules/floor-plan/index.js +123 -102
- package/lib/server/modules/floor-plan/types.js +30 -15
- package/lib/server/modules/index.js +68 -106
- package/lib/server/modules/menu/index.js +122 -146
- package/lib/server/modules/menu/types.js +31 -18
- package/lib/server/modules/order/index.js +642 -567
- package/lib/server/modules/order/types.js +32 -117
- package/lib/server/modules/order/utils/filterBookings.js +194 -219
- package/lib/server/modules/order/utils/filterOrders.js +92 -118
- package/lib/server/modules/payment/index.js +83 -59
- package/lib/server/modules/payment/types.js +16 -4
- package/lib/server/modules/products/index.js +459 -575
- package/lib/server/modules/products/types.js +34 -44
- package/lib/server/modules/quotation/index.js +172 -137
- package/lib/server/modules/quotation/types.js +31 -21
- package/lib/server/modules/resource/index.js +184 -213
- package/lib/server/modules/resource/types.js +33 -42
- package/lib/server/modules/schedule/index.js +123 -135
- package/lib/server/modules/schedule/types.js +21 -14
- package/lib/server/modules/schedule/utils.js +163 -334
- package/lib/server/types.js +16 -4
- package/lib/server/utils/index.js +23 -25
- package/lib/server/utils/product.js +139 -196
- package/lib/server/utils/schedule.js +41 -34
- package/lib/server/utils/small-ticket.js +456 -478
- package/lib/server/utils/time.js +49 -40
- package/lib/solution/BaseSales/index.js +1016 -850
- package/lib/solution/BaseSales/types.js +37 -41
- package/lib/solution/BaseSales/utils/cartPromotion.js +460 -611
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +105 -85
- package/lib/solution/BaseSales/utils/quotationPrice.js +114 -56
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +143 -102
- package/lib/solution/BaseSales/utils.js +140 -155
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1340 -1530
- package/lib/solution/BookingByStep/types.js +99 -40
- package/lib/solution/BookingByStep/utils/capacity.js +160 -192
- package/lib/solution/BookingByStep/utils/products.js +52 -42
- package/lib/solution/BookingByStep/utils/resources.js +330 -527
- package/lib/solution/BookingByStep/utils/stock.js +44 -65
- package/lib/solution/BookingByStep/utils/timeslots.js +131 -129
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +459 -543
- package/lib/solution/BookingTicket/types.js +77 -99
- package/lib/solution/BookingTicket/utils/addProductDecision.js +184 -219
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +89 -58
- package/lib/solution/BookingTicket/utils/bookingStatus.js +78 -107
- package/lib/solution/BookingTicket/utils/cartView.js +94 -110
- package/lib/solution/BookingTicket/utils/exampleData.js +0 -185
- package/lib/solution/BookingTicket/utils/orderCustomer.js +41 -18
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +86 -219
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +93 -144
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +91 -79
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +41 -54
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +81 -84
- package/lib/solution/BookingTicket/utils/scan/index.js +104 -98
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +43 -90
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +64 -52
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +58 -56
- package/lib/solution/BuyTickets/index.js +70 -67
- package/lib/solution/BuyTickets/types.js +38 -22
- package/lib/solution/Checkout/index.js +1158 -1451
- package/lib/solution/Checkout/types.js +61 -91
- package/lib/solution/Checkout/utils/index.js +156 -228
- package/lib/solution/PlaceOrder/index.js +0 -55
- package/lib/solution/RegisterAndLogin/config.js +460 -493
- package/lib/solution/RegisterAndLogin/index.js +630 -633
- package/lib/solution/RegisterAndLogin/types.js +76 -189
- package/lib/solution/RegisterAndLogin/utils.js +125 -183
- package/lib/solution/Sales/index.js +320 -317
- package/lib/solution/Sales/types.js +33 -27
- package/lib/solution/ScanOrder/index.js +862 -831
- package/lib/solution/ScanOrder/types.js +34 -33
- package/lib/solution/ScanOrder/utils.js +371 -406
- package/lib/solution/ShopDiscount/index.js +233 -235
- package/lib/solution/ShopDiscount/types.d.ts +4 -5
- package/lib/solution/ShopDiscount/types.js +37 -15
- package/lib/solution/ShopDiscount/utils.d.ts +0 -9
- package/lib/solution/ShopDiscount/utils.js +172 -309
- package/lib/solution/UnifiedBookingSales/index.js +405 -379
- package/lib/solution/UnifiedBookingSales/types.js +31 -12
- package/lib/solution/VenueBooking/index.d.ts +3 -31
- package/lib/solution/VenueBooking/index.js +916 -967
- package/lib/solution/VenueBooking/types.d.ts +1 -3
- package/lib/solution/VenueBooking/types.js +39 -20
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/lib/solution/VenueBooking/utils/dateSummary.js +62 -25
- package/lib/solution/VenueBooking/utils/resource.js +54 -31
- package/lib/solution/VenueBooking/utils/slotMerge.js +107 -94
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -138
- package/lib/solution/VenueBooking/utils.js +67 -130
- package/lib/solution/index.js +41 -124
- package/lib/store/createStore.js +29 -32
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.js +16 -4
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +47 -81
- package/package.json +2 -4
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/dist/solution/VenueBooking/utils/smartPricing.js +0 -233
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/lib/solution/VenueBooking/utils/smartPricing.js +0 -192
|
@@ -157,7 +157,9 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
157
157
|
app = appPlugin.getApp();
|
|
158
158
|
this.dbManager = app.sqlite;
|
|
159
159
|
this.logger = app.logger;
|
|
160
|
-
if (this.dbManager) {
|
|
160
|
+
if (this.dbManager) {
|
|
161
|
+
console.log('[Schedule] SQLite 已初始化');
|
|
162
|
+
} else {
|
|
161
163
|
console.warn('[Schedule] SQLite 未找到');
|
|
162
164
|
}
|
|
163
165
|
}
|
|
@@ -321,6 +323,7 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
321
323
|
} finally {
|
|
322
324
|
_iterator2.f();
|
|
323
325
|
}
|
|
326
|
+
console.log("[Schedule] Map \u7F13\u5B58\u5DF2\u540C\u6B65\uFF0C\u5171 ".concat(this.store.map.size, " \u4E2A\u65E5\u7A0B"));
|
|
324
327
|
}
|
|
325
328
|
|
|
326
329
|
/**
|
|
@@ -341,31 +344,32 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
341
344
|
this.store.map.clear();
|
|
342
345
|
// 同时清空 SQLite 中的数据
|
|
343
346
|
if (!this.dbManager) {
|
|
344
|
-
_context3.next =
|
|
347
|
+
_context3.next = 16;
|
|
345
348
|
break;
|
|
346
349
|
}
|
|
347
350
|
_context3.prev = 4;
|
|
348
351
|
_context3.next = 7;
|
|
349
352
|
return this.dbManager.clear(SCHEDULE_STORE_NAME);
|
|
350
353
|
case 7:
|
|
354
|
+
console.log('[Schedule] SQLite 缓存已清空');
|
|
351
355
|
this.logInfo('SQLite 缓存已清空');
|
|
352
|
-
_context3.next =
|
|
356
|
+
_context3.next = 16;
|
|
353
357
|
break;
|
|
354
|
-
case
|
|
355
|
-
_context3.prev =
|
|
358
|
+
case 11:
|
|
359
|
+
_context3.prev = 11;
|
|
356
360
|
_context3.t0 = _context3["catch"](4);
|
|
357
361
|
errorMessage = _context3.t0 instanceof Error ? _context3.t0.message : String(_context3.t0);
|
|
358
362
|
console.error('[Schedule] 清空 SQLite 缓存失败:', _context3.t0);
|
|
359
363
|
this.logError('清空 SQLite 缓存失败', {
|
|
360
364
|
error: errorMessage
|
|
361
365
|
});
|
|
362
|
-
case 15:
|
|
363
|
-
this.logInfo('缓存清空完成');
|
|
364
366
|
case 16:
|
|
367
|
+
this.logInfo('缓存清空完成');
|
|
368
|
+
case 17:
|
|
365
369
|
case "end":
|
|
366
370
|
return _context3.stop();
|
|
367
371
|
}
|
|
368
|
-
}, _callee3, this, [[4,
|
|
372
|
+
}, _callee3, this, [[4, 11]]);
|
|
369
373
|
}));
|
|
370
374
|
function clear() {
|
|
371
375
|
return _clear.apply(this, arguments);
|
|
@@ -505,13 +509,14 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
505
509
|
return _this4.dbManager.add(SCHEDULE_STORE_NAME, schedule);
|
|
506
510
|
}));
|
|
507
511
|
case 20:
|
|
512
|
+
console.log("[Schedule] \u5DF2\u5C06 ".concat(scheduleList.length, " \u6761\u65E5\u7A0B\u6570\u636E\u4FDD\u5B58\u5230 SQLite"));
|
|
508
513
|
this.logInfo('日程数据已保存到 SQLite', {
|
|
509
514
|
scheduleCount: scheduleList.length
|
|
510
515
|
});
|
|
511
|
-
_context5.next =
|
|
516
|
+
_context5.next = 29;
|
|
512
517
|
break;
|
|
513
|
-
case
|
|
514
|
-
_context5.prev =
|
|
518
|
+
case 24:
|
|
519
|
+
_context5.prev = 24;
|
|
515
520
|
_context5.t0 = _context5["catch"](4);
|
|
516
521
|
errorMessage = _context5.t0 instanceof Error ? _context5.t0.message : String(_context5.t0);
|
|
517
522
|
console.error('[Schedule] 保存数据到 SQLite 失败:', _context5.t0);
|
|
@@ -519,11 +524,11 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
519
524
|
scheduleCount: scheduleList.length,
|
|
520
525
|
error: errorMessage
|
|
521
526
|
});
|
|
522
|
-
case
|
|
527
|
+
case 29:
|
|
523
528
|
case "end":
|
|
524
529
|
return _context5.stop();
|
|
525
530
|
}
|
|
526
|
-
}, _callee5, this, [[4,
|
|
531
|
+
}, _callee5, this, [[4, 24]]);
|
|
527
532
|
}));
|
|
528
533
|
function saveScheduleToSQLite(_x3) {
|
|
529
534
|
return _saveScheduleToSQLite.apply(this, arguments);
|
|
@@ -543,17 +548,19 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
543
548
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
544
549
|
while (1) switch (_context6.prev = _context6.next) {
|
|
545
550
|
case 0:
|
|
551
|
+
console.log('[Schedule] 开始预加载数据...');
|
|
546
552
|
startTime = Date.now();
|
|
547
553
|
this.logInfo('开始预加载数据');
|
|
548
|
-
_context6.prev =
|
|
549
|
-
_context6.next =
|
|
554
|
+
_context6.prev = 3;
|
|
555
|
+
_context6.next = 6;
|
|
550
556
|
return this.loadScheduleFromSQLite();
|
|
551
|
-
case
|
|
557
|
+
case 6:
|
|
552
558
|
cachedData = _context6.sent;
|
|
553
559
|
if (!(cachedData && cachedData.length > 0)) {
|
|
554
|
-
_context6.next =
|
|
560
|
+
_context6.next = 14;
|
|
555
561
|
break;
|
|
556
562
|
}
|
|
563
|
+
console.log("[Schedule] \u4ECE SQLite \u52A0\u8F7D\u4E86 ".concat(cachedData.length, " \u6761\u65E5\u7A0B\u6570\u636E"));
|
|
557
564
|
// 将缓存数据放入 store
|
|
558
565
|
this.store.scheduleList = cloneDeep(cachedData);
|
|
559
566
|
// 同步更新 Map 缓存
|
|
@@ -565,22 +572,23 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
565
572
|
source: 'SQLite'
|
|
566
573
|
});
|
|
567
574
|
return _context6.abrupt("return");
|
|
568
|
-
case
|
|
575
|
+
case 14:
|
|
576
|
+
console.log('[Schedule] SQLite 中没有缓存数据,从服务器加载...');
|
|
569
577
|
this.logInfo('SQLite 中没有缓存数据,准备从服务器加载');
|
|
570
|
-
_context6.next =
|
|
578
|
+
_context6.next = 23;
|
|
571
579
|
break;
|
|
572
|
-
case
|
|
573
|
-
_context6.prev =
|
|
574
|
-
_context6.t0 = _context6["catch"](
|
|
580
|
+
case 18:
|
|
581
|
+
_context6.prev = 18;
|
|
582
|
+
_context6.t0 = _context6["catch"](3);
|
|
575
583
|
errorMessage = _context6.t0 instanceof Error ? _context6.t0.message : String(_context6.t0);
|
|
576
584
|
console.warn('[Schedule] 从 SQLite 加载数据失败:', _context6.t0);
|
|
577
585
|
this.logWarning('从 SQLite 加载数据失败,准备从服务器加载', {
|
|
578
586
|
error: errorMessage
|
|
579
587
|
});
|
|
580
|
-
case
|
|
581
|
-
_context6.next =
|
|
588
|
+
case 23:
|
|
589
|
+
_context6.next = 25;
|
|
582
590
|
return this.loadAllSchedule();
|
|
583
|
-
case
|
|
591
|
+
case 25:
|
|
584
592
|
scheduleList = _context6.sent;
|
|
585
593
|
// 3. 将服务器数据放入 store
|
|
586
594
|
if (scheduleList && scheduleList.length > 0) {
|
|
@@ -599,11 +607,11 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
599
607
|
duration: "".concat(_duration3, "ms")
|
|
600
608
|
});
|
|
601
609
|
}
|
|
602
|
-
case
|
|
610
|
+
case 27:
|
|
603
611
|
case "end":
|
|
604
612
|
return _context6.stop();
|
|
605
613
|
}
|
|
606
|
-
}, _callee6, this, [[
|
|
614
|
+
}, _callee6, this, [[3, 18]]);
|
|
607
615
|
}));
|
|
608
616
|
function preload() {
|
|
609
617
|
return _preload.apply(this, arguments);
|
|
@@ -82,6 +82,7 @@ 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] 没有价格数据,返回原商品');
|
|
85
86
|
return products;
|
|
86
87
|
}
|
|
87
88
|
var t1 = performance.now();
|
|
@@ -1966,10 +1966,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1966
1966
|
});
|
|
1967
1967
|
case 40:
|
|
1968
1968
|
if (!rulesModule) {
|
|
1969
|
-
_context20.next =
|
|
1969
|
+
_context20.next = 77;
|
|
1970
1970
|
break;
|
|
1971
1971
|
}
|
|
1972
1972
|
orderTotalAmount = Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0);
|
|
1973
|
+
console.log('[BaseSales.applyDiscountConfig.calcDiscount]');
|
|
1973
1974
|
result = rulesModule.calcDiscount({
|
|
1974
1975
|
productList: tempOrder.products,
|
|
1975
1976
|
discountList: nextDiscountList,
|
|
@@ -1986,22 +1987,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1986
1987
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
1987
1988
|
}
|
|
1988
1989
|
_iterator2 = _createForOfIteratorHelper(tempOrder.products || []);
|
|
1989
|
-
_context20.prev =
|
|
1990
|
+
_context20.prev = 46;
|
|
1990
1991
|
_iterator2.s();
|
|
1991
|
-
case
|
|
1992
|
+
case 48:
|
|
1992
1993
|
if ((_step2 = _iterator2.n()).done) {
|
|
1993
|
-
_context20.next =
|
|
1994
|
+
_context20.next = 63;
|
|
1994
1995
|
break;
|
|
1995
1996
|
}
|
|
1996
1997
|
product = _step2.value;
|
|
1997
1998
|
productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
|
|
1998
1999
|
runtimeOrigin = productUid ? (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3[productUid]) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.origin : undefined;
|
|
1999
2000
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
2000
|
-
_context20.next =
|
|
2001
|
+
_context20.next = 54;
|
|
2001
2002
|
break;
|
|
2002
2003
|
}
|
|
2003
|
-
return _context20.abrupt("continue",
|
|
2004
|
-
case
|
|
2004
|
+
return _context20.abrupt("continue", 61);
|
|
2005
|
+
case 54:
|
|
2005
2006
|
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
2006
2007
|
return sum + Number(pd.amount || 0);
|
|
2007
2008
|
}, 0);
|
|
@@ -2017,59 +2018,59 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2017
2018
|
mainPrice: newMainSellingPrice,
|
|
2018
2019
|
bundle: product.product_bundle
|
|
2019
2020
|
});
|
|
2020
|
-
case
|
|
2021
|
-
_context20.next =
|
|
2021
|
+
case 61:
|
|
2022
|
+
_context20.next = 48;
|
|
2022
2023
|
break;
|
|
2023
|
-
case
|
|
2024
|
-
_context20.next =
|
|
2024
|
+
case 63:
|
|
2025
|
+
_context20.next = 68;
|
|
2025
2026
|
break;
|
|
2026
|
-
case
|
|
2027
|
-
_context20.prev =
|
|
2028
|
-
_context20.t0 = _context20["catch"](
|
|
2027
|
+
case 65:
|
|
2028
|
+
_context20.prev = 65;
|
|
2029
|
+
_context20.t0 = _context20["catch"](46);
|
|
2029
2030
|
_iterator2.e(_context20.t0);
|
|
2030
|
-
case
|
|
2031
|
-
_context20.prev =
|
|
2031
|
+
case 68:
|
|
2032
|
+
_context20.prev = 68;
|
|
2032
2033
|
_iterator2.f();
|
|
2033
|
-
return _context20.finish(
|
|
2034
|
-
case
|
|
2034
|
+
return _context20.finish(68);
|
|
2035
|
+
case 71:
|
|
2035
2036
|
if (!result.discountList) {
|
|
2036
|
-
_context20.next =
|
|
2037
|
+
_context20.next = 77;
|
|
2037
2038
|
break;
|
|
2038
2039
|
}
|
|
2039
2040
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
2040
2041
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2041
|
-
_context20.next =
|
|
2042
|
+
_context20.next = 76;
|
|
2042
2043
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2043
|
-
case
|
|
2044
|
+
case 76:
|
|
2044
2045
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
2045
2046
|
return discount.isSelected;
|
|
2046
2047
|
});
|
|
2047
|
-
case
|
|
2048
|
-
_context20.next =
|
|
2048
|
+
case 77:
|
|
2049
|
+
_context20.next = 79;
|
|
2049
2050
|
return this.store.order.recalculateSummary({
|
|
2050
2051
|
createIfMissing: true
|
|
2051
2052
|
});
|
|
2052
|
-
case
|
|
2053
|
+
case 79:
|
|
2053
2054
|
summary = _context20.sent;
|
|
2054
2055
|
this.store.order.persistTempOrder();
|
|
2055
|
-
_context20.next =
|
|
2056
|
+
_context20.next = 83;
|
|
2056
2057
|
return this.effectsEmit('onDiscountApplied', {
|
|
2057
2058
|
productList: tempOrder.products || [],
|
|
2058
2059
|
discountList: nextDiscountList,
|
|
2059
2060
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
2060
2061
|
tempOrder: tempOrder
|
|
2061
2062
|
});
|
|
2062
|
-
case
|
|
2063
|
+
case 83:
|
|
2063
2064
|
return _context20.abrupt("return", {
|
|
2064
2065
|
productList: tempOrder.products || [],
|
|
2065
2066
|
discountList: nextDiscountList,
|
|
2066
2067
|
availableWalletIds: this.getAvailableWalletIds()
|
|
2067
2068
|
});
|
|
2068
|
-
case
|
|
2069
|
+
case 84:
|
|
2069
2070
|
case "end":
|
|
2070
2071
|
return _context20.stop();
|
|
2071
2072
|
}
|
|
2072
|
-
}, _callee20, this, [[
|
|
2073
|
+
}, _callee20, this, [[46, 65, 68, 71]]);
|
|
2073
2074
|
}));
|
|
2074
2075
|
function loadDiscountConfig(_x13) {
|
|
2075
2076
|
return _loadDiscountConfig.apply(this, arguments);
|
|
@@ -2113,10 +2114,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2113
2114
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2114
2115
|
case 12:
|
|
2115
2116
|
if (!rulesModule) {
|
|
2116
|
-
_context21.next =
|
|
2117
|
+
_context21.next = 24;
|
|
2117
2118
|
break;
|
|
2118
2119
|
}
|
|
2119
2120
|
orderTotalAmount = Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0);
|
|
2121
|
+
console.log('[BaseSales.bestDiscount.calcDiscount]');
|
|
2120
2122
|
result = rulesModule.calcDiscount({
|
|
2121
2123
|
productList: tempOrder.products,
|
|
2122
2124
|
discountList: nextDiscountList,
|
|
@@ -2130,14 +2132,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2130
2132
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
2131
2133
|
}
|
|
2132
2134
|
if (!result.discountList) {
|
|
2133
|
-
_context21.next =
|
|
2135
|
+
_context21.next = 24;
|
|
2134
2136
|
break;
|
|
2135
2137
|
}
|
|
2136
2138
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
2137
2139
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2138
|
-
_context21.next =
|
|
2140
|
+
_context21.next = 22;
|
|
2139
2141
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2140
|
-
case
|
|
2142
|
+
case 22:
|
|
2141
2143
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
2142
2144
|
return discount.isSelected;
|
|
2143
2145
|
});
|
|
@@ -2145,24 +2147,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2145
2147
|
productList: tempOrder.products,
|
|
2146
2148
|
discountList: nextDiscountList
|
|
2147
2149
|
};
|
|
2148
|
-
case
|
|
2149
|
-
_context21.next =
|
|
2150
|
+
case 24:
|
|
2151
|
+
_context21.next = 26;
|
|
2150
2152
|
return this.store.order.recalculateSummary({
|
|
2151
2153
|
createIfMissing: true
|
|
2152
2154
|
});
|
|
2153
|
-
case
|
|
2155
|
+
case 26:
|
|
2154
2156
|
this.store.order.persistTempOrder();
|
|
2155
|
-
_context21.next =
|
|
2157
|
+
_context21.next = 29;
|
|
2156
2158
|
return this.effectsEmit('onDiscountApplied', {
|
|
2157
2159
|
productList: tempOrder.products || [],
|
|
2158
2160
|
discountList: nextDiscountList,
|
|
2159
2161
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
2160
2162
|
tempOrder: tempOrder
|
|
2161
2163
|
});
|
|
2162
|
-
case
|
|
2164
|
+
case 29:
|
|
2163
2165
|
cb === null || cb === void 0 || cb(result);
|
|
2164
2166
|
return _context21.abrupt("return", result);
|
|
2165
|
-
case
|
|
2167
|
+
case 31:
|
|
2166
2168
|
case "end":
|
|
2167
2169
|
return _context21.stop();
|
|
2168
2170
|
}
|
|
@@ -2328,6 +2330,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2328
2330
|
case 13:
|
|
2329
2331
|
if (rulesModule) {
|
|
2330
2332
|
orderTotalAmount = Number(((_orderStore$summary3 = orderStore.summary) === null || _orderStore$summary3 === void 0 ? void 0 : _orderStore$summary3.total_amount) || 0);
|
|
2333
|
+
console.log('[BaseSales.setDiscountSelected.calcDiscount]');
|
|
2331
2334
|
result = rulesModule.calcDiscount({
|
|
2332
2335
|
productList: tempOrder.products,
|
|
2333
2336
|
discountList: updated,
|
|
@@ -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 |
|
|
329
|
+
weekNum: 0 | 1 | 2 | 6 | 4 | 3 | 5;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -87,22 +87,23 @@ 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] 初始化完成');
|
|
90
91
|
// 获取依赖的插件
|
|
91
92
|
this.request = core.getPlugin('request');
|
|
92
93
|
this.window = core.getPlugin('window');
|
|
93
94
|
this.shopStore = core.getPlugin('shopStore');
|
|
94
95
|
if (this.request) {
|
|
95
|
-
_context.next =
|
|
96
|
+
_context.next = 9;
|
|
96
97
|
break;
|
|
97
98
|
}
|
|
98
99
|
throw new Error('bookingByStep解决方案需要 request 插件支持');
|
|
99
|
-
case
|
|
100
|
+
case 9:
|
|
100
101
|
if (this.shopStore) {
|
|
101
|
-
_context.next =
|
|
102
|
+
_context.next = 11;
|
|
102
103
|
break;
|
|
103
104
|
}
|
|
104
105
|
throw new Error('SummaryModule 需要 shopStore 插件支持');
|
|
105
|
-
case
|
|
106
|
+
case 11:
|
|
106
107
|
// 如果有传 cacheid,默认需要收集上面这些模块里用户操作选中的数据
|
|
107
108
|
// 并且在上面 registerModule 的时候,读取 sessionStroage 里的数据,塞进默认值
|
|
108
109
|
targetCacheData = {};
|
|
@@ -137,7 +138,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
137
138
|
});
|
|
138
139
|
this.store.schedule.loadAllSchedule();
|
|
139
140
|
this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
140
|
-
case
|
|
141
|
+
case 19:
|
|
141
142
|
case "end":
|
|
142
143
|
return _context.stop();
|
|
143
144
|
}
|
|
@@ -1532,16 +1533,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1532
1533
|
}, {
|
|
1533
1534
|
key: "destroy",
|
|
1534
1535
|
value: function destroy() {
|
|
1535
|
-
var _this$store$cart, _this$store$step, _this$store$products, _this$store$guests, _this$store$date, _this$store$accountLi
|
|
1536
|
+
var _this$store$cart, _this$store$step, _this$store$products, _this$store$guests, _this$store$date, _this$store$accountLi;
|
|
1536
1537
|
(_this$store$cart = this.store.cart) === null || _this$store$cart === void 0 || _this$store$cart.destroy();
|
|
1537
1538
|
(_this$store$step = this.store.step) === null || _this$store$step === void 0 || _this$store$step.destroy();
|
|
1538
1539
|
(_this$store$products = this.store.products) === null || _this$store$products === void 0 || _this$store$products.destroy();
|
|
1539
1540
|
(_this$store$guests = this.store.guests) === null || _this$store$guests === void 0 || _this$store$guests.destroy();
|
|
1540
1541
|
(_this$store$date = this.store.date) === null || _this$store$date === void 0 || _this$store$date.destroy();
|
|
1541
1542
|
(_this$store$accountLi = this.store.accountList) === null || _this$store$accountLi === void 0 || _this$store$accountLi.destroy();
|
|
1542
|
-
(_this$store$schedule = this.store.schedule) === null || _this$store$schedule === void 0 || _this$store$schedule.destroy();
|
|
1543
|
-
(_this$store$summary = this.store.summary) === null || _this$store$summary === void 0 || _this$store$summary.destroy();
|
|
1544
|
-
(_this$store$order = this.store.order) === null || _this$store$order === void 0 || _this$store$order.destroy();
|
|
1545
1543
|
this.core.effects.offByModuleDestroy(this.name);
|
|
1546
1544
|
this.core.unregisterModule(this);
|
|
1547
1545
|
}
|
|
@@ -3189,6 +3187,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3189
3187
|
key: "findCommonAvailableTimeSlots",
|
|
3190
3188
|
value: function findCommonAvailableTimeSlots(resources) {
|
|
3191
3189
|
if (resources.length === 0) return [];
|
|
3190
|
+
console.log("\u8BA1\u7B97 ".concat(resources.length, " \u4E2A\u8D44\u6E90\u7684\u516C\u5171\u65F6\u95F4\u6BB5"));
|
|
3191
|
+
|
|
3192
3192
|
// 收集所有资源的时间段,转换为统一的时间格式
|
|
3193
3193
|
var allTimeSlots = resources.map(function (resource) {
|
|
3194
3194
|
return resource.times.map(function (time) {
|
|
@@ -3198,8 +3198,19 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3198
3198
|
};
|
|
3199
3199
|
});
|
|
3200
3200
|
});
|
|
3201
|
+
console.log('所有资源的时间段:', allTimeSlots.map(function (slots) {
|
|
3202
|
+
return slots.map(function (slot) {
|
|
3203
|
+
return "".concat(slot.start.format('HH:mm'), "-").concat(slot.end.format('HH:mm'));
|
|
3204
|
+
});
|
|
3205
|
+
}));
|
|
3206
|
+
|
|
3201
3207
|
// 找到公共时间段的交集
|
|
3202
3208
|
var commonSlots = allTimeSlots[0]; // 从第一个资源的时间段开始
|
|
3209
|
+
console.log('初始公共时间段:', commonSlots.map(function (slot) {
|
|
3210
|
+
return "".concat(slot.start.format('HH:mm'), "-").concat(slot.end.format('HH:mm'));
|
|
3211
|
+
}));
|
|
3212
|
+
|
|
3213
|
+
// 与其他资源的时间段求交集
|
|
3203
3214
|
var _loop3 = function _loop3() {
|
|
3204
3215
|
var currentResourceSlots = allTimeSlots[i];
|
|
3205
3216
|
var intersections = [];
|
|
@@ -3220,11 +3231,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3220
3231
|
});
|
|
3221
3232
|
});
|
|
3222
3233
|
if (intersections.length === 0) {
|
|
3234
|
+
console.log("\u8D44\u6E90".concat(i, "\u4E0E\u5F53\u524D\u516C\u5171\u65F6\u95F4\u6BB5\u65E0\u4EA4\u96C6\uFF0C\u8DF3\u8FC7\u8BE5\u8D44\u6E90"));
|
|
3223
3235
|
return 1; // continue
|
|
3224
3236
|
}
|
|
3225
3237
|
commonSlots = intersections;
|
|
3238
|
+
console.log("\u4E0E\u8D44\u6E90".concat(i, "\u6C42\u4EA4\u96C6\u540E\u7684\u516C\u5171\u65F6\u95F4\u6BB5:"), commonSlots.map(function (slot) {
|
|
3239
|
+
return "".concat(slot.start.format('HH:mm'), "-").concat(slot.end.format('HH:mm'));
|
|
3240
|
+
}));
|
|
3226
3241
|
};
|
|
3227
|
-
// 与其他资源的时间段求交集
|
|
3228
3242
|
for (var i = 1; i < allTimeSlots.length; i++) {
|
|
3229
3243
|
if (_loop3()) continue;
|
|
3230
3244
|
}
|
|
@@ -3236,6 +3250,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3236
3250
|
endTime: slot.end.format('HH:mm')
|
|
3237
3251
|
};
|
|
3238
3252
|
});
|
|
3253
|
+
console.log('最终公共时间段:', result);
|
|
3239
3254
|
return result;
|
|
3240
3255
|
}
|
|
3241
3256
|
}, {
|
|
@@ -3345,6 +3360,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3345
3360
|
// 获取该资源类型对应的 form_id
|
|
3346
3361
|
var targetFormId = resourceCodeToFormIdMap[resourceCode];
|
|
3347
3362
|
if (!targetFormId) {
|
|
3363
|
+
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u627E\u4E0D\u5230\u5BF9\u5E94\u7684 form_id"));
|
|
3348
3364
|
return {
|
|
3349
3365
|
v: {
|
|
3350
3366
|
success: false,
|
|
@@ -3371,6 +3387,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3371
3387
|
});
|
|
3372
3388
|
});
|
|
3373
3389
|
if (resourcesOfThisType.length === 0) {
|
|
3390
|
+
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u6CA1\u6709\u627E\u5230\u53EF\u7528\u8D44\u6E90"));
|
|
3374
3391
|
return {
|
|
3375
3392
|
v: {
|
|
3376
3393
|
success: false,
|
|
@@ -3437,13 +3454,24 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3437
3454
|
// 检查是否有容量问题
|
|
3438
3455
|
if (requiredAmount > totalAvailable) {
|
|
3439
3456
|
hasCapacityIssue = true;
|
|
3457
|
+
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " ").concat(isMultipleBooking ? '容量' : '资源数量', "\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredAmount, ", \u603B\u5171 ").concat(totalAvailable));
|
|
3440
3458
|
}
|
|
3441
3459
|
|
|
3442
3460
|
// 为通过检测的商品分配一个公共可用时间段
|
|
3461
|
+
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u7684\u8D44\u6E90\u65F6\u95F4\u4FE1\u606F:"), resourcesOfThisType.map(function (r) {
|
|
3462
|
+
return {
|
|
3463
|
+
id: r.id,
|
|
3464
|
+
times: r.times.map(function (t) {
|
|
3465
|
+
return "".concat(t.start_at, " - ").concat(t.end_at);
|
|
3466
|
+
})
|
|
3467
|
+
};
|
|
3468
|
+
}));
|
|
3443
3469
|
|
|
3444
3470
|
// 找到所有资源都可用的时间段
|
|
3445
3471
|
var commonTimeSlots = _this16.findCommonAvailableTimeSlots(resourcesOfThisType);
|
|
3472
|
+
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u7684\u516C\u5171\u65F6\u95F4\u6BB5:"), commonTimeSlots);
|
|
3446
3473
|
if (commonTimeSlots.length === 0) {
|
|
3474
|
+
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u6CA1\u6709\u516C\u5171\u53EF\u7528\u65F6\u95F4\u6BB5"));
|
|
3447
3475
|
return {
|
|
3448
3476
|
v: {
|
|
3449
3477
|
success: false,
|
|
@@ -3454,6 +3482,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3454
3482
|
|
|
3455
3483
|
// 使用第一个公共可用时间段,但只处理未处理过的商品
|
|
3456
3484
|
var firstCommonSlot = commonTimeSlots[0];
|
|
3485
|
+
console.log("\u4F7F\u7528\u516C\u5171\u65F6\u95F4\u6BB5: ".concat(firstCommonSlot.startTime, " - ").concat(firstCommonSlot.endTime));
|
|
3457
3486
|
items.forEach(function (cartItem) {
|
|
3458
3487
|
// 只处理未处理过的商品,避免重复添加
|
|
3459
3488
|
if (!processedCartItemIds.has(cartItem._id)) {
|
|
@@ -3764,6 +3793,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3764
3793
|
// 获取该资源类型对应的 form_id
|
|
3765
3794
|
var targetFormId = resourceCodeToFormIdMap[resourceCode];
|
|
3766
3795
|
if (!targetFormId) {
|
|
3796
|
+
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u627E\u4E0D\u5230\u5BF9\u5E94\u7684 form_id"));
|
|
3767
3797
|
return {
|
|
3768
3798
|
v: {
|
|
3769
3799
|
success: false,
|
|
@@ -3790,6 +3820,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3790
3820
|
});
|
|
3791
3821
|
});
|
|
3792
3822
|
if (resourcesOfThisType.length === 0) {
|
|
3823
|
+
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u6CA1\u6709\u627E\u5230\u53EF\u7528\u8D44\u6E90"));
|
|
3793
3824
|
return {
|
|
3794
3825
|
v: {
|
|
3795
3826
|
success: false,
|
|
@@ -3856,13 +3887,24 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3856
3887
|
// 检查是否有容量问题
|
|
3857
3888
|
if (requiredAmount > totalAvailable) {
|
|
3858
3889
|
hasCapacityIssue = true;
|
|
3890
|
+
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " ").concat(isMultipleBooking ? '容量' : '资源数量', "\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredAmount, ", \u603B\u5171 ").concat(totalAvailable));
|
|
3859
3891
|
}
|
|
3860
3892
|
|
|
3861
3893
|
// 为通过检测的商品分配一个公共可用时间段
|
|
3894
|
+
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u7684\u8D44\u6E90\u65F6\u95F4\u4FE1\u606F:"), resourcesOfThisType.map(function (r) {
|
|
3895
|
+
return {
|
|
3896
|
+
id: r.id,
|
|
3897
|
+
times: r.times.map(function (t) {
|
|
3898
|
+
return "".concat(t.start_at, " - ").concat(t.end_at);
|
|
3899
|
+
})
|
|
3900
|
+
};
|
|
3901
|
+
}));
|
|
3862
3902
|
|
|
3863
3903
|
// 找到所有资源都可用的时间段
|
|
3864
3904
|
var commonTimeSlots = _this17.findCommonAvailableTimeSlots(resourcesOfThisType);
|
|
3905
|
+
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u7684\u516C\u5171\u65F6\u95F4\u6BB5:"), commonTimeSlots);
|
|
3865
3906
|
if (commonTimeSlots.length === 0) {
|
|
3907
|
+
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u6CA1\u6709\u516C\u5171\u53EF\u7528\u65F6\u95F4\u6BB5"));
|
|
3866
3908
|
return {
|
|
3867
3909
|
v: {
|
|
3868
3910
|
success: false,
|
|
@@ -3873,6 +3915,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3873
3915
|
|
|
3874
3916
|
// 使用第一个公共可用时间段,但只处理未处理过的商品
|
|
3875
3917
|
var firstCommonSlot = commonTimeSlots[0];
|
|
3918
|
+
console.log("\u4F7F\u7528\u516C\u5171\u65F6\u95F4\u6BB5: ".concat(firstCommonSlot.startTime, " - ").concat(firstCommonSlot.endTime));
|
|
3876
3919
|
items.forEach(function (cartItem) {
|
|
3877
3920
|
// 只处理未处理过的商品,避免重复添加
|
|
3878
3921
|
if (!processedCartItemIds.has(cartItem._id)) {
|
|
@@ -4182,6 +4225,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4182
4225
|
while (1) switch (_context29.prev = _context29.next) {
|
|
4183
4226
|
case 0:
|
|
4184
4227
|
startDate = _ref16.startDate, endDate = _ref16.endDate, scheduleIds = _ref16.scheduleIds, resources = _ref16.resources;
|
|
4228
|
+
console.log('appoimentBooking-session-date-getTimeslotsScheduleByDateRange', {
|
|
4229
|
+
startDate: startDate,
|
|
4230
|
+
endDate: endDate,
|
|
4231
|
+
scheduleIds: scheduleIds,
|
|
4232
|
+
resources: resources
|
|
4233
|
+
});
|
|
4185
4234
|
// 生成日期范围内的所有日期
|
|
4186
4235
|
dates = [];
|
|
4187
4236
|
currentDate = dayjs(startDate);
|
|
@@ -4201,7 +4250,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4201
4250
|
});
|
|
4202
4251
|
}
|
|
4203
4252
|
return _context29.abrupt("return", results);
|
|
4204
|
-
case
|
|
4253
|
+
case 9:
|
|
4205
4254
|
case "end":
|
|
4206
4255
|
return _context29.stop();
|
|
4207
4256
|
}
|
|
@@ -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, _resourceTypeConfig2;
|
|
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,6 +324,12 @@ 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
|
+
});
|
|
327
333
|
if (isMultipleBooking) {
|
|
328
334
|
// 多个预约:计算总可用容量
|
|
329
335
|
var totalAvailableCapacity = 0;
|
|
@@ -337,7 +343,9 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
|
|
|
337
343
|
totalAvailableCapacity += resource.capacity || 0;
|
|
338
344
|
}
|
|
339
345
|
});
|
|
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));
|
|
340
347
|
if (totalAvailableCapacity < requiredCapacity) {
|
|
348
|
+
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u5BB9\u91CF\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredCapacity, ", \u53EF\u7528 ").concat(totalAvailableCapacity));
|
|
341
349
|
return {
|
|
342
350
|
v: {
|
|
343
351
|
success: false,
|
|
@@ -358,7 +366,9 @@ export function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, all
|
|
|
358
366
|
availableResourceCount++;
|
|
359
367
|
}
|
|
360
368
|
});
|
|
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));
|
|
361
370
|
if (availableResourceCount < requiredCapacity) {
|
|
371
|
+
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(formId, " \u6570\u91CF\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredCapacity, ", \u53EF\u7528 ").concat(availableResourceCount));
|
|
362
372
|
return {
|
|
363
373
|
v: {
|
|
364
374
|
success: false,
|