@wikala/spmkt 2.12.4 → 2.13.1
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/api/address.js +5 -0
- package/components/Account/AccountDashboard.vue +4 -1
- package/components/Address/AddressBook.vue +6 -1
- package/components/Address/AddressSelect.vue +11 -3
- package/components/Address/Edit.vue +14 -1
- package/components/Cart/Delivery/Delivery.vue +1 -0
- package/components/Cart/Delivery/DeliveryAddress.vue +1 -1
- package/package.json +1 -1
package/api/address.js
CHANGED
|
@@ -48,6 +48,11 @@ const Address = {
|
|
|
48
48
|
if (!addressData.type) {
|
|
49
49
|
addressData.type = 'customer.shipping'
|
|
50
50
|
}
|
|
51
|
+
if(addressData.type !== 'business') {
|
|
52
|
+
['company_name', 'company_tax_id', 'company_business_id'].forEach(
|
|
53
|
+
f => addressData[f] = ''
|
|
54
|
+
)
|
|
55
|
+
}
|
|
51
56
|
return request({
|
|
52
57
|
url: '/addresses',
|
|
53
58
|
method: 'post',
|
|
@@ -21,7 +21,10 @@
|
|
|
21
21
|
</b-tab-item>
|
|
22
22
|
|
|
23
23
|
<b-tab-item :label="$t('account.addresses')">
|
|
24
|
-
<AddressBook
|
|
24
|
+
<AddressBook
|
|
25
|
+
:countries="this.countryList"
|
|
26
|
+
:orderAsBussinessEnabled="Boolean(parseInt(initialState.orderAsBusiness))"
|
|
27
|
+
/>
|
|
25
28
|
</b-tab-item>
|
|
26
29
|
|
|
27
30
|
<b-tab-item :label="$t('account.settings')">
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
:countries="countries"
|
|
29
29
|
:address-data="addressData"
|
|
30
30
|
:errors="validationErrors"
|
|
31
|
+
:show-business="orderAsBussinessEnabled"
|
|
31
32
|
/>
|
|
32
33
|
</section>
|
|
33
34
|
<footer class="modal-card-foot">
|
|
@@ -56,6 +57,10 @@ export default {
|
|
|
56
57
|
default: () => {
|
|
57
58
|
return []
|
|
58
59
|
}
|
|
60
|
+
},
|
|
61
|
+
orderAsBussinessEnabled: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: false
|
|
59
64
|
}
|
|
60
65
|
},
|
|
61
66
|
components: {
|
|
@@ -106,7 +111,7 @@ export default {
|
|
|
106
111
|
},
|
|
107
112
|
|
|
108
113
|
async saveAddress() {
|
|
109
|
-
this.addressData.type = '-'
|
|
114
|
+
//this.addressData.type = '-'
|
|
110
115
|
try {
|
|
111
116
|
await this.setCoordinates()
|
|
112
117
|
} catch (e) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="choose-addr">
|
|
3
3
|
<div v-if="addAddress" class="add-address">
|
|
4
|
-
<button type="button" @click="
|
|
4
|
+
<button type="button" @click="addNewAddress()" class="button">{{ $t('address.add') }}</button>
|
|
5
5
|
<b-modal :active="showEditAddressDialog" @close="showEditAddressDialog = false" class="wkl-modal-container">
|
|
6
6
|
<div class="edit-address-container">
|
|
7
7
|
<header class="modal-card-head">
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
</b-modal>
|
|
23
23
|
</div>
|
|
24
24
|
<div v-if="addressList.length" class="address-list" ref="selectAddressContainer">
|
|
25
|
-
<div class="address-container" v-for="(address, index) in addressList">
|
|
25
|
+
<div class="address-container" v-for="(address, index) in addressList" :key="index">
|
|
26
26
|
<div class="address-cb">
|
|
27
27
|
<b-radio @input="selectAddress(address)" v-model="selectedAddressId" :native-value="address.id" size="is-small"></b-radio>
|
|
28
28
|
</div>
|
|
@@ -69,7 +69,8 @@ export default {
|
|
|
69
69
|
type: [Array, Object]
|
|
70
70
|
},
|
|
71
71
|
addAddress: {
|
|
72
|
-
type: Boolean
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: true
|
|
73
74
|
},
|
|
74
75
|
defaultSelected: {
|
|
75
76
|
type: Number,
|
|
@@ -105,6 +106,13 @@ export default {
|
|
|
105
106
|
this.addressData.coordinates = await gmaps.geocodeAddress(AddressRepository.getFormatted(this.addressData))
|
|
106
107
|
},
|
|
107
108
|
|
|
109
|
+
addNewAddress() {
|
|
110
|
+
this.addressData = {
|
|
111
|
+
...addressSchema
|
|
112
|
+
}
|
|
113
|
+
this.showEditAddressDialog = true;
|
|
114
|
+
},
|
|
115
|
+
|
|
108
116
|
async editAddress(pl, button) {
|
|
109
117
|
button.classList.add('is-loading')
|
|
110
118
|
try {
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
<div class="columns" v-if="showBusiness">
|
|
175
175
|
<div class="column">
|
|
176
176
|
<b-field>
|
|
177
|
-
<b-checkbox v-model="businessAddress">{{ $t('address.isBusiness') }} </b-checkbox>
|
|
177
|
+
<b-checkbox v-model="businessAddress" @input="onChangeIsBusiness($event)">{{ $t('address.isBusiness') }} </b-checkbox>
|
|
178
178
|
</b-field>
|
|
179
179
|
</div>
|
|
180
180
|
</div>
|
|
@@ -457,6 +457,14 @@ export default {
|
|
|
457
457
|
return _.findWhere(states, {
|
|
458
458
|
[field]: query
|
|
459
459
|
})
|
|
460
|
+
},
|
|
461
|
+
|
|
462
|
+
onChangeIsBusiness(e) {
|
|
463
|
+
if(e) {
|
|
464
|
+
this.addressData.type = 'business'
|
|
465
|
+
} else {
|
|
466
|
+
this.addressData.type = 'customer.shipping'
|
|
467
|
+
}
|
|
460
468
|
}
|
|
461
469
|
|
|
462
470
|
},
|
|
@@ -508,6 +516,11 @@ export default {
|
|
|
508
516
|
}
|
|
509
517
|
}
|
|
510
518
|
|
|
519
|
+
if(this.addressData.company_name || this.addressData.company_business_id || this.addressData.company_tax_id) {
|
|
520
|
+
this.businessAddress = true
|
|
521
|
+
this.onChangeIsBusiness(true)
|
|
522
|
+
}
|
|
523
|
+
|
|
511
524
|
}
|
|
512
525
|
|
|
513
526
|
}
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
:address-list="addressList"
|
|
19
19
|
:add-address="true"
|
|
20
20
|
:address-actions-enabled="['edit', 'delete']"
|
|
21
|
+
:orderAsBussinessEnabled="Boolean(parseInt(initialState.orderAsBusiness))"
|
|
21
22
|
@addressSaved="onAddressSaved"
|
|
22
23
|
@addressDeleted="getAddresses"
|
|
23
24
|
@select="selectAddress($event)"
|
|
24
|
-
:order-as-business-enabled="initialState.orderAsBusiness"
|
|
25
25
|
/>
|
|
26
26
|
</div>
|
|
27
27
|
</div>
|