@pisell/pisellos 0.0.178 → 0.0.180
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/Cart/utils/cartProduct.d.ts +1 -0
- package/dist/modules/Cart/utils/cartProduct.js +5 -12
- package/dist/solution/BookingByStep/index.js +2 -2
- package/lib/modules/Cart/utils/cartProduct.d.ts +1 -0
- package/lib/modules/Cart/utils/cartProduct.js +4 -3
- package/lib/solution/BookingByStep/index.js +3 -2
- package/package.json +1 -1
|
@@ -71,7 +71,8 @@ export var formatProductToCartItem = function formatProductToCartItem(params) {
|
|
|
71
71
|
product: product,
|
|
72
72
|
bundle: bundle,
|
|
73
73
|
options: options,
|
|
74
|
-
num: num
|
|
74
|
+
num: num,
|
|
75
|
+
discounts: discounts
|
|
75
76
|
});
|
|
76
77
|
cartItem.image = product === null || product === void 0 ? void 0 : product.cover;
|
|
77
78
|
cartItem.like_status = 'common';
|
|
@@ -206,19 +207,11 @@ export var getProductTotalPrice = function getProductTotalPrice(params) {
|
|
|
206
207
|
export var getProductOriginTotalPrice = function getProductOriginTotalPrice(params) {
|
|
207
208
|
var product = params.product,
|
|
208
209
|
bundle = params.bundle,
|
|
209
|
-
options = params.options
|
|
210
|
+
options = params.options,
|
|
211
|
+
discounts = params.discounts;
|
|
210
212
|
var num = (params === null || params === void 0 ? void 0 : params.num) || 1;
|
|
211
213
|
var price = Number(product.original_price);
|
|
212
|
-
|
|
213
|
-
// if (product.discount_list?.length) {
|
|
214
|
-
// price = product.discount_list.reduce((accumulator: any, currentValue: any) => {
|
|
215
|
-
// return (
|
|
216
|
-
// accumulator + Number(currentValue.price) * Number(currentValue.num)
|
|
217
|
-
// );
|
|
218
|
-
// }, price);
|
|
219
|
-
// }
|
|
220
|
-
|
|
221
|
-
if (isNaN(price) || price === 0) {
|
|
214
|
+
if ((isNaN(price) || price === 0) && !(discounts !== null && discounts !== void 0 && discounts.length)) {
|
|
222
215
|
return undefined;
|
|
223
216
|
}
|
|
224
217
|
if (bundle !== null && bundle !== void 0 && bundle.length) {
|
|
@@ -1295,7 +1295,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1295
1295
|
var originResource = allOriginResources.find(function (n) {
|
|
1296
1296
|
return n.id === targetRes.id;
|
|
1297
1297
|
});
|
|
1298
|
-
var canUse = checkResourceCanUseByCapacity(currentResourcesCapacityMap[m.id], currentCapacity, originResource === null || originResource === void 0 ? void 0 : originResource.capacity);
|
|
1298
|
+
var canUse = checkResourceCanUseByCapacity(currentResourcesCapacityMap[m.id] || 0, currentCapacity, originResource === null || originResource === void 0 ? void 0 : originResource.capacity);
|
|
1299
1299
|
if (canUse) currentResourcesCapacityMap[m.id] += currentCapacity;
|
|
1300
1300
|
return !canUse;
|
|
1301
1301
|
}
|
|
@@ -1425,7 +1425,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1425
1425
|
var resources = [];
|
|
1426
1426
|
if (dateRange !== null && dateRange !== void 0 && dateRange.length) {
|
|
1427
1427
|
dateRange.forEach(function (n) {
|
|
1428
|
-
resources.push.apply(resources, _toConsumableArray(
|
|
1428
|
+
if (n.resource) resources.push.apply(resources, _toConsumableArray(n.resource));
|
|
1429
1429
|
});
|
|
1430
1430
|
}
|
|
1431
1431
|
var cartItems = this.store.cart.getItems().filter(function (n) {
|
|
@@ -82,7 +82,8 @@ var formatProductToCartItem = (params) => {
|
|
|
82
82
|
product,
|
|
83
83
|
bundle,
|
|
84
84
|
options,
|
|
85
|
-
num
|
|
85
|
+
num,
|
|
86
|
+
discounts
|
|
86
87
|
});
|
|
87
88
|
cartItem.image = product == null ? void 0 : product.cover;
|
|
88
89
|
cartItem.like_status = "common";
|
|
@@ -189,10 +190,10 @@ var getProductTotalPrice = (params) => {
|
|
|
189
190
|
return price;
|
|
190
191
|
};
|
|
191
192
|
var getProductOriginTotalPrice = (params) => {
|
|
192
|
-
const { product, bundle, options } = params;
|
|
193
|
+
const { product, bundle, options, discounts } = params;
|
|
193
194
|
const num = (params == null ? void 0 : params.num) || 1;
|
|
194
195
|
let price = Number(product.original_price);
|
|
195
|
-
if (isNaN(price) || price === 0) {
|
|
196
|
+
if ((isNaN(price) || price === 0) && !(discounts == null ? void 0 : discounts.length)) {
|
|
196
197
|
return void 0;
|
|
197
198
|
}
|
|
198
199
|
if (bundle == null ? void 0 : bundle.length) {
|
|
@@ -719,7 +719,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
719
719
|
(n) => n.id === targetRes.id
|
|
720
720
|
);
|
|
721
721
|
const canUse = (0, import_capacity.checkResourceCanUseByCapacity)(
|
|
722
|
-
currentResourcesCapacityMap[m.id],
|
|
722
|
+
currentResourcesCapacityMap[m.id] || 0,
|
|
723
723
|
currentCapacity,
|
|
724
724
|
originResource == null ? void 0 : originResource.capacity
|
|
725
725
|
);
|
|
@@ -825,7 +825,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
825
825
|
const resources = [];
|
|
826
826
|
if (dateRange == null ? void 0 : dateRange.length) {
|
|
827
827
|
dateRange.forEach((n) => {
|
|
828
|
-
|
|
828
|
+
if (n.resource)
|
|
829
|
+
resources.push(...n.resource);
|
|
829
830
|
});
|
|
830
831
|
}
|
|
831
832
|
const cartItems = this.store.cart.getItems().filter((n) => !(0, import_utils4.isNormalProduct)(n._productOrigin));
|