@lancom/shared 0.0.58 → 0.0.64
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 +5 -0
- package/components/checkout/order/address-form/address-form.vue +7 -1
- package/components/checkout/order/order-checkout-method/order-checkout-method.scss +9 -0
- package/components/checkout/order/order-checkout-method/order-checkout-method.vue +73 -4
- package/components/checkout/order/order.vue +2 -1
- package/components/common/stars-mark.vue +1 -0
- package/components/customer/customer.scss +9 -0
- package/components/customer/customer.vue +84 -0
- package/components/customer/customer_form/customer-form.scss +12 -0
- package/components/customer/customer_form/customer-form.vue +211 -150
- package/components/customer/signin_form/signin-form.vue +2 -2
- package/components/pages/customer/create/create.vue +4 -1
- package/components/quotes/quote_request/quote-request.scss +2 -2
- package/components/quotes/quote_request/quote-request.vue +2 -2
- package/nuxt.config.js +44 -3
- package/package.json +1 -1
- package/store/auth.js +11 -12
|
@@ -7,6 +7,7 @@ export default {
|
|
|
7
7
|
],
|
|
8
8
|
computed: {
|
|
9
9
|
...mapGetters(['shop']),
|
|
10
|
+
...mapGetters('auth', ['user']),
|
|
10
11
|
...mapGetters('cart', [
|
|
11
12
|
'entities',
|
|
12
13
|
'simpleProducts',
|
|
@@ -32,6 +33,10 @@ export default {
|
|
|
32
33
|
},
|
|
33
34
|
mounted() {
|
|
34
35
|
this.calculateCartPrice(this.shop);
|
|
36
|
+
if (!this.suburb && this.user?.suburb) {
|
|
37
|
+
this.handleSuburbChange(this.user.suburb);
|
|
38
|
+
}
|
|
39
|
+
console.log('user: ', this.user);
|
|
35
40
|
},
|
|
36
41
|
methods: {
|
|
37
42
|
...mapMutations('cart', [
|
|
@@ -259,9 +259,15 @@ export default {
|
|
|
259
259
|
...mapGetters(['shop']),
|
|
260
260
|
...mapGetters('cart', [
|
|
261
261
|
'suburb'
|
|
262
|
+
]),
|
|
263
|
+
...mapGetters('auth', [
|
|
264
|
+
'user'
|
|
262
265
|
])
|
|
263
266
|
},
|
|
264
|
-
|
|
267
|
+
created() {
|
|
268
|
+
if (!this.address.suburb && !this.suburb && this.user?.suburb) {
|
|
269
|
+
this.handleSuburbChange(this.user.suburb);
|
|
270
|
+
}
|
|
265
271
|
if (!this.address.suburb) {
|
|
266
272
|
this.setAddressSuburb(this.suburb);
|
|
267
273
|
}
|
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="OrderCheckoutMethod__wrapper">
|
|
3
|
-
<div class="
|
|
4
|
-
|
|
3
|
+
<div class="row">
|
|
4
|
+
<div class="col-12">
|
|
5
|
+
<div class="OrderCheckoutMethod__controls">
|
|
6
|
+
<div>
|
|
7
|
+
<btn
|
|
8
|
+
:btn-class="isRegister ? 'white' : 'green'"
|
|
9
|
+
btn-label="LOG IN"
|
|
10
|
+
:btn-block="true"
|
|
11
|
+
@onclick="isRegister = false" />
|
|
12
|
+
</div>
|
|
13
|
+
<div>
|
|
14
|
+
<btn
|
|
15
|
+
:btn-class="isRegister ? 'green' : 'white'"
|
|
16
|
+
btn-label="REGISTER"
|
|
17
|
+
:btn-block="true"
|
|
18
|
+
@onclick="isRegister = true" />
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
5
22
|
</div>
|
|
6
23
|
<div class="row">
|
|
7
24
|
<div class="col-12">
|
|
8
|
-
<
|
|
25
|
+
<customer-form
|
|
26
|
+
v-if="isRegister"
|
|
27
|
+
:customer="customer"
|
|
28
|
+
@save="createdCustomer($event)" />
|
|
29
|
+
<signin-form
|
|
30
|
+
v-else
|
|
31
|
+
@signin="signin()" />
|
|
9
32
|
</div>
|
|
10
33
|
</div>
|
|
11
34
|
<progress-steps-controls
|
|
@@ -16,14 +39,60 @@
|
|
|
16
39
|
</template>
|
|
17
40
|
|
|
18
41
|
<script>
|
|
42
|
+
import { mapActions, mapGetters } from 'vuex';
|
|
19
43
|
import ProgressStepsControls from '@lancom/shared/components/common/progress_steps/progress_steps_controls/progress-steps-controls';
|
|
20
44
|
import SigninForm from '@lancom/shared/components/customer/signin_form/signin-form';
|
|
45
|
+
import CustomerForm from '@lancom/shared/components/customer/customer_form/customer-form';
|
|
21
46
|
|
|
22
47
|
export default {
|
|
23
48
|
name: 'OrderCheckoutMethod',
|
|
24
49
|
components: {
|
|
25
50
|
ProgressStepsControls,
|
|
26
|
-
SigninForm
|
|
51
|
+
SigninForm,
|
|
52
|
+
CustomerForm
|
|
53
|
+
},
|
|
54
|
+
props: {
|
|
55
|
+
order: {
|
|
56
|
+
type: Object,
|
|
57
|
+
required: true
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
data() {
|
|
61
|
+
return {
|
|
62
|
+
isRegister: false,
|
|
63
|
+
customer: {
|
|
64
|
+
firstName: null,
|
|
65
|
+
lastName: null,
|
|
66
|
+
email: null,
|
|
67
|
+
phone: null,
|
|
68
|
+
password: null
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
computed: {
|
|
73
|
+
...mapGetters('auth', ['user'])
|
|
74
|
+
},
|
|
75
|
+
methods: {
|
|
76
|
+
...mapActions('auth', ['update_user']),
|
|
77
|
+
createdCustomer({ customer: user, token }) {
|
|
78
|
+
this.update_user({ user, token });
|
|
79
|
+
|
|
80
|
+
this.updateorderData(user);
|
|
81
|
+
|
|
82
|
+
this.$emit('next');
|
|
83
|
+
},
|
|
84
|
+
signin() {
|
|
85
|
+
this.updateorderData(this.user);
|
|
86
|
+
this.$emit('next');
|
|
87
|
+
},
|
|
88
|
+
updateorderData(user) {
|
|
89
|
+
if (user) {
|
|
90
|
+
this.order.billingAddress.fullName = this.order.billingAddress.fullName || `${user.firstName} ${user.lastName}`;
|
|
91
|
+
this.order.billingAddress.phone = this.order.billingAddress.phone || user.phone;
|
|
92
|
+
this.order.billingAddress.email = this.order.billingAddress.email || user.email;
|
|
93
|
+
this.order.billingAddress.company = this.order.billingAddress.company || user.company;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
27
96
|
}
|
|
28
97
|
};
|
|
29
98
|
</script>
|
|
@@ -109,7 +109,8 @@ export default {
|
|
|
109
109
|
...(this.user ? {
|
|
110
110
|
fullName: `${this.user.firstName} ${this.user.lastName}`,
|
|
111
111
|
phone: this.user.phone,
|
|
112
|
-
email: this.user.email
|
|
112
|
+
email: this.user.email,
|
|
113
|
+
company: this.user.company
|
|
113
114
|
} : {})
|
|
114
115
|
},
|
|
115
116
|
shippingAddress: {
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="CustomerPage__wrapper">
|
|
3
|
+
<div class="row">
|
|
4
|
+
<div class="col-12">
|
|
5
|
+
<div class="CustomerPage__controls">
|
|
6
|
+
<div>
|
|
7
|
+
<btn
|
|
8
|
+
:btn-class="isRegister ? 'white' : 'green'"
|
|
9
|
+
btn-label="LOG IN"
|
|
10
|
+
:btn-block="true"
|
|
11
|
+
@onclick="isRegister = false" />
|
|
12
|
+
</div>
|
|
13
|
+
<div>
|
|
14
|
+
<btn
|
|
15
|
+
:btn-class="isRegister ? 'green' : 'white'"
|
|
16
|
+
btn-label="REGISTER"
|
|
17
|
+
:btn-block="true"
|
|
18
|
+
@onclick="isRegister = true" />
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="row">
|
|
24
|
+
<div class="col-12">
|
|
25
|
+
<customer-form
|
|
26
|
+
v-if="isRegister"
|
|
27
|
+
:customer="customer"
|
|
28
|
+
@save="createdCustomer($event)" />
|
|
29
|
+
<signin-form
|
|
30
|
+
v-else
|
|
31
|
+
@signin="signin()" />
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script>
|
|
38
|
+
import { mapGetters, mapActions, mapMutations } from 'vuex';
|
|
39
|
+
import SigninForm from '@lancom/shared/components/customer/signin_form/signin-form';
|
|
40
|
+
import CustomerForm from '@lancom/shared/components/customer/customer_form/customer-form';
|
|
41
|
+
|
|
42
|
+
export default {
|
|
43
|
+
name: 'Customer',
|
|
44
|
+
components: {
|
|
45
|
+
SigninForm,
|
|
46
|
+
CustomerForm
|
|
47
|
+
},
|
|
48
|
+
props: {
|
|
49
|
+
activeRegister: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
data() {
|
|
55
|
+
return {
|
|
56
|
+
isRegister: this.activeRegister,
|
|
57
|
+
customer: {
|
|
58
|
+
firstName: null,
|
|
59
|
+
lastName: null,
|
|
60
|
+
email: null,
|
|
61
|
+
phone: null,
|
|
62
|
+
password: null,
|
|
63
|
+
company: null,
|
|
64
|
+
suburb: null,
|
|
65
|
+
signUpForNewsletter: false
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
methods: {
|
|
70
|
+
...mapActions('auth', ['update_user']),
|
|
71
|
+
createdCustomer({ customer: user, token }) {
|
|
72
|
+
this.update_user({ user, token });
|
|
73
|
+
this.$router.push('/');
|
|
74
|
+
},
|
|
75
|
+
signin() {
|
|
76
|
+
this.$router.push('/');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<style lang="scss" scoped>
|
|
83
|
+
@import 'customer.scss';
|
|
84
|
+
</style>
|
|
@@ -1,161 +1,213 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="form__wrapper CustomerFrom__wrapper">
|
|
3
3
|
<validation-observer ref="form">
|
|
4
|
-
<div
|
|
5
|
-
v-if="errorMessage"
|
|
6
|
-
class="alert alert-danger">
|
|
7
|
-
Save error: {{ errorMessage }}
|
|
8
|
-
</div>
|
|
9
4
|
<div class="mt-10">
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
5
|
+
<div class="row">
|
|
6
|
+
<div class="col-6">
|
|
7
|
+
<validation-provider
|
|
8
|
+
v-slot="{ errors }"
|
|
9
|
+
tag="div"
|
|
10
|
+
name="Email"
|
|
11
|
+
rules="required|email"
|
|
12
|
+
class="form-row">
|
|
13
|
+
<label
|
|
14
|
+
for="email"
|
|
15
|
+
class="form-label">
|
|
16
|
+
Email
|
|
17
|
+
</label>
|
|
18
|
+
<input
|
|
19
|
+
id="email"
|
|
20
|
+
ref="email"
|
|
21
|
+
v-model="customer.email"
|
|
22
|
+
name="email"
|
|
23
|
+
type="text"
|
|
24
|
+
class="form-field labelless"
|
|
25
|
+
placeholder="Email"
|
|
26
|
+
:disabled="customer._id"
|
|
27
|
+
:class="{
|
|
28
|
+
'is-invalid': errors.length,
|
|
29
|
+
filled: customer.email
|
|
30
|
+
}" />
|
|
31
|
+
<span
|
|
32
|
+
v-if="errors.length"
|
|
33
|
+
class="form-help is-danger">
|
|
34
|
+
{{ errors[0] }}
|
|
35
|
+
</span>
|
|
36
|
+
</validation-provider>
|
|
37
|
+
<validation-provider
|
|
38
|
+
v-slot="{ errors }"
|
|
39
|
+
tag="div"
|
|
40
|
+
name="First Name"
|
|
41
|
+
rules="required"
|
|
42
|
+
class="form-row">
|
|
43
|
+
<label
|
|
44
|
+
for="firstName"
|
|
45
|
+
class="form-label">
|
|
46
|
+
First Name
|
|
47
|
+
</label>
|
|
48
|
+
<input
|
|
49
|
+
id="firstName"
|
|
50
|
+
v-model="customer.firstName"
|
|
51
|
+
name="firstName"
|
|
52
|
+
type="text"
|
|
53
|
+
class="form-field labelless"
|
|
54
|
+
placeholder="First Name"
|
|
55
|
+
:class="{
|
|
56
|
+
'is-invalid': errors.length,
|
|
57
|
+
filled: customer.firstName
|
|
58
|
+
}" />
|
|
59
|
+
<span
|
|
60
|
+
v-if="errors.length"
|
|
61
|
+
class="form-help is-danger">
|
|
62
|
+
{{ errors[0] }}
|
|
63
|
+
</span>
|
|
64
|
+
</validation-provider>
|
|
65
|
+
<validation-provider
|
|
66
|
+
v-slot="{ errors }"
|
|
67
|
+
tag="div"
|
|
68
|
+
name="Phone"
|
|
69
|
+
class="form-row">
|
|
70
|
+
<label
|
|
71
|
+
for="phone"
|
|
72
|
+
class="form-label">
|
|
73
|
+
Phone (optional)
|
|
74
|
+
</label>
|
|
75
|
+
<input
|
|
76
|
+
id="phone"
|
|
77
|
+
v-model="customer.phone"
|
|
78
|
+
name="phone"
|
|
79
|
+
type="number"
|
|
80
|
+
class="form-field labelless"
|
|
81
|
+
placeholder="Phone"
|
|
82
|
+
:class="{
|
|
83
|
+
'is-invalid': errors.length,
|
|
84
|
+
filled: customer.phone
|
|
85
|
+
}" />
|
|
86
|
+
<span
|
|
87
|
+
v-if="errors.length"
|
|
88
|
+
class="form-help is-danger">
|
|
89
|
+
{{ errors[0] }}
|
|
90
|
+
</span>
|
|
91
|
+
</validation-provider>
|
|
92
|
+
</div>
|
|
93
|
+
<div class="col-6">
|
|
94
|
+
<validation-provider
|
|
95
|
+
v-if="!customer._id"
|
|
96
|
+
v-slot="{ errors }"
|
|
97
|
+
tag="div"
|
|
98
|
+
name="Password"
|
|
99
|
+
rules="required"
|
|
100
|
+
class="form-row">
|
|
101
|
+
<label
|
|
102
|
+
for="password"
|
|
103
|
+
class="form-label">
|
|
104
|
+
Password
|
|
105
|
+
</label>
|
|
106
|
+
<input
|
|
107
|
+
id="password"
|
|
108
|
+
ref="password"
|
|
109
|
+
v-model="customer.password"
|
|
110
|
+
name="password"
|
|
111
|
+
type="password"
|
|
112
|
+
class="form-field labelless"
|
|
113
|
+
placeholder="Password"
|
|
114
|
+
:class="{
|
|
115
|
+
'is-invalid': errors.length,
|
|
116
|
+
filled: customer.password
|
|
117
|
+
}" />
|
|
118
|
+
<span
|
|
119
|
+
v-if="errors.length"
|
|
120
|
+
class="form-help is-danger">
|
|
121
|
+
{{ errors[0] }}
|
|
122
|
+
</span>
|
|
123
|
+
</validation-provider>
|
|
124
|
+
<validation-provider
|
|
125
|
+
v-slot="{ errors }"
|
|
126
|
+
tag="div"
|
|
127
|
+
name="Last Name"
|
|
128
|
+
rules="required"
|
|
129
|
+
class="form-row">
|
|
130
|
+
<label
|
|
131
|
+
for="lastName"
|
|
132
|
+
class="form-label">
|
|
133
|
+
Last Name
|
|
134
|
+
</label>
|
|
135
|
+
<input
|
|
136
|
+
id="lastName"
|
|
137
|
+
v-model="customer.lastName"
|
|
138
|
+
name="lastName"
|
|
139
|
+
type="text"
|
|
140
|
+
class="form-field labelless"
|
|
141
|
+
placeholder="Last Name"
|
|
142
|
+
:class="{
|
|
143
|
+
'is-invalid': errors.length,
|
|
144
|
+
filled: customer.lastName
|
|
145
|
+
}" />
|
|
146
|
+
<span
|
|
147
|
+
v-if="errors.length"
|
|
148
|
+
class="form-help is-danger">
|
|
149
|
+
{{ errors[0] }}
|
|
150
|
+
</span>
|
|
151
|
+
</validation-provider>
|
|
152
|
+
<validation-provider
|
|
153
|
+
v-slot="{ errors }"
|
|
154
|
+
tag="div"
|
|
155
|
+
name="Company"
|
|
156
|
+
class="form-row">
|
|
157
|
+
<label
|
|
158
|
+
for="company"
|
|
159
|
+
class="form-label">
|
|
160
|
+
Company (optional)
|
|
161
|
+
</label>
|
|
162
|
+
<input
|
|
163
|
+
id="company"
|
|
164
|
+
v-model="customer.company"
|
|
165
|
+
name="company"
|
|
166
|
+
type="text"
|
|
167
|
+
class="form-field labelless"
|
|
168
|
+
placeholder="Company"
|
|
169
|
+
:class="{
|
|
170
|
+
'is-invalid': errors.length,
|
|
171
|
+
filled: customer.company
|
|
172
|
+
}" />
|
|
173
|
+
<span
|
|
174
|
+
v-if="errors.length"
|
|
175
|
+
class="form-help is-danger">
|
|
176
|
+
{{ errors[0] }}
|
|
177
|
+
</span>
|
|
178
|
+
</validation-provider>
|
|
179
|
+
</div>
|
|
180
|
+
</div>
|
|
181
|
+
<div
|
|
182
|
+
class="row"
|
|
183
|
+
style="margin-top: -20px">
|
|
184
|
+
<div class="col-12">
|
|
185
|
+
<postcode-select
|
|
186
|
+
:suburb="customer.suburb"
|
|
187
|
+
:labelless="true"
|
|
188
|
+
placeholder="Suburb"
|
|
189
|
+
@select="handleSuburbChange">
|
|
190
|
+
</postcode-select>
|
|
191
|
+
<div class="form-row">
|
|
192
|
+
<label class="form-label">
|
|
193
|
+
<checkbox v-model="customer.signUpForNewsletter" />
|
|
194
|
+
<span class="lc_regular12 lc__grey1">
|
|
195
|
+
Sign up for newsletter
|
|
196
|
+
</span>
|
|
197
|
+
</label>
|
|
198
|
+
</div>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
154
201
|
</div>
|
|
155
202
|
<div class="form__footer mt-5">
|
|
203
|
+
<div
|
|
204
|
+
v-if="errorMessage"
|
|
205
|
+
class="CustomerForm__error">
|
|
206
|
+
{{ errorMessage }}
|
|
207
|
+
</div>
|
|
156
208
|
<div class="form-actions full">
|
|
157
209
|
<btn
|
|
158
|
-
class="btn btn-
|
|
210
|
+
class="btn btn-black"
|
|
159
211
|
:btn-processing="processing"
|
|
160
212
|
:btn-disabled="processing"
|
|
161
213
|
:btn-label="customer._id ? 'Save' : 'Create Account'"
|
|
@@ -169,10 +221,14 @@
|
|
|
169
221
|
|
|
170
222
|
<script>
|
|
171
223
|
import { mapGetters } from 'vuex';
|
|
224
|
+
import PostcodeSelect from '@lancom/shared/components/common/postcode_select/postcode-select';
|
|
172
225
|
import api from '@lancom/shared/assets/js/api';
|
|
173
226
|
|
|
174
227
|
export default {
|
|
175
228
|
name: 'CustomerForm',
|
|
229
|
+
components: {
|
|
230
|
+
PostcodeSelect
|
|
231
|
+
},
|
|
176
232
|
props: {
|
|
177
233
|
customer: {
|
|
178
234
|
type: Object,
|
|
@@ -190,6 +246,8 @@ export default {
|
|
|
190
246
|
},
|
|
191
247
|
methods: {
|
|
192
248
|
async submit() {
|
|
249
|
+
this.errorMessage = null;
|
|
250
|
+
|
|
193
251
|
const isValid = await this.$refs.form.validate();
|
|
194
252
|
if (!isValid) {
|
|
195
253
|
return;
|
|
@@ -205,6 +263,9 @@ export default {
|
|
|
205
263
|
} finally {
|
|
206
264
|
this.processing = false;
|
|
207
265
|
}
|
|
266
|
+
},
|
|
267
|
+
handleSuburbChange(suburb) {
|
|
268
|
+
this.$set(this.customer, 'suburb', suburb);
|
|
208
269
|
}
|
|
209
270
|
}
|
|
210
271
|
};
|
|
@@ -118,6 +118,8 @@ export default {
|
|
|
118
118
|
methods: {
|
|
119
119
|
...mapActions('auth', ['auth_request']),
|
|
120
120
|
async submit() {
|
|
121
|
+
this.error = null;
|
|
122
|
+
|
|
121
123
|
const isValid = await this.$refs.form.validate();
|
|
122
124
|
if (!isValid) {
|
|
123
125
|
return;
|
|
@@ -125,8 +127,6 @@ export default {
|
|
|
125
127
|
|
|
126
128
|
try {
|
|
127
129
|
this.processing = true;
|
|
128
|
-
|
|
129
|
-
this.error = null;
|
|
130
130
|
const data = { customer: this.customer, shop: this.shop };
|
|
131
131
|
const customer = await this.auth_request(data);
|
|
132
132
|
if (this.authStatus === 'error') {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="QuoteRequest__wrapper">
|
|
3
|
-
<div class="QuoteRequest__title">
|
|
3
|
+
<!-- <div class="QuoteRequest__title">
|
|
4
4
|
Quick Quote
|
|
5
5
|
</div>
|
|
6
6
|
<div class="QuoteRequest__info">
|
|
7
7
|
Fill our the form below and one of our team members will respond with a Quote ASAP!
|
|
8
|
-
</div>
|
|
8
|
+
</div> -->
|
|
9
9
|
<div class="QuoteRequest__content">
|
|
10
10
|
<validation-observer
|
|
11
11
|
v-slot="{ invalid, handleSubmit, errors: submittedErrors }"
|
package/nuxt.config.js
CHANGED
|
@@ -31,7 +31,7 @@ module.exports = (config, axios) => ({
|
|
|
31
31
|
'/customer/**'
|
|
32
32
|
],
|
|
33
33
|
routes: async () => {
|
|
34
|
-
const { data } = await axios.get(`${config.API_URL}/sitemap?host=${config.HOST_NAME}`);
|
|
34
|
+
const { data } = await axios.get(`${config.API_URL}/feed/sitemap?host=${config.HOST_NAME}`);
|
|
35
35
|
return data.map(url => ({ url, priority: 0.8 }));
|
|
36
36
|
}
|
|
37
37
|
},
|
|
@@ -56,7 +56,8 @@ module.exports = (config, axios) => ({
|
|
|
56
56
|
modules: [
|
|
57
57
|
'@nuxtjs/axios',
|
|
58
58
|
'@nuxtjs/dotenv',
|
|
59
|
-
'@nuxtjs/sitemap'
|
|
59
|
+
'@nuxtjs/sitemap',
|
|
60
|
+
'@/node_modules/@lancom/feed/lib/module'
|
|
60
61
|
],
|
|
61
62
|
axios: {
|
|
62
63
|
},
|
|
@@ -71,5 +72,45 @@ module.exports = (config, axios) => ({
|
|
|
71
72
|
'@lancom'
|
|
72
73
|
],
|
|
73
74
|
extend(config, ctx) {}
|
|
74
|
-
}
|
|
75
|
+
},
|
|
76
|
+
feed: [{
|
|
77
|
+
path: '/google-shopping.xml',
|
|
78
|
+
async get() {
|
|
79
|
+
const { data } = await axios.get(`${config.API_URL}/feed/products?host=${config.HOST_NAME}`);
|
|
80
|
+
return {
|
|
81
|
+
title: { _text: 'All products' },
|
|
82
|
+
link: { _text: `https://${config.HOST_NAME}` },
|
|
83
|
+
generator: { _text: config.HOST_NAME },
|
|
84
|
+
item: data.map(item => {
|
|
85
|
+
const spliceFirstImage = images => (images || []).splice(0, 1)[0];
|
|
86
|
+
const getImages = images => (images || []).length > 0 ? images : null;
|
|
87
|
+
const image = spliceFirstImage(item.colorImages) || spliceFirstImage(item.frontImages) || spliceFirstImage(item.backImages) || {};
|
|
88
|
+
const images = getImages(item.colorImages) || getImages(item.frontImages) || getImages(item.backImages) || [];
|
|
89
|
+
return {
|
|
90
|
+
title: { _text: `${item.name} ${item.color}-${item.size}` },
|
|
91
|
+
link: { _text: `https://${config.HOST_NAME}${item.link}` },
|
|
92
|
+
'g:id': { _text: item.id },
|
|
93
|
+
'g:item_group_id': { _text: item.groupId },
|
|
94
|
+
'g:size': { _text: item.size },
|
|
95
|
+
'g:size_system': 'AU',
|
|
96
|
+
'g:size_type': 'regular',
|
|
97
|
+
'g:gender': { _text: item.gender },
|
|
98
|
+
'g:material': { _text: item.naterial },
|
|
99
|
+
'g:brand': { _text: item.brand },
|
|
100
|
+
'g:condition': { _text: item.condition },
|
|
101
|
+
'g:mpn': { _text: item.mpn },
|
|
102
|
+
'g:color': { _text: item.color },
|
|
103
|
+
'g:image_link': image.medium,
|
|
104
|
+
'g:additional_image_link': images.map(i => i.medium),
|
|
105
|
+
// 'g:google_product_category': 'Business & Industrial>Work Safety Protective Equipment>High-Visibility Clothing',
|
|
106
|
+
// 'g:product_type': 'WDP AU ROOT > Day Night Safety Vests',
|
|
107
|
+
// 'g:availability': 'in stock',
|
|
108
|
+
// 'g:price': '5.49AUD',
|
|
109
|
+
// 'g:identifier_exists': true,
|
|
110
|
+
// 'g:shipping_weight': { _text: item.weight }
|
|
111
|
+
};
|
|
112
|
+
})
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}]
|
|
75
116
|
});
|
package/package.json
CHANGED
package/store/auth.js
CHANGED
|
@@ -23,20 +23,19 @@ export const getters = {
|
|
|
23
23
|
stateError: state => state.err
|
|
24
24
|
};
|
|
25
25
|
export const actions = {
|
|
26
|
-
auth_request({ commit }, { user, customer, shop }) {
|
|
26
|
+
async auth_request({ commit }, { user, customer, shop }) {
|
|
27
27
|
commit('AUTH_REQUEST');
|
|
28
28
|
const request = customer ? api.authCustomer(customer, shop._id) : api.admin.authUser(user);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
29
|
+
try {
|
|
30
|
+
const { token, user, customer } = await request;
|
|
31
|
+
Cookie.set('auth', token);
|
|
32
|
+
this.$axios.defaults.headers.authorization = token;
|
|
33
|
+
commit('AUTH_SUCCESS', token, customer || user);
|
|
34
|
+
return customer || user;
|
|
35
|
+
} catch (err) {
|
|
36
|
+
commit('AUTH_ERROR', err);
|
|
37
|
+
Cookie.remove('auth');
|
|
38
|
+
}
|
|
40
39
|
},
|
|
41
40
|
auth_logout({ commit }) {
|
|
42
41
|
commit('AUTH_LOGOUT');
|