@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.
- package/assets/scss/ui_kit/_grid.scss +1 -1
- package/components/checkout/order/address-form/address-form.scss +8 -0
- package/components/checkout/order/address-form/address-form.vue +3 -0
- package/components/checkout/order/order-billing-information/order-billing-information.vue +32 -8
- package/components/checkout/order/order.vue +1 -1
- package/components/common/product_side_with_print/product-side-with-print.vue +1 -1
- package/components/modals/order_modal/order-modal.vue +1 -1
- package/components/order/order_product_prints_preview/order-product-prints-preview.vue +5 -0
- package/package.json +1 -1
- package/store/product.js +3 -1
|
@@ -11,17 +11,20 @@
|
|
|
11
11
|
<address-form
|
|
12
12
|
:address="order.shippingAddress"
|
|
13
13
|
:without-additional-info="true" />
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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-
|
|
22
|
-
<h5 class="
|
|
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:
|
|
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
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
|
|
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);
|