@pisell/pisellos 2.1.41 → 2.2.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.d.ts +8 -1
- package/dist/core/index.js +116 -42
- package/dist/modules/Customer/index.js +1 -1
- package/dist/modules/Order/index.js +4 -4
- package/dist/modules/Order/types.d.ts +0 -1
- package/dist/modules/Product/types.d.ts +19 -0
- package/dist/modules/ProductList/index.js +3 -11
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/plugins/request.d.ts +19 -1
- package/dist/plugins/request.js +11 -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 +774 -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 +2 -22
- package/dist/solution/BookingByStep/index.js +29 -502
- 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 +8 -0
- package/dist/solution/BookingTicket/index.js +105 -71
- package/dist/solution/ShopDiscount/index.js +9 -27
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +0 -1
- package/dist/types/index.d.ts +26 -0
- package/lib/core/index.d.ts +8 -1
- package/lib/core/index.js +48 -1
- package/lib/modules/Customer/index.js +1 -1
- package/lib/modules/Order/index.js +2 -5
- package/lib/modules/Order/types.d.ts +0 -1
- package/lib/modules/Product/types.d.ts +19 -0
- package/lib/modules/ProductList/index.js +2 -10
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/plugins/request.d.ts +19 -1
- package/lib/plugins/request.js +11 -1
- 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 +442 -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 +2 -22
- package/lib/solution/BookingByStep/index.js +42 -321
- 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 +8 -0
- package/lib/solution/BookingTicket/index.js +13 -0
- package/lib/solution/ShopDiscount/index.js +0 -9
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +0 -2
- package/lib/types/index.d.ts +26 -0
- package/package.json +2 -2
- package/dist/solution/RegisterAndLogin/config.d.ts +0 -87
- package/dist/solution/RegisterAndLogin/config.js +0 -792
- package/dist/solution/RegisterAndLogin/index.d.ts +0 -189
- package/dist/solution/RegisterAndLogin/index.js +0 -2667
- package/dist/solution/RegisterAndLogin/types.d.ts +0 -444
- package/dist/solution/RegisterAndLogin/types.js +0 -231
- package/dist/solution/RegisterAndLogin/utils.d.ts +0 -95
- package/dist/solution/RegisterAndLogin/utils.js +0 -322
- package/lib/solution/RegisterAndLogin/config.d.ts +0 -87
- package/lib/solution/RegisterAndLogin/config.js +0 -594
- package/lib/solution/RegisterAndLogin/index.d.ts +0 -189
- package/lib/solution/RegisterAndLogin/index.js +0 -1593
- package/lib/solution/RegisterAndLogin/types.d.ts +0 -444
- package/lib/solution/RegisterAndLogin/types.js +0 -78
- package/lib/solution/RegisterAndLogin/utils.d.ts +0 -95
- package/lib/solution/RegisterAndLogin/utils.js +0 -279
|
@@ -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");
|
|
@@ -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
|
}
|
|
@@ -504,7 +503,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
504
503
|
});
|
|
505
504
|
}
|
|
506
505
|
// 购物车提交订单
|
|
507
|
-
async submitOrder(
|
|
506
|
+
async submitOrder() {
|
|
508
507
|
const cartItems = this.store.cart.getItems();
|
|
509
508
|
const newCartItems = (0, import_lodash_es.cloneDeep)(cartItems);
|
|
510
509
|
newCartItems.forEach((item) => {
|
|
@@ -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";
|
|
@@ -535,8 +534,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
535
534
|
query: {
|
|
536
535
|
cartItems: newCartItems,
|
|
537
536
|
type,
|
|
538
|
-
platform: this.platform
|
|
539
|
-
extraData
|
|
537
|
+
platform: this.platform
|
|
540
538
|
}
|
|
541
539
|
});
|
|
542
540
|
}
|
|
@@ -637,15 +635,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
637
635
|
addItemParams.account = account;
|
|
638
636
|
}
|
|
639
637
|
this.addProductCheck({ date });
|
|
640
|
-
|
|
641
|
-
for (let i = 0; i < addItemParams.quantity; i++) {
|
|
642
|
-
const newAddItemParams = (0, import_lodash_es.cloneDeep)(addItemParams);
|
|
643
|
-
newAddItemParams.quantity = 1;
|
|
644
|
-
this.store.cart.addItem(newAddItemParams);
|
|
645
|
-
}
|
|
646
|
-
} else {
|
|
647
|
-
this.store.cart.addItem(addItemParams);
|
|
648
|
-
}
|
|
638
|
+
this.store.cart.addItem(addItemParams);
|
|
649
639
|
return { success: true };
|
|
650
640
|
}
|
|
651
641
|
/**
|
|
@@ -658,7 +648,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
658
648
|
date
|
|
659
649
|
}) {
|
|
660
650
|
if (date) {
|
|
661
|
-
const cartItems = this.store.cart.getItems().filter((n) => !(0,
|
|
651
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
662
652
|
const cartItemsByDate = cartItems.filter(
|
|
663
653
|
(n) => !(0, import_dayjs.default)(n.start_date).isSame((0, import_dayjs.default)(date.startTime), "day")
|
|
664
654
|
);
|
|
@@ -820,7 +810,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
820
810
|
* @returns 不符合条件的购物车商品ID列表
|
|
821
811
|
*/
|
|
822
812
|
checkCartItems(type) {
|
|
823
|
-
const cartItems = this.store.cart.getItems().filter((n) => !(0,
|
|
813
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
824
814
|
const errorCartItemIds = [];
|
|
825
815
|
cartItems.forEach((cartItem) => {
|
|
826
816
|
const result = this.store.cart.checkCartItemByType(cartItem, type);
|
|
@@ -851,7 +841,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
851
841
|
resources.push(...n.resource);
|
|
852
842
|
});
|
|
853
843
|
}
|
|
854
|
-
const cartItems = this.store.cart.getItems().filter((n) => !(0,
|
|
844
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
855
845
|
if (!resources.length) {
|
|
856
846
|
const firstDateCartItem = cartItems == null ? void 0 : cartItems.find((n) => n.start_date);
|
|
857
847
|
if (firstDateCartItem == null ? void 0 : firstDateCartItem.start_date) {
|
|
@@ -867,7 +857,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
867
857
|
});
|
|
868
858
|
}
|
|
869
859
|
}
|
|
870
|
-
const resourcesMap = (0,
|
|
860
|
+
const resourcesMap = (0, import_utils.getResourcesMap)((0, import_lodash_es.cloneDeep)(resources));
|
|
871
861
|
const arr = [];
|
|
872
862
|
cartItems.forEach((cartItem) => {
|
|
873
863
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
@@ -996,14 +986,14 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
996
986
|
*/
|
|
997
987
|
getResourcesListByCartItem(id) {
|
|
998
988
|
var _a, _b;
|
|
999
|
-
const cartItems = this.store.cart.getItems().filter((n) => !(0,
|
|
989
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
1000
990
|
const dateRange = this.store.date.getDateRange();
|
|
1001
991
|
const resources = [];
|
|
1002
992
|
dateRange.forEach((n) => {
|
|
1003
993
|
if (n.resource)
|
|
1004
994
|
resources.push(...n.resource);
|
|
1005
995
|
});
|
|
1006
|
-
const resourcesMap = (0,
|
|
996
|
+
const resourcesMap = (0, import_utils.getResourcesMap)(resources);
|
|
1007
997
|
const targetCartItem = cartItems.find((n) => n._id === id);
|
|
1008
998
|
if (!targetCartItem) {
|
|
1009
999
|
throw new Error(`没有找到${id}购物车商品`);
|
|
@@ -1060,7 +1050,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1060
1050
|
capacity
|
|
1061
1051
|
}) {
|
|
1062
1052
|
var _a, _b, _c;
|
|
1063
|
-
if ((0,
|
|
1053
|
+
if ((0, import_utils4.isNormalProduct)(cartItem._productOrigin)) {
|
|
1064
1054
|
return {};
|
|
1065
1055
|
}
|
|
1066
1056
|
const dateRange = this.store.date.getDateRange();
|
|
@@ -1095,7 +1085,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1095
1085
|
});
|
|
1096
1086
|
}
|
|
1097
1087
|
}
|
|
1098
|
-
const resourcesMap = (0,
|
|
1088
|
+
const resourcesMap = (0, import_utils.getResourcesMap)((0, import_lodash_es.cloneDeep)(AllResources));
|
|
1099
1089
|
const allCartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
|
|
1100
1090
|
const selectedResources = (0, import_resources.getOthersSelectedResources)(
|
|
1101
1091
|
allCartItems,
|
|
@@ -1176,7 +1166,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1176
1166
|
selectedResource: targetResource
|
|
1177
1167
|
};
|
|
1178
1168
|
} else {
|
|
1179
|
-
const resourcesMap2 = (0,
|
|
1169
|
+
const resourcesMap2 = (0, import_utils.getResourcesMap)(resources);
|
|
1180
1170
|
const resourceIds = resources.map((n) => n.id);
|
|
1181
1171
|
const timeSlots2 = (0, import_resources.getTimeSlicesByResources)({
|
|
1182
1172
|
resourceIds,
|
|
@@ -1314,7 +1304,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1314
1304
|
currentResourcesRenderList.push(...n.renderList || []);
|
|
1315
1305
|
}
|
|
1316
1306
|
});
|
|
1317
|
-
const resourcesMap = (0,
|
|
1307
|
+
const resourcesMap = (0, import_utils.getResourcesMap)(currentResourcesRenderList);
|
|
1318
1308
|
if (item.holder_id) {
|
|
1319
1309
|
selectedResources = (0, import_resources.getOthersSelectedResources)(
|
|
1320
1310
|
allCartItems,
|
|
@@ -1379,7 +1369,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1379
1369
|
}
|
|
1380
1370
|
});
|
|
1381
1371
|
};
|
|
1382
|
-
const cartItems = this.store.cart.getItems().filter((n) => !(0,
|
|
1372
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
1383
1373
|
if (cartItems == null ? void 0 : cartItems[0].holder_id) {
|
|
1384
1374
|
accountList.forEach((account) => {
|
|
1385
1375
|
const cartItems2 = this.store.cart.getCartByAccount(account.getId());
|
|
@@ -1395,7 +1385,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1395
1385
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1396
1386
|
let dateRange = this.store.date.getDateRange();
|
|
1397
1387
|
const resources = [];
|
|
1398
|
-
const cartItems = this.store.cart.getItems().filter((n) => !(0,
|
|
1388
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
1399
1389
|
const resourceIds = [];
|
|
1400
1390
|
let resourcesTypeId = void 0;
|
|
1401
1391
|
let isSingleResource = false;
|
|
@@ -1433,7 +1423,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1433
1423
|
}
|
|
1434
1424
|
});
|
|
1435
1425
|
}
|
|
1436
|
-
const resourcesMap = (0,
|
|
1426
|
+
const resourcesMap = (0, import_utils.getResourcesMap)(resources);
|
|
1437
1427
|
let duration = 0;
|
|
1438
1428
|
const accountList = this.store.accountList.getAccounts();
|
|
1439
1429
|
const checkDuration = (cartItems2) => {
|
|
@@ -1532,7 +1522,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1532
1522
|
// 提交时间切片,绑定到对应购物车的商品上,更新购物车---只有 duration 商品
|
|
1533
1523
|
submitTimeSlot(timeSlots) {
|
|
1534
1524
|
var _a, _b;
|
|
1535
|
-
const cartItems = this.store.cart.getItems().filter((n) => !(0,
|
|
1525
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
1536
1526
|
const allResources = this.store.date.getResourcesListByDate(
|
|
1537
1527
|
timeSlots.start_at.format("YYYY-MM-DD")
|
|
1538
1528
|
);
|
|
@@ -1610,7 +1600,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1610
1600
|
getScheduleDataByIds(scheduleIds) {
|
|
1611
1601
|
const targetSchedules = this.store.schedule.getScheduleListByIds(scheduleIds);
|
|
1612
1602
|
const targetSchedulesData = targetSchedules.map((item) => {
|
|
1613
|
-
return (0,
|
|
1603
|
+
return (0, import_utils2.calcCalendarDataByScheduleResult)(item);
|
|
1614
1604
|
});
|
|
1615
1605
|
const newSchedule = {};
|
|
1616
1606
|
targetSchedulesData.forEach((item) => {
|
|
@@ -1682,7 +1672,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1682
1672
|
const resourcesDates = this.store.date.getDateList();
|
|
1683
1673
|
const targetResourceDate = resourcesDates.find((n) => n.date === date);
|
|
1684
1674
|
const cartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
|
|
1685
|
-
const resourcesMap = (0,
|
|
1675
|
+
const resourcesMap = (0, import_utils.getResourcesMap)((targetResourceDate == null ? void 0 : targetResourceDate.resource) || []);
|
|
1686
1676
|
const selectedResources = (0, import_resources.getOthersSelectedResources)(
|
|
1687
1677
|
cartItems,
|
|
1688
1678
|
"",
|
|
@@ -1694,12 +1684,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1694
1684
|
selectedResources,
|
|
1695
1685
|
1
|
|
1696
1686
|
);
|
|
1697
|
-
const minTimeMaxTime = (0,
|
|
1687
|
+
const minTimeMaxTime = (0, import_utils2.calcMinTimeMaxTimeBySchedules)(
|
|
1698
1688
|
targetSchedules,
|
|
1699
1689
|
{},
|
|
1700
1690
|
date
|
|
1701
1691
|
);
|
|
1702
|
-
const scheduleTimeSlots = (0,
|
|
1692
|
+
const scheduleTimeSlots = (0, import_utils2.getAllSortedDateRanges)(minTimeMaxTime);
|
|
1703
1693
|
let allProductResources = productResources.flatMap((n) => n.renderList);
|
|
1704
1694
|
allProductResources.sort((a, b) => {
|
|
1705
1695
|
var _a2, _b2, _c2, _d2;
|
|
@@ -1815,7 +1805,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1815
1805
|
otherSameTimesCartItems.forEach((m) => {
|
|
1816
1806
|
var _a2, _b2;
|
|
1817
1807
|
const productResources2 = (0, import_resources.getResourcesByProduct)(
|
|
1818
|
-
(0,
|
|
1808
|
+
(0, import_utils.getResourcesMap)((targetResourceDate == null ? void 0 : targetResourceDate.resource) || []),
|
|
1819
1809
|
((_b2 = (_a2 = m._productOrigin) == null ? void 0 : _a2.product_resource) == null ? void 0 : _b2.resources) || [],
|
|
1820
1810
|
selectedResources,
|
|
1821
1811
|
1
|
|
@@ -1921,7 +1911,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1921
1911
|
}
|
|
1922
1912
|
checkMaxDurationCapacity() {
|
|
1923
1913
|
var _a, _b;
|
|
1924
|
-
const cartItems = this.store.cart.getItems()
|
|
1914
|
+
const cartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
|
|
1925
1915
|
if (cartItems.length === 0)
|
|
1926
1916
|
return { success: true, minAvailableCount: 0 };
|
|
1927
1917
|
const itemsWithTime = [];
|
|
@@ -1962,7 +1952,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1962
1952
|
const targetResourceDate = resourcesDates.find((n) => n.date === dateRange[0].date);
|
|
1963
1953
|
if (!targetResourceDate)
|
|
1964
1954
|
return { success: false, minAvailableCount: 0 };
|
|
1965
|
-
const resourcesMap = (0,
|
|
1955
|
+
const resourcesMap = (0, import_utils.getResourcesMap)(targetResourceDate.resource || []);
|
|
1966
1956
|
const resourceCodeToFormIdMap = {};
|
|
1967
1957
|
Object.values(itemsByResourceType).flat().forEach((cartItem) => {
|
|
1968
1958
|
var _a2, _b2;
|
|
@@ -2104,7 +2094,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2104
2094
|
const targetResourceDate = resourcesDates.find((n) => n.date === startDate);
|
|
2105
2095
|
if (!targetResourceDate)
|
|
2106
2096
|
continue;
|
|
2107
|
-
const resourcesMap = (0,
|
|
2097
|
+
const resourcesMap = (0, import_utils.getResourcesMap)(targetResourceDate.resource || []);
|
|
2108
2098
|
itemsInTimeSlot.forEach((cartItem) => {
|
|
2109
2099
|
if (!cartItem._productOrigin)
|
|
2110
2100
|
return;
|
|
@@ -2116,8 +2106,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2116
2106
|
}
|
|
2117
2107
|
});
|
|
2118
2108
|
});
|
|
2119
|
-
|
|
2120
|
-
if (!success) {
|
|
2109
|
+
if (!(0, import_capacity.checkTimeSlotCapacity)(timeSlotStart, timeSlotEnd, itemsInTimeSlot, allResourcesForTimeSlot)) {
|
|
2121
2110
|
const minAvailableCount2 = availableCountsByResourceType.length > 0 ? Math.min(...availableCountsByResourceType) : 0;
|
|
2122
2111
|
return { success: false, minAvailableCount: minAvailableCount2 };
|
|
2123
2112
|
}
|
|
@@ -2125,268 +2114,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2125
2114
|
const minAvailableCount = availableCountsByResourceType.length > 0 ? Math.min(...availableCountsByResourceType) : 0;
|
|
2126
2115
|
return { success: true, minAvailableCount };
|
|
2127
2116
|
}
|
|
2128
|
-
/**
|
|
2129
|
-
* 将 ProductData 转换为 CartItem,但不添加到购物车
|
|
2130
|
-
* 参考 addProductToCart 方法的实现
|
|
2131
|
-
*/
|
|
2132
|
-
convertProductToCartItem({
|
|
2133
|
-
product,
|
|
2134
|
-
date,
|
|
2135
|
-
account
|
|
2136
|
-
}) {
|
|
2137
|
-
const {
|
|
2138
|
-
bundle,
|
|
2139
|
-
options,
|
|
2140
|
-
origin,
|
|
2141
|
-
product_variant_id,
|
|
2142
|
-
quantity = 1
|
|
2143
|
-
} = product || {};
|
|
2144
|
-
const productData = { ...origin, product_variant_id };
|
|
2145
|
-
const processedProduct = (0, import_utils.handleVariantProduct)(productData);
|
|
2146
|
-
if (!account) {
|
|
2147
|
-
const activeAccount = this.getActiveAccount();
|
|
2148
|
-
if (activeAccount) {
|
|
2149
|
-
account = activeAccount;
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2152
|
-
const cartItem = {
|
|
2153
|
-
_id: (0, import_utils.getUniqueId)("temp_"),
|
|
2154
|
-
_origin: (0, import_utils.createCartItemOrigin)(),
|
|
2155
|
-
_productOrigin: processedProduct,
|
|
2156
|
-
_productInit: product
|
|
2157
|
-
};
|
|
2158
|
-
(0, import_utils.formatProductToCartItem)({
|
|
2159
|
-
cartItem,
|
|
2160
|
-
product: processedProduct,
|
|
2161
|
-
bundle,
|
|
2162
|
-
options,
|
|
2163
|
-
product_variant_id,
|
|
2164
|
-
quantity
|
|
2165
|
-
});
|
|
2166
|
-
if (date) {
|
|
2167
|
-
(0, import_utils.formatDateToCartItem)({
|
|
2168
|
-
cartItem,
|
|
2169
|
-
date
|
|
2170
|
-
});
|
|
2171
|
-
}
|
|
2172
|
-
if (account) {
|
|
2173
|
-
(0, import_utils.formatAccountToCartItem)({
|
|
2174
|
-
cartItem,
|
|
2175
|
-
account
|
|
2176
|
-
});
|
|
2177
|
-
}
|
|
2178
|
-
return cartItem;
|
|
2179
|
-
}
|
|
2180
|
-
checkMaxDurationCapacityForDetailNums({
|
|
2181
|
-
product,
|
|
2182
|
-
date,
|
|
2183
|
-
account
|
|
2184
|
-
}) {
|
|
2185
|
-
var _a, _b;
|
|
2186
|
-
const cartItems = this.store.cart.getItems().filter((item) => !(0, import_utils5.isNormalProduct)(item._productOrigin));
|
|
2187
|
-
const currentCartItem = this.convertProductToCartItem({ product, date, account });
|
|
2188
|
-
cartItems.push(currentCartItem);
|
|
2189
|
-
if (cartItems.length === 0)
|
|
2190
|
-
return { success: true, minAvailableCount: 0 };
|
|
2191
|
-
const itemsWithTime = [];
|
|
2192
|
-
const itemsWithoutTime = [];
|
|
2193
|
-
const availableCountsByResourceType = [];
|
|
2194
|
-
cartItems.forEach((cartItem) => {
|
|
2195
|
-
if (cartItem.start_time && cartItem.end_time && cartItem.start_date) {
|
|
2196
|
-
itemsWithTime.push(cartItem);
|
|
2197
|
-
} else {
|
|
2198
|
-
itemsWithoutTime.push(cartItem);
|
|
2199
|
-
}
|
|
2200
|
-
});
|
|
2201
|
-
const processedItemsWithoutTime = [];
|
|
2202
|
-
if (itemsWithoutTime.length > 0) {
|
|
2203
|
-
const itemsByResourceType = {};
|
|
2204
|
-
itemsWithoutTime.forEach((cartItem) => {
|
|
2205
|
-
var _a2;
|
|
2206
|
-
if (!cartItem._productOrigin)
|
|
2207
|
-
return;
|
|
2208
|
-
const resourceTypes = ((_a2 = cartItem._productOrigin.product_resource) == null ? void 0 : _a2.resources) || [];
|
|
2209
|
-
resourceTypes.forEach((resourceType) => {
|
|
2210
|
-
var _a3;
|
|
2211
|
-
if (resourceType.status === 1) {
|
|
2212
|
-
const resourceCode = resourceType.code || ((_a3 = resourceType.id) == null ? void 0 : _a3.toString());
|
|
2213
|
-
if (!itemsByResourceType[resourceCode]) {
|
|
2214
|
-
itemsByResourceType[resourceCode] = [];
|
|
2215
|
-
}
|
|
2216
|
-
if (!itemsByResourceType[resourceCode].find((item) => item._id === cartItem._id)) {
|
|
2217
|
-
itemsByResourceType[resourceCode].push(cartItem);
|
|
2218
|
-
}
|
|
2219
|
-
}
|
|
2220
|
-
});
|
|
2221
|
-
});
|
|
2222
|
-
const dateRange = this.store.date.getDateRange();
|
|
2223
|
-
if (!dateRange || dateRange.length === 0)
|
|
2224
|
-
return { success: false, minAvailableCount: 0 };
|
|
2225
|
-
const resourcesDates = this.store.date.getDateList();
|
|
2226
|
-
const targetResourceDate = resourcesDates.find((n) => n.date === dateRange[0].date);
|
|
2227
|
-
if (!targetResourceDate)
|
|
2228
|
-
return { success: false, minAvailableCount: 0 };
|
|
2229
|
-
const resourcesMap = (0, import_utils2.getResourcesMap)(targetResourceDate.resource || []);
|
|
2230
|
-
const resourceCodeToFormIdMap = {};
|
|
2231
|
-
Object.values(itemsByResourceType).flat().forEach((cartItem) => {
|
|
2232
|
-
var _a2, _b2;
|
|
2233
|
-
if ((_b2 = (_a2 = cartItem._productOrigin) == null ? void 0 : _a2.product_resource) == null ? void 0 : _b2.resources) {
|
|
2234
|
-
cartItem._productOrigin.product_resource.resources.forEach((resourceConfig) => {
|
|
2235
|
-
var _a3, _b3;
|
|
2236
|
-
if (resourceConfig.status === 1 && resourceConfig.code) {
|
|
2237
|
-
const formId = ((_a3 = resourceConfig.id) == null ? void 0 : _a3.toString()) || ((_b3 = resourceConfig.resource_type_id) == null ? void 0 : _b3.toString());
|
|
2238
|
-
if (formId) {
|
|
2239
|
-
resourceCodeToFormIdMap[resourceConfig.code] = formId;
|
|
2240
|
-
}
|
|
2241
|
-
}
|
|
2242
|
-
});
|
|
2243
|
-
}
|
|
2244
|
-
});
|
|
2245
|
-
let hasCapacityIssue = false;
|
|
2246
|
-
const resourceCapacityInfo = [];
|
|
2247
|
-
const processedCartItemIds = /* @__PURE__ */ new Set();
|
|
2248
|
-
for (const [resourceCode, items] of Object.entries(itemsByResourceType)) {
|
|
2249
|
-
const targetFormId = resourceCodeToFormIdMap[resourceCode];
|
|
2250
|
-
if (!targetFormId) {
|
|
2251
|
-
console.log(`资源类型 ${resourceCode} 找不到对应的 form_id`);
|
|
2252
|
-
return { success: false, minAvailableCount: 0 };
|
|
2253
|
-
}
|
|
2254
|
-
const resourcesOfThisType = [];
|
|
2255
|
-
items.forEach((cartItem) => {
|
|
2256
|
-
const productResourceIds = (0, import_capacity.getResourcesIdsByProduct)(cartItem._productOrigin);
|
|
2257
|
-
productResourceIds.forEach((resourceId) => {
|
|
2258
|
-
var _a2;
|
|
2259
|
-
const resource = resourcesMap[resourceId];
|
|
2260
|
-
if (resource && ((_a2 = resource.form_id) == null ? void 0 : _a2.toString()) === targetFormId) {
|
|
2261
|
-
if (!resourcesOfThisType.find((r) => r.id === resource.id)) {
|
|
2262
|
-
resourcesOfThisType.push(resource);
|
|
2263
|
-
}
|
|
2264
|
-
}
|
|
2265
|
-
});
|
|
2266
|
-
});
|
|
2267
|
-
if (resourcesOfThisType.length === 0) {
|
|
2268
|
-
console.log(`资源类型 ${resourceCode} 没有找到可用资源`);
|
|
2269
|
-
return { success: false, minAvailableCount: 0 };
|
|
2270
|
-
}
|
|
2271
|
-
let resourceTypeConfig = null;
|
|
2272
|
-
for (const cartItem of items) {
|
|
2273
|
-
if ((_b = (_a = cartItem._productOrigin) == null ? void 0 : _a.product_resource) == null ? void 0 : _b.resources) {
|
|
2274
|
-
resourceTypeConfig = cartItem._productOrigin.product_resource.resources.find(
|
|
2275
|
-
(r) => r.code === resourceCode && r.status === 1
|
|
2276
|
-
);
|
|
2277
|
-
if (resourceTypeConfig)
|
|
2278
|
-
break;
|
|
2279
|
-
}
|
|
2280
|
-
}
|
|
2281
|
-
const isMultipleBooking = (resourceTypeConfig == null ? void 0 : resourceTypeConfig.type) === "multiple";
|
|
2282
|
-
let totalAvailable;
|
|
2283
|
-
let requiredAmount;
|
|
2284
|
-
let availableAmount;
|
|
2285
|
-
if (isMultipleBooking) {
|
|
2286
|
-
totalAvailable = resourcesOfThisType.reduce((sum, resource) => {
|
|
2287
|
-
return sum + (resource.capacity || 0);
|
|
2288
|
-
}, 0);
|
|
2289
|
-
requiredAmount = items.reduce((sum, cartItem) => {
|
|
2290
|
-
const { currentCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(cartItem);
|
|
2291
|
-
return sum + currentCapacity;
|
|
2292
|
-
}, 0);
|
|
2293
|
-
availableAmount = Math.max(0, totalAvailable - requiredAmount);
|
|
2294
|
-
} else {
|
|
2295
|
-
totalAvailable = resourcesOfThisType.length;
|
|
2296
|
-
requiredAmount = items.reduce((sum, cartItem) => {
|
|
2297
|
-
return sum + (cartItem.num || 1);
|
|
2298
|
-
}, 0);
|
|
2299
|
-
availableAmount = Math.max(0, totalAvailable - requiredAmount);
|
|
2300
|
-
}
|
|
2301
|
-
resourceCapacityInfo.push({
|
|
2302
|
-
code: resourceCode,
|
|
2303
|
-
available: availableAmount,
|
|
2304
|
-
total: totalAvailable,
|
|
2305
|
-
required: requiredAmount,
|
|
2306
|
-
isMultiple: isMultipleBooking
|
|
2307
|
-
});
|
|
2308
|
-
availableCountsByResourceType.push(availableAmount);
|
|
2309
|
-
if (requiredAmount > totalAvailable) {
|
|
2310
|
-
hasCapacityIssue = true;
|
|
2311
|
-
console.log(`资源类型 ${resourceCode} ${isMultipleBooking ? "容量" : "资源数量"}不足: 需要 ${requiredAmount}, 总共 ${totalAvailable}`);
|
|
2312
|
-
}
|
|
2313
|
-
console.log(`资源类型 ${resourceCode} 的资源时间信息:`, resourcesOfThisType.map((r) => ({
|
|
2314
|
-
id: r.id,
|
|
2315
|
-
times: r.times.map((t) => `${t.start_at} - ${t.end_at}`)
|
|
2316
|
-
})));
|
|
2317
|
-
const commonTimeSlots = this.findCommonAvailableTimeSlots(resourcesOfThisType);
|
|
2318
|
-
console.log(`资源类型 ${resourceCode} 的公共时间段:`, commonTimeSlots);
|
|
2319
|
-
if (commonTimeSlots.length === 0) {
|
|
2320
|
-
console.log(`资源类型 ${resourceCode} 没有公共可用时间段`);
|
|
2321
|
-
return { success: false, minAvailableCount: 0 };
|
|
2322
|
-
}
|
|
2323
|
-
const firstCommonSlot = commonTimeSlots[0];
|
|
2324
|
-
console.log(`使用公共时间段: ${firstCommonSlot.startTime} - ${firstCommonSlot.endTime}`);
|
|
2325
|
-
items.forEach((cartItem) => {
|
|
2326
|
-
if (!processedCartItemIds.has(cartItem._id)) {
|
|
2327
|
-
processedCartItemIds.add(cartItem._id);
|
|
2328
|
-
const processedItem = {
|
|
2329
|
-
...cartItem,
|
|
2330
|
-
start_date: dateRange[0].date,
|
|
2331
|
-
start_time: firstCommonSlot.startTime,
|
|
2332
|
-
end_time: firstCommonSlot.endTime,
|
|
2333
|
-
end_date: dateRange[0].date
|
|
2334
|
-
};
|
|
2335
|
-
processedItemsWithoutTime.push(processedItem);
|
|
2336
|
-
}
|
|
2337
|
-
});
|
|
2338
|
-
}
|
|
2339
|
-
if (hasCapacityIssue) {
|
|
2340
|
-
const overCapacityResources = resourceCapacityInfo.filter((info) => info.required > info.total);
|
|
2341
|
-
if (overCapacityResources.length > 0) {
|
|
2342
|
-
const minTotalCapacity2 = Math.min(...overCapacityResources.map((info) => info.total));
|
|
2343
|
-
return { success: false, minAvailableCount: minTotalCapacity2 };
|
|
2344
|
-
}
|
|
2345
|
-
const minTotalCapacity = Math.min(...resourceCapacityInfo.map((info) => info.total));
|
|
2346
|
-
return { success: false, minAvailableCount: minTotalCapacity };
|
|
2347
|
-
}
|
|
2348
|
-
}
|
|
2349
|
-
const allProcessedItems = [...itemsWithTime, ...processedItemsWithoutTime];
|
|
2350
|
-
const cartItemsByTimeSlot = {};
|
|
2351
|
-
allProcessedItems.forEach((cartItem) => {
|
|
2352
|
-
if (!cartItem.start_time || !cartItem.end_time || !cartItem.start_date)
|
|
2353
|
-
return;
|
|
2354
|
-
const timeSlotKey = `${cartItem.start_date}_${cartItem.start_time}_${cartItem.end_date || cartItem.start_date}_${cartItem.end_time}`;
|
|
2355
|
-
if (!cartItemsByTimeSlot[timeSlotKey]) {
|
|
2356
|
-
cartItemsByTimeSlot[timeSlotKey] = [];
|
|
2357
|
-
}
|
|
2358
|
-
cartItemsByTimeSlot[timeSlotKey].push(cartItem);
|
|
2359
|
-
});
|
|
2360
|
-
for (const [timeSlotKey, itemsInTimeSlot] of Object.entries(cartItemsByTimeSlot)) {
|
|
2361
|
-
const [startDate, startTime, endDate, endTime] = timeSlotKey.split("_");
|
|
2362
|
-
const timeSlotStart = `${startDate} ${startTime}`;
|
|
2363
|
-
const timeSlotEnd = `${endDate} ${endTime}`;
|
|
2364
|
-
const allResourcesForTimeSlot = [];
|
|
2365
|
-
const resourcesIdSet = /* @__PURE__ */ new Set();
|
|
2366
|
-
const resourcesDates = this.store.date.getDateList();
|
|
2367
|
-
const targetResourceDate = resourcesDates.find((n) => n.date === startDate);
|
|
2368
|
-
if (!targetResourceDate)
|
|
2369
|
-
continue;
|
|
2370
|
-
const resourcesMap = (0, import_utils2.getResourcesMap)(targetResourceDate.resource || []);
|
|
2371
|
-
itemsInTimeSlot.forEach((cartItem) => {
|
|
2372
|
-
if (!cartItem._productOrigin)
|
|
2373
|
-
return;
|
|
2374
|
-
const productResourceIds = (0, import_capacity.getResourcesIdsByProduct)(cartItem._productOrigin);
|
|
2375
|
-
productResourceIds.forEach((resourceId) => {
|
|
2376
|
-
if (resourcesMap[resourceId] && !resourcesIdSet.has(resourceId)) {
|
|
2377
|
-
resourcesIdSet.add(resourceId);
|
|
2378
|
-
allResourcesForTimeSlot.push(resourcesMap[resourceId]);
|
|
2379
|
-
}
|
|
2380
|
-
});
|
|
2381
|
-
});
|
|
2382
|
-
const { success, required, available } = (0, import_capacity.checkTimeSlotCapacity)(timeSlotStart, timeSlotEnd, itemsInTimeSlot, allResourcesForTimeSlot);
|
|
2383
|
-
if (!success) {
|
|
2384
|
-
return { success: false, minAvailableCount: available };
|
|
2385
|
-
}
|
|
2386
|
-
}
|
|
2387
|
-
const minAvailableCount = availableCountsByResourceType.length > 0 ? Math.min(...availableCountsByResourceType) : 0;
|
|
2388
|
-
return { success: true, minAvailableCount };
|
|
2389
|
-
}
|
|
2390
2117
|
setOtherData(key, value) {
|
|
2391
2118
|
this.otherData[key] = value;
|
|
2392
2119
|
this.checkSaveCache({
|
|
@@ -2438,8 +2165,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2438
2165
|
resources.push(...n.resource);
|
|
2439
2166
|
});
|
|
2440
2167
|
}
|
|
2441
|
-
const resourcesMap = (0,
|
|
2442
|
-
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));
|
|
2443
2170
|
const cartItem = cartItems.find((item) => item._id === cartItemId);
|
|
2444
2171
|
if (!cartItem)
|
|
2445
2172
|
return [];
|
|
@@ -2652,12 +2379,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2652
2379
|
}
|
|
2653
2380
|
}
|
|
2654
2381
|
if (status === "available") {
|
|
2655
|
-
const minTimeMaxTime = (0,
|
|
2382
|
+
const minTimeMaxTime = (0, import_utils2.calcMinTimeMaxTimeBySchedules)(
|
|
2656
2383
|
targetSchedules,
|
|
2657
2384
|
{},
|
|
2658
2385
|
currentDateStr
|
|
2659
2386
|
);
|
|
2660
|
-
const scheduleTimeSlots = (0,
|
|
2387
|
+
const scheduleTimeSlots = (0, import_utils2.getAllSortedDateRanges)(minTimeMaxTime);
|
|
2661
2388
|
const timesSlotCanUse = scheduleTimeSlots.some((item) => {
|
|
2662
2389
|
const resourcesUseableMap = {};
|
|
2663
2390
|
return openResources.every((resource) => {
|
|
@@ -2714,7 +2441,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2714
2441
|
}
|
|
2715
2442
|
currentDate = (0, import_dayjs.default)(currentDate).add(1, "day");
|
|
2716
2443
|
}
|
|
2717
|
-
dates = (0,
|
|
2444
|
+
dates = (0, import_utils3.handleAvailableDateByResource)(res.data, dates);
|
|
2718
2445
|
this.store.date.setDateList(dates);
|
|
2719
2446
|
if (!this.store.currentProductMeta)
|
|
2720
2447
|
this.store.currentProductMeta = {};
|
|
@@ -2730,11 +2457,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2730
2457
|
};
|
|
2731
2458
|
}
|
|
2732
2459
|
isCartAllNormalProducts() {
|
|
2733
|
-
const cartItems = this.store.cart.getItems().filter((n) => !(0,
|
|
2460
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
2734
2461
|
return !cartItems.length;
|
|
2735
2462
|
}
|
|
2736
2463
|
isCartHasDurationProduct() {
|
|
2737
|
-
const cartItems = this.store.cart.getItems().filter((n) => !(0,
|
|
2464
|
+
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|
|
2738
2465
|
return cartItems.some((n) => {
|
|
2739
2466
|
var _a;
|
|
2740
2467
|
return (_a = n._productOrigin) == null ? void 0 : _a.duration;
|
|
@@ -2743,17 +2470,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
2743
2470
|
isTargetNormalProduct(product) {
|
|
2744
2471
|
if (!product)
|
|
2745
2472
|
return false;
|
|
2746
|
-
return (0,
|
|
2473
|
+
return (0, import_utils4.isNormalProduct)(product);
|
|
2747
2474
|
}
|
|
2748
2475
|
isTargetCartIdNormalProduct(id) {
|
|
2749
2476
|
const cartItem = this.store.cart.getItems().find((n) => n._id === id);
|
|
2750
|
-
return cartItem && (0,
|
|
2751
|
-
}
|
|
2752
|
-
/**
|
|
2753
|
-
* 获取联系信息
|
|
2754
|
-
*/
|
|
2755
|
-
async getContactInfo(params) {
|
|
2756
|
-
return this.request.get("/customer/metadata", params);
|
|
2477
|
+
return cartItem && (0, import_utils4.isNormalProduct)(cartItem._productOrigin);
|
|
2757
2478
|
}
|
|
2758
2479
|
};
|
|
2759
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;
|