@pisell/pisellos 1.0.1 → 1.0.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.
|
@@ -2019,17 +2019,17 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2019
2019
|
};
|
|
2020
2020
|
}
|
|
2021
2021
|
if (recordTimeSlots) {
|
|
2022
|
-
var _item$_productOrigin4, _item$_productOrigin5;
|
|
2022
|
+
var _item$_productOrigin4, _item$_productOrigin5, _item$_productOrigin6;
|
|
2023
2023
|
// 同一账号下,如果当前商品不是第一个,则需要根据上一个商品的 end_time 和 duration 计算出当前商品的 start_time 和 end_time
|
|
2024
2024
|
// 前提:当前资源是单个预约才需要这么做
|
|
2025
2025
|
var currentResourceConfig = (_item$_productOrigin4 = item._productOrigin) === null || _item$_productOrigin4 === void 0 || (_item$_productOrigin4 = _item$_productOrigin4.product_resource) === null || _item$_productOrigin4 === void 0 || (_item$_productOrigin4 = _item$_productOrigin4.resources) === null || _item$_productOrigin4 === void 0 ? void 0 : _item$_productOrigin4.find(function (n) {
|
|
2026
2026
|
return n.code === resources_code;
|
|
2027
2027
|
});
|
|
2028
2028
|
// 只有 duration 类商品需要这个操作
|
|
2029
|
-
if (index !== 0 && recordTimeSlots && (currentResourceConfig === null || currentResourceConfig === void 0 ? void 0 : currentResourceConfig.type) === 'single' && (_item$_productOrigin5 = item._productOrigin) !== null && _item$_productOrigin5 !== void 0 && _item$_productOrigin5.duration) {
|
|
2030
|
-
var _item$
|
|
2031
|
-
var start_at = dayjs(recordTimeSlots.end_time).add(((_item$
|
|
2032
|
-
var end_at = start_at.add(((_item$
|
|
2029
|
+
if (index !== 0 && recordTimeSlots && (currentResourceConfig === null || currentResourceConfig === void 0 ? void 0 : currentResourceConfig.type) === 'single' && (_item$_productOrigin5 = item._productOrigin) !== null && _item$_productOrigin5 !== void 0 && _item$_productOrigin5.duration && ((_item$_productOrigin6 = item._productOrigin) === null || _item$_productOrigin6 === void 0 || (_item$_productOrigin6 = _item$_productOrigin6.duration) === null || _item$_productOrigin6 === void 0 ? void 0 : _item$_productOrigin6.type) !== 'flexible') {
|
|
2030
|
+
var _item$_productOrigin7, _item$_productOrigin8;
|
|
2031
|
+
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');
|
|
2032
|
+
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');
|
|
2033
2033
|
recordTimeSlots = {
|
|
2034
2034
|
start_time: start_at.format('HH:mm'),
|
|
2035
2035
|
end_time: end_at.format('HH:mm'),
|
|
@@ -2077,12 +2077,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2077
2077
|
errorList.push(item._id);
|
|
2078
2078
|
}
|
|
2079
2079
|
} else {
|
|
2080
|
-
var _item$
|
|
2080
|
+
var _item$_productOrigin9, _productResources$fin;
|
|
2081
2081
|
// 这里必须每次循环重新读,避免前一次循环操作了购物车,导致数据变更
|
|
2082
2082
|
var allCartItems = cloneDeep(_this10.store.cart.getItems());
|
|
2083
2083
|
// 如果没有传递 timeSlots,代表是第一种资源,则直接拿商品的 duration,到资源列表里找一个公共可用的
|
|
2084
2084
|
var selectedResources = [];
|
|
2085
|
-
var _resources = cloneDeep(((_item$
|
|
2085
|
+
var _resources = cloneDeep(((_item$_productOrigin9 = item._productOrigin) === null || _item$_productOrigin9 === void 0 || (_item$_productOrigin9 = _item$_productOrigin9.product_resource) === null || _item$_productOrigin9 === void 0 ? void 0 : _item$_productOrigin9.resources) || []);
|
|
2086
2086
|
var currentResourcesRenderList = [];
|
|
2087
2087
|
_resources.forEach(function (n) {
|
|
2088
2088
|
var _n$renderList;
|
|
@@ -2197,8 +2197,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2197
2197
|
var maxCutOffTime = undefined;
|
|
2198
2198
|
var maxCutOffTimeValue = dayjs();
|
|
2199
2199
|
cartItems.forEach(function (item) {
|
|
2200
|
-
var _item$
|
|
2201
|
-
(_item$
|
|
2200
|
+
var _item$_productOrigin10, _item$_productOrigin11, _item$_productOrigin12, _item$_productOrigin13;
|
|
2201
|
+
(_item$_productOrigin10 = item._productOrigin) === null || _item$_productOrigin10 === void 0 || (_item$_productOrigin10 = _item$_productOrigin10.product_resource) === null || _item$_productOrigin10 === void 0 || (_item$_productOrigin10 = _item$_productOrigin10.resources) === null || _item$_productOrigin10 === void 0 || _item$_productOrigin10.forEach(function (n) {
|
|
2202
2202
|
// TODO: 少了个 status 的判断
|
|
2203
2203
|
if (n.code === resources_code) {
|
|
2204
2204
|
resources.push.apply(resources, _toConsumableArray(n.renderList || []));
|
|
@@ -2211,10 +2211,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2211
2211
|
if (item.resource_id) {
|
|
2212
2212
|
resourceIds.push(item.resource_id);
|
|
2213
2213
|
}
|
|
2214
|
-
resourcesTypeId = item === null || item === void 0 || (_item$
|
|
2214
|
+
resourcesTypeId = item === null || item === void 0 || (_item$_productOrigin11 = item._productOrigin) === null || _item$_productOrigin11 === void 0 || (_item$_productOrigin11 = _item$_productOrigin11.product_resource) === null || _item$_productOrigin11 === void 0 || (_item$_productOrigin11 = _item$_productOrigin11.resources) === null || _item$_productOrigin11 === void 0 || (_item$_productOrigin11 = _item$_productOrigin11.find(function (n) {
|
|
2215
2215
|
return n.code === resources_code;
|
|
2216
|
-
})) === null || _item$
|
|
2217
|
-
if ((_item$
|
|
2216
|
+
})) === null || _item$_productOrigin11 === void 0 ? void 0 : _item$_productOrigin11.id;
|
|
2217
|
+
if ((_item$_productOrigin12 = item._productOrigin) !== null && _item$_productOrigin12 !== void 0 && _item$_productOrigin12.cut_off_time && ((_item$_productOrigin13 = item._productOrigin) === null || _item$_productOrigin13 === void 0 ? void 0 : _item$_productOrigin13.cut_off_time.type) === 'advance') {
|
|
2218
2218
|
var currentCutOffTime = dayjs().add(item._productOrigin.cut_off_time.unit, item._productOrigin.cut_off_time.unit_type);
|
|
2219
2219
|
if (currentCutOffTime.isAfter(maxCutOffTimeValue, 'minute')) {
|
|
2220
2220
|
maxCutOffTimeValue = currentCutOffTime;
|
|
@@ -2242,13 +2242,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2242
2242
|
cartItems.forEach(function (item) {
|
|
2243
2243
|
// 单个预约累加账号 多个预约取最大值
|
|
2244
2244
|
if (isSingleResource) {
|
|
2245
|
-
var _item$_productOrigin13;
|
|
2246
|
-
accountDuration += ((_item$_productOrigin13 = item._productOrigin) === null || _item$_productOrigin13 === void 0 || (_item$_productOrigin13 = _item$_productOrigin13.duration) === null || _item$_productOrigin13 === void 0 ? void 0 : _item$_productOrigin13.value) || 10;
|
|
2247
|
-
} else {
|
|
2248
2245
|
var _item$_productOrigin14;
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2246
|
+
accountDuration += ((_item$_productOrigin14 = item._productOrigin) === null || _item$_productOrigin14 === void 0 || (_item$_productOrigin14 = _item$_productOrigin14.duration) === null || _item$_productOrigin14 === void 0 ? void 0 : _item$_productOrigin14.value) || 10;
|
|
2247
|
+
} else {
|
|
2248
|
+
var _item$_productOrigin15;
|
|
2249
|
+
if (accountDuration < (((_item$_productOrigin15 = item._productOrigin) === null || _item$_productOrigin15 === void 0 || (_item$_productOrigin15 = _item$_productOrigin15.duration) === null || _item$_productOrigin15 === void 0 ? void 0 : _item$_productOrigin15.value) || 10)) {
|
|
2250
|
+
var _item$_productOrigin16;
|
|
2251
|
+
accountDuration = ((_item$_productOrigin16 = item._productOrigin) === null || _item$_productOrigin16 === void 0 || (_item$_productOrigin16 = _item$_productOrigin16.duration) === null || _item$_productOrigin16 === void 0 ? void 0 : _item$_productOrigin16.value) || 10;
|
|
2252
2252
|
}
|
|
2253
2253
|
}
|
|
2254
2254
|
});
|
|
@@ -2285,8 +2285,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2285
2285
|
}
|
|
2286
2286
|
var resourcesUseableMap = {};
|
|
2287
2287
|
var hasFlexibleDuration = cartItems.some(function (item) {
|
|
2288
|
-
var _item$
|
|
2289
|
-
return ((_item$
|
|
2288
|
+
var _item$_productOrigin17;
|
|
2289
|
+
return ((_item$_productOrigin17 = item._productOrigin) === null || _item$_productOrigin17 === void 0 || (_item$_productOrigin17 = _item$_productOrigin17.duration) === null || _item$_productOrigin17 === void 0 ? void 0 : _item$_productOrigin17.type) === 'flexible';
|
|
2290
2290
|
});
|
|
2291
2291
|
var operating_day_boundary = (_this$shopStore$get = this.shopStore.get('core')) === null || _this$shopStore$get === void 0 || (_this$shopStore$get = _this$shopStore$get.core) === null || _this$shopStore$get === void 0 || (_this$shopStore$get = _this$shopStore$get.operating_day_boundary) === null || _this$shopStore$get === void 0 ? void 0 : _this$shopStore$get.time;
|
|
2292
2292
|
var timeSlots = getTimeSlicesByResources({
|
|
@@ -2337,9 +2337,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2337
2337
|
var _newResources$;
|
|
2338
2338
|
var newResources = cloneDeep(item._origin.resources);
|
|
2339
2339
|
newResources.forEach(function (resource) {
|
|
2340
|
-
var _item$
|
|
2340
|
+
var _item$_productOrigin18;
|
|
2341
2341
|
// 如果商品配置的是灵活时长,开始时间设置为提交的时间,结束时间从资源的可用最晚时间和店铺营业结束时间里取一个最早的
|
|
2342
|
-
if (((_item$
|
|
2342
|
+
if (((_item$_productOrigin18 = item._productOrigin) === null || _item$_productOrigin18 === void 0 || (_item$_productOrigin18 = _item$_productOrigin18.duration) === null || _item$_productOrigin18 === void 0 ? void 0 : _item$_productOrigin18.type) === 'flexible') {
|
|
2343
2343
|
var _allResources$find;
|
|
2344
2344
|
item.duration = {
|
|
2345
2345
|
type: 'minutes',
|
|
@@ -2365,9 +2365,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2365
2365
|
}
|
|
2366
2366
|
resource.endTime = formattedEndTime.format('YYYY-MM-DD HH:mm');
|
|
2367
2367
|
} else {
|
|
2368
|
-
var _item$
|
|
2368
|
+
var _item$_productOrigin19;
|
|
2369
2369
|
resource.startTime = currentStartTime;
|
|
2370
|
-
resource.endTime = dayjs(currentStartTime).add(((_item$
|
|
2370
|
+
resource.endTime = dayjs(currentStartTime).add(((_item$_productOrigin19 = item._productOrigin) === null || _item$_productOrigin19 === void 0 || (_item$_productOrigin19 = _item$_productOrigin19.duration) === null || _item$_productOrigin19 === void 0 ? void 0 : _item$_productOrigin19.value) || 10, 'minutes').format('YYYY-MM-DD HH:mm');
|
|
2371
2371
|
}
|
|
2372
2372
|
// delete resource.times;
|
|
2373
2373
|
});
|
|
@@ -1295,7 +1295,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1295
1295
|
const selectForCartResources = (cartItems2) => {
|
|
1296
1296
|
let recordTimeSlots = (0, import_lodash_es.cloneDeep)(timeSlots);
|
|
1297
1297
|
cartItems2.forEach((item, index) => {
|
|
1298
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
1298
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
1299
1299
|
const formatCapacity = (0, import_resources.formatDefaultCapacitys)({
|
|
1300
1300
|
capacity: (_a2 = item._productOrigin) == null ? void 0 : _a2.capacity,
|
|
1301
1301
|
product_bundle: item._origin.product.product_bundle
|
|
@@ -1313,13 +1313,13 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1313
1313
|
const currentResourceConfig = (_d = (_c = (_b = item._productOrigin) == null ? void 0 : _b.product_resource) == null ? void 0 : _c.resources) == null ? void 0 : _d.find(
|
|
1314
1314
|
(n) => n.code === resources_code
|
|
1315
1315
|
);
|
|
1316
|
-
if (index !== 0 && recordTimeSlots && (currentResourceConfig == null ? void 0 : currentResourceConfig.type) === "single" && ((_e = item._productOrigin) == null ? void 0 : _e.duration)) {
|
|
1316
|
+
if (index !== 0 && recordTimeSlots && (currentResourceConfig == null ? void 0 : currentResourceConfig.type) === "single" && ((_e = item._productOrigin) == null ? void 0 : _e.duration) && ((_g = (_f = item._productOrigin) == null ? void 0 : _f.duration) == null ? void 0 : _g.type) !== "flexible") {
|
|
1317
1317
|
let start_at = (0, import_dayjs.default)(recordTimeSlots.end_time).add(
|
|
1318
|
-
((
|
|
1318
|
+
((_i = (_h = item._productOrigin) == null ? void 0 : _h.duration) == null ? void 0 : _i.value) || 10,
|
|
1319
1319
|
"minutes"
|
|
1320
1320
|
);
|
|
1321
1321
|
let end_at = start_at.add(
|
|
1322
|
-
((
|
|
1322
|
+
((_k = (_j = item._productOrigin) == null ? void 0 : _j.duration) == null ? void 0 : _k.value) || 10,
|
|
1323
1323
|
"minutes"
|
|
1324
1324
|
);
|
|
1325
1325
|
recordTimeSlots = {
|
|
@@ -1373,7 +1373,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1373
1373
|
const allCartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
|
|
1374
1374
|
let selectedResources = [];
|
|
1375
1375
|
const resources2 = (0, import_lodash_es.cloneDeep)(
|
|
1376
|
-
((
|
|
1376
|
+
((_m = (_l = item._productOrigin) == null ? void 0 : _l.product_resource) == null ? void 0 : _m.resources) || []
|
|
1377
1377
|
);
|
|
1378
1378
|
const currentResourcesRenderList = [];
|
|
1379
1379
|
resources2.forEach((n) => {
|
|
@@ -1421,11 +1421,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1421
1421
|
return recordCount >= currentCapacity;
|
|
1422
1422
|
});
|
|
1423
1423
|
});
|
|
1424
|
-
const targetRenderList = (
|
|
1424
|
+
const targetRenderList = (_n = productResources.find(
|
|
1425
1425
|
(n) => n.code === resources_code
|
|
1426
|
-
)) == null ? void 0 :
|
|
1426
|
+
)) == null ? void 0 : _n.renderList;
|
|
1427
1427
|
if (targetRenderList && targetRenderList.length > 0) {
|
|
1428
|
-
if ((
|
|
1428
|
+
if ((_o = item._origin.resources) == null ? void 0 : _o.some(
|
|
1429
1429
|
(n) => n.form_id === targetRenderList[0].form_id
|
|
1430
1430
|
)) {
|
|
1431
1431
|
return;
|