@lancom/shared 0.0.396 → 0.0.397
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/components/products_kit/products_kit/products_kit_cart/products-kit-cart.scss +2 -2
- package/components/products_kit/products_kit/products_kit_cart/products-kit-cart.vue +13 -13
- package/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_color/products-kit-option-color.scss +15 -0
- package/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_products/products-kit-option-products.vue +26 -0
- package/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_products/products_kit_option_product/products-kit-option-product.scss +38 -4
- package/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_products/products_kit_option_product/products-kit-option-product.vue +3 -2
- package/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_size/products-kit-option-size.scss +14 -0
- package/components/quotes/quote_view/quote_product_color_simple_products/quote_product_color_simple_product/quote-product-color-simple-product.vue +3 -1
- package/mixins/product-preview.js +4 -0
- package/package.json +1 -1
- package/store/productsKit.js +10 -6
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="ProductsKitCart__wrapper">
|
|
3
3
|
<div class="ProductsKitCart__products">
|
|
4
|
-
<products-kit-cart-options :
|
|
5
|
-
<div class="ProductsKitCart__qty">
|
|
6
|
-
<number-input
|
|
7
|
-
v-model="kitQty"
|
|
8
|
-
:disabled="addingToCart || !isAllOptionsSelected" />
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
11
|
-
<div class="ProductsKitCart__info">
|
|
4
|
+
<products-kit-cart-options :products-kit="productsKit" />
|
|
12
5
|
<div
|
|
13
6
|
v-if="isAllOptionsSelected"
|
|
14
7
|
class="ProductsKitCart__price">
|
|
15
8
|
{{ totalPrice | price }}
|
|
16
9
|
</div>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="ProductsKitCart__info">
|
|
12
|
+
<div class="ProductsKitCart__qty">
|
|
13
|
+
<number-input
|
|
14
|
+
v-model="kitQty"
|
|
15
|
+
:disabled="addingToCart || !isAllOptionsSelected" />
|
|
16
|
+
</div>
|
|
17
17
|
<div>
|
|
18
18
|
<btn
|
|
19
|
-
:btn-disabled="addingToCart || !isAllOptionsSelected"
|
|
19
|
+
:btn-disabled="addingToCart || !isAllOptionsSelected || !kitQty"
|
|
20
20
|
btn-class="green"
|
|
21
|
-
btn-label="ADD TO CART"
|
|
22
|
-
@onclick="proceedToCard()"/>
|
|
21
|
+
btn-label="ADD TO CART"
|
|
22
|
+
@onclick="proceedToCard()" />
|
|
23
23
|
</div>
|
|
24
24
|
</div>
|
|
25
25
|
</div>
|
|
@@ -109,10 +109,10 @@ export default {
|
|
|
109
109
|
};
|
|
110
110
|
await this.addToCart(data);
|
|
111
111
|
this.$toastr.s('Products Kit successfully added to cart');
|
|
112
|
-
this.kitQty =
|
|
112
|
+
this.kitQty = 0;
|
|
113
113
|
this.clearOptions();
|
|
114
114
|
this.clearProductsKitPricing();
|
|
115
|
-
} catch (e) {
|
|
115
|
+
} catch (e) {
|
|
116
116
|
console.log(e);
|
|
117
117
|
} finally {
|
|
118
118
|
this.addingToCart = false;
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
13
|
<script>
|
|
14
|
+
import { mapGetters, mapActions } from 'vuex';
|
|
14
15
|
import ProductsKitOptionProduct from './products_kit_option_product/products-kit-option-product';
|
|
15
16
|
|
|
16
17
|
export default {
|
|
@@ -27,6 +28,31 @@ export default {
|
|
|
27
28
|
type: Object,
|
|
28
29
|
required: true
|
|
29
30
|
}
|
|
31
|
+
},
|
|
32
|
+
computed: {
|
|
33
|
+
...mapGetters([
|
|
34
|
+
'country',
|
|
35
|
+
'currency',
|
|
36
|
+
'stockCountry'
|
|
37
|
+
])
|
|
38
|
+
},
|
|
39
|
+
mounted() {
|
|
40
|
+
if (this.option.required && this.option.products?.length === 1) {
|
|
41
|
+
this.selectProduct(this.option.products[0]);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
methods: {
|
|
45
|
+
...mapActions('productsKit', ['selectOptionProduct']),
|
|
46
|
+
selectProduct(product) {
|
|
47
|
+
const params = {
|
|
48
|
+
country: this.country?._id,
|
|
49
|
+
currency: this.currency?._id,
|
|
50
|
+
stockCountry: this.stockCountry?._id,
|
|
51
|
+
option: this.option,
|
|
52
|
+
product
|
|
53
|
+
};
|
|
54
|
+
this.selectOptionProduct(params);
|
|
55
|
+
}
|
|
30
56
|
}
|
|
31
57
|
};
|
|
32
58
|
</script>
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
&__preview {
|
|
11
|
-
width:
|
|
12
|
-
height:
|
|
13
|
-
margin:
|
|
11
|
+
width: 175px;
|
|
12
|
+
height: 290px;
|
|
13
|
+
margin: 7px;
|
|
14
14
|
position: relative;
|
|
15
15
|
z-index: 1;
|
|
16
16
|
&--without-price {
|
|
17
|
-
height:
|
|
17
|
+
height: 340px;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
&__select {
|
|
@@ -38,4 +38,38 @@
|
|
|
38
38
|
font-weight: bold;
|
|
39
39
|
z-index: 2;
|
|
40
40
|
}
|
|
41
|
+
}
|
|
42
|
+
::v-deep {
|
|
43
|
+
.ProductPreview {
|
|
44
|
+
&__link {
|
|
45
|
+
height: 175px;
|
|
46
|
+
&-cover,
|
|
47
|
+
&-cover-hover {
|
|
48
|
+
height: 175px;
|
|
49
|
+
top: 10px;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
&__sku {
|
|
53
|
+
font-size: 13px;
|
|
54
|
+
}
|
|
55
|
+
&__name {
|
|
56
|
+
font-size: 15px;
|
|
57
|
+
line-height: 20px;
|
|
58
|
+
margin-top: 1px;
|
|
59
|
+
min-height: 35px;
|
|
60
|
+
}
|
|
61
|
+
&__prices-printed-price {
|
|
62
|
+
font-size: 16px;
|
|
63
|
+
line-height: 20px;
|
|
64
|
+
}
|
|
65
|
+
&__slogan-item {
|
|
66
|
+
span {
|
|
67
|
+
padding: 2px 3px;
|
|
68
|
+
font-size: 8px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
&__content {
|
|
72
|
+
padding: 10px 10px 0px 10px;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
41
75
|
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
ref="preview"
|
|
14
14
|
:product="product"
|
|
15
15
|
:to-editor="false"
|
|
16
|
+
:visible-color-thumbs="false"
|
|
16
17
|
:visible-prices="!option.required"
|
|
17
18
|
@preview="onPreviewProduct($event)"
|
|
18
19
|
@color="onProductSelectColor($event)" />
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
:btn-block="true"
|
|
23
24
|
@onclick="selectProduct"
|
|
24
25
|
:btn-class="isSelectedProduct ? 'green' : 'gray'"
|
|
25
|
-
btn-label="SELECT" />
|
|
26
|
+
:btn-label="isSelectedProduct ? 'DESELECT' : 'SELECT'" />
|
|
26
27
|
<div
|
|
27
28
|
v-if="isSelectedProduct"
|
|
28
29
|
class="ProductsKitOptionProduct__config mt-5">
|
|
@@ -129,7 +130,7 @@ export default {
|
|
|
129
130
|
currency: this.currency?._id,
|
|
130
131
|
stockCountry: this.stockCountry?._id,
|
|
131
132
|
option: this.option,
|
|
132
|
-
product: this.product
|
|
133
|
+
product: this.isSelectedProduct ? null : this.product
|
|
133
134
|
};
|
|
134
135
|
this.selectOptionProduct(params);
|
|
135
136
|
},
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
class="form-field centered QuoteProductColorSimpleProduct__field"
|
|
16
16
|
:class="{
|
|
17
17
|
empty: !model,
|
|
18
|
-
error: model > simpleProduct.quantityStock
|
|
18
|
+
error: model > simpleProduct.quantityStock && !quote.ignoreStockAvailability
|
|
19
19
|
}"
|
|
20
20
|
@wheel="onWheel"
|
|
21
21
|
@change="onChange()" />
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
</template>
|
|
37
37
|
|
|
38
38
|
<script>
|
|
39
|
+
import { mapGetters } from 'vuex';
|
|
39
40
|
import confirm from '@lancom/shared/mixins/confirm';
|
|
40
41
|
import { inRange, price } from '@lancom/shared/assets/js/utils/filters';
|
|
41
42
|
|
|
@@ -52,6 +53,7 @@ export default {
|
|
|
52
53
|
}
|
|
53
54
|
},
|
|
54
55
|
computed: {
|
|
56
|
+
...mapGetters('quote', ['quote']),
|
|
55
57
|
model: {
|
|
56
58
|
get() {
|
|
57
59
|
return this.simpleProduct.amount;
|
package/package.json
CHANGED
package/store/productsKit.js
CHANGED
|
@@ -5,7 +5,7 @@ import { generateGUID } from '@lancom/shared/assets/js/utils/guid';
|
|
|
5
5
|
import Vue from 'vue';
|
|
6
6
|
|
|
7
7
|
export const state = () => ({
|
|
8
|
-
amount:
|
|
8
|
+
amount: 0,
|
|
9
9
|
productsKit: null,
|
|
10
10
|
loadError: null,
|
|
11
11
|
selectedOptionsProducts: {},
|
|
@@ -39,10 +39,14 @@ export const getters = {
|
|
|
39
39
|
selectedOptionsSimpleProducts: ({ selectedOptionsSimpleProducts }) => selectedOptionsSimpleProducts,
|
|
40
40
|
selectedOptionsColors: ({ selectedOptionsColors }) => selectedOptionsColors,
|
|
41
41
|
selectedOptionsSizes: ({ selectedOptionsSizes }) => selectedOptionsSizes,
|
|
42
|
-
isAllOptionsSelected: ({ productsKit,
|
|
43
|
-
const selectedSimpleProducts = getSelectedSimpleProducts(selectedOptionsSimpleProducts, selectedOptionsColors, selectedOptionsSizes);
|
|
42
|
+
isAllOptionsSelected: ({ productsKit, selectedOptionsColors, selectedOptionsSizes, selectedOptionsProducts }) => {
|
|
44
43
|
const requiredOptions = productsKit.productsKitOptions?.filter(pk => pk.required) || [];
|
|
45
|
-
|
|
44
|
+
const isAllRequieredSelected = requiredOptions.every(o => !!selectedOptionsProducts[o._id] && !!selectedOptionsColors[o._id] && !!selectedOptionsSizes[o._id]);
|
|
45
|
+
|
|
46
|
+
const selectedNotRequiredOptions = productsKit.productsKitOptions?.filter(pk => !pk.required && selectedOptionsProducts[pk._id]) || [];
|
|
47
|
+
const isAllNotRequieredSelected = selectedNotRequiredOptions.every(o => !!selectedOptionsColors[o._id] && !!selectedOptionsSizes[o._id]);
|
|
48
|
+
|
|
49
|
+
return isAllRequieredSelected && isAllNotRequieredSelected;
|
|
46
50
|
},
|
|
47
51
|
selectedSimpleProducts: ({ selectedOptionsSimpleProducts, selectedOptionsColors, selectedOptionsSizes }) => getSelectedSimpleProducts(selectedOptionsSimpleProducts, selectedOptionsColors, selectedOptionsSizes),
|
|
48
52
|
maxOrderQty: ({ selectedOptionsSimpleProducts, selectedOptionsColors, selectedOptionsSizes }) => {
|
|
@@ -93,7 +97,7 @@ export const actions = {
|
|
|
93
97
|
},
|
|
94
98
|
async selectOptionProduct({ commit }, { option, product, country, currency, stockCountry }) {
|
|
95
99
|
const params = { country, currency, stockCountry };
|
|
96
|
-
const simpleProducts = await api.fetchProductDetails(null, product.alias, params);
|
|
100
|
+
const simpleProducts = product ? (await api.fetchProductDetails(null, product.alias, params)) : [];
|
|
97
101
|
|
|
98
102
|
commit('setSelectedOptionProduct', { option, product });
|
|
99
103
|
commit('setSelectedOptionSimpleProducts', { option, simpleProducts });
|
|
@@ -137,7 +141,7 @@ export const actions = {
|
|
|
137
141
|
commit('setCalculatingPrice', false);
|
|
138
142
|
},
|
|
139
143
|
updateAmount({ getters, commit }, amount) {
|
|
140
|
-
const value = Math.min(getters.maxOrderQty, Math.max(amount,
|
|
144
|
+
const value = Math.min(getters.maxOrderQty, Math.max(amount, 0));
|
|
141
145
|
commit('setAmount', value);
|
|
142
146
|
}
|
|
143
147
|
};
|