@pisell/pisellos 3.0.66 → 3.0.67
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/modules/ProductList/index.js +10 -2
- package/dist/solution/BookingByStep/index.d.ts +16 -0
- package/dist/solution/BookingByStep/index.js +505 -62
- package/dist/solution/BookingByStep/utils/capacity.d.ts +7 -2
- package/dist/solution/BookingByStep/utils/capacity.js +24 -8
- package/dist/solution/ShopDiscount/index.js +27 -9
- package/lib/modules/ProductList/index.js +9 -1
- package/lib/solution/BookingByStep/index.d.ts +16 -0
- package/lib/solution/BookingByStep/index.js +316 -44
- package/lib/solution/BookingByStep/utils/capacity.d.ts +7 -2
- package/lib/solution/BookingByStep/utils/capacity.js +21 -8
- package/lib/solution/ShopDiscount/index.js +9 -0
- package/package.json +1 -1
|
@@ -68,12 +68,12 @@ var formatDefaultCapacitys = ({
|
|
|
68
68
|
}
|
|
69
69
|
return [{ id: 0, value: 1, name: "" }];
|
|
70
70
|
};
|
|
71
|
-
var getSumCapacity = ({ capacity }) => {
|
|
71
|
+
var getSumCapacity = ({ capacity, num = 1 }) => {
|
|
72
72
|
let sum = 0;
|
|
73
73
|
for (let item of capacity || []) {
|
|
74
74
|
sum += item.value;
|
|
75
75
|
}
|
|
76
|
-
return sum;
|
|
76
|
+
return sum * num;
|
|
77
77
|
};
|
|
78
78
|
function getCapacityInfoByCartItem(targetCartItem) {
|
|
79
79
|
var _a;
|
|
@@ -81,7 +81,7 @@ function getCapacityInfoByCartItem(targetCartItem) {
|
|
|
81
81
|
capacity: (_a = targetCartItem._productOrigin) == null ? void 0 : _a.capacity,
|
|
82
82
|
product_bundle: targetCartItem._origin.product.product_bundle
|
|
83
83
|
});
|
|
84
|
-
const currentCapacity = getSumCapacity({ capacity: formatCapacity });
|
|
84
|
+
const currentCapacity = getSumCapacity({ capacity: formatCapacity, num: (targetCartItem == null ? void 0 : targetCartItem.num) || 1 });
|
|
85
85
|
return {
|
|
86
86
|
formatCapacity,
|
|
87
87
|
currentCapacity
|
|
@@ -194,7 +194,7 @@ function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, allResourc
|
|
|
194
194
|
);
|
|
195
195
|
if (needsThisResourceType) {
|
|
196
196
|
if (selectType === "single") {
|
|
197
|
-
requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + 1;
|
|
197
|
+
requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + ((cartItem == null ? void 0 : cartItem.num) || 1);
|
|
198
198
|
} else {
|
|
199
199
|
requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + currentCapacity;
|
|
200
200
|
}
|
|
@@ -238,13 +238,18 @@ function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, allResourc
|
|
|
238
238
|
console.log(`capacity.ts - 资源类型 ${formId} 多个预约检查: 总容量 ${totalAvailableCapacity}, 需求 ${requiredCapacity}`);
|
|
239
239
|
if (totalAvailableCapacity < requiredCapacity) {
|
|
240
240
|
console.log(`资源类型 ${formId} 容量不足: 需要 ${requiredCapacity}, 可用 ${totalAvailableCapacity}`);
|
|
241
|
-
return
|
|
241
|
+
return {
|
|
242
|
+
success: false,
|
|
243
|
+
required: requiredCapacity,
|
|
244
|
+
available: totalAvailableCapacity
|
|
245
|
+
};
|
|
242
246
|
}
|
|
243
247
|
} else {
|
|
244
248
|
let availableResourceCount = 0;
|
|
245
249
|
resourcesInType.forEach((resource) => {
|
|
246
250
|
const availableTimes = resource.times.filter((time) => {
|
|
247
|
-
|
|
251
|
+
var _a2;
|
|
252
|
+
return !(0, import_dayjs.default)(time.start_at).isAfter((0, import_dayjs.default)(timeSlotStart), "minute") && !(0, import_dayjs.default)(time.end_at).isBefore((0, import_dayjs.default)(timeSlotEnd), "minute") || (0, import_dayjs.default)(time.start_at).isBefore((0, import_dayjs.default)(timeSlotEnd), "minute") && (0, import_dayjs.default)(time.end_at).isAfter((0, import_dayjs.default)(timeSlotStart), "minute") && ((_a2 = time.event_list) == null ? void 0 : _a2.length) === 0;
|
|
248
253
|
});
|
|
249
254
|
if (availableTimes.length > 0) {
|
|
250
255
|
availableResourceCount++;
|
|
@@ -253,11 +258,19 @@ function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, allResourc
|
|
|
253
258
|
console.log(`capacity.ts - 资源类型 ${formId} 单个预约检查: 可用资源数 ${availableResourceCount}, 需求 ${requiredCapacity}`);
|
|
254
259
|
if (availableResourceCount < requiredCapacity) {
|
|
255
260
|
console.log(`资源类型 ${formId} 数量不足: 需要 ${requiredCapacity}, 可用 ${availableResourceCount}`);
|
|
256
|
-
return
|
|
261
|
+
return {
|
|
262
|
+
success: false,
|
|
263
|
+
required: requiredCapacity,
|
|
264
|
+
available: availableResourceCount
|
|
265
|
+
};
|
|
257
266
|
}
|
|
258
267
|
}
|
|
259
268
|
}
|
|
260
|
-
return
|
|
269
|
+
return {
|
|
270
|
+
success: true,
|
|
271
|
+
required: 0,
|
|
272
|
+
available: 0
|
|
273
|
+
};
|
|
261
274
|
}
|
|
262
275
|
// Annotate the CommonJS export names for ESM import in node:
|
|
263
276
|
0 && (module.exports = {
|
|
@@ -225,6 +225,15 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
225
225
|
isScan: true
|
|
226
226
|
};
|
|
227
227
|
});
|
|
228
|
+
const currentSelectedDiscountList = this.getDiscountList().filter((n) => n.isSelected);
|
|
229
|
+
if (currentSelectedDiscountList.length && currentSelectedDiscountList.some((n) => withScanList.some((m) => m.id === n.id))) {
|
|
230
|
+
return {
|
|
231
|
+
type: "clientCalc",
|
|
232
|
+
isAvailable: true,
|
|
233
|
+
productList: this.store.productList || [],
|
|
234
|
+
discountList: this.getDiscountList()
|
|
235
|
+
};
|
|
236
|
+
}
|
|
228
237
|
const {
|
|
229
238
|
productList: newProductList,
|
|
230
239
|
discountList: newDiscountList,
|