@lancom/shared 0.0.378 → 0.0.380
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/components/checkout/cart/cart.mixin.js +19 -2
- package/components/checkout/cart/cart.vue +4 -12
- package/components/checkout/order/order-billing-information/order-billing-information.vue +11 -3
- package/components/common/postcode_select/postcode-select.vue +7 -1
- package/mixins/product-view.js +4 -1
- package/package.json +1 -1
- package/plugins/save-state.js +2 -0
- package/store/index.js +1 -5
- package/store/product.js +5 -3
- package/store/products.js +3 -1
|
@@ -15,6 +15,7 @@ export default {
|
|
|
15
15
|
...mapGetters(['shop', 'country', 'currency']),
|
|
16
16
|
...mapGetters('auth', ['user']),
|
|
17
17
|
...mapGetters('cart', [
|
|
18
|
+
'needToPickup',
|
|
18
19
|
'entities',
|
|
19
20
|
'cartPricing',
|
|
20
21
|
'simpleProducts',
|
|
@@ -27,6 +28,17 @@ export default {
|
|
|
27
28
|
'notValidStockQuantities',
|
|
28
29
|
'notValidPrintsQuantities'
|
|
29
30
|
]),
|
|
31
|
+
wantsToPickup: {
|
|
32
|
+
get() {
|
|
33
|
+
return this.needToPickup;
|
|
34
|
+
},
|
|
35
|
+
set(needToPickup) {
|
|
36
|
+
if (needToPickup) {
|
|
37
|
+
this.setSuburb(null);
|
|
38
|
+
}
|
|
39
|
+
this.setNeedToPickup(needToPickup);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
30
42
|
isNotValidQuantity() {
|
|
31
43
|
return this.isNotValidProductsQuantity || this.isNotValidStockQuantity || this.isNotValidPrintsQuantity || this.isNotValidPrintsBigSizeQuantity;
|
|
32
44
|
},
|
|
@@ -45,17 +57,18 @@ export default {
|
|
|
45
57
|
},
|
|
46
58
|
watch: {
|
|
47
59
|
entities() {
|
|
48
|
-
this.calculateCartPriceWithDebounce({ shop: this.shop, country: this.country });
|
|
60
|
+
this.calculateCartPriceWithDebounce({ shop: this.shop, country: this.country, currency: this.currency });
|
|
49
61
|
}
|
|
50
62
|
},
|
|
51
63
|
mounted() {
|
|
52
|
-
this.calculateCartPriceWithDebounce({ shop: this.shop, country: this.country });
|
|
64
|
+
this.calculateCartPriceWithDebounce({ shop: this.shop, country: this.country, currency: this.currency });
|
|
53
65
|
if (!this.suburb && this.user?.suburb) {
|
|
54
66
|
this.handleSuburbChange(this.user.suburb);
|
|
55
67
|
}
|
|
56
68
|
},
|
|
57
69
|
methods: {
|
|
58
70
|
...mapMutations('cart', [
|
|
71
|
+
'setNeedToPickup',
|
|
59
72
|
'setSuburb',
|
|
60
73
|
'setCoupon'
|
|
61
74
|
]),
|
|
@@ -63,8 +76,12 @@ export default {
|
|
|
63
76
|
'removeSimpleProductsFromCart',
|
|
64
77
|
'calculateCartPrice'
|
|
65
78
|
]),
|
|
79
|
+
recalculatePricing() {
|
|
80
|
+
this.calculateCartPriceWithDebounce({ shop: this.shop, country: this.country, currency: this.currency });
|
|
81
|
+
},
|
|
66
82
|
handleSuburbChange(suburb) {
|
|
67
83
|
this.setSuburb(suburb);
|
|
84
|
+
this.setNeedToPickup(false);
|
|
68
85
|
this.calculateCartPrice({ shop: this.shop, country: this.country, currency: this.currency });
|
|
69
86
|
},
|
|
70
87
|
handleCouponChange(coupon) {
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
<checkbox
|
|
37
37
|
v-model="wantsToPickup"
|
|
38
38
|
:disabled="hasNotValidProductsPickup"
|
|
39
|
-
:dark="true"
|
|
39
|
+
:dark="true"
|
|
40
|
+
@change="recalculatePricing()">
|
|
40
41
|
<div class="ml-10 Cart__pickup-label">Wants to pickup</div>
|
|
41
42
|
</checkbox>
|
|
42
43
|
</div>
|
|
@@ -63,7 +64,7 @@
|
|
|
63
64
|
<btn
|
|
64
65
|
:btn-disabled="isNotValidQuantity || cartPricingError || cartPricingCalculating"
|
|
65
66
|
:btn-block="true"
|
|
66
|
-
:to="
|
|
67
|
+
:to="'/checkout/order'"
|
|
67
68
|
btn-class="green"
|
|
68
69
|
btn-label="PROCEED TO CHECKOUT">
|
|
69
70
|
<i
|
|
@@ -113,15 +114,7 @@ export default {
|
|
|
113
114
|
mixins: [CartMixin],
|
|
114
115
|
computed: {
|
|
115
116
|
...mapGetters(['MESSAGES', 'SETTINGS', 'currency', 'country']),
|
|
116
|
-
...mapGetters('cart', ['isEmpty', '
|
|
117
|
-
wantsToPickup: {
|
|
118
|
-
get() {
|
|
119
|
-
return this.needToPickup;
|
|
120
|
-
},
|
|
121
|
-
set(needToPickup) {
|
|
122
|
-
this.setNeedToPickup(needToPickup);
|
|
123
|
-
}
|
|
124
|
-
},
|
|
117
|
+
...mapGetters('cart', ['isEmpty', 'notValidProductsPickup','cartPricingError', 'cartPricing', 'cartPricingCalculating', 'entities']),
|
|
125
118
|
hasNotValidProductsPickup() {
|
|
126
119
|
return this.notValidProductsPickup.length > 0;
|
|
127
120
|
},
|
|
@@ -148,7 +141,6 @@ export default {
|
|
|
148
141
|
}
|
|
149
142
|
},
|
|
150
143
|
methods: {
|
|
151
|
-
...mapMutations('cart', ['setNeedToPickup']),
|
|
152
144
|
loadedPricing() {
|
|
153
145
|
gtm.viewCart(this.entities, this.cartPricing, this.currency);
|
|
154
146
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="OrderBillingInformation__wrapper">
|
|
3
3
|
<div class="lc_h3 lc_uppercase lc_bold">
|
|
4
|
-
Delivery Address
|
|
4
|
+
{{ needToPickup ? 'Contact Info' : 'Delivery Address' }}
|
|
5
5
|
</div>
|
|
6
6
|
<div class="OrderBillingInformation__form">
|
|
7
7
|
<validation-observer
|
|
@@ -10,8 +10,11 @@
|
|
|
10
10
|
<div class="OrderBillingInformation__content">
|
|
11
11
|
<address-form
|
|
12
12
|
:address="order.shippingAddress"
|
|
13
|
+
:only-contact-info="needToPickup"
|
|
13
14
|
:without-additional-info="true" />
|
|
14
|
-
<div
|
|
15
|
+
<div
|
|
16
|
+
v-if="!needToPickup"
|
|
17
|
+
class="mt-20 mb-20">
|
|
15
18
|
<checkbox
|
|
16
19
|
v-model="copyToBillingAddress"
|
|
17
20
|
:dark="true">
|
|
@@ -74,11 +77,16 @@ export default {
|
|
|
74
77
|
computed: {
|
|
75
78
|
...mapGetters(['currency'])
|
|
76
79
|
},
|
|
80
|
+
mounted() {
|
|
81
|
+
if (this.needToPickup) {
|
|
82
|
+
this.copyToBillingAddress = false;
|
|
83
|
+
}
|
|
84
|
+
},
|
|
77
85
|
methods: {
|
|
78
86
|
async submit() {
|
|
79
87
|
this.isSubmit = true;
|
|
80
88
|
|
|
81
|
-
const isValid = await this.$refs.form.validate() && !!this.order.shippingAddress.postcode;
|
|
89
|
+
const isValid = await this.$refs.form.validate() && (!!this.order.shippingAddress.postcode || this.needToPickup);
|
|
82
90
|
if (!isValid) {
|
|
83
91
|
return;
|
|
84
92
|
}
|
|
@@ -149,11 +149,17 @@ export default {
|
|
|
149
149
|
return this.selected?._id ? this.selected : null;
|
|
150
150
|
},
|
|
151
151
|
set(option) {
|
|
152
|
-
|
|
153
152
|
this.updatePostcode(option);
|
|
154
153
|
}
|
|
155
154
|
}
|
|
156
155
|
},
|
|
156
|
+
watch: {
|
|
157
|
+
suburb() {
|
|
158
|
+
if (!this.suburb) {
|
|
159
|
+
this.selected = null;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
157
163
|
mounted() {
|
|
158
164
|
if (this.suburb) {
|
|
159
165
|
const option = this.createOptionFromSuburb(this.suburb);
|
package/mixins/product-view.js
CHANGED
|
@@ -62,7 +62,10 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
|
|
|
62
62
|
const pageItem = store.getters['product/product'];
|
|
63
63
|
const loadError = store.getters['product/loadError'];
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
// console.log('loadError: ', loadError);
|
|
66
|
+
if (loadError?.redirectLink) {
|
|
67
|
+
return redirect(301, loadError?.redirectLink);
|
|
68
|
+
} else if (loadError) {
|
|
66
69
|
error(loadError);
|
|
67
70
|
}
|
|
68
71
|
|
package/package.json
CHANGED
package/plugins/save-state.js
CHANGED
|
@@ -6,6 +6,8 @@ const SAVE_STATE_MODULES = new Map([
|
|
|
6
6
|
['cart/setId', 'cart.id'],
|
|
7
7
|
['cart/clearCart', 'cart.id'],
|
|
8
8
|
['cart/setCoupon', 'cart.coupon'],
|
|
9
|
+
['cart/setNeedToPickup', 'cart.needToPickup'],
|
|
10
|
+
['cart/setSuburb', 'cart.suburb'],
|
|
9
11
|
['cart/clearCart', 'cart.coupon']
|
|
10
12
|
]);
|
|
11
13
|
|
package/store/index.js
CHANGED
|
@@ -53,7 +53,7 @@ export const getters = {
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
export const actions = {
|
|
56
|
-
async nuxtServerInit({ commit }, { req
|
|
56
|
+
async nuxtServerInit({ commit }, { req }) {
|
|
57
57
|
const shop = await api.fetchShopByUrl(process.env.HOST_NAME);
|
|
58
58
|
const menus = await api.fetchMenus(shop._id);
|
|
59
59
|
commit('setMenus', menus);
|
|
@@ -98,10 +98,6 @@ export const actions = {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
} catch (e) {}
|
|
101
|
-
|
|
102
|
-
if (query?.needToPickup === 'true') {
|
|
103
|
-
commit('cart/setNeedToPickup', true);
|
|
104
|
-
}
|
|
105
101
|
},
|
|
106
102
|
async loadState({ dispatch, commit, state: { shop, currency, country, notificationBar } }, query) {
|
|
107
103
|
const state = await loadState();
|
package/store/product.js
CHANGED
|
@@ -172,12 +172,14 @@ export const actions = {
|
|
|
172
172
|
commit('setIsPrintPricing', true);
|
|
173
173
|
}
|
|
174
174
|
} catch (e) {
|
|
175
|
-
console.log(e);
|
|
175
|
+
// console.log(e);
|
|
176
176
|
const { status, data } = e?.response || {};
|
|
177
|
+
// console.log('data: ', data);
|
|
177
178
|
const statusCode = status || 500;
|
|
178
179
|
commit('setLoadError', {
|
|
179
180
|
statusCode,
|
|
180
|
-
message: data?.error || 'Product not found'
|
|
181
|
+
message: data?.error || 'Product not found',
|
|
182
|
+
redirectLink: data?.redirectLink || null
|
|
181
183
|
});
|
|
182
184
|
}
|
|
183
185
|
},
|
|
@@ -265,7 +267,7 @@ export const actions = {
|
|
|
265
267
|
printType: selectedPrintType?._id
|
|
266
268
|
}
|
|
267
269
|
});
|
|
268
|
-
console.log('layer: ', layer);
|
|
270
|
+
// console.log('layer: ', layer);
|
|
269
271
|
if (preselect) {
|
|
270
272
|
commit('setSelectedLayer', layer);
|
|
271
273
|
}
|
package/store/products.js
CHANGED
|
@@ -69,11 +69,13 @@ export const actions = {
|
|
|
69
69
|
return { products };
|
|
70
70
|
} catch (e) {
|
|
71
71
|
const { status, data } = e?.response || {};
|
|
72
|
+
// console.log(e.response.data)
|
|
72
73
|
const statusCode = status || 500;
|
|
73
74
|
// console.log('statusCode: ', statusCode, data?.error || 'Post not found');
|
|
74
75
|
commit('setLoadError', {
|
|
75
76
|
statusCode,
|
|
76
|
-
error: data?.error || 'Post not found'
|
|
77
|
+
error: data?.error || 'Post not found',
|
|
78
|
+
redirectLink: data?.redirectLink || null
|
|
77
79
|
});
|
|
78
80
|
throw e;
|
|
79
81
|
}
|