@pisell/pisellos 0.0.130 → 0.0.131
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.
|
@@ -1999,11 +1999,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1999
1999
|
// timeSlots 传进来的只是用户选中的时间片,但是实际上需要根据多个商品时间进行累加
|
|
2000
2000
|
// 假设 timeSlots.start_time 是15:40 duration 是 30min
|
|
2001
2001
|
// 第一个商品分配完以后,第二个商品分配的start_time应该是第一个商品的 end_time ,然后 end_time 应该是 start_time+duration
|
|
2002
|
-
|
|
2003
|
-
cartItems.
|
|
2002
|
+
// 判断购物车里是否有 flexible 类型的商品,如果有则不累加时间
|
|
2003
|
+
var hasFlexibleProduct = cartItems.some(function (item) {
|
|
2004
2004
|
var _item$_productOrigin3;
|
|
2005
|
+
return ((_item$_productOrigin3 = item._productOrigin) === null || _item$_productOrigin3 === void 0 || (_item$_productOrigin3 = _item$_productOrigin3.duration) === null || _item$_productOrigin3 === void 0 ? void 0 : _item$_productOrigin3.type) === 'flexible';
|
|
2006
|
+
});
|
|
2007
|
+
cartItems.forEach(function (item, index) {
|
|
2008
|
+
var _item$_productOrigin4;
|
|
2005
2009
|
var formatCapacity = formatDefaultCapacitys({
|
|
2006
|
-
capacity: (_item$
|
|
2010
|
+
capacity: (_item$_productOrigin4 = item._productOrigin) === null || _item$_productOrigin4 === void 0 ? void 0 : _item$_productOrigin4.capacity,
|
|
2007
2011
|
product_bundle: item._origin.product.product_bundle
|
|
2008
2012
|
});
|
|
2009
2013
|
var currentCapacity = getSumCapacity({
|
|
@@ -2019,15 +2023,15 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2019
2023
|
};
|
|
2020
2024
|
}
|
|
2021
2025
|
if (recordTimeSlots) {
|
|
2022
|
-
var _item$
|
|
2026
|
+
var _item$_productOrigin5, _item$_productOrigin6;
|
|
2023
2027
|
// 同一账号下,如果当前商品不是第一个,则需要根据上一个商品的 end_time 和 duration 计算出当前商品的 start_time 和 end_time
|
|
2024
2028
|
// 前提:当前资源是单个预约才需要这么做
|
|
2025
|
-
var currentResourceConfig = (_item$
|
|
2029
|
+
var currentResourceConfig = (_item$_productOrigin5 = item._productOrigin) === null || _item$_productOrigin5 === void 0 || (_item$_productOrigin5 = _item$_productOrigin5.product_resource) === null || _item$_productOrigin5 === void 0 || (_item$_productOrigin5 = _item$_productOrigin5.resources) === null || _item$_productOrigin5 === void 0 ? void 0 : _item$_productOrigin5.find(function (n) {
|
|
2026
2030
|
return n.code === resources_code;
|
|
2027
2031
|
});
|
|
2028
2032
|
var resourceBookingType = (currentResourceConfig === null || currentResourceConfig === void 0 ? void 0 : currentResourceConfig.type) || 'single';
|
|
2029
2033
|
// 只有 duration 类商品需要这个操作
|
|
2030
|
-
if (index !== 0 && recordTimeSlots && (currentResourceConfig === null || currentResourceConfig === void 0 ? void 0 : currentResourceConfig.type) === 'single' && (_item$
|
|
2034
|
+
if (index !== 0 && recordTimeSlots && (currentResourceConfig === null || currentResourceConfig === void 0 ? void 0 : currentResourceConfig.type) === 'single' && (_item$_productOrigin6 = item._productOrigin) !== null && _item$_productOrigin6 !== void 0 && _item$_productOrigin6.duration && !hasFlexibleProduct) {
|
|
2031
2035
|
var _item$_productOrigin7, _item$_productOrigin8;
|
|
2032
2036
|
var start_at = dayjs(recordTimeSlots.end_time).add(((_item$_productOrigin7 = item._productOrigin) === null || _item$_productOrigin7 === void 0 || (_item$_productOrigin7 = _item$_productOrigin7.duration) === null || _item$_productOrigin7 === void 0 ? void 0 : _item$_productOrigin7.value) || 10, 'minutes');
|
|
2033
2037
|
var end_at = start_at.add(((_item$_productOrigin8 = item._productOrigin) === null || _item$_productOrigin8 === void 0 || (_item$_productOrigin8 = _item$_productOrigin8.duration) === null || _item$_productOrigin8 === void 0 ? void 0 : _item$_productOrigin8.value) || 10, 'minutes');
|
|
@@ -1294,8 +1294,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1294
1294
|
const accountList = this.store.accountList.getAccounts();
|
|
1295
1295
|
const selectForCartResources = (cartItems2) => {
|
|
1296
1296
|
let recordTimeSlots = (0, import_lodash_es.cloneDeep)(timeSlots);
|
|
1297
|
+
const hasFlexibleProduct = cartItems2.some((item) => {
|
|
1298
|
+
var _a2, _b;
|
|
1299
|
+
return ((_b = (_a2 = item._productOrigin) == null ? void 0 : _a2.duration) == null ? void 0 : _b.type) === "flexible";
|
|
1300
|
+
});
|
|
1297
1301
|
cartItems2.forEach((item, index) => {
|
|
1298
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m
|
|
1302
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
1299
1303
|
const formatCapacity = (0, import_resources.formatDefaultCapacitys)({
|
|
1300
1304
|
capacity: (_a2 = item._productOrigin) == null ? void 0 : _a2.capacity,
|
|
1301
1305
|
product_bundle: item._origin.product.product_bundle
|
|
@@ -1314,13 +1318,13 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1314
1318
|
(n) => n.code === resources_code
|
|
1315
1319
|
);
|
|
1316
1320
|
const resourceBookingType = (currentResourceConfig == null ? void 0 : currentResourceConfig.type) || "single";
|
|
1317
|
-
if (index !== 0 && recordTimeSlots && (currentResourceConfig == null ? void 0 : currentResourceConfig.type) === "single" && ((_e = item._productOrigin) == null ? void 0 : _e.duration) &&
|
|
1321
|
+
if (index !== 0 && recordTimeSlots && (currentResourceConfig == null ? void 0 : currentResourceConfig.type) === "single" && ((_e = item._productOrigin) == null ? void 0 : _e.duration) && !hasFlexibleProduct) {
|
|
1318
1322
|
let start_at = (0, import_dayjs.default)(recordTimeSlots.end_time).add(
|
|
1319
|
-
((
|
|
1323
|
+
((_g = (_f = item._productOrigin) == null ? void 0 : _f.duration) == null ? void 0 : _g.value) || 10,
|
|
1320
1324
|
"minutes"
|
|
1321
1325
|
);
|
|
1322
1326
|
let end_at = start_at.add(
|
|
1323
|
-
((
|
|
1327
|
+
((_i = (_h = item._productOrigin) == null ? void 0 : _h.duration) == null ? void 0 : _i.value) || 10,
|
|
1324
1328
|
"minutes"
|
|
1325
1329
|
);
|
|
1326
1330
|
recordTimeSlots = {
|
|
@@ -1374,7 +1378,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1374
1378
|
const allCartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
|
|
1375
1379
|
let selectedResources = [];
|
|
1376
1380
|
const resources2 = (0, import_lodash_es.cloneDeep)(
|
|
1377
|
-
((
|
|
1381
|
+
((_k = (_j = item._productOrigin) == null ? void 0 : _j.product_resource) == null ? void 0 : _k.resources) || []
|
|
1378
1382
|
);
|
|
1379
1383
|
const currentResourcesRenderList = [];
|
|
1380
1384
|
resources2.forEach((n) => {
|
|
@@ -1422,11 +1426,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1422
1426
|
return recordCount >= currentCapacity;
|
|
1423
1427
|
});
|
|
1424
1428
|
});
|
|
1425
|
-
const targetRenderList = (
|
|
1429
|
+
const targetRenderList = (_l = productResources.find(
|
|
1426
1430
|
(n) => n.code === resources_code
|
|
1427
|
-
)) == null ? void 0 :
|
|
1431
|
+
)) == null ? void 0 : _l.renderList;
|
|
1428
1432
|
if (targetRenderList && targetRenderList.length > 0) {
|
|
1429
|
-
if ((
|
|
1433
|
+
if ((_m = item._origin.resources) == null ? void 0 : _m.some(
|
|
1430
1434
|
(n) => n.form_id === targetRenderList[0].form_id
|
|
1431
1435
|
)) {
|
|
1432
1436
|
return;
|