@lancom/shared 0.0.309 → 0.0.310

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.
@@ -783,7 +783,7 @@
783
783
  margin-left: auto !important;
784
784
  }
785
785
  // margins
786
- @for $i from 1 through 10 {
786
+ @for $i from 1 through 20 {
787
787
  .mt-#{$i} {
788
788
  margin-top: #{$i}px !important;
789
789
  }
@@ -14,4 +14,12 @@
14
14
  }
15
15
  }
16
16
  }
17
+ }
18
+
19
+ .CustomerAddressForm {
20
+ &__copy-btn {
21
+ position: absolute;
22
+ top: 5px;
23
+ right: 5px;
24
+ }
17
25
  }
@@ -258,6 +258,9 @@ export default {
258
258
  type: Object,
259
259
  required: true
260
260
  },
261
+ copyFrom: {
262
+ type: Object
263
+ },
261
264
  withoutAdditionalInfo: {
262
265
  type: Boolean,
263
266
  default: false
@@ -11,17 +11,20 @@
11
11
  <address-form
12
12
  :address="order.shippingAddress"
13
13
  :without-additional-info="true" />
14
- <checkbox
15
- v-model="copyToBillingAddress"
16
- :dark="true">
17
- <div class="ml-5">Use same address as the billing address</div>
18
- </checkbox>
14
+ <div class="mt-20 mb-20">
15
+ <checkbox
16
+ v-model="copyToBillingAddress"
17
+ :dark="true">
18
+ <div class="ml-5">Use same address as the billing address</div>
19
+ </checkbox>
20
+ </div>
19
21
  <div
20
22
  v-if="!copyToBillingAddress"
21
- class="mt-7">
22
- <h5 class="lc_h4 mb-7">Billind Address</h5>
23
+ class="mt-15">
24
+ <h5 class="lc_h3 lc_uppercase lc_bold mt-10 mb-15">Billing Address</h5>
23
25
  <address-form
24
26
  :address="order.billingAddress"
27
+ :copy-from="order.shippingAddress"
25
28
  :without-additional-info="true" />
26
29
  </div>
27
30
  </div>
@@ -46,6 +49,27 @@ import CartMixin from '@lancom/shared/components/checkout/cart/cart.mixin';
46
49
  import AddressForm from '@/components/checkout/order/address-form/address-form';
47
50
  import ProgressStepsControls from '@lancom/shared/components/common/progress_steps/progress_steps_controls/progress-steps-controls';
48
51
 
52
+ function isSameAddresses(address, billingAddress) {
53
+ if (!billingAddress) {
54
+ return true;
55
+ }
56
+ const fields = [
57
+ 'fullName',
58
+ 'additionalInfo',
59
+ 'addressLine1',
60
+ 'addressLine2',
61
+ 'city',
62
+ 'company',
63
+ 'country',
64
+ 'email',
65
+ 'phone',
66
+ 'postcode',
67
+ 'state'
68
+ ];
69
+ const getKey = model => fields.reduce((v, field) => `${v}-${model[field] || ''}`, '');
70
+ return address && getKey(address) === getKey(billingAddress);
71
+ }
72
+
49
73
  export default {
50
74
  name: 'OrderBillingInformation',
51
75
  mixins: [CartMixin],
@@ -62,7 +86,7 @@ export default {
62
86
  },
63
87
  data() {
64
88
  return {
65
- copyToBillingAddress: true,
89
+ copyToBillingAddress: isSameAddresses(this.order?.shippingAddress, this.order?.billingAddress),
66
90
  isSubmit: false
67
91
  };
68
92
  },
@@ -106,7 +106,7 @@ export default {
106
106
  this.order = {
107
107
  paymentMethod: 'card',
108
108
  billingAddress: {
109
- ...address,
109
+ ...JSON.parse(JSON.stringify(address)),
110
110
  ...(this.user ? {
111
111
  fullName: `${this.user.firstName} ${this.user.lastName}`,
112
112
  phone: this.user.phone,
@@ -81,7 +81,7 @@ export default {
81
81
  return this.print && this.getImageBackground(this.print);
82
82
  },
83
83
  image() {
84
- const color = this.defaultPreview ? null : this.product.color;
84
+ const color = this.defaultPreview ? null : (this.product.color || (this.product.colors || [])[0]);
85
85
  const product = this.product?.product || this.product;
86
86
  return getColorImage(product, this.size, this.side, color) || getProductCover(product, this.size, this.side, color);
87
87
  },
@@ -361,7 +361,7 @@ export default {
361
361
  recaptchaToken,
362
362
  currency: this.currency?._id,
363
363
  country: this.country?._id,
364
- billingAddress: this.form,
364
+ billingAddress: JSON.parse(JSON.stringify(this.form)),
365
365
  shippingAddress: this.form,
366
366
  products: this.entities,
367
367
  pricing: this.cartPricing,
@@ -7,6 +7,7 @@
7
7
  <product-side-with-print
8
8
  :product="product"
9
9
  :side="side"
10
+ :default-preview="defaultPreview"
10
11
  size="medium" />
11
12
  </div>
12
13
  </div>
@@ -29,6 +30,10 @@ export default {
29
30
  product: {
30
31
  type: Object,
31
32
  required: true
33
+ },
34
+ defaultPreview: {
35
+ type: Boolean,
36
+ default: true
32
37
  }
33
38
  },
34
39
  computed: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.309",
3
+ "version": "0.0.310",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
package/store/product.js CHANGED
@@ -205,7 +205,9 @@ export const actions = {
205
205
  },
206
206
  async calculateProductPrice({ state: { template, product, isPrintPricing }, commit, getters }, { shop, country, currency }) {
207
207
  commit('setCalculatingPrice', true);
208
- const entities = getProductsForCalculatePricing(product, getters.usedSimpleProducts, template.layers, isPrintPricing, true);
208
+ const spProducts = getters.usedSimpleProducts?.length > 0 ? getters.usedSimpleProducts : (getters.defaultSimpleProduct ? [{ ...getters.defaultSimpleProduct, amount: 1 }] : []);
209
+ const entities = getProductsForCalculatePricing(product, spProducts, template.layers, isPrintPricing, true);
210
+
209
211
  const response = await api.calculateProductPrice({ entities, country: country?._id, currency: currency?._id }, shop._id);
210
212
  commit('setProductPricing', response);
211
213
  commit('setCalculatingPrice', false);