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