@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,126 @@
1
+ <template>
2
+ <div
3
+ class="CartShipping__wrapper"
4
+ :class="{
5
+ 'CartShipping__wrapper--warning': (needToPickup && hasNotValidProductsPickup) || !suburb
6
+ }">
7
+ <div class="lc_h4 lc_uppercase lc_black CartShipping__header">
8
+ Order Shipping
9
+ </div>
10
+ <div class="mt-10">
11
+ <postcode-select
12
+ :suburb="suburb"
13
+ :labelless="true"
14
+ :only-postcode="onlyPostcode"
15
+ :placeholder="postcodeLabel"
16
+ :label-text="postcodeInfoLabel"
17
+ :allow-empty="true"
18
+ @select="$emit('suburb', $event)" />
19
+ <div class="mt-10 mb-10">
20
+ <checkbox
21
+ v-model="wantsToPickup"
22
+ :dark="true"
23
+ @change="calculatePrice()">
24
+ <div class="ml-10 CartPriceInfo__pickup-label">
25
+ {{ contacts.warehousePickupInfo ? `Pickup from ${contacts.warehousePickupInfo}` : 'Wants to pickup' }}
26
+ </div>
27
+ </checkbox>
28
+ </div>
29
+ <div
30
+ v-if="visiblePickupError && hasNotValidProductsPickup"
31
+ class="CartShipping__pickup-errors">
32
+ <div>Not all items in cart are available for pickup. Some items are available for delivery only</div>
33
+ <ul>
34
+ <li
35
+ v-for="product in notValidProductsPickup"
36
+ :key="product._id">
37
+ <b>{{ product.name }}. {{ product.size ? product.size.shortName : '' }}</b> order quantity: {{ product.amount }}. Available {{ product.warehouseQuantityStock }}
38
+ </li>
39
+ </ul>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ </template>
44
+
45
+ <script>
46
+ import { mapGetters, createNamespacedHelpers } from 'vuex';
47
+ import PostcodeSelect from '@lancom/shared/components/common/postcode_select/postcode-select';
48
+ import { price } from '@lancom/shared/assets/js/utils/filters';
49
+
50
+ const { mapActions, mapMutations } = createNamespacedHelpers('cart');
51
+
52
+ export default {
53
+ name: 'LancomCartShipping',
54
+ filters: { price },
55
+ components: {
56
+ PostcodeSelect
57
+ },
58
+ props: {
59
+ itemsLabel: {
60
+ type: String,
61
+ default: 'Tee'
62
+ }
63
+ },
64
+ data() {
65
+ return {
66
+ visiblePickupError: null,
67
+ price: null
68
+ };
69
+ },
70
+ computed: {
71
+ ...mapGetters(['shop', 'SETTINGS', 'MESSAGES', 'country', 'currency', 'contacts']),
72
+ ...mapGetters('cart', [
73
+ 'suburb',
74
+ 'notValidProductsPickup',
75
+ 'needToPickup',
76
+ 'needToPickupWithoutErrors',
77
+ 'cartPricing',
78
+ 'cartPricingError'
79
+ ]),
80
+ postcodeInfoLabel() {
81
+ return this.MESSAGES.CART_POSTCODE_INFO || 'Enter postcode to calculate shipping';
82
+ },
83
+ onlyPostcode() {
84
+ return !!this.SETTINGS.CART_ONLY_POSTCODE && this.country?.isoCode === 'UK';
85
+ },
86
+ postcodeLabel() {
87
+ return this.onlyPostcode ? 'Postcode' : (this.MESSAGES.CART_POSTCODE || 'Postcode');
88
+ },
89
+ hasNotValidProductsPickup() {
90
+ return this.notValidProductsPickup.length > 0;
91
+ },
92
+ wantsToPickup: {
93
+ get() {
94
+ return this.needToPickup;
95
+ },
96
+ set(needToPickup) {
97
+ if (needToPickup && this.hasNotValidProductsPickup) {
98
+ this.visiblePickupError = true;
99
+ } else {
100
+ // if (needToPickup) {
101
+ // this.setSuburb(null);
102
+ // }
103
+ this.setNeedToPickup(needToPickup);
104
+ this.visiblePickupError = false;
105
+ }
106
+ }
107
+ }
108
+ },
109
+ methods: {
110
+ ...mapMutations([
111
+ 'setSuburb',
112
+ 'setNeedToPickup'
113
+ ]),
114
+ ...mapActions([
115
+ 'calculateCartPrice'
116
+ ]),
117
+ async calculatePrice() {
118
+ await this.calculateCartPrice({ shop: this.shop, country: this.country, currency: this.currency });
119
+ }
120
+ }
121
+ };
122
+ </script>
123
+
124
+ <style lang="scss" scoped>
125
+ @import 'cart-shipping.scss';
126
+ </style>
@@ -160,6 +160,7 @@
160
160
  <postcode-select
161
161
  class="form-col col-half"
162
162
  :suburb="address.suburb"
163
+ :disabled="disabledPostcode"
163
164
  :labelless="true"
164
165
  :required="true"
165
166
  :name-prefix="namePrefix"
@@ -244,6 +245,10 @@ export default {
244
245
  type: Boolean,
245
246
  default: false
246
247
  },
248
+ disabledPostcode: {
249
+ type: Boolean,
250
+ default: false
251
+ },
247
252
  namePrefix: {
248
253
  type: String,
249
254
  default: ''
@@ -11,6 +11,7 @@
11
11
  <address-form
12
12
  :address="order.shippingAddress"
13
13
  :only-contact-info="needToPickupWithoutErrors"
14
+ :disabled-postcode="true"
14
15
  :without-additional-info="true" />
15
16
  <div
16
17
  v-if="!needToPickupWithoutErrors"
@@ -34,6 +34,14 @@
34
34
  Google Pay
35
35
  </span>
36
36
  </label>
37
+ <label
38
+ class="form-label OrderPaymentInformation__checkbox"
39
+ @click="updatePaymentType('apple')">
40
+ <checked-icon :checked="paymentMethod === 'apple'" />
41
+ <span class="lc_regular12 lc__grey1 OrderPaymentInformation__checkbox-label">
42
+ Apple Pay
43
+ </span>
44
+ </label>
37
45
  </div>
38
46
  <div
39
47
  v-if="paymentMethod === 'deposit'"
@@ -71,6 +79,7 @@
71
79
  ref="paymentCart"
72
80
  :key="paymentMethod"
73
81
  :google="paymentMethod === 'google'"
82
+ :apple="paymentMethod === 'apple'"
74
83
  :amount="cartPricing.totalPrice"
75
84
  :order="orderData"
76
85
  @inited="initedCard">
@@ -0,0 +1,69 @@
1
+ @import "@/assets/scss/variables";
2
+
3
+ .NumberInput {
4
+ &__wrapper {
5
+ width: 100%;
6
+ height: 100%;
7
+ display: flex;
8
+ justify-content: center;
9
+ &--double {
10
+ width: 200px;
11
+ input {
12
+ font-size: 25px !important;
13
+ }
14
+ }
15
+ &.side-controls {
16
+ input::-webkit-outer-spin-button,
17
+ input::-webkit-inner-spin-button {
18
+ -webkit-appearance: none;
19
+ margin: 0;
20
+ }
21
+ input[type=number] {
22
+ -moz-appearance: textfield;
23
+ }
24
+ }
25
+ }
26
+ &__field {
27
+ position: relative;
28
+ width: 100%;
29
+ input {
30
+ text-align: center !important;
31
+ color: $black;
32
+ transition: height .2s ease-in-out;
33
+ &.invalidate {
34
+ opacity: .3;
35
+ }
36
+ &.empty {
37
+ color: $grey_2;
38
+ }
39
+ }
40
+ }
41
+ &__side-control {
42
+ position: absolute;
43
+ display: flex;
44
+ align-items: center;
45
+ justify-content: center;
46
+ top: 3px;
47
+ bottom: 3px;
48
+ width: 20px;
49
+ background: $grey_2;
50
+ border-radius: 3px;
51
+ padding-top: 2px;
52
+ cursor: pointer;
53
+ &--left {
54
+ left: 3px;
55
+ }
56
+ &--right {
57
+ padding-top: 2px;
58
+ right: 3px;
59
+ }
60
+ &--double {
61
+ width: 40px;
62
+ padding-top: 5px;
63
+ font-size: 20px;
64
+ }
65
+ &.disabled {
66
+ display: none;
67
+ }
68
+ }
69
+ }
@@ -0,0 +1,97 @@
1
+ <template>
2
+ <div
3
+ class="NumberInput__wrapper"
4
+ :class="{
5
+ 'side-controls': sideControls,
6
+ 'NumberInput__wrapper--double': doubleSize
7
+ }">
8
+ <div class="NumberInput__field">
9
+ <div
10
+ class="NumberInput__side-control NumberInput__side-control--left"
11
+ :class="{ disabled, 'NumberInput__side-control--double': doubleSize }"
12
+ @click="model -= step">
13
+ <span> - </span>
14
+ </div>
15
+ <input
16
+ v-model.number="model"
17
+ :id="id"
18
+ :min="min"
19
+ :max="max"
20
+ :name="name || uniqueCode"
21
+ placeholder="0"
22
+ type="number"
23
+ class="form-control"
24
+ :class="{ invalidate: disabled, empty: !model }"
25
+ :disabled="disabled"
26
+ @change="$emit('change', model)" />
27
+ <div
28
+ class="NumberInput__side-control NumberInput__side-control--right"
29
+ :class="{ disabled, 'NumberInput__side-control--double': doubleSize }"
30
+ @click="model += step">
31
+ <span> + </span>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </template>
36
+
37
+ <script>
38
+ import { generateGUID } from '@lancom/shared/assets/js/utils/guid';
39
+
40
+ export default {
41
+ name: 'NumberInput',
42
+ data() {
43
+ return {
44
+ uniqueCode: generateGUID()
45
+ };
46
+ },
47
+ props: {
48
+ id: {
49
+ type: String
50
+ },
51
+ value: {
52
+ type: Number
53
+ },
54
+ name: {
55
+ type: String
56
+ },
57
+ min: {
58
+ type: Number
59
+ },
60
+ max: {
61
+ type: Number
62
+ },
63
+ sideControls: {
64
+ type: Boolean,
65
+ default: true
66
+ },
67
+ doubleSize: {
68
+ type: Boolean,
69
+ default: false
70
+ },
71
+ step: {
72
+ type: Number,
73
+ default: 1
74
+ },
75
+ disabled: {
76
+ type: Boolean,
77
+ default: false
78
+ }
79
+ },
80
+ computed: {
81
+ model: {
82
+ get() {
83
+ return this.value;
84
+ },
85
+ set(value) {
86
+ value = typeof this.min === 'number' ? Math.max(this.min, +value) : value;
87
+ value = typeof this.max === 'number' ? Math.min(this.max, +value) : value;
88
+ this.$emit('input', +value);
89
+ }
90
+ }
91
+ }
92
+ };
93
+ </script>
94
+
95
+ <style lang="scss" scoped>
96
+ @import 'number-input.scss';
97
+ </style>
@@ -0,0 +1,8 @@
1
+ @import "@/assets/scss/ui_kit";
2
+ @import "@/assets/scss/variables";
3
+
4
+ .Payment {
5
+ &__wrapper {
6
+ font-weight: bold;
7
+ }
8
+ }
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <div class="Payment__wrapper">
3
+ Temporarily Not Available
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: 'Applepay'
10
+ };
11
+ </script>
12
+
13
+
14
+ <style lang="scss" scoped>
15
+ @import 'applepay.scss';
16
+ </style>
@@ -17,6 +17,7 @@ import { mapGetters } from 'vuex';
17
17
  export default {
18
18
  name: 'PaymentCard',
19
19
  components: {
20
+ Applepay: () => import('./applepay/applepay'),
20
21
  Googlepay: () => import('./googlepay/googlepay'),
21
22
  Pinpayment: () => import('./pinpayment/pinpayment'),
22
23
  Stripe: () => import('./stripe_card/stripe-card'),
@@ -32,6 +33,9 @@ export default {
32
33
  },
33
34
  google: {
34
35
  type: Boolean
36
+ },
37
+ apple: {
38
+ type: Boolean
35
39
  }
36
40
  },
37
41
  computed: {
@@ -40,6 +44,9 @@ export default {
40
44
  if (this.google) {
41
45
  return 'googlepay';
42
46
  }
47
+ if (this.apple) {
48
+ return 'applepay';
49
+ }
43
50
  return this.payment?.type || 'stripe-payment';
44
51
  }
45
52
  },
@@ -5,4 +5,10 @@
5
5
  font-weight: bold;
6
6
  background-color: $green_lighter;
7
7
  }
8
+ &__clear {
9
+ position: absolute;
10
+ cursor: pointer;
11
+ top: 25px;
12
+ left: -5px;
13
+ }
8
14
  }
@@ -75,6 +75,12 @@
75
75
  {{ errors[0] }}
76
76
  </span>
77
77
  </validation-provider>
78
+ <div
79
+ v-if="allowEmpty && (value || selected)"
80
+ class="PostcodeSelect__clear"
81
+ @click="model = null">
82
+ <i class="icon-close-r"></i>
83
+ </div>
78
84
  </div>
79
85
  </template>
80
86
 
@@ -127,6 +133,10 @@ export default {
127
133
  suburb: {
128
134
  type: Object
129
135
  },
136
+ allowEmpty: {
137
+ type: Boolean,
138
+ default: false
139
+ },
130
140
  namePrefix: {
131
141
  type: String,
132
142
  default: ''
@@ -199,21 +209,21 @@ export default {
199
209
  };
200
210
  },
201
211
  async updatePostcode(option) {
202
- this.selected = option;
203
- if (!option.value) {
212
+ this.selected = (this.allowEmpty && this.selected?._id === option?._id) ? null : option;
213
+ if (this.selected && !this.selected?.value) {
204
214
  try {
205
215
  this.isLoading = true;
206
- const suburb = await api.fetchAddressInfo(option._id, this.shop?._id);
216
+ const suburb = await api.fetchAddressInfo(this.selected._id, this.shop?._id);
207
217
  this.$emit('input', suburb.postcode);
208
218
  this.$emit('select', suburb);
209
- option.label = this.createOptionFromSuburb(suburb).label;
219
+ this.selected.label = this.createOptionFromSuburb(suburb).label;
210
220
  } catch (e) {
211
221
  } finally {
212
222
  this.isLoading = false;
213
223
  }
214
224
  } else {
215
- this.$emit('input', option.value);
216
- this.$emit('select', this.suburbs.find(({ _id }) => _id === option._id));
225
+ this.$emit('input', this.selected?.value);
226
+ this.$emit('select', this.suburbs.find(({ _id }) => _id === this.selected?._id));
217
227
  }
218
228
  }
219
229
  }
@@ -17,10 +17,20 @@
17
17
  }">
18
18
  <td>{{ (range.max >= 9999 || !range.max) ? `${range.min}+` : `${range.min}-${range.max}` }}</td>
19
19
  <td v-if="withGst">
20
- {{ range.price | priceWithTax(pricingSettings, currency) }}
20
+ <span v-if="range.percent">
21
+ {{ range.percent }}%
22
+ </span>
23
+ <span v-else>
24
+ {{ range.price | priceWithTax(pricingSettings, currency) }}
25
+ </span>
21
26
  </td>
22
27
  <td v-else>
23
- {{ range.price | price(currency) }}
28
+ <span v-if="range.percent">
29
+ {{ range.percent }}%
30
+ </span>
31
+ <span v-else>
32
+ {{ range.price | price(currency) }}
33
+ </span>
24
34
  </td>
25
35
  </tr>
26
36
  </tbody>
@@ -0,0 +1,33 @@
1
+ @import "@/assets/scss/variables";
2
+
3
+ .CustomerCoupons__wrapper {
4
+ .VueTables {
5
+ &__table {
6
+ width: 100%;
7
+ border-collapse: collapse;
8
+ th, td {
9
+ padding: 10px;
10
+ text-align: left;
11
+ border-bottom: 1px solid $grey_2;
12
+ font-size: 14px;
13
+ &:nth-child(-n+3) {
14
+ width: 220px;
15
+ }
16
+ }
17
+ th {
18
+ background-color: $grey_3;
19
+ font-weight: bold;
20
+ }
21
+ a {
22
+ color: $black;
23
+ text-decoration: none;
24
+ transition: color 0.2s ease;
25
+
26
+ &:hover {
27
+ color: darken($black, 10%);
28
+ text-decoration: underline;
29
+ }
30
+ }
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,103 @@
1
+ <template>
2
+ <div class="CustomerCoupons__wrapper">
3
+ <client-only>
4
+ <v-server-table
5
+ :key="uniqueKey"
6
+ ref="table"
7
+ :columns="columns"
8
+ :options="options">
9
+ <template #value="{ row }">
10
+ <div v-if="row.percentValue || row.value">
11
+ {{ row.percentValue ? `${row.percentValue}%` : price(row.value) }}
12
+ </div>
13
+ </template>
14
+ <template #minOrderValue="{ row }">
15
+ {{ row.minOrderValue ? price(row.minOrderValue) : '' }}
16
+ </template>
17
+ <template #items="{ row }">
18
+ <div>
19
+ <customer-coupon-products
20
+ v-if="row.products && row.products.length > 0"
21
+ :coupon="row" />
22
+ <customer-coupon-prints
23
+ v-if="row.prints && row.prints.length > 0"
24
+ :coupon="row" />
25
+ </div>
26
+ </template>
27
+ <template #apply="{ row }">
28
+ <div class="CustomerCoupon__apply">
29
+ <customer-coupon-apply :coupon="row" />
30
+ </div>
31
+ </template>
32
+ </v-server-table>
33
+ </client-only>
34
+ </div>
35
+ </template>
36
+
37
+ <script>
38
+ import { mapGetters } from 'vuex';
39
+ import Vue from 'vue';
40
+ import { ServerTable } from 'vue-tables-2';
41
+ import CustomerCouponApply from './customer_coupon_apply/customer-coupon-apply';
42
+ import CustomerCouponPrints from './customer_coupon_prints/customer-coupon-prints';
43
+ import CustomerCouponProducts from './customer_coupon_products/customer-coupon-products';
44
+ import { _get } from '@lancom/shared/assets/js/api/helpers';
45
+ import { price } from '@lancom/shared/assets/js/utils/filters';
46
+
47
+ Vue.use(ServerTable);
48
+
49
+ export default {
50
+ name: 'CustomerCoupons',
51
+ components: {
52
+ CustomerCouponApply,
53
+ CustomerCouponPrints,
54
+ CustomerCouponProducts
55
+ },
56
+ props: {
57
+ customer: {
58
+ type: Object,
59
+ required: true
60
+ }
61
+ },
62
+ data() {
63
+ return {
64
+ uniqueKey: Date.now(),
65
+ orders: [],
66
+ columns: ['name', 'code', 'value', 'minOrderValue', 'items', 'apply']
67
+ }
68
+ },
69
+ computed: {
70
+ ...mapGetters(['shop']),
71
+ url() {
72
+ return `shop/${this.shop._id}/customer/${this.customer._id}/coupons`;
73
+ },
74
+ options() {
75
+ return {
76
+ query: null,
77
+ perPage: 15,
78
+ perPageValues: [15],
79
+ initialPage: 1,
80
+ filterable: false,
81
+ headings: { select: '' },
82
+ requestFunction: params => this.request(params),
83
+ columnsClasses: {
84
+ controls: 'controls-column'
85
+ }
86
+ };
87
+ }
88
+ },
89
+ methods: {
90
+ price,
91
+ async request(params) {
92
+ const query = { ...params };
93
+ const result = await _get(this.url, query);
94
+ return result;
95
+ },
96
+ }
97
+ };
98
+ </script>
99
+
100
+ <style lang="scss">
101
+ @import 'customer-coupons';
102
+ </style>
103
+
@@ -0,0 +1 @@
1
+ @import "@/assets/scss/variables";
@@ -0,0 +1,51 @@
1
+ <template>
2
+ <div class="CustomerCouponApply__wrapper">
3
+ <btn
4
+ btn-class="green"
5
+ :btn-disabled="processing"
6
+ :btn-processing="processing"
7
+ btn-label="Coupon Apply"
8
+ @onclick="applyCoupon()">
9
+ </btn>
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ import { mapMutations } from 'vuex';
15
+
16
+ export default {
17
+ name: 'CustomerCouponApply',
18
+ data() {
19
+ return {
20
+ processing: false
21
+ }
22
+ },
23
+ props: {
24
+ coupon: {
25
+ type: Object,
26
+ required: true
27
+ }
28
+ },
29
+ methods: {
30
+ ...mapMutations('cart', [
31
+ 'setCoupon'
32
+ ]),
33
+ async applyCoupon() {
34
+ try {
35
+ this.processing = true;
36
+ this.setCoupon(this.coupon);
37
+ this.$router.push('/checkout/cart');
38
+ } catch (e) {
39
+ console.log(e);
40
+ } finally {
41
+ this.processing = false;
42
+ }
43
+ }
44
+ }
45
+ };
46
+ </script>
47
+
48
+ <style lang="scss">
49
+ @import 'customer-coupon-apply';
50
+ </style>
51
+