@pisell/pisellos 2.1.38 → 2.2.1
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.d.ts +8 -1
- package/dist/core/index.js +116 -42
- package/dist/effects/index.d.ts +1 -0
- package/dist/effects/index.js +29 -6
- package/dist/modules/Account/index.js +2 -3
- package/dist/modules/BaseModule.d.ts +3 -0
- package/dist/modules/BaseModule.js +15 -0
- package/dist/modules/Customer/index.js +9 -10
- package/dist/modules/Customer/types.d.ts +2 -2
- package/dist/modules/Customer/types.js +2 -2
- package/dist/modules/Discount/index.js +1 -1
- package/dist/modules/Guests/index.js +9 -9
- package/dist/modules/Order/index.js +1 -1
- package/dist/modules/Payment/index.js +63 -73
- package/dist/modules/Payment/walletpass.js +4 -1
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +19 -0
- package/dist/modules/ProductList/index.js +5 -14
- package/dist/modules/Resource/index.js +1 -1
- package/dist/modules/Rules/index.js +2 -3
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +152 -0
- package/dist/server/index.js +946 -0
- package/dist/server/modules/index.d.ts +16 -0
- package/dist/server/modules/index.js +21 -0
- package/dist/server/modules/menu/index.d.ts +63 -0
- package/dist/server/modules/menu/index.js +476 -0
- package/dist/server/modules/menu/types.d.ts +68 -0
- package/dist/server/modules/menu/types.js +16 -0
- package/dist/server/modules/products/index.d.ts +141 -0
- package/dist/server/modules/products/index.js +768 -0
- package/dist/server/modules/products/types.d.ts +94 -0
- package/dist/server/modules/products/types.js +43 -0
- package/dist/server/modules/quotation/index.d.ts +47 -0
- package/dist/server/modules/quotation/index.js +367 -0
- package/dist/server/modules/quotation/types.d.ts +50 -0
- package/dist/server/modules/quotation/types.js +20 -0
- package/dist/server/modules/schedule/index.d.ts +62 -0
- package/dist/server/modules/schedule/index.js +431 -0
- package/dist/server/modules/schedule/types.d.ts +1 -0
- package/dist/server/modules/schedule/types.js +2 -0
- package/dist/server/modules/schedule/utils.d.ts +32 -0
- package/dist/server/modules/schedule/utils.js +747 -0
- package/dist/server/types.d.ts +64 -0
- package/dist/server/types.js +1 -0
- package/dist/server/utils/index.d.ts +5 -0
- package/dist/server/utils/index.js +6 -0
- package/dist/server/utils/product.d.ts +18 -0
- package/dist/server/utils/product.js +339 -0
- package/dist/server/utils/schedule.d.ts +14 -0
- package/dist/server/utils/schedule.js +108 -0
- package/dist/server/utils/time.d.ts +18 -0
- package/dist/server/utils/time.js +53 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -17
- package/dist/solution/BookingByStep/index.js +23 -468
- package/dist/solution/BookingByStep/utils/capacity.d.ts +2 -7
- package/dist/solution/BookingByStep/utils/capacity.js +8 -24
- package/dist/solution/BookingTicket/index.d.ts +12 -0
- package/dist/solution/BookingTicket/index.js +122 -79
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +25 -16
- package/dist/solution/BuyTickets/index.js +7 -8
- package/dist/solution/Checkout/index.d.ts +1 -46
- package/dist/solution/Checkout/index.js +530 -850
- package/dist/solution/ShopDiscount/index.js +9 -10
- package/dist/types/index.d.ts +27 -0
- package/lib/core/index.d.ts +8 -1
- package/lib/core/index.js +48 -1
- package/lib/effects/index.d.ts +1 -0
- package/lib/effects/index.js +13 -0
- package/lib/modules/Account/index.js +2 -3
- package/lib/modules/BaseModule.d.ts +3 -0
- package/lib/modules/BaseModule.js +9 -0
- package/lib/modules/Customer/index.js +9 -10
- package/lib/modules/Customer/types.d.ts +2 -2
- package/lib/modules/Customer/types.js +2 -2
- package/lib/modules/Discount/index.js +1 -1
- package/lib/modules/Guests/index.js +9 -9
- package/lib/modules/Order/index.js +1 -1
- package/lib/modules/Payment/index.js +56 -43
- package/lib/modules/Payment/walletpass.js +3 -1
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +19 -0
- package/lib/modules/ProductList/index.js +4 -13
- package/lib/modules/Resource/index.js +1 -1
- package/lib/modules/Rules/index.js +2 -3
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +152 -0
- package/lib/server/index.js +555 -0
- package/lib/server/modules/index.d.ts +16 -0
- package/lib/server/modules/index.js +47 -0
- package/lib/server/modules/menu/index.d.ts +63 -0
- package/lib/server/modules/menu/index.js +234 -0
- package/lib/server/modules/menu/types.d.ts +68 -0
- package/lib/server/modules/menu/types.js +33 -0
- package/lib/server/modules/products/index.d.ts +141 -0
- package/lib/server/modules/products/index.js +434 -0
- package/lib/server/modules/products/types.d.ts +94 -0
- package/lib/server/modules/products/types.js +35 -0
- package/lib/server/modules/quotation/index.d.ts +47 -0
- package/lib/server/modules/quotation/index.js +177 -0
- package/lib/server/modules/quotation/types.d.ts +50 -0
- package/lib/server/modules/quotation/types.js +33 -0
- package/lib/server/modules/schedule/index.d.ts +62 -0
- package/lib/server/modules/schedule/index.js +231 -0
- package/lib/server/modules/schedule/types.d.ts +1 -0
- package/lib/server/modules/schedule/types.js +23 -0
- package/lib/server/modules/schedule/utils.d.ts +32 -0
- package/lib/server/modules/schedule/utils.js +451 -0
- package/lib/server/types.d.ts +64 -0
- package/lib/server/types.js +17 -0
- package/lib/server/utils/index.d.ts +5 -0
- package/lib/server/utils/index.js +25 -0
- package/lib/server/utils/product.d.ts +18 -0
- package/lib/server/utils/product.js +262 -0
- package/lib/server/utils/schedule.d.ts +14 -0
- package/lib/server/utils/schedule.js +88 -0
- package/lib/server/utils/time.d.ts +18 -0
- package/lib/server/utils/time.js +70 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -17
- package/lib/solution/BookingByStep/index.js +40 -312
- package/lib/solution/BookingByStep/utils/capacity.d.ts +2 -7
- package/lib/solution/BookingByStep/utils/capacity.js +8 -21
- package/lib/solution/BookingTicket/index.d.ts +12 -0
- package/lib/solution/BookingTicket/index.js +25 -6
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +7 -1
- package/lib/solution/BuyTickets/index.js +7 -8
- package/lib/solution/Checkout/index.d.ts +1 -46
- package/lib/solution/Checkout/index.js +92 -289
- package/lib/solution/ShopDiscount/index.js +10 -11
- package/lib/types/index.d.ts +27 -0
- package/package.json +2 -2
|
@@ -34,17 +34,16 @@ __export(BookingByStep_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(BookingByStep_exports);
|
|
35
35
|
var import_BaseModule = require("../../modules/BaseModule");
|
|
36
36
|
var import_types = require("./types");
|
|
37
|
-
var import_utils = require("../../modules/Cart/utils");
|
|
38
37
|
var import_products = require("./utils/products");
|
|
39
38
|
var import_resources = require("./utils/resources");
|
|
40
39
|
var import_dayjs = __toESM(require("dayjs"));
|
|
41
40
|
var import_isSameOrBefore = __toESM(require("dayjs/plugin/isSameOrBefore"));
|
|
42
41
|
var import_isSameOrAfter = __toESM(require("dayjs/plugin/isSameOrAfter"));
|
|
43
|
-
var
|
|
42
|
+
var import_utils = require("../../modules/Resource/utils");
|
|
44
43
|
var import_lodash_es = require("lodash-es");
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
44
|
+
var import_utils2 = require("../../modules/Schedule/utils");
|
|
45
|
+
var import_utils3 = require("../../modules/Date/utils");
|
|
46
|
+
var import_utils4 = require("../../modules/Product/utils");
|
|
48
47
|
var import_timeslots = require("./utils/timeslots");
|
|
49
48
|
var import_changePrice = require("../../modules/Cart/utils/changePrice");
|
|
50
49
|
var import_capacity = require("./utils/capacity");
|
|
@@ -116,7 +115,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
116
115
|
}
|
|
117
116
|
});
|
|
118
117
|
this.store.schedule.loadAllSchedule();
|
|
119
|
-
this.core.effects.emit(
|
|
118
|
+
this.core.effects.emit(`${this.name}:onInited`, {});
|
|
120
119
|
}
|
|
121
120
|
// 初始化step
|
|
122
121
|
initStep(stepList) {
|
|
@@ -364,7 +363,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
364
363
|
let date = (_b = (_a = this.store.date.getDateRange()) == null ? void 0 : _a[0]) == null ? void 0 : _b.date;
|
|
365
364
|
if (!date) {
|
|
366
365
|
const normalProductCartItem = cartItems.find(
|
|
367
|
-
(n) => !(0,
|
|
366
|
+
(n) => !(0, import_utils4.isNormalProduct)(n._productOrigin)
|
|
368
367
|
);
|
|
369
368
|
date = (normalProductCartItem == null ? void 0 : normalProductCartItem.start_date) || "";
|
|
370
369
|
}
|
|
@@ -474,7 +473,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
474
473
|
let date = (_b = (_a = this.store.date.getDateRange()) == null ? void 0 : _a[0]) == null ? void 0 : _b.date;
|
|
475
474
|
if (!date) {
|
|
476
475
|
const normalProductCartItem = cartItems.find(
|
|
477
|
-
(n) => !(0,
|
|
476
|
+
(n) => !(0, import_utils4.isNormalProduct)(n._productOrigin)
|
|
478
477
|
);
|
|
479
478
|
date = (normalProductCartItem == null ? void 0 : normalProductCartItem.start_date) || "";
|
|
480
479
|
}
|
|
@@ -526,7 +525,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
526
525
|
}
|
|
527
526
|
});
|
|
528
527
|
let type = this.otherParams.isRetailTemplate ? "virtual" : "appointment_booking";
|
|
529
|
-
if ((0,
|
|
528
|
+
if ((0, import_utils4.areAllNormalProducts)(
|
|
530
529
|
newCartItems.map((n) => n._productOrigin)
|
|
531
530
|
)) {
|
|
532
531
|
type = "virtual";
|
|
@@ -636,15 +635,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
636
635
|
addItemParams.account = account;
|
|
637
636
|
}
|
|
638
637
|
this.addProductCheck({ date });
|
|
639
|
-
|
|
640
|
-
for (let i = 0; i < addItemParams.quantity; i++) {
|
|
641
|
-
const newAddItemParams = (0, import_lodash_es.cloneDeep)(addItemParams);
|
|
642
|
-
newAddItemParams.quantity = 1;
|
|
643
|
-
this.store.cart.addItem(newAddItemParams);
|
|
644
|
-
}
|
|
645
|
-
} else {
|
|
646
|
-
this.store.cart.addItem(addItemParams);
|
|
647
|
-
}
|
|
638
|
+
this.store.cart.addItem(addItemParams);
|
|
648
639
|
return { success: true };
|
|
649
640
|
}
|
|
650
641
|
/**
|
|
@@ -657,7 +648,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
657
648
|
date
|
|
658
649
|
}) {
|
|
659
650
|
if (date) {
|
|
660
|
-
const cartItems = this.store.cart.getItems().filter((n) => !(0,
|
|
651
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
661
652
|
const cartItemsByDate = cartItems.filter(
|
|
662
653
|
(n) => !(0, import_dayjs.default)(n.start_date).isSame((0, import_dayjs.default)(date.startTime), "day")
|
|
663
654
|
);
|
|
@@ -819,7 +810,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
819
810
|
* @returns 不符合条件的购物车商品ID列表
|
|
820
811
|
*/
|
|
821
812
|
checkCartItems(type) {
|
|
822
|
-
const cartItems = this.store.cart.getItems().filter((n) => !(0,
|
|
813
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
823
814
|
const errorCartItemIds = [];
|
|
824
815
|
cartItems.forEach((cartItem) => {
|
|
825
816
|
const result = this.store.cart.checkCartItemByType(cartItem, type);
|
|
@@ -850,7 +841,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
850
841
|
resources.push(...n.resource);
|
|
851
842
|
});
|
|
852
843
|
}
|
|
853
|
-
const cartItems = this.store.cart.getItems().filter((n) => !(0,
|
|
844
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
854
845
|
if (!resources.length) {
|
|
855
846
|
const firstDateCartItem = cartItems == null ? void 0 : cartItems.find((n) => n.start_date);
|
|
856
847
|
if (firstDateCartItem == null ? void 0 : firstDateCartItem.start_date) {
|
|
@@ -866,7 +857,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
866
857
|
});
|
|
867
858
|
}
|
|
868
859
|
}
|
|
869
|
-
const resourcesMap = (0,
|
|
860
|
+
const resourcesMap = (0, import_utils.getResourcesMap)((0, import_lodash_es.cloneDeep)(resources));
|
|
870
861
|
const arr = [];
|
|
871
862
|
cartItems.forEach((cartItem) => {
|
|
872
863
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
@@ -995,14 +986,14 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
995
986
|
*/
|
|
996
987
|
getResourcesListByCartItem(id) {
|
|
997
988
|
var _a, _b;
|
|
998
|
-
const cartItems = this.store.cart.getItems().filter((n) => !(0,
|
|
989
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
999
990
|
const dateRange = this.store.date.getDateRange();
|
|
1000
991
|
const resources = [];
|
|
1001
992
|
dateRange.forEach((n) => {
|
|
1002
993
|
if (n.resource)
|
|
1003
994
|
resources.push(...n.resource);
|
|
1004
995
|
});
|
|
1005
|
-
const resourcesMap = (0,
|
|
996
|
+
const resourcesMap = (0, import_utils.getResourcesMap)(resources);
|
|
1006
997
|
const targetCartItem = cartItems.find((n) => n._id === id);
|
|
1007
998
|
if (!targetCartItem) {
|
|
1008
999
|
throw new Error(`没有找到${id}购物车商品`);
|
|
@@ -1059,7 +1050,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1059
1050
|
capacity
|
|
1060
1051
|
}) {
|
|
1061
1052
|
var _a, _b, _c;
|
|
1062
|
-
if ((0,
|
|
1053
|
+
if ((0, import_utils4.isNormalProduct)(cartItem._productOrigin)) {
|
|
1063
1054
|
return {};
|
|
1064
1055
|
}
|
|
1065
1056
|
const dateRange = this.store.date.getDateRange();
|
|
@@ -1094,7 +1085,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1094
1085
|
});
|
|
1095
1086
|
}
|
|
1096
1087
|
}
|
|
1097
|
-
const resourcesMap = (0,
|
|
1088
|
+
const resourcesMap = (0, import_utils.getResourcesMap)((0, import_lodash_es.cloneDeep)(AllResources));
|
|
1098
1089
|
const allCartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
|
|
1099
1090
|
const selectedResources = (0, import_resources.getOthersSelectedResources)(
|
|
1100
1091
|
allCartItems,
|
|
@@ -1175,7 +1166,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1175
1166
|
selectedResource: targetResource
|
|
1176
1167
|
};
|
|
1177
1168
|
} else {
|
|
1178
|
-
const resourcesMap2 = (0,
|
|
1169
|
+
const resourcesMap2 = (0, import_utils.getResourcesMap)(resources);
|
|
1179
1170
|
const resourceIds = resources.map((n) => n.id);
|
|
1180
1171
|
const timeSlots2 = (0, import_resources.getTimeSlicesByResources)({
|
|
1181
1172
|
resourceIds,
|
|
@@ -1313,7 +1304,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1313
1304
|
currentResourcesRenderList.push(...n.renderList || []);
|
|
1314
1305
|
}
|
|
1315
1306
|
});
|
|
1316
|
-
const resourcesMap = (0,
|
|
1307
|
+
const resourcesMap = (0, import_utils.getResourcesMap)(currentResourcesRenderList);
|
|
1317
1308
|
if (item.holder_id) {
|
|
1318
1309
|
selectedResources = (0, import_resources.getOthersSelectedResources)(
|
|
1319
1310
|
allCartItems,
|
|
@@ -1378,7 +1369,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1378
1369
|
}
|
|
1379
1370
|
});
|
|
1380
1371
|
};
|
|
1381
|
-
const cartItems = this.store.cart.getItems().filter((n) => !(0,
|
|
1372
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
1382
1373
|
if (cartItems == null ? void 0 : cartItems[0].holder_id) {
|
|
1383
1374
|
accountList.forEach((account) => {
|
|
1384
1375
|
const cartItems2 = this.store.cart.getCartByAccount(account.getId());
|
|
@@ -1394,7 +1385,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1394
1385
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1395
1386
|
let dateRange = this.store.date.getDateRange();
|
|
1396
1387
|
const resources = [];
|
|
1397
|
-
const cartItems = this.store.cart.getItems().filter((n) => !(0,
|
|
1388
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
1398
1389
|
const resourceIds = [];
|
|
1399
1390
|
let resourcesTypeId = void 0;
|
|
1400
1391
|
let isSingleResource = false;
|
|
@@ -1432,7 +1423,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1432
1423
|
}
|
|
1433
1424
|
});
|
|
1434
1425
|
}
|
|
1435
|
-
const resourcesMap = (0,
|
|
1426
|
+
const resourcesMap = (0, import_utils.getResourcesMap)(resources);
|
|
1436
1427
|
let duration = 0;
|
|
1437
1428
|
const accountList = this.store.accountList.getAccounts();
|
|
1438
1429
|
const checkDuration = (cartItems2) => {
|
|
@@ -1531,7 +1522,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1531
1522
|
// 提交时间切片,绑定到对应购物车的商品上,更新购物车---只有 duration 商品
|
|
1532
1523
|
submitTimeSlot(timeSlots) {
|
|
1533
1524
|
var _a, _b;
|
|
1534
|
-
const cartItems = this.store.cart.getItems().filter((n) => !(0,
|
|
1525
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
1535
1526
|
const allResources = this.store.date.getResourcesListByDate(
|
|
1536
1527
|
timeSlots.start_at.format("YYYY-MM-DD")
|
|
1537
1528
|
);
|
|
@@ -1609,7 +1600,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1609
1600
|
getScheduleDataByIds(scheduleIds) {
|
|
1610
1601
|
const targetSchedules = this.store.schedule.getScheduleListByIds(scheduleIds);
|
|
1611
1602
|
const targetSchedulesData = targetSchedules.map((item) => {
|
|
1612
|
-
return (0,
|
|
1603
|
+
return (0, import_utils2.calcCalendarDataByScheduleResult)(item);
|
|
1613
1604
|
});
|
|
1614
1605
|
const newSchedule = {};
|
|
1615
1606
|
targetSchedulesData.forEach((item) => {
|
|
@@ -1681,7 +1672,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1681
1672
|
const resourcesDates = this.store.date.getDateList();
|
|
1682
1673
|
const targetResourceDate = resourcesDates.find((n) => n.date === date);
|
|
1683
1674
|
const cartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
|
|
1684
|
-
const resourcesMap = (0,
|
|
1675
|
+
const resourcesMap = (0, import_utils.getResourcesMap)((targetResourceDate == null ? void 0 : targetResourceDate.resource) || []);
|
|
1685
1676
|
const selectedResources = (0, import_resources.getOthersSelectedResources)(
|
|
1686
1677
|
cartItems,
|
|
1687
1678
|
"",
|
|
@@ -1693,12 +1684,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1693
1684
|
selectedResources,
|
|
1694
1685
|
1
|
|
1695
1686
|
);
|
|
1696
|
-
const minTimeMaxTime = (0,
|
|
1687
|
+
const minTimeMaxTime = (0, import_utils2.calcMinTimeMaxTimeBySchedules)(
|
|
1697
1688
|
targetSchedules,
|
|
1698
1689
|
{},
|
|
1699
1690
|
date
|
|
1700
1691
|
);
|
|
1701
|
-
const scheduleTimeSlots = (0,
|
|
1692
|
+
const scheduleTimeSlots = (0, import_utils2.getAllSortedDateRanges)(minTimeMaxTime);
|
|
1702
1693
|
let allProductResources = productResources.flatMap((n) => n.renderList);
|
|
1703
1694
|
allProductResources.sort((a, b) => {
|
|
1704
1695
|
var _a2, _b2, _c2, _d2;
|
|
@@ -1814,7 +1805,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1814
1805
|
otherSameTimesCartItems.forEach((m) => {
|
|
1815
1806
|
var _a2, _b2;
|
|
1816
1807
|
const productResources2 = (0, import_resources.getResourcesByProduct)(
|
|
1817
|
-
(0,
|
|
1808
|
+
(0, import_utils.getResourcesMap)((targetResourceDate == null ? void 0 : targetResourceDate.resource) || []),
|
|
1818
1809
|
((_b2 = (_a2 = m._productOrigin) == null ? void 0 : _a2.product_resource) == null ? void 0 : _b2.resources) || [],
|
|
1819
1810
|
selectedResources,
|
|
1820
1811
|
1
|
|
@@ -1961,7 +1952,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1961
1952
|
const targetResourceDate = resourcesDates.find((n) => n.date === dateRange[0].date);
|
|
1962
1953
|
if (!targetResourceDate)
|
|
1963
1954
|
return { success: false, minAvailableCount: 0 };
|
|
1964
|
-
const resourcesMap = (0,
|
|
1955
|
+
const resourcesMap = (0, import_utils.getResourcesMap)(targetResourceDate.resource || []);
|
|
1965
1956
|
const resourceCodeToFormIdMap = {};
|
|
1966
1957
|
Object.values(itemsByResourceType).flat().forEach((cartItem) => {
|
|
1967
1958
|
var _a2, _b2;
|
|
@@ -2103,7 +2094,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2103
2094
|
const targetResourceDate = resourcesDates.find((n) => n.date === startDate);
|
|
2104
2095
|
if (!targetResourceDate)
|
|
2105
2096
|
continue;
|
|
2106
|
-
const resourcesMap = (0,
|
|
2097
|
+
const resourcesMap = (0, import_utils.getResourcesMap)(targetResourceDate.resource || []);
|
|
2107
2098
|
itemsInTimeSlot.forEach((cartItem) => {
|
|
2108
2099
|
if (!cartItem._productOrigin)
|
|
2109
2100
|
return;
|
|
@@ -2115,8 +2106,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2115
2106
|
}
|
|
2116
2107
|
});
|
|
2117
2108
|
});
|
|
2118
|
-
|
|
2119
|
-
if (!success) {
|
|
2109
|
+
if (!(0, import_capacity.checkTimeSlotCapacity)(timeSlotStart, timeSlotEnd, itemsInTimeSlot, allResourcesForTimeSlot)) {
|
|
2120
2110
|
const minAvailableCount2 = availableCountsByResourceType.length > 0 ? Math.min(...availableCountsByResourceType) : 0;
|
|
2121
2111
|
return { success: false, minAvailableCount: minAvailableCount2 };
|
|
2122
2112
|
}
|
|
@@ -2124,268 +2114,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2124
2114
|
const minAvailableCount = availableCountsByResourceType.length > 0 ? Math.min(...availableCountsByResourceType) : 0;
|
|
2125
2115
|
return { success: true, minAvailableCount };
|
|
2126
2116
|
}
|
|
2127
|
-
/**
|
|
2128
|
-
* 将 ProductData 转换为 CartItem,但不添加到购物车
|
|
2129
|
-
* 参考 addProductToCart 方法的实现
|
|
2130
|
-
*/
|
|
2131
|
-
convertProductToCartItem({
|
|
2132
|
-
product,
|
|
2133
|
-
date,
|
|
2134
|
-
account
|
|
2135
|
-
}) {
|
|
2136
|
-
const {
|
|
2137
|
-
bundle,
|
|
2138
|
-
options,
|
|
2139
|
-
origin,
|
|
2140
|
-
product_variant_id,
|
|
2141
|
-
quantity = 1
|
|
2142
|
-
} = product || {};
|
|
2143
|
-
const productData = { ...origin, product_variant_id };
|
|
2144
|
-
const processedProduct = (0, import_utils.handleVariantProduct)(productData);
|
|
2145
|
-
if (!account) {
|
|
2146
|
-
const activeAccount = this.getActiveAccount();
|
|
2147
|
-
if (activeAccount) {
|
|
2148
|
-
account = activeAccount;
|
|
2149
|
-
}
|
|
2150
|
-
}
|
|
2151
|
-
const cartItem = {
|
|
2152
|
-
_id: (0, import_utils.getUniqueId)("temp_"),
|
|
2153
|
-
_origin: (0, import_utils.createCartItemOrigin)(),
|
|
2154
|
-
_productOrigin: processedProduct,
|
|
2155
|
-
_productInit: product
|
|
2156
|
-
};
|
|
2157
|
-
(0, import_utils.formatProductToCartItem)({
|
|
2158
|
-
cartItem,
|
|
2159
|
-
product: processedProduct,
|
|
2160
|
-
bundle,
|
|
2161
|
-
options,
|
|
2162
|
-
product_variant_id,
|
|
2163
|
-
quantity
|
|
2164
|
-
});
|
|
2165
|
-
if (date) {
|
|
2166
|
-
(0, import_utils.formatDateToCartItem)({
|
|
2167
|
-
cartItem,
|
|
2168
|
-
date
|
|
2169
|
-
});
|
|
2170
|
-
}
|
|
2171
|
-
if (account) {
|
|
2172
|
-
(0, import_utils.formatAccountToCartItem)({
|
|
2173
|
-
cartItem,
|
|
2174
|
-
account
|
|
2175
|
-
});
|
|
2176
|
-
}
|
|
2177
|
-
return cartItem;
|
|
2178
|
-
}
|
|
2179
|
-
checkMaxDurationCapacityForDetailNums({
|
|
2180
|
-
product,
|
|
2181
|
-
date,
|
|
2182
|
-
account
|
|
2183
|
-
}) {
|
|
2184
|
-
var _a, _b;
|
|
2185
|
-
const cartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
|
|
2186
|
-
const currentCartItem = this.convertProductToCartItem({ product, date, account });
|
|
2187
|
-
cartItems.push(currentCartItem);
|
|
2188
|
-
if (cartItems.length === 0)
|
|
2189
|
-
return { success: true, minAvailableCount: 0 };
|
|
2190
|
-
const itemsWithTime = [];
|
|
2191
|
-
const itemsWithoutTime = [];
|
|
2192
|
-
const availableCountsByResourceType = [];
|
|
2193
|
-
cartItems.forEach((cartItem) => {
|
|
2194
|
-
if (cartItem.start_time && cartItem.end_time && cartItem.start_date) {
|
|
2195
|
-
itemsWithTime.push(cartItem);
|
|
2196
|
-
} else {
|
|
2197
|
-
itemsWithoutTime.push(cartItem);
|
|
2198
|
-
}
|
|
2199
|
-
});
|
|
2200
|
-
const processedItemsWithoutTime = [];
|
|
2201
|
-
if (itemsWithoutTime.length > 0) {
|
|
2202
|
-
const itemsByResourceType = {};
|
|
2203
|
-
itemsWithoutTime.forEach((cartItem) => {
|
|
2204
|
-
var _a2;
|
|
2205
|
-
if (!cartItem._productOrigin)
|
|
2206
|
-
return;
|
|
2207
|
-
const resourceTypes = ((_a2 = cartItem._productOrigin.product_resource) == null ? void 0 : _a2.resources) || [];
|
|
2208
|
-
resourceTypes.forEach((resourceType) => {
|
|
2209
|
-
var _a3;
|
|
2210
|
-
if (resourceType.status === 1) {
|
|
2211
|
-
const resourceCode = resourceType.code || ((_a3 = resourceType.id) == null ? void 0 : _a3.toString());
|
|
2212
|
-
if (!itemsByResourceType[resourceCode]) {
|
|
2213
|
-
itemsByResourceType[resourceCode] = [];
|
|
2214
|
-
}
|
|
2215
|
-
if (!itemsByResourceType[resourceCode].find((item) => item._id === cartItem._id)) {
|
|
2216
|
-
itemsByResourceType[resourceCode].push(cartItem);
|
|
2217
|
-
}
|
|
2218
|
-
}
|
|
2219
|
-
});
|
|
2220
|
-
});
|
|
2221
|
-
const dateRange = this.store.date.getDateRange();
|
|
2222
|
-
if (!dateRange || dateRange.length === 0)
|
|
2223
|
-
return { success: false, minAvailableCount: 0 };
|
|
2224
|
-
const resourcesDates = this.store.date.getDateList();
|
|
2225
|
-
const targetResourceDate = resourcesDates.find((n) => n.date === dateRange[0].date);
|
|
2226
|
-
if (!targetResourceDate)
|
|
2227
|
-
return { success: false, minAvailableCount: 0 };
|
|
2228
|
-
const resourcesMap = (0, import_utils2.getResourcesMap)(targetResourceDate.resource || []);
|
|
2229
|
-
const resourceCodeToFormIdMap = {};
|
|
2230
|
-
Object.values(itemsByResourceType).flat().forEach((cartItem) => {
|
|
2231
|
-
var _a2, _b2;
|
|
2232
|
-
if ((_b2 = (_a2 = cartItem._productOrigin) == null ? void 0 : _a2.product_resource) == null ? void 0 : _b2.resources) {
|
|
2233
|
-
cartItem._productOrigin.product_resource.resources.forEach((resourceConfig) => {
|
|
2234
|
-
var _a3, _b3;
|
|
2235
|
-
if (resourceConfig.status === 1 && resourceConfig.code) {
|
|
2236
|
-
const formId = ((_a3 = resourceConfig.id) == null ? void 0 : _a3.toString()) || ((_b3 = resourceConfig.resource_type_id) == null ? void 0 : _b3.toString());
|
|
2237
|
-
if (formId) {
|
|
2238
|
-
resourceCodeToFormIdMap[resourceConfig.code] = formId;
|
|
2239
|
-
}
|
|
2240
|
-
}
|
|
2241
|
-
});
|
|
2242
|
-
}
|
|
2243
|
-
});
|
|
2244
|
-
let hasCapacityIssue = false;
|
|
2245
|
-
const resourceCapacityInfo = [];
|
|
2246
|
-
const processedCartItemIds = /* @__PURE__ */ new Set();
|
|
2247
|
-
for (const [resourceCode, items] of Object.entries(itemsByResourceType)) {
|
|
2248
|
-
const targetFormId = resourceCodeToFormIdMap[resourceCode];
|
|
2249
|
-
if (!targetFormId) {
|
|
2250
|
-
console.log(`资源类型 ${resourceCode} 找不到对应的 form_id`);
|
|
2251
|
-
return { success: false, minAvailableCount: 0 };
|
|
2252
|
-
}
|
|
2253
|
-
const resourcesOfThisType = [];
|
|
2254
|
-
items.forEach((cartItem) => {
|
|
2255
|
-
const productResourceIds = (0, import_capacity.getResourcesIdsByProduct)(cartItem._productOrigin);
|
|
2256
|
-
productResourceIds.forEach((resourceId) => {
|
|
2257
|
-
var _a2;
|
|
2258
|
-
const resource = resourcesMap[resourceId];
|
|
2259
|
-
if (resource && ((_a2 = resource.form_id) == null ? void 0 : _a2.toString()) === targetFormId) {
|
|
2260
|
-
if (!resourcesOfThisType.find((r) => r.id === resource.id)) {
|
|
2261
|
-
resourcesOfThisType.push(resource);
|
|
2262
|
-
}
|
|
2263
|
-
}
|
|
2264
|
-
});
|
|
2265
|
-
});
|
|
2266
|
-
if (resourcesOfThisType.length === 0) {
|
|
2267
|
-
console.log(`资源类型 ${resourceCode} 没有找到可用资源`);
|
|
2268
|
-
return { success: false, minAvailableCount: 0 };
|
|
2269
|
-
}
|
|
2270
|
-
let resourceTypeConfig = null;
|
|
2271
|
-
for (const cartItem of items) {
|
|
2272
|
-
if ((_b = (_a = cartItem._productOrigin) == null ? void 0 : _a.product_resource) == null ? void 0 : _b.resources) {
|
|
2273
|
-
resourceTypeConfig = cartItem._productOrigin.product_resource.resources.find(
|
|
2274
|
-
(r) => r.code === resourceCode && r.status === 1
|
|
2275
|
-
);
|
|
2276
|
-
if (resourceTypeConfig)
|
|
2277
|
-
break;
|
|
2278
|
-
}
|
|
2279
|
-
}
|
|
2280
|
-
const isMultipleBooking = (resourceTypeConfig == null ? void 0 : resourceTypeConfig.type) === "multiple";
|
|
2281
|
-
let totalAvailable;
|
|
2282
|
-
let requiredAmount;
|
|
2283
|
-
let availableAmount;
|
|
2284
|
-
if (isMultipleBooking) {
|
|
2285
|
-
totalAvailable = resourcesOfThisType.reduce((sum, resource) => {
|
|
2286
|
-
return sum + (resource.capacity || 0);
|
|
2287
|
-
}, 0);
|
|
2288
|
-
requiredAmount = items.reduce((sum, cartItem) => {
|
|
2289
|
-
const { currentCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(cartItem);
|
|
2290
|
-
return sum + currentCapacity;
|
|
2291
|
-
}, 0);
|
|
2292
|
-
availableAmount = Math.max(0, totalAvailable - requiredAmount);
|
|
2293
|
-
} else {
|
|
2294
|
-
totalAvailable = resourcesOfThisType.length;
|
|
2295
|
-
requiredAmount = items.reduce((sum, cartItem) => {
|
|
2296
|
-
return sum + (cartItem.num || 1);
|
|
2297
|
-
}, 0);
|
|
2298
|
-
availableAmount = Math.max(0, totalAvailable - requiredAmount);
|
|
2299
|
-
}
|
|
2300
|
-
resourceCapacityInfo.push({
|
|
2301
|
-
code: resourceCode,
|
|
2302
|
-
available: availableAmount,
|
|
2303
|
-
total: totalAvailable,
|
|
2304
|
-
required: requiredAmount,
|
|
2305
|
-
isMultiple: isMultipleBooking
|
|
2306
|
-
});
|
|
2307
|
-
availableCountsByResourceType.push(availableAmount);
|
|
2308
|
-
if (requiredAmount > totalAvailable) {
|
|
2309
|
-
hasCapacityIssue = true;
|
|
2310
|
-
console.log(`资源类型 ${resourceCode} ${isMultipleBooking ? "容量" : "资源数量"}不足: 需要 ${requiredAmount}, 总共 ${totalAvailable}`);
|
|
2311
|
-
}
|
|
2312
|
-
console.log(`资源类型 ${resourceCode} 的资源时间信息:`, resourcesOfThisType.map((r) => ({
|
|
2313
|
-
id: r.id,
|
|
2314
|
-
times: r.times.map((t) => `${t.start_at} - ${t.end_at}`)
|
|
2315
|
-
})));
|
|
2316
|
-
const commonTimeSlots = this.findCommonAvailableTimeSlots(resourcesOfThisType);
|
|
2317
|
-
console.log(`资源类型 ${resourceCode} 的公共时间段:`, commonTimeSlots);
|
|
2318
|
-
if (commonTimeSlots.length === 0) {
|
|
2319
|
-
console.log(`资源类型 ${resourceCode} 没有公共可用时间段`);
|
|
2320
|
-
return { success: false, minAvailableCount: 0 };
|
|
2321
|
-
}
|
|
2322
|
-
const firstCommonSlot = commonTimeSlots[0];
|
|
2323
|
-
console.log(`使用公共时间段: ${firstCommonSlot.startTime} - ${firstCommonSlot.endTime}`);
|
|
2324
|
-
items.forEach((cartItem) => {
|
|
2325
|
-
if (!processedCartItemIds.has(cartItem._id)) {
|
|
2326
|
-
processedCartItemIds.add(cartItem._id);
|
|
2327
|
-
const processedItem = {
|
|
2328
|
-
...cartItem,
|
|
2329
|
-
start_date: dateRange[0].date,
|
|
2330
|
-
start_time: firstCommonSlot.startTime,
|
|
2331
|
-
end_time: firstCommonSlot.endTime,
|
|
2332
|
-
end_date: dateRange[0].date
|
|
2333
|
-
};
|
|
2334
|
-
processedItemsWithoutTime.push(processedItem);
|
|
2335
|
-
}
|
|
2336
|
-
});
|
|
2337
|
-
}
|
|
2338
|
-
if (hasCapacityIssue) {
|
|
2339
|
-
const overCapacityResources = resourceCapacityInfo.filter((info) => info.required > info.total);
|
|
2340
|
-
if (overCapacityResources.length > 0) {
|
|
2341
|
-
const minTotalCapacity2 = Math.min(...overCapacityResources.map((info) => info.total));
|
|
2342
|
-
return { success: false, minAvailableCount: minTotalCapacity2 };
|
|
2343
|
-
}
|
|
2344
|
-
const minTotalCapacity = Math.min(...resourceCapacityInfo.map((info) => info.total));
|
|
2345
|
-
return { success: false, minAvailableCount: minTotalCapacity };
|
|
2346
|
-
}
|
|
2347
|
-
}
|
|
2348
|
-
const allProcessedItems = [...itemsWithTime, ...processedItemsWithoutTime];
|
|
2349
|
-
const cartItemsByTimeSlot = {};
|
|
2350
|
-
allProcessedItems.forEach((cartItem) => {
|
|
2351
|
-
if (!cartItem.start_time || !cartItem.end_time || !cartItem.start_date)
|
|
2352
|
-
return;
|
|
2353
|
-
const timeSlotKey = `${cartItem.start_date}_${cartItem.start_time}_${cartItem.end_date || cartItem.start_date}_${cartItem.end_time}`;
|
|
2354
|
-
if (!cartItemsByTimeSlot[timeSlotKey]) {
|
|
2355
|
-
cartItemsByTimeSlot[timeSlotKey] = [];
|
|
2356
|
-
}
|
|
2357
|
-
cartItemsByTimeSlot[timeSlotKey].push(cartItem);
|
|
2358
|
-
});
|
|
2359
|
-
for (const [timeSlotKey, itemsInTimeSlot] of Object.entries(cartItemsByTimeSlot)) {
|
|
2360
|
-
const [startDate, startTime, endDate, endTime] = timeSlotKey.split("_");
|
|
2361
|
-
const timeSlotStart = `${startDate} ${startTime}`;
|
|
2362
|
-
const timeSlotEnd = `${endDate} ${endTime}`;
|
|
2363
|
-
const allResourcesForTimeSlot = [];
|
|
2364
|
-
const resourcesIdSet = /* @__PURE__ */ new Set();
|
|
2365
|
-
const resourcesDates = this.store.date.getDateList();
|
|
2366
|
-
const targetResourceDate = resourcesDates.find((n) => n.date === startDate);
|
|
2367
|
-
if (!targetResourceDate)
|
|
2368
|
-
continue;
|
|
2369
|
-
const resourcesMap = (0, import_utils2.getResourcesMap)(targetResourceDate.resource || []);
|
|
2370
|
-
itemsInTimeSlot.forEach((cartItem) => {
|
|
2371
|
-
if (!cartItem._productOrigin)
|
|
2372
|
-
return;
|
|
2373
|
-
const productResourceIds = (0, import_capacity.getResourcesIdsByProduct)(cartItem._productOrigin);
|
|
2374
|
-
productResourceIds.forEach((resourceId) => {
|
|
2375
|
-
if (resourcesMap[resourceId] && !resourcesIdSet.has(resourceId)) {
|
|
2376
|
-
resourcesIdSet.add(resourceId);
|
|
2377
|
-
allResourcesForTimeSlot.push(resourcesMap[resourceId]);
|
|
2378
|
-
}
|
|
2379
|
-
});
|
|
2380
|
-
});
|
|
2381
|
-
const { success, required, available } = (0, import_capacity.checkTimeSlotCapacity)(timeSlotStart, timeSlotEnd, itemsInTimeSlot, allResourcesForTimeSlot);
|
|
2382
|
-
if (!success) {
|
|
2383
|
-
return { success: false, minAvailableCount: available };
|
|
2384
|
-
}
|
|
2385
|
-
}
|
|
2386
|
-
const minAvailableCount = availableCountsByResourceType.length > 0 ? Math.min(...availableCountsByResourceType) : 0;
|
|
2387
|
-
return { success: true, minAvailableCount };
|
|
2388
|
-
}
|
|
2389
2117
|
setOtherData(key, value) {
|
|
2390
2118
|
this.otherData[key] = value;
|
|
2391
2119
|
this.checkSaveCache({
|
|
@@ -2437,8 +2165,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2437
2165
|
resources.push(...n.resource);
|
|
2438
2166
|
});
|
|
2439
2167
|
}
|
|
2440
|
-
const resourcesMap = (0,
|
|
2441
|
-
const cartItems = this.store.cart.getItems().filter((n) => !(0,
|
|
2168
|
+
const resourcesMap = (0, import_utils.getResourcesMap)((0, import_lodash_es.cloneDeep)(resources));
|
|
2169
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
2442
2170
|
const cartItem = cartItems.find((item) => item._id === cartItemId);
|
|
2443
2171
|
if (!cartItem)
|
|
2444
2172
|
return [];
|
|
@@ -2651,12 +2379,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2651
2379
|
}
|
|
2652
2380
|
}
|
|
2653
2381
|
if (status === "available") {
|
|
2654
|
-
const minTimeMaxTime = (0,
|
|
2382
|
+
const minTimeMaxTime = (0, import_utils2.calcMinTimeMaxTimeBySchedules)(
|
|
2655
2383
|
targetSchedules,
|
|
2656
2384
|
{},
|
|
2657
2385
|
currentDateStr
|
|
2658
2386
|
);
|
|
2659
|
-
const scheduleTimeSlots = (0,
|
|
2387
|
+
const scheduleTimeSlots = (0, import_utils2.getAllSortedDateRanges)(minTimeMaxTime);
|
|
2660
2388
|
const timesSlotCanUse = scheduleTimeSlots.some((item) => {
|
|
2661
2389
|
const resourcesUseableMap = {};
|
|
2662
2390
|
return openResources.every((resource) => {
|
|
@@ -2713,7 +2441,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2713
2441
|
}
|
|
2714
2442
|
currentDate = (0, import_dayjs.default)(currentDate).add(1, "day");
|
|
2715
2443
|
}
|
|
2716
|
-
dates = (0,
|
|
2444
|
+
dates = (0, import_utils3.handleAvailableDateByResource)(res.data, dates);
|
|
2717
2445
|
this.store.date.setDateList(dates);
|
|
2718
2446
|
if (!this.store.currentProductMeta)
|
|
2719
2447
|
this.store.currentProductMeta = {};
|
|
@@ -2729,11 +2457,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2729
2457
|
};
|
|
2730
2458
|
}
|
|
2731
2459
|
isCartAllNormalProducts() {
|
|
2732
|
-
const cartItems = this.store.cart.getItems().filter((n) => !(0,
|
|
2460
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
2733
2461
|
return !cartItems.length;
|
|
2734
2462
|
}
|
|
2735
2463
|
isCartHasDurationProduct() {
|
|
2736
|
-
const cartItems = this.store.cart.getItems().filter((n) => !(0,
|
|
2464
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
2737
2465
|
return cartItems.some((n) => {
|
|
2738
2466
|
var _a;
|
|
2739
2467
|
return (_a = n._productOrigin) == null ? void 0 : _a.duration;
|
|
@@ -2742,11 +2470,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2742
2470
|
isTargetNormalProduct(product) {
|
|
2743
2471
|
if (!product)
|
|
2744
2472
|
return false;
|
|
2745
|
-
return (0,
|
|
2473
|
+
return (0, import_utils4.isNormalProduct)(product);
|
|
2746
2474
|
}
|
|
2747
2475
|
isTargetCartIdNormalProduct(id) {
|
|
2748
2476
|
const cartItem = this.store.cart.getItems().find((n) => n._id === id);
|
|
2749
|
-
return cartItem && (0,
|
|
2477
|
+
return cartItem && (0, import_utils4.isNormalProduct)(cartItem._productOrigin);
|
|
2750
2478
|
}
|
|
2751
2479
|
};
|
|
2752
2480
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -15,9 +15,8 @@ export declare const formatDefaultCapacitys: ({ capacity, product_bundle, }: any
|
|
|
15
15
|
* @return {*}
|
|
16
16
|
* @Author: zhiwei.Wang
|
|
17
17
|
*/
|
|
18
|
-
export declare const getSumCapacity: ({ capacity
|
|
18
|
+
export declare const getSumCapacity: ({ capacity }: {
|
|
19
19
|
capacity: CapacityItem[];
|
|
20
|
-
num: number;
|
|
21
20
|
}) => number;
|
|
22
21
|
/**
|
|
23
22
|
* 给定购物车数据,返回对应的 capacity 信息和套餐 capacity
|
|
@@ -68,8 +67,4 @@ export declare function getResourcesIdsByProduct(product: any): number[];
|
|
|
68
67
|
/**
|
|
69
68
|
* 检查特定时间段的容量是否足够
|
|
70
69
|
*/
|
|
71
|
-
export declare function checkTimeSlotCapacity(timeSlotStart: string, timeSlotEnd: string, cartItems: CartItem[], allResources: ResourceItem[]):
|
|
72
|
-
success: boolean;
|
|
73
|
-
required: number;
|
|
74
|
-
available: number;
|
|
75
|
-
};
|
|
70
|
+
export declare function checkTimeSlotCapacity(timeSlotStart: string, timeSlotEnd: string, cartItems: CartItem[], allResources: ResourceItem[]): boolean;
|