@lancom/shared 0.0.383 → 0.0.385

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.
Files changed (94) hide show
  1. package/assets/js/api/admin.js +12 -0
  2. package/assets/js/api/index.js +11 -1
  3. package/assets/js/utils/scroll.js +11 -0
  4. package/components/checkout/cart/cart.mixin.js +5 -1
  5. package/components/checkout/cart/cart.vue +32 -19
  6. package/components/checkout/cart/cart_entity/cart-entity.mixin.js +4 -0
  7. package/components/checkout/cart/cart_entity/cart-entity.vue +2 -0
  8. package/components/checkout/cart/cart_entity/cart_entity_color_simple_products/cart-entity-color-simple-products.vue +2 -0
  9. package/components/checkout/cart/cart_price_info/cart-price-info.vue +8 -53
  10. package/components/checkout/cart/cart_pricing/cart-pricing.scss +11 -3
  11. package/components/checkout/cart/cart_pricing/cart-pricing.vue +6 -2
  12. package/components/checkout/cart/cart_products_kit_entity/cart-products-kit-entity.scss +24 -0
  13. package/components/checkout/cart/cart_products_kit_entity/cart-products-kit-entity.vue +66 -0
  14. package/components/checkout/cart/cart_shipments_pricing/cart-shipments-pricing.scss +3 -0
  15. package/components/checkout/cart/cart_shipments_pricing/cart-shipments-pricing.vue +12 -2
  16. package/components/checkout/cart/cart_shipping/cart-shipping.scss +43 -0
  17. package/components/checkout/cart/cart_shipping/cart-shipping.vue +126 -0
  18. package/components/checkout/order/address-form/address-form.vue +5 -0
  19. package/components/checkout/order/order-billing-information/order-billing-information.vue +1 -0
  20. package/components/checkout/order/order-payment-information/order-payment-information.vue +9 -0
  21. package/components/common/number_input/number-input.scss +69 -0
  22. package/components/common/number_input/number-input.vue +97 -0
  23. package/components/common/payment/payment_card/applepay/applepay.scss +8 -0
  24. package/components/common/payment/payment_card/applepay/applepay.vue +16 -0
  25. package/components/common/payment/payment_card/payment-card.vue +7 -0
  26. package/components/common/postcode_select/postcode-select.scss +6 -0
  27. package/components/common/postcode_select/postcode-select.vue +16 -6
  28. package/components/common/pricing_discounts_table/pricing-discounts-table.vue +12 -2
  29. package/components/customer/customer_coupons/customer-coupons.scss +33 -0
  30. package/components/customer/customer_coupons/customer-coupons.vue +103 -0
  31. package/components/customer/customer_coupons/customer_coupon_apply/customer-coupon-apply.scss +1 -0
  32. package/components/customer/customer_coupons/customer_coupon_apply/customer-coupon-apply.vue +51 -0
  33. package/components/customer/customer_coupons/customer_coupon_prints/customer-coupon-prints.scss +1 -0
  34. package/components/customer/customer_coupons/customer_coupon_prints/customer-coupon-prints.vue +33 -0
  35. package/components/customer/customer_coupons/customer_coupon_prints/customer_coupon_print/customer-coupon-print.scss +19 -0
  36. package/components/customer/customer_coupons/customer_coupon_prints/customer_coupon_print/customer-coupon-print.vue +82 -0
  37. package/components/customer/customer_coupons/customer_coupon_products/customer-coupon-products.scss +1 -0
  38. package/components/customer/customer_coupons/customer_coupon_products/customer-coupon-products.vue +33 -0
  39. package/components/customer/customer_coupons/customer_coupon_products/customer_coupon_product/customer-coupon-product.scss +17 -0
  40. package/components/customer/customer_coupons/customer_coupon_products/customer_coupon_product/customer-coupon-product.vue +52 -0
  41. package/components/customer/customer_navigation_menu/customer-navigation-menu.vue +72 -0
  42. package/components/customer/customer_orders/customer-orders.scss +26 -12
  43. package/components/customer/customer_orders/customer-orders.vue +64 -33
  44. package/components/customer/customer_orders/customer_order_reorder/customer-order-reorder.scss +1 -0
  45. package/components/customer/customer_orders/customer_order_reorder/customer-order-reorder.vue +55 -0
  46. package/components/customer/customer_orders/customer_order_trackings/customer-order-trackings.scss +8 -0
  47. package/components/customer/customer_orders/customer_order_trackings/customer-order-trackings.vue +38 -0
  48. package/components/editor/editor.vue +4 -12
  49. package/components/editor/mobile_editor_product_details/mobile-editor-product-details.vue +2 -10
  50. package/components/products_kit/products_kit/products-kit.scss +54 -0
  51. package/components/products_kit/products_kit/products-kit.vue +47 -0
  52. package/components/products_kit/products_kit/products_kit_cart/products-kit-cart.scss +32 -0
  53. package/components/products_kit/products_kit/products_kit_cart/products-kit-cart.vue +132 -0
  54. package/components/products_kit/products_kit/products_kit_cart/products_kit_cart_options/products-kit-cart-options.scss +15 -0
  55. package/components/products_kit/products_kit/products_kit_cart/products_kit_cart_options/products-kit-cart-options.vue +31 -0
  56. package/components/products_kit/products_kit/products_kit_cart/products_kit_cart_options/products_kit_cart_option/products-kit-cart-option.scss +41 -0
  57. package/components/products_kit/products_kit/products_kit_cart/products_kit_cart_options/products_kit_cart_option/products-kit-cart-option.vue +89 -0
  58. package/components/products_kit/products_kit/products_kit_options/products-kit-options.scss +9 -0
  59. package/components/products_kit/products_kit/products_kit_options/products-kit-options.vue +32 -0
  60. package/components/products_kit/products_kit/products_kit_options/products_kit_option/products-kit-option.scss +1 -0
  61. package/components/products_kit/products_kit/products_kit_options/products_kit_option/products-kit-option.vue +36 -0
  62. package/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_color/products-kit-option-color.scss +1 -0
  63. package/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_color/products-kit-option-color.vue +88 -0
  64. package/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_products/products-kit-option-products.scss +7 -0
  65. package/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_products/products-kit-option-products.vue +36 -0
  66. 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 +20 -0
  67. 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 +127 -0
  68. package/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_size/products-kit-option-size.scss +1 -0
  69. package/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_size/products-kit-option-size.vue +87 -0
  70. package/components/products_kit/products_kits_list/products-kits-list.scss +68 -0
  71. package/components/products_kit/products_kits_list/products-kits-list.vue +50 -0
  72. package/components/products_kit/products_kits_list/products_kits_list_item/products-kits-list-item.scss +84 -0
  73. package/components/products_kit/products_kits_list/products_kits_list_item/products-kits-list-item.vue +52 -0
  74. package/components/quotes/quote_view/quote-view.vue +1 -0
  75. package/components/quotes/quote_view/quote_option_view/quote-option-view.vue +4 -0
  76. package/components/quotes/quote_view/quote_product_color_simple_products/quote-product-color-simple-products.vue +9 -2
  77. package/components/quotes/quote_view/quote_product_color_simple_products/quote_product_color_simple_product/quote-product-color-simple-product.scss +54 -1
  78. package/components/quotes/quote_view/quote_product_color_simple_products/quote_product_color_simple_product/quote-product-color-simple-product.vue +83 -5
  79. package/components/quotes/quote_view/quote_view_product/quote-view-product.scss +7 -0
  80. package/components/quotes/quote_view/quote_view_product/quote-view-product.vue +33 -11
  81. package/feeds/google-shopping.js +10 -4
  82. package/mixins/product-preview.js +6 -0
  83. package/package.json +1 -1
  84. package/pages/checkout/order.vue +13 -4
  85. package/pages/contact.vue +54 -0
  86. package/pages/customer/coupons.vue +39 -0
  87. package/pages/customer/orders.vue +39 -0
  88. package/pages/customer/settings.vue +4 -2
  89. package/pages/products-kit/_alias.vue +103 -0
  90. package/pages/products-kit/index.vue +59 -0
  91. package/routes/index.js +21 -1
  92. package/store/cart.js +2 -2
  93. package/store/productsKit.js +175 -0
  94. package/pages/customer/orders/index.vue +0 -29
@@ -0,0 +1,127 @@
1
+ <template>
2
+ <div
3
+ class="ProductsKitOptionProduct__wrapper"
4
+ :class="{
5
+ 'ProductsKitOptionProduct__wrapper--active': isSelectedProduct
6
+ }">
7
+ <div class="ProductsKitOptionProduct__preview">
8
+ <product-preview-main
9
+ ref="preview"
10
+ :product="product"
11
+ :to-editor="false"
12
+ @color="onProductSelectColor($event)" />
13
+ </div>
14
+ <div class="ProductsKitOptionProduct__select">
15
+ <btn
16
+ :btn-block="true"
17
+ @onclick="selectProduct"
18
+ :btn-class="isSelectedProduct ? 'green' : 'gray'"
19
+ btn-label="SELECT" />
20
+ <div
21
+ v-if="isSelectedProduct"
22
+ class="mt-5">
23
+ <products-kit-option-color
24
+ :products-kit="productsKit"
25
+ :option="option"
26
+ @color="onChooseColor($event)" />
27
+ <products-kit-option-size
28
+ class="mt-5"
29
+ :products-kit="productsKit"
30
+ :option="option" />
31
+ <div
32
+ v-if="selectedSimpleProduct"
33
+ class="mt-5 lc_subtitle3">
34
+ Stock: {{ currentQuantityStockLabel }}
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </div>
39
+ </template>
40
+
41
+ <script>
42
+ import { mapGetters, mapActions } from 'vuex';
43
+ import ProductPreviewMain from '@/components/product/product_preview_main/product-preview-main';
44
+ import ProductsKitOptionColor from '@lancom/shared/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_color/products-kit-option-color';
45
+ import ProductsKitOptionSize from '@lancom/shared/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_size/products-kit-option-size';
46
+
47
+ export default {
48
+ name: 'ProductsKitOptionProduct',
49
+ components: {
50
+ ProductPreviewMain,
51
+ ProductsKitOptionColor,
52
+ ProductsKitOptionSize
53
+ },
54
+ props: {
55
+ productsKit: {
56
+ type: Object,
57
+ required: true
58
+ },
59
+ option: {
60
+ type: Object,
61
+ required: true
62
+ },
63
+ product: {
64
+ type: Object,
65
+ required: true
66
+ }
67
+ },
68
+ computed: {
69
+ ...mapGetters(['country', 'currency', 'stockCountry']),
70
+ ...mapGetters('productsKit', [
71
+ 'selectedOptionsProducts',
72
+ 'selectedOptionsSimpleProducts',
73
+ 'selectedOptionsColors',
74
+ 'selectedOptionsSizes'
75
+ ]),
76
+ isSelectedProduct() {
77
+ return this.selectedOptionsProducts[this.option._id]?._id === this.product._id;
78
+ },
79
+ selectedColor() {
80
+ return this.selectedOptionsColors[this.option._id];
81
+ },
82
+ selectedSize() {
83
+ return this.selectedOptionsSizes[this.option._id];
84
+ },
85
+ selectedSimpleProduct() {
86
+ const simpleProducts = this.selectedOptionsSimpleProducts[this.option._id] || [];
87
+ return simpleProducts.find(sp => {
88
+ const isSameSize = sp.size?._id === this.selectedSize?._id;
89
+ const isSameColor = sp.color?._id === this.selectedColor?._id;
90
+ return isSameSize && isSameColor;
91
+ });
92
+ },
93
+ currentQuantityStock() {
94
+ return (this.selectedSimpleProduct?.quantityStock || 0);
95
+ },
96
+ currentQuantityStockLabel() {
97
+ return this.currentQuantityStock > 100 ? '100+' : this.currentQuantityStock;
98
+ }
99
+ },
100
+ watch: {
101
+ selectedColor() {
102
+ const color = this.isSelectedProduct ? this.selectedColor : null;
103
+ this.$refs.preview.currentColor = color;
104
+ }
105
+ },
106
+ methods: {
107
+ ...mapActions('productsKit', ['selectOptionProduct', 'selectOptionColor']),
108
+ selectProduct() {
109
+ const params = {
110
+ country: this.country?._id,
111
+ currency: this.currency?._id,
112
+ stockCountry: this.stockCountry?._id,
113
+ option: this.option,
114
+ product: this.product
115
+ };
116
+ this.selectOptionProduct(params);
117
+ },
118
+ onProductSelectColor(color) {
119
+ this.selectOptionColor({ option: this.option, color });
120
+ }
121
+ }
122
+ };
123
+ </script>
124
+
125
+ <style lang="scss" scoped>
126
+ @import 'products-kit-option-product';
127
+ </style>
@@ -0,0 +1,87 @@
1
+ <template>
2
+ <div class="ProductsKitOptionSize__wrapper">
3
+ <multiselect
4
+ v-model="selectedSize"
5
+ value="_id"
6
+ label="shortName"
7
+ track-by="_id"
8
+ placeholder="Select size"
9
+ :options="availableSizes"
10
+ :allow-empty="false"
11
+ :searchable="false"
12
+ :option-height="60">
13
+ <template #option="{ option }">
14
+ <div class="ProductsKitOptionSize__option">
15
+ <span class="ProductsKitOptionSize__option-name">
16
+ {{ option.shortName }}
17
+ </span>
18
+ </div>
19
+ </template>
20
+ <template #singleLabel="{ option }">
21
+ <div class="ProductsKitOptionSize__option">
22
+ {{ option.shortName }}
23
+ </div>
24
+ </template>
25
+ </multiselect>
26
+ </div>
27
+ </template>
28
+
29
+ <script>
30
+ import { mapGetters, mapActions } from 'vuex';
31
+ import Multiselect from 'vue-multiselect';
32
+
33
+ export default {
34
+ name: 'ProductsKitOptionSize',
35
+ components: {
36
+ Multiselect
37
+ },
38
+ props: {
39
+ productsKit: {
40
+ type: Object,
41
+ required: true
42
+ },
43
+ option: {
44
+ type: Object,
45
+ required: true
46
+ }
47
+ },
48
+ computed: {
49
+ ...mapGetters('productsKit', [
50
+ 'selectedOptionsSimpleProducts',
51
+ 'selectedOptionsColors',
52
+ 'selectedOptionsSizes',
53
+ ]),
54
+ selectedColor() {
55
+ return this.selectedOptionsColors[this.option._id];
56
+ },
57
+ selectedSize: {
58
+ get () {
59
+ return this.selectedOptionsSizes[this.option._id];
60
+ },
61
+ set(size) {
62
+ this.selectOptionSize({ option: this.option, size });
63
+ }
64
+ },
65
+ availableSizes() {
66
+ const simpleProducts = this.selectedOptionsSimpleProducts[this.option._id] || [];
67
+ const uniqueSizesMap = new Map();
68
+ simpleProducts
69
+ .filter(sp => sp.quantityStock > 0)
70
+ .forEach(({ size, color }) => {
71
+ const isSameColor = color?._id === this.selectedColor?._id;
72
+ if (size && isSameColor && !uniqueSizesMap.has(size._id)) {
73
+ uniqueSizesMap.set(size._id, size);
74
+ }
75
+ });
76
+ return Array.from(uniqueSizesMap.values());
77
+ }
78
+ },
79
+ methods: {
80
+ ...mapActions('productsKit', ['selectOptionSize'])
81
+ }
82
+ };
83
+ </script>
84
+
85
+ <style lang="scss" scoped>
86
+ @import 'products-kit-option-size';
87
+ </style>
@@ -0,0 +1,68 @@
1
+ @import "@/assets/scss/variables";
2
+
3
+ .ProductKitsList {
4
+ &__wrapper {
5
+ display: flex;
6
+ flex-wrap: wrap;
7
+ margin-bottom: 20px;
8
+ }
9
+ &__item {
10
+ width: calc(50% - 30px);
11
+ @media (max-width: $bp-extra-small-max) {
12
+ width: 100%
13
+ }
14
+ margin: 15px;
15
+ height: 300px;
16
+
17
+ &--large {
18
+ width: 100%;
19
+ height: 500px;
20
+ @media (max-width: $bp-extra-small-max) {
21
+ height: 300px;
22
+ }
23
+ }
24
+ }
25
+ }
26
+
27
+
28
+ .VuePagination {
29
+ &__pagination {
30
+ display: flex;
31
+ justify-content: center;
32
+ &-item {
33
+ font-size: 16px;
34
+ line-height: 170%;
35
+ color: $black;
36
+ width: 50px;
37
+ height: 50px;
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+ border: 1px solid $grey_3;
42
+ border-radius: 4px;
43
+ margin: 0 3px;
44
+ a {
45
+ display: block;
46
+ width: 100%;
47
+ height: 100%;
48
+ text-align: center;
49
+ padding-top: 11px;
50
+ cursor: pointer;
51
+ &:hover {
52
+ background-color: $grey_3;
53
+ }
54
+ }
55
+ &.active {
56
+ background-color: $black;
57
+ color: white;
58
+ }
59
+ &.disabled {
60
+ pointer-events: none;
61
+ opacity: .5;
62
+ }
63
+ }
64
+ }
65
+ &__count {
66
+ display: none;
67
+ }
68
+ }
@@ -0,0 +1,50 @@
1
+ <template>
2
+ <div>
3
+ <div class="ProductKitsList__wrapper">
4
+ <div
5
+ v-for="(item) in productsKits"
6
+ :key="item._id"
7
+ class="ProductKitsList__item">
8
+ <transition appear>
9
+ <products-kits-list-item :item="item" class="elevation2" />
10
+ </transition>
11
+ </div>
12
+ </div>
13
+ <pagination
14
+ v-if="count > perPage"
15
+ :itemsCount="count"
16
+ :itemsPerPage="perPage" />
17
+ </div>
18
+ </template>
19
+
20
+ <script>
21
+ import Pagination from '@lancom/shared/components/common/pagination';
22
+ import ProductsKitsListItem from './products_kits_list_item/products-kits-list-item';
23
+
24
+ export default {
25
+ name: 'ProductKitsList',
26
+ components: {
27
+ ProductsKitsListItem,
28
+ Pagination
29
+ },
30
+ props: {
31
+ productsKits: {
32
+ type: Array,
33
+ required: true
34
+ },
35
+ count: {
36
+ type: Number
37
+ },
38
+ perPage: {
39
+ type: Number
40
+ },
41
+ page: {
42
+ type: Number
43
+ }
44
+ }
45
+ };
46
+ </script>
47
+
48
+ <style lang="scss">
49
+ @import 'products-kits-list';
50
+ </style>
@@ -0,0 +1,84 @@
1
+ @import "@/assets/scss/variables";
2
+
3
+ .ProductsKitsListItem {
4
+ &__wrapper {
5
+ background-repeat: no-repeat;
6
+ background-size: cover;
7
+ background-position: center;
8
+ background-color: $black_medium_emphasis;
9
+ position: relative;
10
+ height: 100%;
11
+ }
12
+ &__info {
13
+ position: absolute;
14
+ top: 30px;
15
+ left: 30px;
16
+ right: 30px;
17
+ }
18
+ &__link {
19
+ color: white;
20
+ font-size: 30px;
21
+ font-weight: 800;
22
+ @media (max-width: $bp-extra-small-max) {
23
+ font-size: 25px;
24
+ }
25
+ &:hover {
26
+ text-decoration: none;
27
+ }
28
+ }
29
+ &__text {
30
+ margin-top: 10px;
31
+ color: white;
32
+ line-height: 150%;;
33
+ }
34
+ &__date {
35
+ color: #e8e8e8;
36
+ margin-top: 7px;
37
+ font-size: 11px;
38
+ }
39
+ &__more {
40
+ position: absolute;
41
+ bottom: 30px;
42
+ left: 30px;
43
+ padding: 10px;
44
+ border-width: 1px;
45
+ border-style: solid;
46
+ border-color: white;
47
+ color: white;
48
+ text-decoration: none;
49
+ text-transform: uppercase;
50
+ transition: border-color 0.3s;
51
+ font-size: 13px;
52
+ font-weight: 800;
53
+ &>span {
54
+ position: relative;
55
+ }
56
+
57
+ &::before {
58
+ content: ' ';
59
+ position: absolute;
60
+ top: 0;
61
+ right: 0;
62
+ bottom: 0;
63
+ left: 0;
64
+ opacity: 0;
65
+ background-color: $green;
66
+ transition: opacity 0.3s;
67
+ }
68
+
69
+ &:hover {
70
+ border-color: $green;
71
+ &::before {
72
+ opacity: 1;
73
+ }
74
+ }
75
+ }
76
+ &__overlay {
77
+ position: absolute;
78
+ top: 0;
79
+ right: 0;
80
+ bottom: 0;
81
+ left: 0;
82
+ cursor: pointer;
83
+ }
84
+ }
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <article
3
+ class="ProductsKitsListItem__wrapper"
4
+ :style="{ backgroundImage }">
5
+ <a
6
+ class="ProductsKitsListItem__overlay"
7
+ :href="linkToProductsKit"
8
+ :title="item.name"></a>
9
+ <div class="ProductsKitsListItem__info">
10
+ <h3>
11
+ <a
12
+ :href="linkToProductsKit"
13
+ class="ProductsKitsListItem__link"
14
+ :title="item.name"
15
+ :style="{ color: item.color }">
16
+ {{ item.name }}
17
+ </a>
18
+ </h3>
19
+ </div>
20
+ </article>
21
+ </template>
22
+
23
+ <script>
24
+ import { staticLink } from '@lancom/shared/assets/js/utils/filters';
25
+
26
+ export default {
27
+ name: 'ProductsKitsListItem',
28
+ props: {
29
+ item: {
30
+ type: Object,
31
+ required: true
32
+ }
33
+ },
34
+ computed: {
35
+ linkToProductsKit() {
36
+ return `/products-kit/${this.item.alias}`;
37
+ },
38
+ backgroundImage() {
39
+ return this.item.image ? `url('${staticLink(this.item.image.medium)}')` : '';
40
+ }
41
+ },
42
+ methods: {
43
+ goToNews() {
44
+ this.$router.push(this.linkToNews);
45
+ }
46
+ }
47
+ };
48
+ </script>
49
+
50
+ <style lang="scss" scoped>
51
+ @import 'products-kits-list-item';
52
+ </style>
@@ -53,6 +53,7 @@
53
53
  v-for="(optionItem, index) of options"
54
54
  :key="`option-${index}`"
55
55
  :option="optionItem"
56
+ :quote="quote"
56
57
  class="QuoteView__option" />
57
58
  </div>
58
59
  <h6
@@ -33,6 +33,10 @@ export default {
33
33
  QuoteViewProduct
34
34
  },
35
35
  props: {
36
+ quote: {
37
+ type: Object,
38
+ require: true
39
+ },
36
40
  option: {
37
41
  type: Object,
38
42
  require: true
@@ -37,7 +37,8 @@
37
37
  <quote-product-color-simple-product
38
38
  v-for="simpleProduct in group.simpleProducts"
39
39
  :key="simpleProduct._id"
40
- :simple-product="simpleProduct" />
40
+ :simple-product="simpleProduct"
41
+ @change="onChangeColorSimpleProduct($event)" />
41
42
  </div>
42
43
  <div class="QuoteProductColorSimpleProducts__totals">
43
44
  <div
@@ -89,7 +90,13 @@ export default {
89
90
  },
90
91
  mixins: [
91
92
  QuoteProductColorSimpleProducts
92
- ]
93
+ ],
94
+ methods: {
95
+ onChangeColorSimpleProduct() {
96
+ console.log('onChangeColorSimpleProduct:change...');
97
+ this.$emit('change');
98
+ }
99
+ }
93
100
  };
94
101
  </script>
95
102
 
@@ -7,6 +7,7 @@
7
7
  align-items: center;
8
8
  flex-direction: column;
9
9
  margin-right: 4px;
10
+ margin-bottom: 5px;
10
11
  }
11
12
  &__label {
12
13
  font-weight: 600;
@@ -17,10 +18,16 @@
17
18
  margin-bottom: 6px;
18
19
  margin-top: 0px;
19
20
  }
21
+ &__field-wrapper {
22
+ position: relative;
23
+ &:hover .QuoteProductColorSimpleProduct__controls {
24
+ display: flex;
25
+ }
26
+ }
20
27
  &__field {
21
28
  width: 32px;
22
29
  height: 28px;
23
- background: #efefef;
30
+ background: $gray;
24
31
  font-weight: 600;
25
32
  font-size: 14px;
26
33
  line-height: 19px;
@@ -28,5 +35,51 @@
28
35
  color: #A2A2A2;
29
36
  border-radius: 0;
30
37
  padding: 2px !important;
38
+
39
+ &::-webkit-outer-spin-button,
40
+ &::-webkit-inner-spin-button {
41
+ -webkit-appearance: none;
42
+ margin: 0;
43
+ }
44
+ &[type=number] {
45
+ -moz-appearance: textfield;
46
+ }
47
+ &.empty {
48
+ color: #272727;
49
+ }
50
+ &.error {
51
+ color: #ff5a5a;
52
+ }
53
+ }
54
+ &__price {
55
+ width: 32px;
56
+ height: 28px;
57
+ font-size: 9px;
58
+ text-align: center;
59
+ color: #A2A2A2;
60
+ padding-top: 5px;
61
+ }
62
+ &__controls {
63
+ display: flex;
64
+ flex-direction: column;
65
+ display: none;
66
+ }
67
+ &__control {
68
+ position: absolute;
69
+ bottom: -10px;
70
+ width: 16px;
71
+ height: 16px;
72
+ background: $white;
73
+ border: 1px solid $gray;
74
+ font-size: 12px;
75
+ z-index: 4;
76
+ cursor: pointer;
77
+ text-align: center;
78
+ &--encrease {
79
+ right: 0px;
80
+ }
81
+ &--decrease {
82
+ left: 0px;
83
+ }
31
84
  }
32
85
  }
@@ -1,23 +1,101 @@
1
1
  <template>
2
2
  <div class="QuoteProductColorSimpleProduct__wrapper">
3
- <div class="lc_regular16 QuoteProductColorSimpleProduct__label">
3
+ <label
4
+ :for="`amount-${simpleProduct.guid}`"
5
+ class="lc_regular16 QuoteProductColorSimpleProduct__label">
4
6
  {{ simpleProduct.size.shortName }}
5
- </div>
6
- <div
7
- class="centered QuoteProductColorSimpleProduct__field">
8
- {{ simpleProduct.amount || '-' }}
7
+ </label>
8
+ <div class="QuoteProductColorSimpleProduct__field-wrapper">
9
+ <input
10
+ :id="`amount-${simpleProduct.guid}`"
11
+ ref="input"
12
+ v-model.number="model"
13
+ type="number"
14
+ min="0"
15
+ class="form-field centered QuoteProductColorSimpleProduct__field"
16
+ :class="{
17
+ empty: !model,
18
+ error: model > simpleProduct.quantityStock
19
+ }"
20
+ @wheel="onWheel"
21
+ @change="onChange()" />
22
+ <div class="QuoteProductColorSimpleProduct__controls">
23
+ <span
24
+ class="QuoteProductColorSimpleProduct__control QuoteProductColorSimpleProduct__control--decrease"
25
+ @click="decrease()">
26
+ -
27
+ </span>
28
+ <span
29
+ class="QuoteProductColorSimpleProduct__control QuoteProductColorSimpleProduct__control--encrease"
30
+ @click="encrease()">
31
+ +
32
+ </span>
33
+ </div>
9
34
  </div>
10
35
  </div>
11
36
  </template>
12
37
 
13
38
  <script>
39
+ import confirm from '@lancom/shared/mixins/confirm';
40
+ import { inRange, price } from '@lancom/shared/assets/js/utils/filters';
41
+
14
42
  export default {
15
43
  name: 'QuoteProductColorSimpleProduct',
44
+ mixins: [confirm],
45
+ filters: {
46
+ price
47
+ },
16
48
  props: {
17
49
  simpleProduct: {
18
50
  type: Object,
19
51
  required: true
20
52
  }
53
+ },
54
+ computed: {
55
+ model: {
56
+ get() {
57
+ return this.simpleProduct.amount;
58
+ },
59
+ set(value) {
60
+ this.setSimpleProductAmount({
61
+ guid: this.simpleProduct.guid,
62
+ amount: this.formatAmount(value)
63
+ });
64
+ }
65
+ }
66
+ },
67
+ methods: {
68
+ setSimpleProductAmount({ amount }) {
69
+ this.simpleProduct.amount = amount;
70
+ },
71
+ onWheel(e) {
72
+ e.target.blur();
73
+ },
74
+ onChange() {
75
+ if (this.$refs.input) {
76
+ this.$refs.input.blur();
77
+ }
78
+ this.$emit('change');
79
+ },
80
+ formatAmount(value) {
81
+ return inRange(value, 0, this.simpleProduct.quantityStock || 999);
82
+ },
83
+ encrease() {
84
+ console.log('encrease...');
85
+ this.setSimpleProductAmount({
86
+ guid: this.simpleProduct.guid,
87
+ amount: this.formatAmount(this.model + 1)
88
+ });
89
+ this.$emit('change');
90
+ },
91
+ decrease() {
92
+ console.log('decrease...');
93
+ this.setSimpleProductAmount({
94
+ guid: this.simpleProduct.guid,
95
+ amount: this.formatAmount(this.model - 1)
96
+ });
97
+ this.$emit('change');
98
+ }
21
99
  }
22
100
  };
23
101
  </script>