@pisell/pisellos 3.0.66 → 3.0.68
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
|
@@ -47,8 +47,9 @@ var formatDefaultCapacitys = ({
|
|
|
47
47
|
if ((capacity == null ? void 0 : capacity.type) === "package") {
|
|
48
48
|
return (product_bundle || []).map((d) => {
|
|
49
49
|
const id = d.bundle_product_id;
|
|
50
|
+
const variantId = d.bundle_variant_id;
|
|
50
51
|
const item = ((capacity == null ? void 0 : capacity.package) || []).find(
|
|
51
|
-
(item2) => item2.product_id === id
|
|
52
|
+
(item2) => item2.product_id === id || item2.product_id === variantId
|
|
52
53
|
);
|
|
53
54
|
return {
|
|
54
55
|
id,
|
|
@@ -68,12 +69,12 @@ var formatDefaultCapacitys = ({
|
|
|
68
69
|
}
|
|
69
70
|
return [{ id: 0, value: 1, name: "" }];
|
|
70
71
|
};
|
|
71
|
-
var getSumCapacity = ({ capacity }) => {
|
|
72
|
+
var getSumCapacity = ({ capacity, num = 1 }) => {
|
|
72
73
|
let sum = 0;
|
|
73
74
|
for (let item of capacity || []) {
|
|
74
75
|
sum += item.value;
|
|
75
76
|
}
|
|
76
|
-
return sum;
|
|
77
|
+
return sum * num;
|
|
77
78
|
};
|
|
78
79
|
function getCapacityInfoByCartItem(targetCartItem) {
|
|
79
80
|
var _a;
|
|
@@ -81,7 +82,7 @@ function getCapacityInfoByCartItem(targetCartItem) {
|
|
|
81
82
|
capacity: (_a = targetCartItem._productOrigin) == null ? void 0 : _a.capacity,
|
|
82
83
|
product_bundle: targetCartItem._origin.product.product_bundle
|
|
83
84
|
});
|
|
84
|
-
const currentCapacity = getSumCapacity({ capacity: formatCapacity });
|
|
85
|
+
const currentCapacity = getSumCapacity({ capacity: formatCapacity, num: (targetCartItem == null ? void 0 : targetCartItem.num) || 1 });
|
|
85
86
|
return {
|
|
86
87
|
formatCapacity,
|
|
87
88
|
currentCapacity
|
|
@@ -194,7 +195,7 @@ function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, allResourc
|
|
|
194
195
|
);
|
|
195
196
|
if (needsThisResourceType) {
|
|
196
197
|
if (selectType === "single") {
|
|
197
|
-
requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + 1;
|
|
198
|
+
requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + ((cartItem == null ? void 0 : cartItem.num) || 1);
|
|
198
199
|
} else {
|
|
199
200
|
requiredCapacityByType[formId] = (requiredCapacityByType[formId] || 0) + currentCapacity;
|
|
200
201
|
}
|
|
@@ -238,7 +239,11 @@ function checkTimeSlotCapacity(timeSlotStart, timeSlotEnd, cartItems, allResourc
|
|
|
238
239
|
console.log(`capacity.ts - 资源类型 ${formId} 多个预约检查: 总容量 ${totalAvailableCapacity}, 需求 ${requiredCapacity}`);
|
|
239
240
|
if (totalAvailableCapacity < requiredCapacity) {
|
|
240
241
|
console.log(`资源类型 ${formId} 容量不足: 需要 ${requiredCapacity}, 可用 ${totalAvailableCapacity}`);
|
|
241
|
-
return
|
|
242
|
+
return {
|
|
243
|
+
success: false,
|
|
244
|
+
required: requiredCapacity,
|
|
245
|
+
available: totalAvailableCapacity
|
|
246
|
+
};
|
|
242
247
|
}
|
|
243
248
|
} else {
|
|
244
249
|
let availableResourceCount = 0;
|
|
@@ -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,
|