@lancom/shared 0.0.409 → 0.0.411

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.
@@ -43,11 +43,6 @@ export default {
43
43
  components: {
44
44
  ProductMultipack
45
45
  },
46
- data() {
47
- return {
48
- thumbsPage: 0
49
- };
50
- },
51
46
  props: {
52
47
  product: {
53
48
  type: Object,
@@ -70,8 +65,10 @@ export default {
70
65
  default: 3
71
66
  }
72
67
  },
73
- created() {
74
- console.log('LancomProductMultipacks...')
68
+ data() {
69
+ return {
70
+ thumbsPage: 0
71
+ };
75
72
  },
76
73
  computed: {
77
74
  ...mapGetters(['currency']),
@@ -25,7 +25,7 @@
25
25
  </div>
26
26
  </div>
27
27
  <div class="ProductMultipack__price">
28
- {{ oneItemPrice | price(currency) }} each
28
+ {{ oneItemPrice | price(currency) }} each
29
29
  <span>{{ totalPrice | price(currency) }}</span>
30
30
  </div>
31
31
  </div>
@@ -79,7 +79,9 @@ export default {
79
79
  return simpleProducts.find(sp => sp.size?.shortName === simpleProduct?.size?.shortName) || simpleProducts[0];
80
80
  },
81
81
  totalPrice() {
82
- return this.oneItemPrice * this.multipack.qty;
82
+ const itemPrice = priceFromRange(this.multipack.qty, this.simpleProduct?.pricing);
83
+ const price = itemPrice * this.multipack.qty;
84
+ return this.withGst ? tax(price, this.gstTax) : price;
83
85
  },
84
86
  oneItemPrice() {
85
87
  const price = priceFromRange(this.multipack.qty, this.simpleProduct?.pricing);
@@ -126,10 +126,10 @@
126
126
  return 'product';
127
127
  },
128
128
  pageItemImage() {
129
- const images = this.products.reduce((images, product) => {
129
+ const images = this.products?.reduce((images, product) => {
130
130
  const image = getProductLargeCover(product, 'front') || getProductMediumCover(product, 'front');
131
131
  return image ? [...images, image] : images;
132
- }, []);
132
+ }, []) || [];
133
133
  return images.slice(0, 1);
134
134
  },
135
135
  currentBrand() {
@@ -42,7 +42,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
42
42
  const redirectUrl = generateProductLink(product, data.defaultColor, isEditor);
43
43
  return redirect(301, redirectUrl);
44
44
  }
45
-
45
+
46
46
  if (params.sku && params.sku !== product?.SKU?.toLowerCase()) {
47
47
  return error({ statusCode: 404, message: 'Product not found' });
48
48
  }
@@ -58,6 +58,11 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
58
58
  if (query.price) {
59
59
  store.commit('product/setPriceIncludeGST', query.price === 'IT');
60
60
  }
61
+ if (query.multipack) {
62
+ const multipackQty = +query.multipack.split('-multipack-')[1];
63
+ const multipack = product.multipacks?.find(m => m.qty === multipackQty);
64
+ store.commit('product/setMultipack', multipack);
65
+ }
61
66
  } catch (e) {
62
67
  console.log(e);
63
68
  }
@@ -179,7 +184,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
179
184
  }
180
185
  } catch (e) {
181
186
  }
182
-
187
+
183
188
  this.fillBreadcrumbs();
184
189
  const { multipack } = this.$route.query;
185
190
  if (multipack) {
@@ -277,7 +282,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
277
282
  const maxPrice = this.printsPrice ? spMaxPrice + this.printsPrice : spMaxPrice;
278
283
  const availability = sp.quantityStock > 0 ? 'InStock' : 'OutOfStock';
279
284
  const name = `${this.product.name} | ${sp.size?.shortName || ''} ${sp.color?.name || ''}`;
280
-
285
+
281
286
  const offer = {
282
287
  '@type': 'Offer',
283
288
  name,
@@ -309,7 +314,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
309
314
  // if (sp.quantityStock > 0) {
310
315
  // }
311
316
  }
312
-
317
+
313
318
  offer.shippingDetails = { "@id": "#shipping_policy" };
314
319
  offer.hasMerchantReturnPolicy = { "@id": "#return_policy" };
315
320
 
@@ -422,4 +427,4 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
422
427
  this.$store.state.shop?.shippingPolicySchema
423
428
  ].filter(s => !!s);
424
429
  }
425
- });
430
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.409",
3
+ "version": "0.0.411",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {