@pisell/pisellos 0.0.444 → 0.0.445
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/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +84 -35
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +34 -3
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -358,7 +358,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
358
358
|
};
|
|
359
359
|
setOtherData(key: string, value: any): void;
|
|
360
360
|
getOtherData(key: string): any;
|
|
361
|
-
getProductTypeById(id: number): Promise<"
|
|
361
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
362
362
|
/**
|
|
363
363
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
364
364
|
*
|
|
@@ -2554,14 +2554,63 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2554
2554
|
var targetResourceTimes = allResources === null || allResources === void 0 || (_allResources$find = allResources.find(function (n) {
|
|
2555
2555
|
return n.id === resource.id;
|
|
2556
2556
|
})) === null || _allResources$find === void 0 ? void 0 : _allResources$find.times;
|
|
2557
|
+
// 找到最晚的 end_at 还没用,因为可能存在资源工作时间是 10:00-19:00,但是资源的 times 里有 16:30-19:00 被 block 的情况
|
|
2558
|
+
// 所以还需要排除掉 block 时间
|
|
2559
|
+
function getEarliestBlockedStartTime(_ref11) {
|
|
2560
|
+
var _earliestBlockStart;
|
|
2561
|
+
var currentStartTime = _ref11.currentStartTime,
|
|
2562
|
+
times = _ref11.times;
|
|
2563
|
+
var currentStart = dayjs(currentStartTime);
|
|
2564
|
+
var earliestBlockStart;
|
|
2565
|
+
var _iterator3 = _createForOfIteratorHelper(times || []),
|
|
2566
|
+
_step3;
|
|
2567
|
+
try {
|
|
2568
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
2569
|
+
var time = _step3.value;
|
|
2570
|
+
var _iterator4 = _createForOfIteratorHelper(time.event_list || []),
|
|
2571
|
+
_step4;
|
|
2572
|
+
try {
|
|
2573
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
2574
|
+
var event = _step4.value;
|
|
2575
|
+
var eventStart = dayjs(event.start_at);
|
|
2576
|
+
var eventEnd = dayjs(event.end_at);
|
|
2577
|
+
if (eventStart.isBefore(currentStart) && eventEnd.isAfter(currentStart)) {
|
|
2578
|
+
return currentStart.format('YYYY-MM-DD HH:mm');
|
|
2579
|
+
}
|
|
2580
|
+
if (eventStart.isAfter(currentStart)) {
|
|
2581
|
+
if (!earliestBlockStart || eventStart.isBefore(earliestBlockStart)) {
|
|
2582
|
+
earliestBlockStart = eventStart;
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
}
|
|
2586
|
+
} catch (err) {
|
|
2587
|
+
_iterator4.e(err);
|
|
2588
|
+
} finally {
|
|
2589
|
+
_iterator4.f();
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
} catch (err) {
|
|
2593
|
+
_iterator3.e(err);
|
|
2594
|
+
} finally {
|
|
2595
|
+
_iterator3.f();
|
|
2596
|
+
}
|
|
2597
|
+
return (_earliestBlockStart = earliestBlockStart) === null || _earliestBlockStart === void 0 ? void 0 : _earliestBlockStart.format('YYYY-MM-DD HH:mm');
|
|
2598
|
+
}
|
|
2557
2599
|
var resourcesEndTime = targetResourceTimes.reduce(function (acc, curr) {
|
|
2558
2600
|
return dayjs(curr.end_at).isAfter(dayjs(acc.end_at)) ? curr : acc;
|
|
2559
2601
|
}, targetResourceTimes[0]);
|
|
2602
|
+
var earliestBlockedStartTime = getEarliestBlockedStartTime({
|
|
2603
|
+
currentStartTime: currentStartTime,
|
|
2604
|
+
times: targetResourceTimes
|
|
2605
|
+
});
|
|
2560
2606
|
|
|
2561
2607
|
// 将 operating_day_boundary 转换为与 resourcesEndTime.end_at 相同日期的完整日期时间
|
|
2562
2608
|
var resourceDate = dayjs(resourcesEndTime.end_at).format('YYYY-MM-DD');
|
|
2563
2609
|
var operatingBoundaryDateTime = "".concat(resourceDate, " ").concat(operating_day_boundary.type === 'start_time' ? '23:59' : operating_day_boundary.time);
|
|
2564
|
-
var
|
|
2610
|
+
var endTimeCandidates = [resourcesEndTime.end_at, operatingBoundaryDateTime].concat(_toConsumableArray(earliestBlockedStartTime ? [earliestBlockedStartTime] : []));
|
|
2611
|
+
var endTime = endTimeCandidates.reduce(function (earliest, value) {
|
|
2612
|
+
return dayjs(value).isBefore(dayjs(earliest)) ? value : earliest;
|
|
2613
|
+
}, endTimeCandidates[0]);
|
|
2565
2614
|
// 修复:如果 endTime 只是时间格式(如 "17:00"),需要加上日期
|
|
2566
2615
|
var formattedEndTime;
|
|
2567
2616
|
if (typeof endTime === 'string' && endTime.includes(':') && !endTime.includes(' ') && !endTime.includes('T')) {
|
|
@@ -2702,14 +2751,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2702
2751
|
// 通过商品和 schedule 来获取视频可用的时间片、时间片内资源可用的数据
|
|
2703
2752
|
}, {
|
|
2704
2753
|
key: "getTimeslotBySchedule",
|
|
2705
|
-
value: function getTimeslotBySchedule(
|
|
2754
|
+
value: function getTimeslotBySchedule(_ref12) {
|
|
2706
2755
|
var _this$store$currentPr2,
|
|
2707
2756
|
_targetProductData$pr,
|
|
2708
2757
|
_this15 = this;
|
|
2709
|
-
var date =
|
|
2710
|
-
scheduleIds =
|
|
2711
|
-
resources =
|
|
2712
|
-
product =
|
|
2758
|
+
var date = _ref12.date,
|
|
2759
|
+
scheduleIds = _ref12.scheduleIds,
|
|
2760
|
+
resources = _ref12.resources,
|
|
2761
|
+
product = _ref12.product;
|
|
2713
2762
|
var targetProduct = this.store.currentProduct;
|
|
2714
2763
|
// 如果外面传递了product 优先用外面的
|
|
2715
2764
|
var targetProductData = product || targetProduct;
|
|
@@ -3268,12 +3317,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3268
3317
|
// 检查资源类型(单个预约 vs 多个预约)
|
|
3269
3318
|
// 从商品配置中获取资源类型信息
|
|
3270
3319
|
var resourceTypeConfig = null;
|
|
3271
|
-
var
|
|
3272
|
-
|
|
3320
|
+
var _iterator5 = _createForOfIteratorHelper(items),
|
|
3321
|
+
_step5;
|
|
3273
3322
|
try {
|
|
3274
|
-
for (
|
|
3323
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
3275
3324
|
var _cartItem$_productOri12;
|
|
3276
|
-
var cartItem =
|
|
3325
|
+
var cartItem = _step5.value;
|
|
3277
3326
|
if ((_cartItem$_productOri12 = cartItem._productOrigin) !== null && _cartItem$_productOri12 !== void 0 && (_cartItem$_productOri12 = _cartItem$_productOri12.product_resource) !== null && _cartItem$_productOri12 !== void 0 && _cartItem$_productOri12.resources) {
|
|
3278
3327
|
resourceTypeConfig = cartItem._productOrigin.product_resource.resources.find(function (r) {
|
|
3279
3328
|
return r.code === resourceCode && r.status === 1;
|
|
@@ -3282,9 +3331,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3282
3331
|
}
|
|
3283
3332
|
}
|
|
3284
3333
|
} catch (err) {
|
|
3285
|
-
|
|
3334
|
+
_iterator5.e(err);
|
|
3286
3335
|
} finally {
|
|
3287
|
-
|
|
3336
|
+
_iterator5.f();
|
|
3288
3337
|
}
|
|
3289
3338
|
var isMultipleBooking = ((_resourceTypeConfig = resourceTypeConfig) === null || _resourceTypeConfig === void 0 ? void 0 : _resourceTypeConfig.type) === 'multiple';
|
|
3290
3339
|
var totalAvailable;
|
|
@@ -3487,17 +3536,17 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3487
3536
|
*/
|
|
3488
3537
|
}, {
|
|
3489
3538
|
key: "convertProductToCartItem",
|
|
3490
|
-
value: function convertProductToCartItem(
|
|
3491
|
-
var product =
|
|
3492
|
-
date =
|
|
3493
|
-
account =
|
|
3494
|
-
var
|
|
3495
|
-
bundle =
|
|
3496
|
-
options =
|
|
3497
|
-
origin =
|
|
3498
|
-
product_variant_id =
|
|
3499
|
-
|
|
3500
|
-
quantity =
|
|
3539
|
+
value: function convertProductToCartItem(_ref13) {
|
|
3540
|
+
var product = _ref13.product,
|
|
3541
|
+
date = _ref13.date,
|
|
3542
|
+
account = _ref13.account;
|
|
3543
|
+
var _ref14 = product || {},
|
|
3544
|
+
bundle = _ref14.bundle,
|
|
3545
|
+
options = _ref14.options,
|
|
3546
|
+
origin = _ref14.origin,
|
|
3547
|
+
product_variant_id = _ref14.product_variant_id,
|
|
3548
|
+
_ref14$quantity = _ref14.quantity,
|
|
3549
|
+
quantity = _ref14$quantity === void 0 ? 1 : _ref14$quantity;
|
|
3501
3550
|
|
|
3502
3551
|
// 处理商品数据,类似 addProductToCart 中的逻辑
|
|
3503
3552
|
var productData = _objectSpread(_objectSpread({}, origin), {}, {
|
|
@@ -3552,11 +3601,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3552
3601
|
}
|
|
3553
3602
|
}, {
|
|
3554
3603
|
key: "checkMaxDurationCapacityForDetailNums",
|
|
3555
|
-
value: function checkMaxDurationCapacityForDetailNums(
|
|
3604
|
+
value: function checkMaxDurationCapacityForDetailNums(_ref15) {
|
|
3556
3605
|
var _this17 = this;
|
|
3557
|
-
var product =
|
|
3558
|
-
date =
|
|
3559
|
-
account =
|
|
3606
|
+
var product = _ref15.product,
|
|
3607
|
+
date = _ref15.date,
|
|
3608
|
+
account = _ref15.account;
|
|
3560
3609
|
var cartItems = this.store.cart.getItems().filter(function (item) {
|
|
3561
3610
|
return !isNormalProduct(item._productOrigin);
|
|
3562
3611
|
});
|
|
@@ -3701,12 +3750,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3701
3750
|
// 检查资源类型(单个预约 vs 多个预约)
|
|
3702
3751
|
// 从商品配置中获取资源类型信息
|
|
3703
3752
|
var resourceTypeConfig = null;
|
|
3704
|
-
var
|
|
3705
|
-
|
|
3753
|
+
var _iterator6 = _createForOfIteratorHelper(items),
|
|
3754
|
+
_step6;
|
|
3706
3755
|
try {
|
|
3707
|
-
for (
|
|
3756
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
3708
3757
|
var _cartItem$_productOri15;
|
|
3709
|
-
var cartItem =
|
|
3758
|
+
var cartItem = _step6.value;
|
|
3710
3759
|
if ((_cartItem$_productOri15 = cartItem._productOrigin) !== null && _cartItem$_productOri15 !== void 0 && (_cartItem$_productOri15 = _cartItem$_productOri15.product_resource) !== null && _cartItem$_productOri15 !== void 0 && _cartItem$_productOri15.resources) {
|
|
3711
3760
|
resourceTypeConfig = cartItem._productOrigin.product_resource.resources.find(function (r) {
|
|
3712
3761
|
return r.code === resourceCode && r.status === 1;
|
|
@@ -3715,9 +3764,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3715
3764
|
}
|
|
3716
3765
|
}
|
|
3717
3766
|
} catch (err) {
|
|
3718
|
-
|
|
3767
|
+
_iterator6.e(err);
|
|
3719
3768
|
} finally {
|
|
3720
|
-
|
|
3769
|
+
_iterator6.f();
|
|
3721
3770
|
}
|
|
3722
3771
|
var isMultipleBooking = ((_resourceTypeConfig2 = resourceTypeConfig) === null || _resourceTypeConfig2 === void 0 ? void 0 : _resourceTypeConfig2.type) === 'multiple';
|
|
3723
3772
|
var totalAvailable;
|
|
@@ -4088,12 +4137,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4088
4137
|
}, {
|
|
4089
4138
|
key: "getTimeslotsScheduleByDateRange",
|
|
4090
4139
|
value: (function () {
|
|
4091
|
-
var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(
|
|
4140
|
+
var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(_ref16) {
|
|
4092
4141
|
var startDate, endDate, scheduleIds, resources, dates, currentDate, end, results, _i5, _dates, date;
|
|
4093
4142
|
return _regeneratorRuntime().wrap(function _callee27$(_context28) {
|
|
4094
4143
|
while (1) switch (_context28.prev = _context28.next) {
|
|
4095
4144
|
case 0:
|
|
4096
|
-
startDate =
|
|
4145
|
+
startDate = _ref16.startDate, endDate = _ref16.endDate, scheduleIds = _ref16.scheduleIds, resources = _ref16.resources;
|
|
4097
4146
|
console.log('appoimentBooking-session-date-getTimeslotsScheduleByDateRange', {
|
|
4098
4147
|
startDate: startDate,
|
|
4099
4148
|
endDate: endDate,
|
|
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
123
123
|
* 获取当前的客户搜索条件
|
|
124
124
|
* @returns 当前搜索条件
|
|
125
125
|
*/
|
|
126
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
126
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
127
127
|
/**
|
|
128
128
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
129
129
|
* @returns 客户状态
|
|
@@ -358,7 +358,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
358
358
|
};
|
|
359
359
|
setOtherData(key: string, value: any): void;
|
|
360
360
|
getOtherData(key: string): any;
|
|
361
|
-
getProductTypeById(id: number): Promise<"
|
|
361
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
362
362
|
/**
|
|
363
363
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
364
364
|
*
|
|
@@ -1768,6 +1768,28 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1768
1768
|
newResources.forEach((resource) => {
|
|
1769
1769
|
var _a3, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
1770
1770
|
if (((_b2 = (_a3 = item._productOrigin) == null ? void 0 : _a3.duration) == null ? void 0 : _b2.type) === "flexible") {
|
|
1771
|
+
let getEarliestBlockedStartTime = function({
|
|
1772
|
+
currentStartTime: currentStartTime2,
|
|
1773
|
+
times
|
|
1774
|
+
}) {
|
|
1775
|
+
const currentStart = (0, import_dayjs.default)(currentStartTime2);
|
|
1776
|
+
let earliestBlockStart;
|
|
1777
|
+
for (const time of times || []) {
|
|
1778
|
+
for (const event of time.event_list || []) {
|
|
1779
|
+
const eventStart = (0, import_dayjs.default)(event.start_at);
|
|
1780
|
+
const eventEnd = (0, import_dayjs.default)(event.end_at);
|
|
1781
|
+
if (eventStart.isBefore(currentStart) && eventEnd.isAfter(currentStart)) {
|
|
1782
|
+
return currentStart.format("YYYY-MM-DD HH:mm");
|
|
1783
|
+
}
|
|
1784
|
+
if (eventStart.isAfter(currentStart)) {
|
|
1785
|
+
if (!earliestBlockStart || eventStart.isBefore(earliestBlockStart)) {
|
|
1786
|
+
earliestBlockStart = eventStart;
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
return earliestBlockStart == null ? void 0 : earliestBlockStart.format("YYYY-MM-DD HH:mm");
|
|
1792
|
+
};
|
|
1771
1793
|
item.duration = {
|
|
1772
1794
|
type: "minutes",
|
|
1773
1795
|
value: 10
|
|
@@ -1782,13 +1804,22 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1782
1804
|
},
|
|
1783
1805
|
targetResourceTimes[0]
|
|
1784
1806
|
);
|
|
1807
|
+
const earliestBlockedStartTime = getEarliestBlockedStartTime({
|
|
1808
|
+
currentStartTime,
|
|
1809
|
+
times: targetResourceTimes
|
|
1810
|
+
});
|
|
1785
1811
|
const resourceDate = (0, import_dayjs.default)(resourcesEndTime.end_at).format(
|
|
1786
1812
|
"YYYY-MM-DD"
|
|
1787
1813
|
);
|
|
1788
1814
|
const operatingBoundaryDateTime = `${resourceDate} ${operating_day_boundary.type === "start_time" ? "23:59" : operating_day_boundary.time}`;
|
|
1789
|
-
const
|
|
1790
|
-
|
|
1791
|
-
|
|
1815
|
+
const endTimeCandidates = [
|
|
1816
|
+
resourcesEndTime.end_at,
|
|
1817
|
+
operatingBoundaryDateTime,
|
|
1818
|
+
...earliestBlockedStartTime ? [earliestBlockedStartTime] : []
|
|
1819
|
+
];
|
|
1820
|
+
const endTime = endTimeCandidates.reduce((earliest, value) => {
|
|
1821
|
+
return (0, import_dayjs.default)(value).isBefore((0, import_dayjs.default)(earliest)) ? value : earliest;
|
|
1822
|
+
}, endTimeCandidates[0]);
|
|
1792
1823
|
let formattedEndTime;
|
|
1793
1824
|
if (typeof endTime === "string" && endTime.includes(":") && !endTime.includes(" ") && !endTime.includes("T")) {
|
|
1794
1825
|
const currentDate = timeSlots.start_at.format("YYYY-MM-DD");
|
|
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
123
123
|
* 获取当前的客户搜索条件
|
|
124
124
|
* @returns 当前搜索条件
|
|
125
125
|
*/
|
|
126
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
126
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
127
127
|
/**
|
|
128
128
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
129
129
|
* @returns 客户状态
|