@pisell/pisellos 2.1.36 → 2.2.1
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/effects/index.d.ts +1 -0
- package/dist/effects/index.js +29 -6
- package/dist/modules/Account/index.js +2 -3
- package/dist/modules/BaseModule.d.ts +3 -0
- package/dist/modules/BaseModule.js +15 -0
- package/dist/modules/Customer/index.js +9 -10
- package/dist/modules/Customer/types.d.ts +2 -2
- package/dist/modules/Customer/types.js +2 -2
- package/dist/modules/Discount/index.js +1 -1
- package/dist/modules/Guests/index.js +9 -9
- package/dist/modules/Order/index.js +1 -1
- package/dist/modules/Payment/index.js +63 -73
- package/dist/modules/Payment/walletpass.js +4 -1
- package/dist/modules/Product/types.d.ts +19 -0
- package/dist/modules/ProductList/index.js +5 -14
- package/dist/modules/Resource/index.js +1 -1
- package/dist/modules/Rules/index.js +2 -3
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/plugins/request.d.ts +1 -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 +768 -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 +0 -16
- package/dist/solution/BookingByStep/index.js +57 -508
- 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 +12 -0
- package/dist/solution/BookingTicket/index.js +122 -79
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +25 -16
- package/dist/solution/BuyTickets/index.js +7 -8
- package/dist/solution/Checkout/index.d.ts +1 -46
- package/dist/solution/Checkout/index.js +530 -850
- package/dist/solution/ShopDiscount/index.js +9 -10
- package/dist/types/index.d.ts +27 -0
- package/lib/core/index.d.ts +8 -1
- package/lib/core/index.js +48 -1
- package/lib/effects/index.d.ts +1 -0
- package/lib/effects/index.js +13 -0
- package/lib/modules/Account/index.js +2 -3
- package/lib/modules/BaseModule.d.ts +3 -0
- package/lib/modules/BaseModule.js +9 -0
- package/lib/modules/Customer/index.js +9 -10
- package/lib/modules/Customer/types.d.ts +2 -2
- package/lib/modules/Customer/types.js +2 -2
- package/lib/modules/Discount/index.js +1 -1
- package/lib/modules/Guests/index.js +9 -9
- package/lib/modules/Order/index.js +1 -1
- package/lib/modules/Payment/index.js +56 -43
- package/lib/modules/Payment/walletpass.js +3 -1
- package/lib/modules/Product/types.d.ts +19 -0
- package/lib/modules/ProductList/index.js +4 -13
- package/lib/modules/Resource/index.js +1 -1
- package/lib/modules/Rules/index.js +2 -3
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/plugins/request.d.ts +1 -0
- 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 +434 -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 +0 -16
- package/lib/solution/BookingByStep/index.js +44 -316
- 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 +12 -0
- package/lib/solution/BookingTicket/index.js +25 -6
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +7 -1
- package/lib/solution/BuyTickets/index.js +7 -8
- package/lib/solution/Checkout/index.d.ts +1 -46
- package/lib/solution/Checkout/index.js +92 -289
- package/lib/solution/ShopDiscount/index.js +10 -11
- package/lib/types/index.d.ts +27 -0
- package/package.json +2 -2
|
@@ -29,8 +29,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
29
29
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
30
30
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
31
31
|
import { BaseModule } from "../../modules/BaseModule";
|
|
32
|
-
import {
|
|
33
|
-
import { formatProductToCartItem, createCartItemOrigin, getUniqueId, handleVariantProduct, formatDateToCartItem, formatAccountToCartItem } from "../../modules/Cart/utils";
|
|
32
|
+
import { createModule } from "./types";
|
|
34
33
|
import { getAvailableProductResources } from "./utils/products";
|
|
35
34
|
import { getResourcesByProduct, getTimeSlicesByResource, getTimeSlicesByResources, getIsUsableByTimeItem, getOthersSelectedResources, getOthersCartSelectedResources, filterScheduleByDateRange, checkSessionProductLeadTime, sortCombinedResources, filterResourcesByFormItem, checkTwoResourcesIntersection, isConflict } from "./utils/resources";
|
|
36
35
|
import dayjs from 'dayjs';
|
|
@@ -137,7 +136,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
137
136
|
}
|
|
138
137
|
});
|
|
139
138
|
this.store.schedule.loadAllSchedule();
|
|
140
|
-
this.core.effects.emit(
|
|
139
|
+
this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
141
140
|
case 19:
|
|
142
141
|
case "end":
|
|
143
142
|
return _context.stop();
|
|
@@ -1195,16 +1194,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1195
1194
|
this.addProductCheck({
|
|
1196
1195
|
date: date
|
|
1197
1196
|
});
|
|
1198
|
-
|
|
1199
|
-
if (addItemParams.quantity > 1 && !isNormalProduct(productData)) {
|
|
1200
|
-
for (var i = 0; i < addItemParams.quantity; i++) {
|
|
1201
|
-
var newAddItemParams = cloneDeep(addItemParams);
|
|
1202
|
-
newAddItemParams.quantity = 1;
|
|
1203
|
-
this.store.cart.addItem(newAddItemParams);
|
|
1204
|
-
}
|
|
1205
|
-
} else {
|
|
1206
|
-
this.store.cart.addItem(addItemParams);
|
|
1207
|
-
}
|
|
1197
|
+
this.store.cart.addItem(addItemParams);
|
|
1208
1198
|
return {
|
|
1209
1199
|
success: true
|
|
1210
1200
|
};
|
|
@@ -2686,41 +2676,35 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2686
2676
|
|
|
2687
2677
|
// 与其他资源的时间段求交集
|
|
2688
2678
|
var _loop2 = function _loop2() {
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
});
|
|
2679
|
+
var currentResourceSlots = allTimeSlots[i];
|
|
2680
|
+
var intersections = [];
|
|
2681
|
+
|
|
2682
|
+
// 计算当前公共时间段与下一个资源时间段的交集
|
|
2683
|
+
commonSlots.forEach(function (commonSlot) {
|
|
2684
|
+
currentResourceSlots.forEach(function (currentSlot) {
|
|
2685
|
+
var overlapStart = commonSlot.start.isAfter(currentSlot.start) ? commonSlot.start : currentSlot.start;
|
|
2686
|
+
var overlapEnd = commonSlot.end.isBefore(currentSlot.end) ? commonSlot.end : currentSlot.end;
|
|
2687
|
+
|
|
2688
|
+
// 如果有重叠时间且重叠时间大于0
|
|
2689
|
+
if (overlapStart.isBefore(overlapEnd)) {
|
|
2690
|
+
intersections.push({
|
|
2691
|
+
start: overlapStart,
|
|
2692
|
+
end: overlapEnd
|
|
2693
|
+
});
|
|
2694
|
+
}
|
|
2706
2695
|
});
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
};
|
|
2718
|
-
}
|
|
2719
|
-
},
|
|
2720
|
-
_ret2;
|
|
2696
|
+
});
|
|
2697
|
+
if (intersections.length === 0) {
|
|
2698
|
+
console.log("\u8D44\u6E90".concat(i, "\u4E0E\u5F53\u524D\u516C\u5171\u65F6\u95F4\u6BB5\u65E0\u4EA4\u96C6\uFF0C\u8DF3\u8FC7\u8BE5\u8D44\u6E90"));
|
|
2699
|
+
return 1; // continue
|
|
2700
|
+
}
|
|
2701
|
+
commonSlots = intersections;
|
|
2702
|
+
console.log("\u4E0E\u8D44\u6E90".concat(i, "\u6C42\u4EA4\u96C6\u540E\u7684\u516C\u5171\u65F6\u95F4\u6BB5:"), commonSlots.map(function (slot) {
|
|
2703
|
+
return "".concat(slot.start.format('HH:mm'), "-").concat(slot.end.format('HH:mm'));
|
|
2704
|
+
}));
|
|
2705
|
+
};
|
|
2721
2706
|
for (var i = 1; i < allTimeSlots.length; i++) {
|
|
2722
|
-
|
|
2723
|
-
if (_ret2) return _ret2.v;
|
|
2707
|
+
if (_loop2()) continue;
|
|
2724
2708
|
}
|
|
2725
2709
|
|
|
2726
2710
|
// 格式化返回结果
|
|
@@ -2969,10 +2953,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2969
2953
|
}
|
|
2970
2954
|
});
|
|
2971
2955
|
},
|
|
2972
|
-
|
|
2956
|
+
_ret2;
|
|
2973
2957
|
for (var _i = 0, _Object$entries = Object.entries(itemsByResourceType); _i < _Object$entries.length; _i++) {
|
|
2974
|
-
|
|
2975
|
-
if (
|
|
2958
|
+
_ret2 = _loop3();
|
|
2959
|
+
if (_ret2) return _ret2.v;
|
|
2976
2960
|
}
|
|
2977
2961
|
|
|
2978
2962
|
// 如果有容量问题,找出限制最严格的资源类型,返回其总容量
|
|
@@ -3054,11 +3038,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3054
3038
|
});
|
|
3055
3039
|
|
|
3056
3040
|
// 按资源类型分组检查容量
|
|
3057
|
-
|
|
3058
|
-
success = _checkTimeSlotCapacit.success,
|
|
3059
|
-
required = _checkTimeSlotCapacit.required,
|
|
3060
|
-
available = _checkTimeSlotCapacit.available;
|
|
3061
|
-
if (!success) {
|
|
3041
|
+
if (!checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, itemsInTimeSlot, allResourcesForTimeSlot)) {
|
|
3062
3042
|
// 如果有可用数量记录,返回最小值;否则返回 0
|
|
3063
3043
|
var _minAvailableCount = availableCountsByResourceType.length > 0 ? Math.min.apply(Math, availableCountsByResourceType) : 0;
|
|
3064
3044
|
return {
|
|
@@ -3069,442 +3049,11 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3069
3049
|
};
|
|
3070
3050
|
}
|
|
3071
3051
|
},
|
|
3072
|
-
|
|
3052
|
+
_ret3;
|
|
3073
3053
|
for (var _i2 = 0, _Object$entries2 = Object.entries(cartItemsByTimeSlot); _i2 < _Object$entries2.length; _i2++) {
|
|
3074
|
-
|
|
3075
|
-
if (
|
|
3076
|
-
if (
|
|
3077
|
-
}
|
|
3078
|
-
|
|
3079
|
-
// 全部通过检测,返回成功和最小可用数量
|
|
3080
|
-
var minAvailableCount = availableCountsByResourceType.length > 0 ? Math.min.apply(Math, availableCountsByResourceType) : 0;
|
|
3081
|
-
return {
|
|
3082
|
-
success: true,
|
|
3083
|
-
minAvailableCount: minAvailableCount
|
|
3084
|
-
};
|
|
3085
|
-
}
|
|
3086
|
-
|
|
3087
|
-
/**
|
|
3088
|
-
* 将 ProductData 转换为 CartItem,但不添加到购物车
|
|
3089
|
-
* 参考 addProductToCart 方法的实现
|
|
3090
|
-
*/
|
|
3091
|
-
}, {
|
|
3092
|
-
key: "convertProductToCartItem",
|
|
3093
|
-
value: function convertProductToCartItem(_ref11) {
|
|
3094
|
-
var product = _ref11.product,
|
|
3095
|
-
date = _ref11.date,
|
|
3096
|
-
account = _ref11.account;
|
|
3097
|
-
var _ref12 = product || {},
|
|
3098
|
-
bundle = _ref12.bundle,
|
|
3099
|
-
options = _ref12.options,
|
|
3100
|
-
origin = _ref12.origin,
|
|
3101
|
-
product_variant_id = _ref12.product_variant_id,
|
|
3102
|
-
_ref12$quantity = _ref12.quantity,
|
|
3103
|
-
quantity = _ref12$quantity === void 0 ? 1 : _ref12$quantity;
|
|
3104
|
-
|
|
3105
|
-
// 处理商品数据,类似 addProductToCart 中的逻辑
|
|
3106
|
-
var productData = _objectSpread(_objectSpread({}, origin), {}, {
|
|
3107
|
-
product_variant_id: product_variant_id
|
|
3108
|
-
});
|
|
3109
|
-
|
|
3110
|
-
// 处理组合商品
|
|
3111
|
-
var processedProduct = handleVariantProduct(productData);
|
|
3112
|
-
|
|
3113
|
-
// 如果没有传入账户,获取当前活跃账户
|
|
3114
|
-
if (!account) {
|
|
3115
|
-
var activeAccount = this.getActiveAccount();
|
|
3116
|
-
if (activeAccount) {
|
|
3117
|
-
account = activeAccount;
|
|
3118
|
-
}
|
|
3119
|
-
}
|
|
3120
|
-
|
|
3121
|
-
// 创建基础的 CartItem
|
|
3122
|
-
var cartItem = {
|
|
3123
|
-
_id: getUniqueId('temp_'),
|
|
3124
|
-
_origin: createCartItemOrigin(),
|
|
3125
|
-
_productOrigin: processedProduct,
|
|
3126
|
-
_productInit: product
|
|
3127
|
-
};
|
|
3128
|
-
|
|
3129
|
-
// 使用格式化函数填充 CartItem 数据
|
|
3130
|
-
formatProductToCartItem({
|
|
3131
|
-
cartItem: cartItem,
|
|
3132
|
-
product: processedProduct,
|
|
3133
|
-
bundle: bundle,
|
|
3134
|
-
options: options,
|
|
3135
|
-
product_variant_id: product_variant_id,
|
|
3136
|
-
quantity: quantity
|
|
3137
|
-
});
|
|
3138
|
-
|
|
3139
|
-
// 如果有日期信息,格式化日期到购物车
|
|
3140
|
-
if (date) {
|
|
3141
|
-
formatDateToCartItem({
|
|
3142
|
-
cartItem: cartItem,
|
|
3143
|
-
date: date
|
|
3144
|
-
});
|
|
3145
|
-
}
|
|
3146
|
-
|
|
3147
|
-
// 如果有账户信息,格式化账户到购物车
|
|
3148
|
-
if (account) {
|
|
3149
|
-
formatAccountToCartItem({
|
|
3150
|
-
cartItem: cartItem,
|
|
3151
|
-
account: account
|
|
3152
|
-
});
|
|
3153
|
-
}
|
|
3154
|
-
return cartItem;
|
|
3155
|
-
}
|
|
3156
|
-
}, {
|
|
3157
|
-
key: "checkMaxDurationCapacityForDetailNums",
|
|
3158
|
-
value: function checkMaxDurationCapacityForDetailNums(_ref13) {
|
|
3159
|
-
var _this16 = this;
|
|
3160
|
-
var product = _ref13.product,
|
|
3161
|
-
date = _ref13.date,
|
|
3162
|
-
account = _ref13.account;
|
|
3163
|
-
var cartItems = cloneDeep(this.store.cart.getItems());
|
|
3164
|
-
|
|
3165
|
-
// 将 ProductData 转换为 CartItem 但不真正添加到购物车
|
|
3166
|
-
var currentCartItem = this.convertProductToCartItem({
|
|
3167
|
-
product: product,
|
|
3168
|
-
date: date,
|
|
3169
|
-
account: account
|
|
3170
|
-
});
|
|
3171
|
-
cartItems.push(currentCartItem);
|
|
3172
|
-
if (cartItems.length === 0) return {
|
|
3173
|
-
success: true,
|
|
3174
|
-
minAvailableCount: 0
|
|
3175
|
-
};
|
|
3176
|
-
|
|
3177
|
-
// 将购物车商品分为有时间的和没有时间的
|
|
3178
|
-
var itemsWithTime = [];
|
|
3179
|
-
var itemsWithoutTime = [];
|
|
3180
|
-
// 记录每种资源类型的可用数量
|
|
3181
|
-
var availableCountsByResourceType = [];
|
|
3182
|
-
cartItems.forEach(function (cartItem) {
|
|
3183
|
-
if (cartItem.start_time && cartItem.end_time && cartItem.start_date) {
|
|
3184
|
-
itemsWithTime.push(cartItem);
|
|
3185
|
-
} else {
|
|
3186
|
-
itemsWithoutTime.push(cartItem);
|
|
3187
|
-
}
|
|
3188
|
-
});
|
|
3189
|
-
|
|
3190
|
-
// 处理没有时间的商品,为它们分配公共可用时间的第一个时间片
|
|
3191
|
-
var processedItemsWithoutTime = [];
|
|
3192
|
-
if (itemsWithoutTime.length > 0) {
|
|
3193
|
-
// 按资源类型分组处理没有时间的商品
|
|
3194
|
-
var itemsByResourceType = {};
|
|
3195
|
-
itemsWithoutTime.forEach(function (cartItem) {
|
|
3196
|
-
var _cartItem$_productOri13;
|
|
3197
|
-
if (!cartItem._productOrigin) return;
|
|
3198
|
-
var resourceTypes = ((_cartItem$_productOri13 = cartItem._productOrigin.product_resource) === null || _cartItem$_productOri13 === void 0 ? void 0 : _cartItem$_productOri13.resources) || [];
|
|
3199
|
-
resourceTypes.forEach(function (resourceType) {
|
|
3200
|
-
if (resourceType.status === 1) {
|
|
3201
|
-
var _resourceType$id2;
|
|
3202
|
-
var resourceCode = resourceType.code || ((_resourceType$id2 = resourceType.id) === null || _resourceType$id2 === void 0 ? void 0 : _resourceType$id2.toString());
|
|
3203
|
-
if (!itemsByResourceType[resourceCode]) {
|
|
3204
|
-
itemsByResourceType[resourceCode] = [];
|
|
3205
|
-
}
|
|
3206
|
-
// 避免重复添加同一个商品
|
|
3207
|
-
if (!itemsByResourceType[resourceCode].find(function (item) {
|
|
3208
|
-
return item._id === cartItem._id;
|
|
3209
|
-
})) {
|
|
3210
|
-
itemsByResourceType[resourceCode].push(cartItem);
|
|
3211
|
-
}
|
|
3212
|
-
}
|
|
3213
|
-
});
|
|
3214
|
-
});
|
|
3215
|
-
|
|
3216
|
-
// 为每种资源类型检查容量
|
|
3217
|
-
var dateRange = this.store.date.getDateRange();
|
|
3218
|
-
if (!dateRange || dateRange.length === 0) return {
|
|
3219
|
-
success: false,
|
|
3220
|
-
minAvailableCount: 0
|
|
3221
|
-
};
|
|
3222
|
-
var resourcesDates = this.store.date.getDateList();
|
|
3223
|
-
var targetResourceDate = resourcesDates.find(function (n) {
|
|
3224
|
-
return n.date === dateRange[0].date;
|
|
3225
|
-
});
|
|
3226
|
-
if (!targetResourceDate) return {
|
|
3227
|
-
success: false,
|
|
3228
|
-
minAvailableCount: 0
|
|
3229
|
-
};
|
|
3230
|
-
var resourcesMap = getResourcesMap(targetResourceDate.resource || []);
|
|
3231
|
-
|
|
3232
|
-
// 从购物车商品中获取资源类型配置,建立 resourceCode 到 form_id 的映射关系
|
|
3233
|
-
var resourceCodeToFormIdMap = {};
|
|
3234
|
-
|
|
3235
|
-
// 遍历购物车中的商品,收集所有资源类型配置
|
|
3236
|
-
Object.values(itemsByResourceType).flat().forEach(function (cartItem) {
|
|
3237
|
-
var _cartItem$_productOri14;
|
|
3238
|
-
if ((_cartItem$_productOri14 = cartItem._productOrigin) !== null && _cartItem$_productOri14 !== void 0 && (_cartItem$_productOri14 = _cartItem$_productOri14.product_resource) !== null && _cartItem$_productOri14 !== void 0 && _cartItem$_productOri14.resources) {
|
|
3239
|
-
cartItem._productOrigin.product_resource.resources.forEach(function (resourceConfig) {
|
|
3240
|
-
// 只处理启用的资源类型 (status === 1)
|
|
3241
|
-
if (resourceConfig.status === 1 && resourceConfig.code) {
|
|
3242
|
-
var _resourceConfig$id2, _resourceConfig$resou2;
|
|
3243
|
-
var formId = ((_resourceConfig$id2 = resourceConfig.id) === null || _resourceConfig$id2 === void 0 ? void 0 : _resourceConfig$id2.toString()) || ((_resourceConfig$resou2 = resourceConfig.resource_type_id) === null || _resourceConfig$resou2 === void 0 ? void 0 : _resourceConfig$resou2.toString());
|
|
3244
|
-
if (formId) {
|
|
3245
|
-
resourceCodeToFormIdMap[resourceConfig.code] = formId;
|
|
3246
|
-
}
|
|
3247
|
-
}
|
|
3248
|
-
});
|
|
3249
|
-
}
|
|
3250
|
-
});
|
|
3251
|
-
var hasCapacityIssue = false;
|
|
3252
|
-
var resourceCapacityInfo = [];
|
|
3253
|
-
|
|
3254
|
-
// 用于跟踪已处理的商品,避免重复添加
|
|
3255
|
-
var processedCartItemIds = new Set();
|
|
3256
|
-
|
|
3257
|
-
// 先检查所有资源类型,收集可用数量信息
|
|
3258
|
-
var _loop5 = function _loop5() {
|
|
3259
|
-
var _resourceTypeConfig2;
|
|
3260
|
-
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2),
|
|
3261
|
-
resourceCode = _Object$entries3$_i[0],
|
|
3262
|
-
items = _Object$entries3$_i[1];
|
|
3263
|
-
// 获取该资源类型对应的 form_id
|
|
3264
|
-
var targetFormId = resourceCodeToFormIdMap[resourceCode];
|
|
3265
|
-
if (!targetFormId) {
|
|
3266
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u627E\u4E0D\u5230\u5BF9\u5E94\u7684 form_id"));
|
|
3267
|
-
return {
|
|
3268
|
-
v: {
|
|
3269
|
-
success: false,
|
|
3270
|
-
minAvailableCount: 0
|
|
3271
|
-
}
|
|
3272
|
-
};
|
|
3273
|
-
}
|
|
3274
|
-
|
|
3275
|
-
// 获取该资源类型的所有资源
|
|
3276
|
-
var resourcesOfThisType = [];
|
|
3277
|
-
items.forEach(function (cartItem) {
|
|
3278
|
-
var productResourceIds = getResourcesIdsByProduct(cartItem._productOrigin);
|
|
3279
|
-
productResourceIds.forEach(function (resourceId) {
|
|
3280
|
-
var _resource$form_id2;
|
|
3281
|
-
var resource = resourcesMap[resourceId];
|
|
3282
|
-
if (resource && ((_resource$form_id2 = resource.form_id) === null || _resource$form_id2 === void 0 ? void 0 : _resource$form_id2.toString()) === targetFormId) {
|
|
3283
|
-
// 避免重复添加同一个资源
|
|
3284
|
-
if (!resourcesOfThisType.find(function (r) {
|
|
3285
|
-
return r.id === resource.id;
|
|
3286
|
-
})) {
|
|
3287
|
-
resourcesOfThisType.push(resource);
|
|
3288
|
-
}
|
|
3289
|
-
}
|
|
3290
|
-
});
|
|
3291
|
-
});
|
|
3292
|
-
if (resourcesOfThisType.length === 0) {
|
|
3293
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u6CA1\u6709\u627E\u5230\u53EF\u7528\u8D44\u6E90"));
|
|
3294
|
-
return {
|
|
3295
|
-
v: {
|
|
3296
|
-
success: false,
|
|
3297
|
-
minAvailableCount: 0
|
|
3298
|
-
}
|
|
3299
|
-
};
|
|
3300
|
-
}
|
|
3301
|
-
|
|
3302
|
-
// 检查资源类型(单个预约 vs 多个预约)
|
|
3303
|
-
// 从商品配置中获取资源类型信息
|
|
3304
|
-
var resourceTypeConfig = null;
|
|
3305
|
-
var _iterator4 = _createForOfIteratorHelper(items),
|
|
3306
|
-
_step4;
|
|
3307
|
-
try {
|
|
3308
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
3309
|
-
var _cartItem$_productOri15;
|
|
3310
|
-
var cartItem = _step4.value;
|
|
3311
|
-
if ((_cartItem$_productOri15 = cartItem._productOrigin) !== null && _cartItem$_productOri15 !== void 0 && (_cartItem$_productOri15 = _cartItem$_productOri15.product_resource) !== null && _cartItem$_productOri15 !== void 0 && _cartItem$_productOri15.resources) {
|
|
3312
|
-
resourceTypeConfig = cartItem._productOrigin.product_resource.resources.find(function (r) {
|
|
3313
|
-
return r.code === resourceCode && r.status === 1;
|
|
3314
|
-
});
|
|
3315
|
-
if (resourceTypeConfig) break;
|
|
3316
|
-
}
|
|
3317
|
-
}
|
|
3318
|
-
} catch (err) {
|
|
3319
|
-
_iterator4.e(err);
|
|
3320
|
-
} finally {
|
|
3321
|
-
_iterator4.f();
|
|
3322
|
-
}
|
|
3323
|
-
var isMultipleBooking = ((_resourceTypeConfig2 = resourceTypeConfig) === null || _resourceTypeConfig2 === void 0 ? void 0 : _resourceTypeConfig2.type) === 'multiple';
|
|
3324
|
-
var totalAvailable;
|
|
3325
|
-
var requiredAmount;
|
|
3326
|
-
var availableAmount;
|
|
3327
|
-
if (isMultipleBooking) {
|
|
3328
|
-
// 多个预约:计算容量
|
|
3329
|
-
totalAvailable = resourcesOfThisType.reduce(function (sum, resource) {
|
|
3330
|
-
return sum + (resource.capacity || 0);
|
|
3331
|
-
}, 0);
|
|
3332
|
-
requiredAmount = items.reduce(function (sum, cartItem) {
|
|
3333
|
-
var _getCapacityInfoByCar8 = getCapacityInfoByCartItem(cartItem),
|
|
3334
|
-
currentCapacity = _getCapacityInfoByCar8.currentCapacity;
|
|
3335
|
-
return sum + currentCapacity;
|
|
3336
|
-
}, 0);
|
|
3337
|
-
availableAmount = Math.max(0, totalAvailable - requiredAmount);
|
|
3338
|
-
} else {
|
|
3339
|
-
// 单个预约:计算资源个数
|
|
3340
|
-
totalAvailable = resourcesOfThisType.length;
|
|
3341
|
-
requiredAmount = items.reduce(function (sum, cartItem) {
|
|
3342
|
-
return sum + (cartItem.num || 1);
|
|
3343
|
-
}, 0);
|
|
3344
|
-
availableAmount = Math.max(0, totalAvailable - requiredAmount);
|
|
3345
|
-
}
|
|
3346
|
-
|
|
3347
|
-
// 记录资源容量信息
|
|
3348
|
-
resourceCapacityInfo.push({
|
|
3349
|
-
code: resourceCode,
|
|
3350
|
-
available: availableAmount,
|
|
3351
|
-
total: totalAvailable,
|
|
3352
|
-
required: requiredAmount,
|
|
3353
|
-
isMultiple: isMultipleBooking
|
|
3354
|
-
});
|
|
3355
|
-
availableCountsByResourceType.push(availableAmount);
|
|
3356
|
-
|
|
3357
|
-
// 检查是否有容量问题
|
|
3358
|
-
if (requiredAmount > totalAvailable) {
|
|
3359
|
-
hasCapacityIssue = true;
|
|
3360
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " ").concat(isMultipleBooking ? '容量' : '资源数量', "\u4E0D\u8DB3: \u9700\u8981 ").concat(requiredAmount, ", \u603B\u5171 ").concat(totalAvailable));
|
|
3361
|
-
}
|
|
3362
|
-
|
|
3363
|
-
// 为通过检测的商品分配一个公共可用时间段
|
|
3364
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u7684\u8D44\u6E90\u65F6\u95F4\u4FE1\u606F:"), resourcesOfThisType.map(function (r) {
|
|
3365
|
-
return {
|
|
3366
|
-
id: r.id,
|
|
3367
|
-
times: r.times.map(function (t) {
|
|
3368
|
-
return "".concat(t.start_at, " - ").concat(t.end_at);
|
|
3369
|
-
})
|
|
3370
|
-
};
|
|
3371
|
-
}));
|
|
3372
|
-
|
|
3373
|
-
// 找到所有资源都可用的时间段
|
|
3374
|
-
var commonTimeSlots = _this16.findCommonAvailableTimeSlots(resourcesOfThisType);
|
|
3375
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u7684\u516C\u5171\u65F6\u95F4\u6BB5:"), commonTimeSlots);
|
|
3376
|
-
if (commonTimeSlots.length === 0) {
|
|
3377
|
-
console.log("\u8D44\u6E90\u7C7B\u578B ".concat(resourceCode, " \u6CA1\u6709\u516C\u5171\u53EF\u7528\u65F6\u95F4\u6BB5"));
|
|
3378
|
-
return {
|
|
3379
|
-
v: {
|
|
3380
|
-
success: false,
|
|
3381
|
-
minAvailableCount: 0
|
|
3382
|
-
}
|
|
3383
|
-
};
|
|
3384
|
-
}
|
|
3385
|
-
|
|
3386
|
-
// 使用第一个公共可用时间段,但只处理未处理过的商品
|
|
3387
|
-
var firstCommonSlot = commonTimeSlots[0];
|
|
3388
|
-
console.log("\u4F7F\u7528\u516C\u5171\u65F6\u95F4\u6BB5: ".concat(firstCommonSlot.startTime, " - ").concat(firstCommonSlot.endTime));
|
|
3389
|
-
items.forEach(function (cartItem) {
|
|
3390
|
-
// 只处理未处理过的商品,避免重复添加
|
|
3391
|
-
if (!processedCartItemIds.has(cartItem._id)) {
|
|
3392
|
-
processedCartItemIds.add(cartItem._id);
|
|
3393
|
-
var processedItem = _objectSpread(_objectSpread({}, cartItem), {}, {
|
|
3394
|
-
start_date: dateRange[0].date,
|
|
3395
|
-
start_time: firstCommonSlot.startTime,
|
|
3396
|
-
end_time: firstCommonSlot.endTime,
|
|
3397
|
-
end_date: dateRange[0].date
|
|
3398
|
-
});
|
|
3399
|
-
processedItemsWithoutTime.push(processedItem);
|
|
3400
|
-
}
|
|
3401
|
-
});
|
|
3402
|
-
},
|
|
3403
|
-
_ret5;
|
|
3404
|
-
for (var _i3 = 0, _Object$entries3 = Object.entries(itemsByResourceType); _i3 < _Object$entries3.length; _i3++) {
|
|
3405
|
-
_ret5 = _loop5();
|
|
3406
|
-
if (_ret5) return _ret5.v;
|
|
3407
|
-
}
|
|
3408
|
-
|
|
3409
|
-
// 如果有容量问题,找出限制最严格的资源类型,返回其总容量
|
|
3410
|
-
if (hasCapacityIssue) {
|
|
3411
|
-
// 找出超出容量的资源类型中,总容量最少的那个
|
|
3412
|
-
var overCapacityResources = resourceCapacityInfo.filter(function (info) {
|
|
3413
|
-
return info.required > info.total;
|
|
3414
|
-
});
|
|
3415
|
-
if (overCapacityResources.length > 0) {
|
|
3416
|
-
var _minTotalCapacity2 = Math.min.apply(Math, _toConsumableArray(overCapacityResources.map(function (info) {
|
|
3417
|
-
return info.total;
|
|
3418
|
-
})));
|
|
3419
|
-
return {
|
|
3420
|
-
success: false,
|
|
3421
|
-
minAvailableCount: _minTotalCapacity2
|
|
3422
|
-
};
|
|
3423
|
-
}
|
|
3424
|
-
// 如果没有超出容量的(理论上不应该发生),返回总容量最少的
|
|
3425
|
-
var minTotalCapacity = Math.min.apply(Math, _toConsumableArray(resourceCapacityInfo.map(function (info) {
|
|
3426
|
-
return info.total;
|
|
3427
|
-
})));
|
|
3428
|
-
return {
|
|
3429
|
-
success: false,
|
|
3430
|
-
minAvailableCount: minTotalCapacity
|
|
3431
|
-
};
|
|
3432
|
-
}
|
|
3433
|
-
}
|
|
3434
|
-
|
|
3435
|
-
// 合并所有商品(有时间的 + 处理后的没有时间的)
|
|
3436
|
-
var allProcessedItems = [].concat(itemsWithTime, processedItemsWithoutTime);
|
|
3437
|
-
|
|
3438
|
-
// 按时间段分组检查
|
|
3439
|
-
var cartItemsByTimeSlot = {};
|
|
3440
|
-
allProcessedItems.forEach(function (cartItem) {
|
|
3441
|
-
if (!cartItem.start_time || !cartItem.end_time || !cartItem.start_date) return;
|
|
3442
|
-
var timeSlotKey = "".concat(cartItem.start_date, "_").concat(cartItem.start_time, "_").concat(cartItem.end_date || cartItem.start_date, "_").concat(cartItem.end_time);
|
|
3443
|
-
if (!cartItemsByTimeSlot[timeSlotKey]) {
|
|
3444
|
-
cartItemsByTimeSlot[timeSlotKey] = [];
|
|
3445
|
-
}
|
|
3446
|
-
cartItemsByTimeSlot[timeSlotKey].push(cartItem);
|
|
3447
|
-
});
|
|
3448
|
-
// 检查每个时间段是否有足够的资源容量
|
|
3449
|
-
var _loop6 = function _loop6() {
|
|
3450
|
-
var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i4], 2),
|
|
3451
|
-
timeSlotKey = _Object$entries4$_i[0],
|
|
3452
|
-
itemsInTimeSlot = _Object$entries4$_i[1];
|
|
3453
|
-
var _timeSlotKey$split3 = timeSlotKey.split('_'),
|
|
3454
|
-
_timeSlotKey$split4 = _slicedToArray(_timeSlotKey$split3, 4),
|
|
3455
|
-
startDate = _timeSlotKey$split4[0],
|
|
3456
|
-
startTime = _timeSlotKey$split4[1],
|
|
3457
|
-
endDate = _timeSlotKey$split4[2],
|
|
3458
|
-
endTime = _timeSlotKey$split4[3];
|
|
3459
|
-
var timeSlotStart = "".concat(startDate, " ").concat(startTime);
|
|
3460
|
-
var timeSlotEnd = "".concat(endDate, " ").concat(endTime);
|
|
3461
|
-
|
|
3462
|
-
// 获取这个时间段所有商品涉及的资源
|
|
3463
|
-
var allResourcesForTimeSlot = [];
|
|
3464
|
-
var resourcesIdSet = new Set();
|
|
3465
|
-
|
|
3466
|
-
// 获取资源数据
|
|
3467
|
-
// const dateRange = this.store.date.getDateRange();
|
|
3468
|
-
var resourcesDates = _this16.store.date.getDateList();
|
|
3469
|
-
var targetResourceDate = resourcesDates.find(function (n) {
|
|
3470
|
-
return n.date === startDate;
|
|
3471
|
-
});
|
|
3472
|
-
if (!targetResourceDate) return 0; // continue
|
|
3473
|
-
var resourcesMap = getResourcesMap(targetResourceDate.resource || []);
|
|
3474
|
-
itemsInTimeSlot.forEach(function (cartItem) {
|
|
3475
|
-
if (!cartItem._productOrigin) return;
|
|
3476
|
-
|
|
3477
|
-
// 获取商品的资源配置
|
|
3478
|
-
var productResourceIds = getResourcesIdsByProduct(cartItem._productOrigin);
|
|
3479
|
-
productResourceIds.forEach(function (resourceId) {
|
|
3480
|
-
if (resourcesMap[resourceId] && !resourcesIdSet.has(resourceId)) {
|
|
3481
|
-
resourcesIdSet.add(resourceId);
|
|
3482
|
-
allResourcesForTimeSlot.push(resourcesMap[resourceId]);
|
|
3483
|
-
}
|
|
3484
|
-
});
|
|
3485
|
-
});
|
|
3486
|
-
|
|
3487
|
-
// 按资源类型分组检查容量
|
|
3488
|
-
var _checkTimeSlotCapacit2 = checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, itemsInTimeSlot, allResourcesForTimeSlot),
|
|
3489
|
-
success = _checkTimeSlotCapacit2.success,
|
|
3490
|
-
required = _checkTimeSlotCapacit2.required,
|
|
3491
|
-
available = _checkTimeSlotCapacit2.available;
|
|
3492
|
-
if (!success) {
|
|
3493
|
-
// 如果有可用数量记录,返回最小值;否则返回 0
|
|
3494
|
-
// const minAvailableCount = availableCountsByResourceType.length > 0 ? Math.min(...availableCountsByResourceType) : 0;
|
|
3495
|
-
return {
|
|
3496
|
-
v: {
|
|
3497
|
-
success: false,
|
|
3498
|
-
minAvailableCount: available
|
|
3499
|
-
}
|
|
3500
|
-
};
|
|
3501
|
-
}
|
|
3502
|
-
},
|
|
3503
|
-
_ret6;
|
|
3504
|
-
for (var _i4 = 0, _Object$entries4 = Object.entries(cartItemsByTimeSlot); _i4 < _Object$entries4.length; _i4++) {
|
|
3505
|
-
_ret6 = _loop6();
|
|
3506
|
-
if (_ret6 === 0) continue;
|
|
3507
|
-
if (_ret6) return _ret6.v;
|
|
3054
|
+
_ret3 = _loop4();
|
|
3055
|
+
if (_ret3 === 0) continue;
|
|
3056
|
+
if (_ret3) return _ret3.v;
|
|
3508
3057
|
}
|
|
3509
3058
|
|
|
3510
3059
|
// 全部通过检测,返回成功和最小可用数量
|
|
@@ -3585,7 +3134,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3585
3134
|
}, {
|
|
3586
3135
|
key: "getResourcesByCartItemAndCode",
|
|
3587
3136
|
value: function getResourcesByCartItemAndCode(cartItemId, resourceCode) {
|
|
3588
|
-
var _cartItem$
|
|
3137
|
+
var _cartItem$_productOri13;
|
|
3589
3138
|
var dateRange = this.store.date.getDateRange();
|
|
3590
3139
|
var resources = [];
|
|
3591
3140
|
if (dateRange !== null && dateRange !== void 0 && dateRange.length) {
|
|
@@ -3608,16 +3157,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3608
3157
|
});
|
|
3609
3158
|
if (!cartItem) return [];
|
|
3610
3159
|
var selectedResources = [];
|
|
3611
|
-
var
|
|
3612
|
-
currentCapacity =
|
|
3613
|
-
formatCapacity =
|
|
3160
|
+
var _getCapacityInfoByCar8 = getCapacityInfoByCartItem(cartItem),
|
|
3161
|
+
currentCapacity = _getCapacityInfoByCar8.currentCapacity,
|
|
3162
|
+
formatCapacity = _getCapacityInfoByCar8.formatCapacity;
|
|
3614
3163
|
cartItem._origin.metadata.capacity = formatCapacity;
|
|
3615
3164
|
if (cartItem.holder_id) {
|
|
3616
3165
|
selectedResources = getOthersSelectedResources(cartItems, cartItem.holder_id, resourcesMap);
|
|
3617
3166
|
} else {
|
|
3618
3167
|
selectedResources = getOthersCartSelectedResources(cartItems, cartItem._id, resourcesMap);
|
|
3619
3168
|
}
|
|
3620
|
-
var productResources = getResourcesByProduct(resourcesMap, ((_cartItem$
|
|
3169
|
+
var productResources = getResourcesByProduct(resourcesMap, ((_cartItem$_productOri13 = cartItem._productOrigin) === null || _cartItem$_productOri13 === void 0 || (_cartItem$_productOri13 = _cartItem$_productOri13.product_resource) === null || _cartItem$_productOri13 === void 0 ? void 0 : _cartItem$_productOri13.resources) || [], selectedResources, currentCapacity);
|
|
3621
3170
|
var targetResource = productResources.find(function (resource) {
|
|
3622
3171
|
return resource.code === resourceCode;
|
|
3623
3172
|
});
|
|
@@ -3640,7 +3189,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3640
3189
|
});
|
|
3641
3190
|
if (mTimes.length === 0) return false;
|
|
3642
3191
|
var canUseArr = mTimes.map(function (item) {
|
|
3643
|
-
var _cartItem$
|
|
3192
|
+
var _cartItem$_productOri14;
|
|
3644
3193
|
var res = getIsUsableByTimeItem({
|
|
3645
3194
|
timeSlice: {
|
|
3646
3195
|
start_time: startTime.format('HH:mm'),
|
|
@@ -3652,7 +3201,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3652
3201
|
resource: m,
|
|
3653
3202
|
currentCount: currentCapacity || 0,
|
|
3654
3203
|
resourcesUseableMap: resourcesUseableMap,
|
|
3655
|
-
cut_off_time: (_cartItem$
|
|
3204
|
+
cut_off_time: (_cartItem$_productOri14 = cartItem._productOrigin) === null || _cartItem$_productOri14 === void 0 ? void 0 : _cartItem$_productOri14.cut_off_time
|
|
3656
3205
|
});
|
|
3657
3206
|
if ((resourcesUseableMap === null || resourcesUseableMap === void 0 ? void 0 : resourcesUseableMap[m.id]) !== false && res.reason !== 'capacityOnly') {
|
|
3658
3207
|
resourcesUseableMap[m.id] = res.usable;
|
|
@@ -3666,12 +3215,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3666
3215
|
});
|
|
3667
3216
|
} else {
|
|
3668
3217
|
targetResource.renderList = targetResource.renderList.filter(function (n) {
|
|
3669
|
-
var _cartItem$
|
|
3218
|
+
var _cartItem$_productOri15;
|
|
3670
3219
|
var recordCount = n.capacity || 0;
|
|
3671
3220
|
if (n.onlyComputed) return false;
|
|
3672
3221
|
var timeSlots = getTimeSlicesByResource({
|
|
3673
3222
|
resource: n,
|
|
3674
|
-
duration: ((_cartItem$
|
|
3223
|
+
duration: ((_cartItem$_productOri15 = cartItem._productOrigin) === null || _cartItem$_productOri15 === void 0 || (_cartItem$_productOri15 = _cartItem$_productOri15.duration) === null || _cartItem$_productOri15 === void 0 ? void 0 : _cartItem$_productOri15.value) || 10,
|
|
3675
3224
|
split: 10,
|
|
3676
3225
|
currentDate: dateRange[0].date
|
|
3677
3226
|
});
|
|
@@ -3689,12 +3238,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3689
3238
|
}, {
|
|
3690
3239
|
key: "getTimeslotsScheduleByDateRange",
|
|
3691
3240
|
value: (function () {
|
|
3692
|
-
var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(
|
|
3693
|
-
var startDate, endDate, scheduleIds, resources, dates, currentDate, end, results,
|
|
3241
|
+
var _getTimeslotsScheduleByDateRange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(_ref11) {
|
|
3242
|
+
var startDate, endDate, scheduleIds, resources, dates, currentDate, end, results, _i3, _dates, date;
|
|
3694
3243
|
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
3695
3244
|
while (1) switch (_context26.prev = _context26.next) {
|
|
3696
3245
|
case 0:
|
|
3697
|
-
startDate =
|
|
3246
|
+
startDate = _ref11.startDate, endDate = _ref11.endDate, scheduleIds = _ref11.scheduleIds, resources = _ref11.resources;
|
|
3698
3247
|
console.log('appoimentBooking-session-date-getTimeslotsScheduleByDateRange', {
|
|
3699
3248
|
startDate: startDate,
|
|
3700
3249
|
endDate: endDate,
|
|
@@ -3711,8 +3260,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3711
3260
|
}
|
|
3712
3261
|
// 如果不支持 Web Worker,使用同步方式处理
|
|
3713
3262
|
results = {};
|
|
3714
|
-
for (
|
|
3715
|
-
date = _dates[
|
|
3263
|
+
for (_i3 = 0, _dates = dates; _i3 < _dates.length; _i3++) {
|
|
3264
|
+
date = _dates[_i3];
|
|
3716
3265
|
results[date] = this.getTimeslotBySchedule({
|
|
3717
3266
|
date: date,
|
|
3718
3267
|
scheduleIds: scheduleIds,
|
|
@@ -3753,7 +3302,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3753
3302
|
openResources,
|
|
3754
3303
|
allProductResources,
|
|
3755
3304
|
targetSchedules,
|
|
3756
|
-
|
|
3305
|
+
_loop5,
|
|
3757
3306
|
_args28 = arguments;
|
|
3758
3307
|
return _regeneratorRuntime().wrap(function _callee27$(_context28) {
|
|
3759
3308
|
while (1) switch (_context28.prev = _context28.next) {
|
|
@@ -3830,9 +3379,9 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3830
3379
|
}
|
|
3831
3380
|
});
|
|
3832
3381
|
targetSchedules = this.store.schedule.getScheduleListByIds(tempProducts['schedule.ids']);
|
|
3833
|
-
|
|
3382
|
+
_loop5 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop5() {
|
|
3834
3383
|
var currentDateStr, status, _checkSessionProductL, latestStartDate, earliestEndDate, scheduleByDate, minTimeMaxTime, scheduleTimeSlots, timesSlotCanUse;
|
|
3835
|
-
return _regeneratorRuntime().wrap(function
|
|
3384
|
+
return _regeneratorRuntime().wrap(function _loop5$(_context27) {
|
|
3836
3385
|
while (1) switch (_context27.prev = _context27.next) {
|
|
3837
3386
|
case 0:
|
|
3838
3387
|
currentDateStr = currentDate.format('YYYY-MM-DD');
|
|
@@ -3935,14 +3484,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3935
3484
|
case "end":
|
|
3936
3485
|
return _context27.stop();
|
|
3937
3486
|
}
|
|
3938
|
-
},
|
|
3487
|
+
}, _loop5);
|
|
3939
3488
|
});
|
|
3940
3489
|
case 28:
|
|
3941
3490
|
if (!(dayjs(currentDate).isBefore(dayjs(endDate), 'day') || dayjs(currentDate).isSame(dayjs(endDate), 'day'))) {
|
|
3942
3491
|
_context28.next = 34;
|
|
3943
3492
|
break;
|
|
3944
3493
|
}
|
|
3945
|
-
return _context28.delegateYield(
|
|
3494
|
+
return _context28.delegateYield(_loop5(), "t0", 30);
|
|
3946
3495
|
case 30:
|
|
3947
3496
|
if (!_context28.t0) {
|
|
3948
3497
|
_context28.next = 32;
|