@lancom/shared 0.0.322 → 0.0.324

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.
@@ -31,6 +31,9 @@ export default {
31
31
  type: String,
32
32
  required: true
33
33
  },
34
+ color: {
35
+ type: Object
36
+ },
34
37
  size: {
35
38
  default: 'small',
36
39
  validator(value) {
@@ -81,7 +84,7 @@ export default {
81
84
  return this.print && this.getImageBackground(this.print);
82
85
  },
83
86
  image() {
84
- const color = this.defaultPreview ? null : (this.product.color || (this.product.colors || [])[0]);
87
+ const color = this.defaultPreview ? null : (this.color || this.product.color || (this.product.colors || [])[0]);
85
88
  const product = this.product?.product || this.product;
86
89
  return getColorImage(product, this.size, this.side, color) || getProductCover(product, this.size, this.side, color);
87
90
  },
@@ -102,11 +105,14 @@ export default {
102
105
  this.$modal.show(
103
106
  ImageViewer,
104
107
  {
105
- items: this.products.map(product => ({
106
- src: getColorImage(product, 'large', this.side),
107
- print: this.print,
108
- color: product.color.rgb
109
- })),
108
+ items: this.products.map(product => {
109
+ const p = product.product || product;
110
+ return {
111
+ src: getColorImage(p, 'large', this.side, this.color) || getProductCover(p, this.size, this.side, this.color),
112
+ print: this.print,
113
+ color: this.color?.rgb || product.color?.rgb
114
+ };
115
+ }),
110
116
  index: this.products.indexOf(this.product)
111
117
  },
112
118
  {
@@ -7,6 +7,7 @@
7
7
  <product-side-with-print
8
8
  :product="product"
9
9
  :side="side"
10
+ :color="color"
10
11
  :default-preview="defaultPreview"
11
12
  size="medium" />
12
13
  </div>
@@ -31,6 +32,9 @@ export default {
31
32
  type: Object,
32
33
  required: true
33
34
  },
35
+ defaultColor: {
36
+ type: Object
37
+ },
34
38
  defaultPreview: {
35
39
  type: Boolean,
36
40
  default: true
@@ -39,6 +43,10 @@ export default {
39
43
  computed: {
40
44
  sides() {
41
45
  return Object.keys(this.product.printsThumbnails || {});
46
+ },
47
+ color() {
48
+ const simpleProduct = this.product.simpleProducts?.find(sp => sp.amount > 0);
49
+ return this.defaultColor || simpleProduct?.color;
42
50
  }
43
51
  }
44
52
  };
@@ -1,6 +1,7 @@
1
1
  import { mapGetters } from 'vuex';
2
2
  import { price, shortDate, tax } from '@lancom/shared/assets/js/utils/filters';
3
3
  import { getShopCountrySettings } from '@lancom/shared/assets/js/utils/shop';
4
+ import { isSameAddresses } from '@lancom/shared/assets/js/utils/address';
4
5
 
5
6
  export default {
6
7
  filters: {
@@ -34,6 +35,9 @@ export default {
34
35
  isPaid() {
35
36
  return this.model.paymentStatus === 'paid';
36
37
  },
38
+ isDisplayShippingAddress() {
39
+ return !isSameAddresses(this.order.shippingAddress, this.displayAddress);
40
+ },
37
41
  orderId() {
38
42
  return `${this.order.code}`.replace('ORDER', '');
39
43
  },
@@ -67,6 +71,16 @@ export default {
67
71
  purchaseOrderNumber() {
68
72
  return this.invoice?.purchaseOrderNumber || this.order.purchaseOrderNumber;
69
73
  },
74
+ shippingAddress() {
75
+ return [
76
+ this.order.shippingAddress?.addressLine1,
77
+ this.order.shippingAddress?.addressLine2,
78
+ this.order.shippingAddress?.city,
79
+ this.order.shippingAddress?.postcode,
80
+ this.order.shippingAddress?.state,
81
+ this.order.shippingAddress?.country
82
+ ].filter(i => !!i).join(', ');
83
+ },
70
84
  orderAddress() {
71
85
  return [
72
86
  this.displayAddress.addressLine1,
@@ -64,6 +64,11 @@
64
64
  <div class="lc_regular16">
65
65
  <b>Order</b>
66
66
  </div>
67
+ <div
68
+ v-if="isDisplayShippingAddress"
69
+ class="mt-10">
70
+ <b>Billing Address</b>
71
+ </div>
67
72
  <div class="lc_regular16">
68
73
  {{ fullName }}
69
74
  </div>
@@ -86,6 +91,35 @@
86
91
  <div class="lc_regular16">
87
92
  {{ additionalInfo }}
88
93
  </div>
94
+ <div
95
+ v-if="isDisplayShippingAddress && order.shippingAddress"
96
+ class="mt-10">
97
+ <div>
98
+ <b>Shipping Address</b>
99
+ </div>
100
+ <div class="lc_regular16">
101
+ {{ order.shippingAddress.fullName }}
102
+ </div>
103
+ <div
104
+ v-if="order.shippingAddress.company"
105
+ class="lc_regular16">
106
+ {{ order.shippingAddress.company }}
107
+ </div>
108
+ <div
109
+ v-if="order.shippingAddress.phone"
110
+ class="lc_regular16">
111
+ {{ order.shippingAddress.phone }}
112
+ </div>
113
+ <div class="lc_regular16">
114
+ {{ order.shippingAddress.email }}
115
+ </div>
116
+ <div class="lc_regular16">
117
+ {{ shippingAddress }}
118
+ </div>
119
+ <div class="lc_regular16">
120
+ {{ order.shippingAddress.additionalInfo }}
121
+ </div>
122
+ </div>
89
123
  </td>
90
124
  <td
91
125
  v-if="model.paid"
@@ -132,11 +132,12 @@ export default {
132
132
  if ((print.products || []).indexOf(this.product.guid) > 0) {
133
133
  isFreePricing = true;
134
134
  }
135
- const printCost = print.costType === 'setup only' ? 0 : print.printCost;
136
- const setupCost = (print.costType === 'item cost only' || isFreePricing) ? 0 : print.setupCost;
135
+ const printCost = (print.costType === 'setup only' ? 0 : print.printCost) || 0;
136
+ const setupCost = ((print.costType === 'item cost only' || isFreePricing) ? 0 : print.setupCost) || 0;
137
137
  return total + this.amount * printCost + setupCost;
138
138
  }, 0);
139
- const productsTotal = this.simpleProducts.reduce((total, { amount = 0, productCost = 0 }) => total + amount * productCost, 0);
139
+ console.log('totalPrice: ', productsTotal, printsTotal);
140
+ const productsTotal = this.simpleProducts.reduce((total, { amount = 0, productCost = 0 }) => total + (amount || 0) * (productCost || 0), 0);
140
141
  return this.amount > 0 ? (printsTotal + productsTotal) : 0;
141
142
  }
142
143
  }
@@ -18,7 +18,7 @@
18
18
  <div
19
19
  v-if="currentImage.print.pricing"
20
20
  class="Gallery__big-print-price">
21
- Printing at <price :price="currentImage.print.pricing.price" /> for ({{ image.print.pricing.min || 1 }}+)
21
+ Printing at <price :price="currentImage.print.pricing.price" /> for ({{ currentImage.print.pricing.min || 1 }}+)
22
22
  </div>
23
23
  <div class="Gallery__big-print-price-info">
24
24
  example only
@@ -30,12 +30,14 @@
30
30
  <tr>
31
31
  <td>
32
32
  <div><b>QUOTE</b></div>
33
- <div>{{ quote.address.fullName }}</div>
34
- <div v-if="quote.address.company">{{ quote.address.company }}</div>
35
- <div v-if="quote.address.phone">{{ quote.address.phone }}</div>
36
- <div>{{ quote.address.email }}</div>
37
- <div>{{ quoteAddress }}</div>
38
- <div>{{ quote.address.additionalInfo }}</div>
33
+ <div v-if="quote.address">
34
+ <div>{{ quote.address.fullName }}</div>
35
+ <div v-if="quote.address.company">{{ quote.address.company }}</div>
36
+ <div v-if="quote.address.phone">{{ quote.address.phone }}</div>
37
+ <div>{{ quote.address.email }}</div>
38
+ <div>{{ quoteAddress }}</div>
39
+ <div>{{ quote.address.additionalInfo }}</div>
40
+ </div>
39
41
  </td>
40
42
  <td class="w-50">
41
43
  <div><b>{{ MESSAGES.DIRECT_DEPOSIT_DETAILS || 'DIRECT DEPOSIT DETAILS'}}</b></div>
@@ -41,7 +41,7 @@ async function googleShoppingFeed(axios, config, availableStores, country, endSl
41
41
  const backImages = (product.images || []).filter(i => (i.types || []).includes('back') && sp.color._id === i.color).map(i => i.image);
42
42
  const catalogFrontImages = (product.images || []).filter(i => (i.types || []).includes('catalog_front')).map(i => i.image);
43
43
  const image = spliceFirstImage(feedImages) || spliceFirstImage(frontImages) || spliceFirstImage(catalogFrontImages) || spliceFirstImage(backImages) || null;
44
- const images = getImages(backImages) || getImages(frontImages) || [];
44
+ const images = (!backImages?.includes(image) && getImages(backImages)) || (!frontImages?.includes(image) && getImages(frontImages)) || [];
45
45
  const feedTitle = (product.feedTitle || '')
46
46
  .replace(/{colour}/g, sp.color.name)
47
47
  .replace(/{size}/g, sp.size.name)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.322",
3
+ "version": "0.0.324",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
package/store/quote.js CHANGED
@@ -10,6 +10,7 @@ export const state = () => ({
10
10
 
11
11
  export const getters = {
12
12
  quote: ({ quote }) => quote,
13
+ address: ({ quote }) => quote.address || quote.billingAddress,
13
14
  viewedOptions: ({ viewedOptions }) => viewedOptions,
14
15
  viewedOptionsMap: ({ viewedOptions }) => viewedOptions?.reduce((data, option) => ({ ...data, [option]: true }), {}),
15
16
  option: ({ option }) => option,