@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
|
@@ -1,162 +1,138 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/solution/Sales/index.ts
|
|
31
|
+
var Sales_exports = {};
|
|
32
|
+
__export(Sales_exports, {
|
|
33
|
+
Sales: () => SalesImpl,
|
|
34
|
+
SalesImpl: () => SalesImpl,
|
|
35
|
+
default: () => Sales_default
|
|
24
36
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
* - 基础生命周期占位
|
|
33
|
-
*
|
|
34
|
-
* 不提前实现 store 编排、初始化流程细节、状态计算逻辑。
|
|
35
|
-
* TIPS:这块应该改名叫 ReservationModule 更合适一些,目前这边只服务于 Reservation 的 floormap 展示。
|
|
36
|
-
*/
|
|
37
|
-
class SalesImpl extends _BaseModule.BaseModule {
|
|
38
|
-
defaultName = 'sales';
|
|
39
|
-
defaultVersion = '1.0.0';
|
|
40
|
-
defaultTimelineBucketMinutes = 15;
|
|
41
|
-
isSolution = true;
|
|
42
|
-
store;
|
|
43
|
-
options = {};
|
|
44
|
-
otherParams = {};
|
|
45
|
-
request;
|
|
46
|
-
logger; // LoggerManager 实例
|
|
47
|
-
|
|
37
|
+
module.exports = __toCommonJS(Sales_exports);
|
|
38
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
39
|
+
var import_BaseModule = require("../../modules/BaseModule");
|
|
40
|
+
var import_types = require("./types");
|
|
41
|
+
__reExport(Sales_exports, require("./types"), module.exports);
|
|
42
|
+
var SalesImpl = class extends import_BaseModule.BaseModule {
|
|
43
|
+
// LoggerManager 实例
|
|
48
44
|
constructor(name, version) {
|
|
49
45
|
super(name, version);
|
|
46
|
+
this.defaultName = "sales";
|
|
47
|
+
this.defaultVersion = "1.0.0";
|
|
48
|
+
this.defaultTimelineBucketMinutes = 15;
|
|
49
|
+
this.isSolution = true;
|
|
50
|
+
this.options = {};
|
|
51
|
+
this.otherParams = {};
|
|
50
52
|
}
|
|
51
53
|
async initialize(core, options = {}) {
|
|
52
54
|
this.core = core;
|
|
53
55
|
this.options = options;
|
|
54
56
|
this.otherParams = options.otherParams || {};
|
|
55
|
-
const appPlugin = this.core.getPlugin(
|
|
56
|
-
|
|
57
|
-
this.request = appPlugin?.getApp().request;
|
|
57
|
+
const appPlugin = this.core.getPlugin("app");
|
|
58
|
+
this.request = appPlugin == null ? void 0 : appPlugin.getApp().request;
|
|
58
59
|
if (!this.request) {
|
|
59
|
-
throw new Error(
|
|
60
|
+
throw new Error("Sales 解决方案需要 request 插件支持");
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
-
// 初始化 store 状态
|
|
63
62
|
this.store = {
|
|
64
|
-
currentDay: (0,
|
|
63
|
+
currentDay: (0, import_dayjs.default)().startOf("day"),
|
|
65
64
|
reservationList: []
|
|
66
65
|
};
|
|
67
|
-
|
|
68
|
-
// TODO(Rolo): 等领导提供 reservationList 的目标结构后,
|
|
69
|
-
// 在这里补充从 Server/Order 读取 currentDay 原始数据并转换为预约列表。
|
|
70
|
-
|
|
71
|
-
this.logger = appPlugin?.getApp().logger;
|
|
66
|
+
this.logger = appPlugin == null ? void 0 : appPlugin.getApp().logger;
|
|
72
67
|
await this.core.effects.emit(`${this.name}:onInited`, {});
|
|
73
68
|
}
|
|
74
|
-
|
|
75
69
|
// -------------------------------------------------------------------------
|
|
76
70
|
// SalesModuleAPI 实现
|
|
77
71
|
// -------------------------------------------------------------------------
|
|
78
|
-
|
|
79
72
|
/** 获取当前 store 快照 */
|
|
80
73
|
getState() {
|
|
81
|
-
return {
|
|
82
|
-
...this.store
|
|
83
|
-
};
|
|
74
|
+
return { ...this.store };
|
|
84
75
|
}
|
|
85
|
-
|
|
86
76
|
/** 获取当前选择日期 */
|
|
87
77
|
getCurrentDay() {
|
|
88
78
|
return this.store.currentDay;
|
|
89
79
|
}
|
|
90
|
-
|
|
91
80
|
/** 设置当前选择日期,会自动归一到当天 00:00:00 */
|
|
92
81
|
setCurrentDay(currentDay) {
|
|
93
|
-
const normalized = (0,
|
|
82
|
+
const normalized = (0, import_dayjs.default)(currentDay).startOf("day");
|
|
94
83
|
this.store.currentDay = normalized;
|
|
95
|
-
this.core.effects.emit(
|
|
96
|
-
currentDay: normalized
|
|
97
|
-
});
|
|
84
|
+
this.core.effects.emit(import_types.SalesHooks.onCurrentDayChanged, { currentDay: normalized });
|
|
98
85
|
return normalized;
|
|
99
86
|
}
|
|
100
|
-
|
|
101
87
|
/** 获取当前预约列表 */
|
|
102
88
|
getReservationList() {
|
|
103
89
|
return [...this.store.reservationList];
|
|
104
90
|
}
|
|
105
|
-
|
|
106
91
|
/** 覆盖设置当前预约列表 */
|
|
107
92
|
setReservationList(reservationList) {
|
|
108
93
|
this.store.reservationList = reservationList;
|
|
109
|
-
this.core.effects.emit(
|
|
110
|
-
reservationList
|
|
111
|
-
});
|
|
94
|
+
this.core.effects.emit(import_types.SalesHooks.onReservationListChanged, { reservationList });
|
|
112
95
|
return reservationList;
|
|
113
96
|
}
|
|
114
|
-
|
|
115
97
|
/** 重置预约列表为空 */
|
|
116
98
|
resetReservationList() {
|
|
117
99
|
this.store.reservationList = [];
|
|
118
|
-
this.core.effects.emit(
|
|
119
|
-
reservationList: []
|
|
120
|
-
});
|
|
100
|
+
this.core.effects.emit(import_types.SalesHooks.onReservationListChanged, { reservationList: [] });
|
|
121
101
|
return [];
|
|
122
102
|
}
|
|
123
103
|
async cancelOrder(orderIds) {
|
|
124
|
-
const orderModule = this.core.getModule(
|
|
104
|
+
const orderModule = this.core.getModule("order");
|
|
125
105
|
if (!orderModule) {
|
|
126
|
-
throw new Error(
|
|
106
|
+
throw new Error("Sales 取消订单失败:Order 模块未注册");
|
|
127
107
|
}
|
|
128
|
-
return orderModule.cancelOrder({
|
|
129
|
-
order_ids: orderIds
|
|
130
|
-
});
|
|
108
|
+
return orderModule.cancelOrder({ order_ids: orderIds });
|
|
131
109
|
}
|
|
132
110
|
async changeBookingStatus(params) {
|
|
133
|
-
const orderModule = this.core.getModule(
|
|
111
|
+
const orderModule = this.core.getModule("order");
|
|
134
112
|
if (!orderModule) {
|
|
135
|
-
throw new Error(
|
|
113
|
+
throw new Error("Sales 变更预约状态失败:Order 模块未注册");
|
|
136
114
|
}
|
|
137
115
|
return orderModule.changeBookingStatus(params);
|
|
138
116
|
}
|
|
139
|
-
|
|
140
117
|
// -------------------------------------------------------------------------
|
|
141
118
|
// 生命周期
|
|
142
119
|
// -------------------------------------------------------------------------
|
|
143
|
-
|
|
144
120
|
async destroy() {
|
|
145
121
|
await this.core.effects.emit(`${this.name}:onDestroy`, {});
|
|
146
122
|
super.destroy();
|
|
147
123
|
}
|
|
148
|
-
|
|
149
124
|
/**
|
|
150
125
|
* 时间轴粒度(分钟)
|
|
151
126
|
* - 默认 15 分钟
|
|
152
127
|
* - 可通过 registerModule 时的 options.otherParams.timelineBucketMinutes 覆盖
|
|
153
128
|
*/
|
|
154
129
|
getTimelineBucketMinutes() {
|
|
155
|
-
|
|
156
|
-
|
|
130
|
+
var _a;
|
|
131
|
+
const dynamicBucket = Number((_a = this.otherParams) == null ? void 0 : _a.timelineBucketMinutes);
|
|
132
|
+
if (!Number.isFinite(dynamicBucket) || dynamicBucket <= 0)
|
|
133
|
+
return this.defaultTimelineBucketMinutes;
|
|
157
134
|
return Math.floor(dynamicBucket);
|
|
158
135
|
}
|
|
159
|
-
|
|
160
136
|
/**
|
|
161
137
|
* 解析营业日统计窗口:
|
|
162
138
|
* - 当 operating_day_boundary.type === 'start_time'
|
|
@@ -164,32 +140,23 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
164
140
|
* - 否则回退自然日(00:00 到次日 00:00)
|
|
165
141
|
*/
|
|
166
142
|
getTimelineRangeByOperatingBoundary() {
|
|
167
|
-
|
|
168
|
-
const
|
|
169
|
-
const
|
|
170
|
-
const
|
|
171
|
-
const
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
endExclusiveAt: defaultEndExclusive
|
|
177
|
-
};
|
|
143
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
144
|
+
const today = (0, import_dayjs.default)();
|
|
145
|
+
const defaultStart = today.startOf("day");
|
|
146
|
+
const defaultEndExclusive = defaultStart.add(1, "day");
|
|
147
|
+
const appPlugin = this.core.getPlugin("app");
|
|
148
|
+
const coreData = (_f = (_d = (_c = (_b = (_a = appPlugin == null ? void 0 : appPlugin.getApp()) == null ? void 0 : _a.data) == null ? void 0 : _b.store) == null ? void 0 : _c.getStore) == null ? void 0 : (_e = _d.call(_c)).getDataByModel) == null ? void 0 : _f.call(_e, "core");
|
|
149
|
+
const operatingDayBoundary = (_g = coreData == null ? void 0 : coreData.core) == null ? void 0 : _g.operating_day_boundary;
|
|
150
|
+
if ((operatingDayBoundary == null ? void 0 : operatingDayBoundary.type) !== "start_time") {
|
|
151
|
+
return { startAt: defaultStart, endExclusiveAt: defaultEndExclusive };
|
|
178
152
|
}
|
|
179
|
-
const boundaryTime = String(operatingDayBoundary.time ||
|
|
180
|
-
const startAt = (0,
|
|
153
|
+
const boundaryTime = String(operatingDayBoundary.time || "").trim();
|
|
154
|
+
const startAt = (0, import_dayjs.default)(`${today.format("YYYY-MM-DD")} ${boundaryTime}`);
|
|
181
155
|
if (!startAt.isValid()) {
|
|
182
|
-
return {
|
|
183
|
-
startAt: defaultStart,
|
|
184
|
-
endExclusiveAt: defaultEndExclusive
|
|
185
|
-
};
|
|
156
|
+
return { startAt: defaultStart, endExclusiveAt: defaultEndExclusive };
|
|
186
157
|
}
|
|
187
|
-
return {
|
|
188
|
-
startAt,
|
|
189
|
-
endExclusiveAt: startAt.add(1, 'day')
|
|
190
|
-
};
|
|
158
|
+
return { startAt, endExclusiveAt: startAt.add(1, "day") };
|
|
191
159
|
}
|
|
192
|
-
|
|
193
160
|
/**
|
|
194
161
|
* 统计时间轴每个时间片的预约数量。
|
|
195
162
|
* 算法使用差分数组,复杂度 O(n + s):
|
|
@@ -198,37 +165,39 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
198
165
|
*/
|
|
199
166
|
getTimelineHighlights(bookingList = [], startDateTime, endDateTime) {
|
|
200
167
|
const bucketMinutes = this.getTimelineBucketMinutes();
|
|
201
|
-
const bucketMs = bucketMinutes * 60 *
|
|
202
|
-
const customStartAt = startDateTime ? (0,
|
|
203
|
-
const customEndExclusiveAt = endDateTime ? (0,
|
|
168
|
+
const bucketMs = bucketMinutes * 60 * 1e3;
|
|
169
|
+
const customStartAt = startDateTime ? (0, import_dayjs.default)(startDateTime) : (0, import_dayjs.default)("");
|
|
170
|
+
const customEndExclusiveAt = endDateTime ? (0, import_dayjs.default)(endDateTime) : (0, import_dayjs.default)("");
|
|
204
171
|
const hasValidCustomRange = customStartAt.isValid() && customEndExclusiveAt.isValid();
|
|
205
|
-
const {
|
|
206
|
-
startAt,
|
|
207
|
-
endExclusiveAt
|
|
208
|
-
} = hasValidCustomRange ? {
|
|
209
|
-
startAt: customStartAt,
|
|
210
|
-
endExclusiveAt: customEndExclusiveAt
|
|
211
|
-
} : this.getTimelineRangeByOperatingBoundary();
|
|
172
|
+
const { startAt, endExclusiveAt } = hasValidCustomRange ? { startAt: customStartAt, endExclusiveAt: customEndExclusiveAt } : this.getTimelineRangeByOperatingBoundary();
|
|
212
173
|
const startAtMs = startAt.valueOf();
|
|
213
174
|
const endExclusiveAtMs = endExclusiveAt.valueOf();
|
|
214
|
-
if (!startAt.isValid() || !endExclusiveAt.isValid() || endExclusiveAtMs <= startAtMs)
|
|
175
|
+
if (!startAt.isValid() || !endExclusiveAt.isValid() || endExclusiveAtMs <= startAtMs)
|
|
176
|
+
return [];
|
|
215
177
|
const slotCount = Math.ceil((endExclusiveAtMs - startAtMs) / bucketMs);
|
|
216
|
-
if (slotCount <= 0)
|
|
178
|
+
if (slotCount <= 0)
|
|
179
|
+
return [];
|
|
217
180
|
const diff = new Int32Array(slotCount + 1);
|
|
218
181
|
for (let i = 0; i < bookingList.length; i++) {
|
|
219
182
|
const booking = bookingList[i];
|
|
220
|
-
const appointmentStatus = String(booking.appointment_status ?? booking.status ??
|
|
221
|
-
if (appointmentStatus ===
|
|
183
|
+
const appointmentStatus = String(booking.appointment_status ?? booking.status ?? "");
|
|
184
|
+
if (appointmentStatus === "new" || appointmentStatus === "rejected" || appointmentStatus === "cancelled")
|
|
185
|
+
continue;
|
|
222
186
|
const bookingStartAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
223
187
|
const bookingEndAt = this.toBookingDateTime(booking.end_date, booking.end_time);
|
|
224
|
-
if (!bookingStartAt.isValid() || !bookingEndAt.isValid())
|
|
188
|
+
if (!bookingStartAt.isValid() || !bookingEndAt.isValid())
|
|
189
|
+
continue;
|
|
225
190
|
const overlapStartMs = Math.max(bookingStartAt.valueOf(), startAtMs);
|
|
226
|
-
// 结束时间按 <= 处理:转成右开区间时 +1ms,保证命中 end_time 所在时间片
|
|
227
191
|
const overlapEndExclusiveMs = Math.min(bookingEndAt.valueOf() + 1, endExclusiveAtMs);
|
|
228
|
-
if (overlapStartMs >= overlapEndExclusiveMs)
|
|
192
|
+
if (overlapStartMs >= overlapEndExclusiveMs)
|
|
193
|
+
continue;
|
|
229
194
|
const startIdx = Math.max(0, Math.ceil((overlapStartMs - startAtMs) / bucketMs));
|
|
230
|
-
const endIdx = Math.min(
|
|
231
|
-
|
|
195
|
+
const endIdx = Math.min(
|
|
196
|
+
slotCount - 1,
|
|
197
|
+
Math.floor((overlapEndExclusiveMs - 1 - startAtMs) / bucketMs)
|
|
198
|
+
);
|
|
199
|
+
if (startIdx > endIdx)
|
|
200
|
+
continue;
|
|
232
201
|
diff[startIdx] += 1;
|
|
233
202
|
diff[endIdx + 1] -= 1;
|
|
234
203
|
}
|
|
@@ -240,17 +209,14 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
240
209
|
}
|
|
241
210
|
return timeline;
|
|
242
211
|
}
|
|
243
|
-
|
|
244
212
|
/** dayjs 未启用插件时,手动封装 >= 判断 */
|
|
245
213
|
isSameOrAfter(left, right) {
|
|
246
214
|
return left.isAfter(right) || left.isSame(right);
|
|
247
215
|
}
|
|
248
|
-
|
|
249
216
|
/** dayjs 未启用插件时,手动封装 <= 判断 */
|
|
250
217
|
isSameOrBefore(left, right) {
|
|
251
218
|
return left.isBefore(right) || left.isSame(right);
|
|
252
219
|
}
|
|
253
|
-
|
|
254
220
|
/**
|
|
255
221
|
* 将 booking 的日期/时间字段统一组装为 dayjs
|
|
256
222
|
* - date + time 都有:按完整时间解析
|
|
@@ -258,56 +224,63 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
258
224
|
* - 都没有:返回 invalid
|
|
259
225
|
*/
|
|
260
226
|
toBookingDateTime(date, time) {
|
|
261
|
-
if (!date && !time)
|
|
262
|
-
|
|
263
|
-
|
|
227
|
+
if (!date && !time)
|
|
228
|
+
return (0, import_dayjs.default)("");
|
|
229
|
+
if (date && time)
|
|
230
|
+
return (0, import_dayjs.default)(`${date} ${time}`);
|
|
231
|
+
return (0, import_dayjs.default)(date || time);
|
|
264
232
|
}
|
|
265
|
-
|
|
266
233
|
/**
|
|
267
234
|
* 预约状态映射(面向 UI 的统一状态)
|
|
268
235
|
* 说明:locked 逻辑后续会补业务规则,这里先保留分支占位。
|
|
269
236
|
*/
|
|
270
237
|
getBookingStatus(appointmentStatus) {
|
|
271
|
-
if (appointmentStatus ===
|
|
272
|
-
|
|
273
|
-
|
|
238
|
+
if (appointmentStatus === "started")
|
|
239
|
+
return "occupied";
|
|
240
|
+
if (appointmentStatus === "confirmed" || appointmentStatus === "arrived") {
|
|
241
|
+
return "reserved";
|
|
274
242
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
return
|
|
243
|
+
if (appointmentStatus === "locked")
|
|
244
|
+
return "locked";
|
|
245
|
+
return void 0;
|
|
278
246
|
}
|
|
279
247
|
getResourceId(resource) {
|
|
280
|
-
return resource.id ?? resource.form_record_id ??
|
|
248
|
+
return resource.id ?? resource.form_record_id ?? "";
|
|
281
249
|
}
|
|
282
250
|
getBookingAppointmentStatus(booking) {
|
|
283
|
-
return String(booking.appointment_status ?? booking.status ??
|
|
251
|
+
return String(booking.appointment_status ?? booking.status ?? "");
|
|
284
252
|
}
|
|
285
253
|
isBookingIncludedInStats(booking) {
|
|
286
254
|
const appointmentStatus = this.getBookingAppointmentStatus(booking);
|
|
287
|
-
return appointmentStatus !==
|
|
255
|
+
return appointmentStatus !== "new" && appointmentStatus !== "rejected" && appointmentStatus !== "cancelled";
|
|
288
256
|
}
|
|
289
257
|
getBookingOrderPaymentStatus(booking) {
|
|
290
|
-
|
|
258
|
+
var _a;
|
|
259
|
+
return String(((_a = booking.order) == null ? void 0 : _a.payment_status) ?? "");
|
|
291
260
|
}
|
|
292
261
|
countBookingOrders(bookings) {
|
|
293
|
-
const orderIds = new Set();
|
|
294
|
-
bookings.forEach(booking => {
|
|
295
|
-
|
|
296
|
-
|
|
262
|
+
const orderIds = /* @__PURE__ */ new Set();
|
|
263
|
+
bookings.forEach((booking) => {
|
|
264
|
+
var _a;
|
|
265
|
+
const orderId = booking.order_id ?? ((_a = booking.order) == null ? void 0 : _a.order_id);
|
|
266
|
+
if (orderId === void 0 || orderId === null)
|
|
267
|
+
return;
|
|
297
268
|
orderIds.add(String(orderId));
|
|
298
269
|
});
|
|
299
270
|
return orderIds.size;
|
|
300
271
|
}
|
|
301
272
|
countCompletedBookings(bookings) {
|
|
302
|
-
return bookings.filter(booking => this.getBookingAppointmentStatus(booking) ===
|
|
273
|
+
return bookings.filter((booking) => this.getBookingAppointmentStatus(booking) === "completed").length;
|
|
303
274
|
}
|
|
304
275
|
groupBookingsByResource(bookingList) {
|
|
305
|
-
const bookingMap = new Map();
|
|
306
|
-
bookingList.forEach(booking => {
|
|
307
|
-
if (!Array.isArray(booking.resources))
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
276
|
+
const bookingMap = /* @__PURE__ */ new Map();
|
|
277
|
+
bookingList.forEach((booking) => {
|
|
278
|
+
if (!Array.isArray(booking.resources))
|
|
279
|
+
return;
|
|
280
|
+
booking.resources.forEach((resource) => {
|
|
281
|
+
const relationId = resource == null ? void 0 : resource.relation_id;
|
|
282
|
+
if (relationId === void 0 || relationId === null)
|
|
283
|
+
return;
|
|
311
284
|
const key = String(relationId);
|
|
312
285
|
const list = bookingMap.get(key) || [];
|
|
313
286
|
list.push(booking);
|
|
@@ -317,10 +290,12 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
317
290
|
return bookingMap;
|
|
318
291
|
}
|
|
319
292
|
isBookingMatchedResource(booking, resourceId) {
|
|
320
|
-
if (!Array.isArray(booking.resources))
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
293
|
+
if (!Array.isArray(booking.resources))
|
|
294
|
+
return false;
|
|
295
|
+
return booking.resources.some((resource) => {
|
|
296
|
+
const relationId = resource == null ? void 0 : resource.relation_id;
|
|
297
|
+
if (relationId === void 0 || relationId === null)
|
|
298
|
+
return false;
|
|
324
299
|
return String(relationId) === String(resourceId);
|
|
325
300
|
});
|
|
326
301
|
}
|
|
@@ -331,7 +306,6 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
331
306
|
return leftStartAt - rightStartAt;
|
|
332
307
|
});
|
|
333
308
|
}
|
|
334
|
-
|
|
335
309
|
/**
|
|
336
310
|
* 资源下 bookings 的返回裁剪策略:
|
|
337
311
|
* 1) 优先返回当前时刻正在进行中的预约(允许并发返回多条)
|
|
@@ -340,88 +314,100 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
340
314
|
* 4) 最后兜底返回一条(避免资源有历史预约时完全无反馈)
|
|
341
315
|
*/
|
|
342
316
|
pickBookingsForCurrentPoint(current, bookings) {
|
|
343
|
-
if (bookings.length === 0)
|
|
344
|
-
|
|
345
|
-
const
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
const dayScopedBookings = bookings.filter(booking => {
|
|
317
|
+
if (bookings.length === 0)
|
|
318
|
+
return [];
|
|
319
|
+
const currentDayStart = current.startOf("day");
|
|
320
|
+
const currentDayEnd = current.endOf("day");
|
|
321
|
+
const dayScopedBookings = bookings.filter((booking) => {
|
|
349
322
|
const startAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
350
323
|
const endAt = this.toBookingDateTime(booking.end_date, booking.end_time);
|
|
351
|
-
if (!startAt.isValid() || !endAt.isValid())
|
|
324
|
+
if (!startAt.isValid() || !endAt.isValid())
|
|
325
|
+
return false;
|
|
352
326
|
return this.isSameOrBefore(startAt, currentDayEnd) && this.isSameOrAfter(endAt, currentDayStart);
|
|
353
327
|
});
|
|
354
|
-
if (dayScopedBookings.length === 0)
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
const
|
|
360
|
-
|
|
328
|
+
if (dayScopedBookings.length === 0)
|
|
329
|
+
return [];
|
|
330
|
+
const appendNextStartGroupIfNeeded = (selectedBookings) => {
|
|
331
|
+
if (selectedBookings.length === 0)
|
|
332
|
+
return selectedBookings;
|
|
333
|
+
const shouldAppendNextGroup = selectedBookings.some(
|
|
334
|
+
(booking) => booking.status === "reserved" || booking.status === "occupied"
|
|
335
|
+
);
|
|
336
|
+
if (!shouldAppendNextGroup)
|
|
337
|
+
return selectedBookings;
|
|
338
|
+
const selectedStartValues = new Set(
|
|
339
|
+
selectedBookings.map((booking) => this.toBookingDateTime(booking.start_date, booking.start_time)).filter((startAt) => startAt.isValid()).map((startAt) => startAt.valueOf())
|
|
340
|
+
);
|
|
341
|
+
const futureCandidates = dayScopedBookings.filter((booking) => {
|
|
361
342
|
const startAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
362
|
-
if (!startAt.isValid())
|
|
343
|
+
if (!startAt.isValid())
|
|
344
|
+
return false;
|
|
363
345
|
return startAt.isAfter(current) && !selectedStartValues.has(startAt.valueOf());
|
|
364
346
|
});
|
|
365
|
-
if (futureCandidates.length === 0)
|
|
366
|
-
|
|
367
|
-
const
|
|
347
|
+
if (futureCandidates.length === 0)
|
|
348
|
+
return selectedBookings;
|
|
349
|
+
const nextStartAt = this.toBookingDateTime(
|
|
350
|
+
futureCandidates[0].start_date,
|
|
351
|
+
futureCandidates[0].start_time
|
|
352
|
+
).valueOf();
|
|
353
|
+
const nextStartGroup = futureCandidates.filter((booking) => {
|
|
368
354
|
const startAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
369
355
|
return startAt.isValid() && startAt.valueOf() === nextStartAt;
|
|
370
356
|
});
|
|
371
|
-
if (nextStartGroup.length === 0)
|
|
372
|
-
|
|
357
|
+
if (nextStartGroup.length === 0)
|
|
358
|
+
return selectedBookings;
|
|
359
|
+
nextStartGroup.forEach((booking) => {
|
|
373
360
|
booking.isNext = true;
|
|
374
361
|
});
|
|
375
362
|
return [...selectedBookings, ...nextStartGroup];
|
|
376
363
|
};
|
|
377
|
-
|
|
378
|
-
// active: current 处于 [startAt, endAt] 区间
|
|
379
|
-
const activeBookings = dayScopedBookings.filter(booking => {
|
|
364
|
+
const activeBookings = dayScopedBookings.filter((booking) => {
|
|
380
365
|
const startAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
381
366
|
const endAt = this.toBookingDateTime(booking.end_date, booking.end_time);
|
|
382
|
-
if (!startAt.isValid() || !endAt.isValid())
|
|
367
|
+
if (!startAt.isValid() || !endAt.isValid())
|
|
368
|
+
return false;
|
|
383
369
|
return this.isSameOrAfter(current, startAt) && this.isSameOrBefore(current, endAt);
|
|
384
370
|
});
|
|
385
|
-
if (activeBookings.length > 0)
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
const upcoming = dayScopedBookings.filter(booking => {
|
|
371
|
+
if (activeBookings.length > 0)
|
|
372
|
+
return appendNextStartGroupIfNeeded(activeBookings);
|
|
373
|
+
const timeoutOccupied = dayScopedBookings.filter(
|
|
374
|
+
(booking) => booking.status === "occupied" && booking.isTimeout
|
|
375
|
+
);
|
|
376
|
+
if (timeoutOccupied.length > 0)
|
|
377
|
+
return appendNextStartGroupIfNeeded(timeoutOccupied);
|
|
378
|
+
const upcoming = dayScopedBookings.filter((booking) => {
|
|
393
379
|
const startAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
394
|
-
return startAt.isValid() && startAt.isAfter(current) && startAt.isSame(current,
|
|
380
|
+
return startAt.isValid() && startAt.isAfter(current) && startAt.isSame(current, "day");
|
|
395
381
|
});
|
|
396
382
|
if (upcoming.length > 0) {
|
|
397
383
|
const firstStartAt = this.toBookingDateTime(upcoming[0].start_date, upcoming[0].start_time).valueOf();
|
|
398
|
-
const upcomingStartGroup = upcoming.filter(booking => {
|
|
384
|
+
const upcomingStartGroup = upcoming.filter((booking) => {
|
|
399
385
|
const startAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
400
386
|
return startAt.valueOf() === firstStartAt;
|
|
401
387
|
});
|
|
402
388
|
return appendNextStartGroupIfNeeded(upcomingStartGroup);
|
|
403
389
|
}
|
|
404
|
-
|
|
405
|
-
// fallback: 全部是过去且非 timeout 的场景,保留末条便于前端兜底展示
|
|
406
390
|
const fallback = dayScopedBookings[dayScopedBookings.length - 1];
|
|
407
391
|
return fallback ? [fallback] : [];
|
|
408
392
|
}
|
|
409
|
-
|
|
410
393
|
/**
|
|
411
394
|
* 计算 booking 在 current 时刻的执行进度百分比(0-100)。
|
|
412
395
|
* - startAt/endAt 非法或 totalMinutes <= 0 返回 0
|
|
413
396
|
* - current 早于 startAt 返回 0,晚于 endAt 返回 100
|
|
414
397
|
*/
|
|
415
398
|
calcProgressPercent(current, startAt, endAt) {
|
|
416
|
-
if (!startAt.isValid() || !endAt.isValid())
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
399
|
+
if (!startAt.isValid() || !endAt.isValid())
|
|
400
|
+
return 0;
|
|
401
|
+
const totalMinutes = endAt.diff(startAt, "minute");
|
|
402
|
+
if (totalMinutes <= 0)
|
|
403
|
+
return 0;
|
|
404
|
+
const elapsedMinutes = current.diff(startAt, "minute");
|
|
405
|
+
if (elapsedMinutes <= 0)
|
|
406
|
+
return 0;
|
|
407
|
+
if (elapsedMinutes >= totalMinutes)
|
|
408
|
+
return 100;
|
|
422
409
|
return Math.floor(elapsedMinutes / totalMinutes * 100);
|
|
423
410
|
}
|
|
424
|
-
|
|
425
411
|
/**
|
|
426
412
|
* 标准化单条 booking 的分发入口:
|
|
427
413
|
* - 统一过滤 rejected / cancelled(视为没来过)
|
|
@@ -430,10 +416,11 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
430
416
|
*/
|
|
431
417
|
normalizeMatchedBooking(current, deviceCurrent, booking, options = {}) {
|
|
432
418
|
const appointmentStatus = this.getBookingAppointmentStatus(booking);
|
|
433
|
-
if (appointmentStatus ===
|
|
419
|
+
if (appointmentStatus === "rejected" || appointmentStatus === "cancelled")
|
|
420
|
+
return null;
|
|
434
421
|
const startAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
435
422
|
const endAt = this.toBookingDateTime(booking.end_date, booking.end_time);
|
|
436
|
-
if (appointmentStatus ===
|
|
423
|
+
if (appointmentStatus === "completed" && options.includeCompleted) {
|
|
437
424
|
return this.buildCompletedBooking(current, booking, startAt, endAt);
|
|
438
425
|
}
|
|
439
426
|
if (current.isSame(deviceCurrent)) {
|
|
@@ -442,35 +429,35 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
442
429
|
return this.buildSnapshotBooking(current, booking, appointmentStatus, startAt, endAt);
|
|
443
430
|
}
|
|
444
431
|
normalizeResourceBookings(current, deviceCurrent, bookingList, options = {}) {
|
|
445
|
-
const normalizedBookings = bookingList.map(booking => this.normalizeMatchedBooking(current, deviceCurrent, booking, options)).filter(booking => Boolean(booking)).filter(booking => booking.status);
|
|
432
|
+
const normalizedBookings = bookingList.map((booking) => this.normalizeMatchedBooking(current, deviceCurrent, booking, options)).filter((booking) => Boolean(booking)).filter((booking) => booking.status);
|
|
446
433
|
return this.sortMatchedBookings(normalizedBookings);
|
|
447
434
|
}
|
|
448
435
|
buildCompletedBooking(current, booking, startAt, endAt) {
|
|
449
|
-
if (!startAt.isValid() || !endAt.isValid())
|
|
436
|
+
if (!startAt.isValid() || !endAt.isValid())
|
|
437
|
+
return null;
|
|
450
438
|
if (current.isBefore(startAt)) {
|
|
451
439
|
return {
|
|
452
440
|
...booking,
|
|
453
|
-
status:
|
|
441
|
+
status: "reserved",
|
|
454
442
|
isTimeout: false,
|
|
455
|
-
timeoutTime:
|
|
443
|
+
timeoutTime: void 0,
|
|
456
444
|
progressPercent: 0,
|
|
457
|
-
lateTime:
|
|
458
|
-
reserved_status:
|
|
459
|
-
remainingReserveTime: Math.max(startAt.diff(current,
|
|
445
|
+
lateTime: void 0,
|
|
446
|
+
reserved_status: "not_arrived",
|
|
447
|
+
remainingReserveTime: Math.max(startAt.diff(current, "minute"), 0)
|
|
460
448
|
};
|
|
461
449
|
}
|
|
462
450
|
return {
|
|
463
451
|
...booking,
|
|
464
|
-
status:
|
|
452
|
+
status: "occupied",
|
|
465
453
|
isTimeout: false,
|
|
466
|
-
timeoutTime:
|
|
454
|
+
timeoutTime: void 0,
|
|
467
455
|
progressPercent: this.isSameOrAfter(current, endAt) ? 100 : this.calcProgressPercent(current, startAt, endAt),
|
|
468
|
-
lateTime:
|
|
469
|
-
reserved_status:
|
|
470
|
-
remainingReserveTime:
|
|
456
|
+
lateTime: void 0,
|
|
457
|
+
reserved_status: void 0,
|
|
458
|
+
remainingReserveTime: void 0
|
|
471
459
|
};
|
|
472
460
|
}
|
|
473
|
-
|
|
474
461
|
/**
|
|
475
462
|
* 实时模式(current === deviceCurrent):信任 appointment_status
|
|
476
463
|
* - 过滤 new / completed(实时视角下视为非活跃数据)
|
|
@@ -479,21 +466,22 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
479
466
|
* - reserved 且 current < startAt 标记 not_arrived,否则标记 late
|
|
480
467
|
*/
|
|
481
468
|
buildRealtimeBooking(current, booking, appointmentStatus, startAt, endAt) {
|
|
482
|
-
if (appointmentStatus ===
|
|
469
|
+
if (appointmentStatus === "new" || appointmentStatus === "completed")
|
|
470
|
+
return null;
|
|
483
471
|
const bookingStatus = this.getBookingStatus(appointmentStatus);
|
|
484
|
-
const isTimeout = bookingStatus ===
|
|
485
|
-
const timeoutTime = isTimeout ? current.diff(endAt,
|
|
486
|
-
const progressPercent = bookingStatus ===
|
|
472
|
+
const isTimeout = bookingStatus === "occupied" && endAt.isValid() && current.isAfter(endAt);
|
|
473
|
+
const timeoutTime = isTimeout ? current.diff(endAt, "minute") : void 0;
|
|
474
|
+
const progressPercent = bookingStatus === "occupied" ? this.calcProgressPercent(current, startAt, endAt) : 0;
|
|
487
475
|
let reservedStatus;
|
|
488
476
|
let lateTime;
|
|
489
477
|
let remainingReserveTime;
|
|
490
|
-
if (bookingStatus ===
|
|
478
|
+
if (bookingStatus === "reserved" && startAt.isValid()) {
|
|
491
479
|
if (current.isBefore(startAt)) {
|
|
492
|
-
reservedStatus =
|
|
493
|
-
remainingReserveTime = startAt.diff(current,
|
|
480
|
+
reservedStatus = "not_arrived";
|
|
481
|
+
remainingReserveTime = startAt.diff(current, "minute");
|
|
494
482
|
} else {
|
|
495
|
-
reservedStatus =
|
|
496
|
-
lateTime = Math.max(current.diff(startAt,
|
|
483
|
+
reservedStatus = "late";
|
|
484
|
+
lateTime = Math.max(current.diff(startAt, "minute"), 0);
|
|
497
485
|
}
|
|
498
486
|
}
|
|
499
487
|
return {
|
|
@@ -507,7 +495,6 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
507
495
|
remainingReserveTime
|
|
508
496
|
};
|
|
509
497
|
}
|
|
510
|
-
|
|
511
498
|
/**
|
|
512
499
|
* 快照模式(current !== deviceCurrent,过去或未来):忽略 appointment_status
|
|
513
500
|
* 的实时态差异,仅按 booking 时间窗判定,为 current 提供时间点快照视图。
|
|
@@ -523,77 +510,72 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
523
510
|
* 快照模式下 isTimeout 恒为 false,lateTime / timeoutTime 始终置空。
|
|
524
511
|
*/
|
|
525
512
|
buildSnapshotBooking(current, booking, appointmentStatus, startAt, endAt) {
|
|
526
|
-
if (appointmentStatus ===
|
|
527
|
-
|
|
513
|
+
if (appointmentStatus === "new")
|
|
514
|
+
return null;
|
|
515
|
+
if (appointmentStatus === "locked") {
|
|
528
516
|
return {
|
|
529
517
|
...booking,
|
|
530
|
-
status:
|
|
518
|
+
status: "locked",
|
|
531
519
|
isTimeout: false,
|
|
532
|
-
timeoutTime:
|
|
520
|
+
timeoutTime: void 0,
|
|
533
521
|
progressPercent: 0,
|
|
534
|
-
lateTime:
|
|
535
|
-
reserved_status:
|
|
536
|
-
remainingReserveTime:
|
|
522
|
+
lateTime: void 0,
|
|
523
|
+
reserved_status: void 0,
|
|
524
|
+
remainingReserveTime: void 0
|
|
537
525
|
};
|
|
538
526
|
}
|
|
539
|
-
if (!startAt.isValid() || !endAt.isValid())
|
|
540
|
-
|
|
527
|
+
if (!startAt.isValid() || !endAt.isValid())
|
|
528
|
+
return null;
|
|
529
|
+
if (current.isAfter(endAt))
|
|
530
|
+
return null;
|
|
541
531
|
if (this.isSameOrAfter(current, startAt) && this.isSameOrBefore(current, endAt)) {
|
|
542
532
|
return {
|
|
543
533
|
...booking,
|
|
544
|
-
status:
|
|
534
|
+
status: "occupied",
|
|
545
535
|
isTimeout: false,
|
|
546
|
-
timeoutTime:
|
|
536
|
+
timeoutTime: void 0,
|
|
547
537
|
progressPercent: this.calcProgressPercent(current, startAt, endAt),
|
|
548
|
-
lateTime:
|
|
549
|
-
reserved_status:
|
|
550
|
-
remainingReserveTime:
|
|
538
|
+
lateTime: void 0,
|
|
539
|
+
reserved_status: void 0,
|
|
540
|
+
remainingReserveTime: void 0
|
|
551
541
|
};
|
|
552
542
|
}
|
|
553
543
|
return {
|
|
554
544
|
...booking,
|
|
555
|
-
status:
|
|
545
|
+
status: "reserved",
|
|
556
546
|
isTimeout: false,
|
|
557
|
-
timeoutTime:
|
|
547
|
+
timeoutTime: void 0,
|
|
558
548
|
progressPercent: 0,
|
|
559
|
-
lateTime:
|
|
560
|
-
reserved_status:
|
|
561
|
-
remainingReserveTime: Math.max(startAt.diff(current,
|
|
549
|
+
lateTime: void 0,
|
|
550
|
+
reserved_status: "not_arrived",
|
|
551
|
+
remainingReserveTime: Math.max(startAt.diff(current, "minute"), 0)
|
|
562
552
|
};
|
|
563
553
|
}
|
|
564
554
|
async getResourceBookingList(currentTime, bookingList = [], deviceTime = currentTime) {
|
|
565
|
-
|
|
566
|
-
const current = (0,
|
|
567
|
-
if (!current.isValid())
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
const resourceResponse = await this.request.get(
|
|
573
|
-
|
|
574
|
-
num: 999
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
const resourceList = resourceResponse?.data?.list ?? [];
|
|
582
|
-
if (!Array.isArray(resourceList) || resourceList.length === 0) return [];
|
|
583
|
-
|
|
584
|
-
// 全局先做 booking 标准化 + start_time 升序,后续映射直接复用
|
|
555
|
+
var _a;
|
|
556
|
+
const current = (0, import_dayjs.default)(currentTime);
|
|
557
|
+
if (!current.isValid())
|
|
558
|
+
return [];
|
|
559
|
+
const deviceCurrent = (0, import_dayjs.default)(deviceTime);
|
|
560
|
+
if (!deviceCurrent.isValid())
|
|
561
|
+
return [];
|
|
562
|
+
const resourceResponse = await this.request.get(
|
|
563
|
+
"/shop/form/resource/page",
|
|
564
|
+
{ skip: 1, num: 999 },
|
|
565
|
+
// @ts-ignore
|
|
566
|
+
{ osServer: true, isShopApi: true }
|
|
567
|
+
);
|
|
568
|
+
const resourceList = ((_a = resourceResponse == null ? void 0 : resourceResponse.data) == null ? void 0 : _a.list) ?? [];
|
|
569
|
+
if (!Array.isArray(resourceList) || resourceList.length === 0)
|
|
570
|
+
return [];
|
|
585
571
|
const normalizedBookings = this.normalizeResourceBookings(current, deviceCurrent, bookingList);
|
|
586
|
-
|
|
587
|
-
// 建立 resourceId -> bookings[] 倒排索引,加速资源匹配
|
|
588
572
|
const rawBookingMap = this.groupBookingsByResource(bookingList);
|
|
589
573
|
const bookingMap = this.groupBookingsByResource(normalizedBookings);
|
|
590
|
-
|
|
591
|
-
// 输出:每个资源都返回;bookings 可能是 0 / 1 / 多条(并发场景)
|
|
592
|
-
const list = resourceList.map(resource => {
|
|
574
|
+
const list = resourceList.map((resource) => {
|
|
593
575
|
const resourceId = this.getResourceId(resource);
|
|
594
576
|
const rawMatchedBookings = rawBookingMap.get(String(resourceId)) || [];
|
|
595
577
|
const matchedBookings = bookingMap.get(String(resourceId)) || [];
|
|
596
|
-
const statsBookings = rawMatchedBookings.filter(booking => this.isBookingIncludedInStats(booking));
|
|
578
|
+
const statsBookings = rawMatchedBookings.filter((booking) => this.isBookingIncludedInStats(booking));
|
|
597
579
|
const orderCount = this.countBookingOrders(statsBookings);
|
|
598
580
|
const bookingCount = statsBookings.length;
|
|
599
581
|
const compeleteBookingCount = this.countCompletedBookings(statsBookings);
|
|
@@ -608,65 +590,81 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
608
590
|
};
|
|
609
591
|
});
|
|
610
592
|
this.logger.addLog({
|
|
611
|
-
type:
|
|
612
|
-
title:
|
|
593
|
+
type: "info",
|
|
594
|
+
title: "getResourceBookingList",
|
|
613
595
|
metadata: {
|
|
614
596
|
currentTime,
|
|
615
|
-
bookingList: bookingList
|
|
597
|
+
bookingList: bookingList == null ? void 0 : bookingList.length,
|
|
616
598
|
deviceTime,
|
|
617
|
-
list: list
|
|
599
|
+
list: list == null ? void 0 : list.length
|
|
618
600
|
}
|
|
619
601
|
});
|
|
620
602
|
return list;
|
|
621
603
|
}
|
|
622
604
|
async getResourceBookingItem(params) {
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
const
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
isShopApi: true
|
|
635
|
-
|
|
636
|
-
const resourceList = resourceResponse
|
|
637
|
-
if (!Array.isArray(resourceList) || resourceList.length === 0)
|
|
638
|
-
|
|
639
|
-
|
|
605
|
+
var _a, _b;
|
|
606
|
+
const current = (0, import_dayjs.default)(params.currentTime);
|
|
607
|
+
if (!current.isValid())
|
|
608
|
+
return null;
|
|
609
|
+
const deviceCurrent = (0, import_dayjs.default)(params.deviceTime || params.currentTime);
|
|
610
|
+
if (!deviceCurrent.isValid())
|
|
611
|
+
return null;
|
|
612
|
+
const resourceResponse = await this.request.get(
|
|
613
|
+
"/shop/form/resource/page",
|
|
614
|
+
{ skip: 1, num: 999 },
|
|
615
|
+
// @ts-ignore
|
|
616
|
+
{ osServer: true, isShopApi: true }
|
|
617
|
+
);
|
|
618
|
+
const resourceList = ((_a = resourceResponse == null ? void 0 : resourceResponse.data) == null ? void 0 : _a.list) ?? [];
|
|
619
|
+
if (!Array.isArray(resourceList) || resourceList.length === 0)
|
|
620
|
+
return null;
|
|
621
|
+
const targetResource = resourceList.find(
|
|
622
|
+
(resource) => String(this.getResourceId(resource)) === String(params.resourceId)
|
|
623
|
+
);
|
|
624
|
+
if (!targetResource)
|
|
625
|
+
return null;
|
|
640
626
|
const resourceId = this.getResourceId(targetResource);
|
|
641
|
-
const matchedBookingList = params.bookingList.filter(
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
const
|
|
645
|
-
const
|
|
646
|
-
|
|
627
|
+
const matchedBookingList = params.bookingList.filter(
|
|
628
|
+
(booking) => this.isBookingMatchedResource(booking, resourceId)
|
|
629
|
+
);
|
|
630
|
+
const statsBookingList = matchedBookingList.filter((booking) => this.isBookingIncludedInStats(booking));
|
|
631
|
+
const completedBookingList = matchedBookingList.filter(
|
|
632
|
+
(booking) => this.getBookingAppointmentStatus(booking) === "completed"
|
|
633
|
+
);
|
|
634
|
+
const unpaidBookingList = matchedBookingList.filter(
|
|
635
|
+
(booking) => this.getBookingOrderPaymentStatus(booking) === "unpaid" || this.getBookingOrderPaymentStatus(booking) === "payment_processing"
|
|
636
|
+
);
|
|
637
|
+
const bookings = this.pickBookingsForCurrentPoint(
|
|
638
|
+
current,
|
|
639
|
+
this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList)
|
|
640
|
+
);
|
|
641
|
+
const completedBookings = completedBookingList.map((booking) => {
|
|
647
642
|
return {
|
|
648
643
|
...booking,
|
|
649
|
-
status:
|
|
644
|
+
status: "compelete",
|
|
650
645
|
isTimeout: false,
|
|
651
|
-
timeoutTime:
|
|
646
|
+
timeoutTime: void 0,
|
|
652
647
|
progressPercent: 100,
|
|
653
|
-
lateTime:
|
|
654
|
-
reserved_status:
|
|
655
|
-
remainingReserveTime:
|
|
648
|
+
lateTime: void 0,
|
|
649
|
+
reserved_status: void 0,
|
|
650
|
+
remainingReserveTime: void 0
|
|
656
651
|
};
|
|
657
652
|
});
|
|
658
|
-
const unpaidBookings = this.pickBookingsForCurrentPoint(
|
|
653
|
+
const unpaidBookings = this.pickBookingsForCurrentPoint(
|
|
654
|
+
current,
|
|
655
|
+
this.normalizeResourceBookings(current, deviceCurrent, unpaidBookingList)
|
|
656
|
+
);
|
|
659
657
|
const orderCount = this.countBookingOrders(statsBookingList);
|
|
660
658
|
const bookingCount = statsBookingList.length;
|
|
661
659
|
const compeleteBookingCount = this.countCompletedBookings(statsBookingList);
|
|
662
660
|
this.logger.addLog({
|
|
663
|
-
type:
|
|
664
|
-
title:
|
|
661
|
+
type: "info",
|
|
662
|
+
title: "getResourceBookingItem",
|
|
665
663
|
metadata: {
|
|
666
664
|
currentTime: params.currentTime,
|
|
667
665
|
deviceTime: params.deviceTime || params.currentTime,
|
|
668
666
|
resourceId,
|
|
669
|
-
bookingList: params.bookingList
|
|
667
|
+
bookingList: (_b = params.bookingList) == null ? void 0 : _b.length,
|
|
670
668
|
bookings: bookings.length,
|
|
671
669
|
completedBookings: completedBookings.length,
|
|
672
670
|
unpaidBookings: unpaidBookings.length,
|
|
@@ -686,6 +684,11 @@ class SalesImpl extends _BaseModule.BaseModule {
|
|
|
686
684
|
unpaidBookings
|
|
687
685
|
};
|
|
688
686
|
}
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
|
|
687
|
+
};
|
|
688
|
+
var Sales_default = SalesImpl;
|
|
689
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
690
|
+
0 && (module.exports = {
|
|
691
|
+
Sales,
|
|
692
|
+
SalesImpl,
|
|
693
|
+
...require("./types")
|
|
694
|
+
});
|