@lancom/shared 0.0.443 → 0.0.445
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.vue +3 -1
- package/components/checkout/cart/cart_shipping/cart-shipping.vue +3 -0
- package/components/common/number_input/number-input.vue +5 -5
- package/components/product/editor_pricing/editor-pricing.scss +7 -0
- package/components/product/editor_pricing/editor-pricing.vue +25 -2
- package/components/product/layouts/product_colors_selector/product_colors_selector_options/product-colors-selector-options.vue +1 -2
- package/components/product/product_check_delivery/product-check-delivery.vue +33 -10
- package/components/product/products_size_selector_color/product_size_selector_color/product-size-selector-color.vue +2 -2
- package/feeds/google-shopping.js +5 -1
- package/package.json +1 -1
- package/plugins/save-state.js +1 -1
|
@@ -129,6 +129,9 @@ export default {
|
|
|
129
129
|
if (this.wantsToPickup && this.hasNotValidProductsPickup) {
|
|
130
130
|
this.visiblePickupError = true;
|
|
131
131
|
}
|
|
132
|
+
if (!this.suburb && this.SETTINGS.DEFAULT_POSTCODE) {
|
|
133
|
+
this.setSuburb({ postcode: this.SETTINGS.DEFAULT_POSTCODE });
|
|
134
|
+
}
|
|
132
135
|
},
|
|
133
136
|
methods: {
|
|
134
137
|
...mapActions([
|
|
@@ -39,11 +39,6 @@ import { generateGUID } from '@lancom/shared/assets/js/utils/guid';
|
|
|
39
39
|
|
|
40
40
|
export default {
|
|
41
41
|
name: 'NumberInput',
|
|
42
|
-
data() {
|
|
43
|
-
return {
|
|
44
|
-
uniqueCode: generateGUID()
|
|
45
|
-
};
|
|
46
|
-
},
|
|
47
42
|
props: {
|
|
48
43
|
id: {
|
|
49
44
|
type: String
|
|
@@ -77,6 +72,11 @@ export default {
|
|
|
77
72
|
default: false
|
|
78
73
|
}
|
|
79
74
|
},
|
|
75
|
+
data() {
|
|
76
|
+
return {
|
|
77
|
+
uniqueCode: generateGUID()
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
80
|
computed: {
|
|
81
81
|
model: {
|
|
82
82
|
get() {
|
|
@@ -69,7 +69,16 @@
|
|
|
69
69
|
{{ hasPrintIssues ? 'Proceed with order, Will be in touch regarding print issue' : 'All good to go!' }}
|
|
70
70
|
</div>
|
|
71
71
|
</div>
|
|
72
|
-
|
|
72
|
+
<div
|
|
73
|
+
v-if="product.isClearance"
|
|
74
|
+
class="EditorPricing__clearance-message">
|
|
75
|
+
Product is non-returnable clearance product
|
|
76
|
+
</div>
|
|
77
|
+
<div
|
|
78
|
+
v-if="clearanceColorsWithQty.length"
|
|
79
|
+
class="EditorPricing__clearance-message">
|
|
80
|
+
{{ clearanceColorsWithQty.length > 1 ? 'Colours' : 'Colour' }}: {{ clearanceColorsText }} {{ clearanceColorsWithQty.length > 1 ? 'are' : 'is' }} non-returnable clearance {{ clearanceColorsWithQty.length > 1 ? 'colours' : 'colour' }}
|
|
81
|
+
</div>
|
|
73
82
|
<div
|
|
74
83
|
v-if="hasPricing"
|
|
75
84
|
class="EditorPricing__footer">
|
|
@@ -162,7 +171,8 @@ export default {
|
|
|
162
171
|
'multipack',
|
|
163
172
|
'offsetWarningVisible',
|
|
164
173
|
'showRecommendationToUseLargerImage',
|
|
165
|
-
'showErrorAboutSmallImage'
|
|
174
|
+
'showErrorAboutSmallImage',
|
|
175
|
+
'availableColors'
|
|
166
176
|
]),
|
|
167
177
|
hasPrintIssues() {
|
|
168
178
|
return this.offsetWarningVisible || this.showRecommendationToUseLargerImage || this.showErrorAboutSmallImage;
|
|
@@ -173,6 +183,19 @@ export default {
|
|
|
173
183
|
totalPrice() {
|
|
174
184
|
const { totalPriceWithoutTax, totalPrice } = this.productPricing;
|
|
175
185
|
return this.priceIncludeGST ? totalPrice : totalPriceWithoutTax;
|
|
186
|
+
},
|
|
187
|
+
clearanceColors() {
|
|
188
|
+
return this.availableColors?.filter(color => this.product.colorsPricing?.some(c => c.colors?.includes(color._id) && c.clearance)) || [];
|
|
189
|
+
},
|
|
190
|
+
clearanceColorsWithQty() {
|
|
191
|
+
console.log('clearanceColors: ', this.clearanceColors);
|
|
192
|
+
return this.clearanceColors.map(color => {
|
|
193
|
+
const qty = this.usedSimpleProducts.reduce((sum, sp) => sp.color._id === color._id ? sum + (sp.amount || 0) : sum, 0);
|
|
194
|
+
return qty > 0 ? { ...color, qty } : null;
|
|
195
|
+
}).filter(c => c);
|
|
196
|
+
},
|
|
197
|
+
clearanceColorsText() {
|
|
198
|
+
return this.clearanceColorsWithQty.map(c => `${c.name}`).join(', ');
|
|
176
199
|
}
|
|
177
200
|
},
|
|
178
201
|
watch: {
|
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
<div
|
|
4
4
|
v-for="color in availableColors"
|
|
5
5
|
:key="color._id"
|
|
6
|
-
v-tooltip="color.name"
|
|
6
|
+
v-tooltip="(product.isClearance || isClearanceColor(color)) ? `${color.name}. Clearance - non returnable` : color.name"
|
|
7
7
|
class="ProductColorsSelectorOptions__color"
|
|
8
8
|
:class="{ selected: editableColor === color }"
|
|
9
9
|
@click="toggleSelection(color)">
|
|
10
10
|
<i
|
|
11
11
|
v-if="product.isClearance || isClearanceColor(color)"
|
|
12
|
-
v-tooltip="'Clearance'"
|
|
13
12
|
class="icon-percent"></i>
|
|
14
13
|
<product-color-image
|
|
15
14
|
:color="color"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<postcode-select
|
|
17
17
|
v-model="suburb.postcode"
|
|
18
18
|
:suburb="suburb"
|
|
19
|
-
:only-postcode="
|
|
19
|
+
:only-postcode="false"
|
|
20
20
|
label-text="Postcode"
|
|
21
21
|
@select="onSelectSuburb" />
|
|
22
22
|
</div>
|
|
@@ -94,10 +94,14 @@ export default {
|
|
|
94
94
|
return totalPriceWithoutTax;
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
|
+
props: {
|
|
98
|
+
value: {
|
|
99
|
+
type: Object
|
|
100
|
+
}
|
|
101
|
+
},
|
|
97
102
|
data() {
|
|
98
|
-
const postcode = 'SW1A 1AA';
|
|
99
103
|
return {
|
|
100
|
-
suburb:
|
|
104
|
+
suburb: null,
|
|
101
105
|
pricing: null,
|
|
102
106
|
calculating: false,
|
|
103
107
|
recalcNeeded: false,
|
|
@@ -105,10 +109,10 @@ export default {
|
|
|
105
109
|
};
|
|
106
110
|
},
|
|
107
111
|
computed: {
|
|
108
|
-
...mapGetters(['shop', 'country', 'currency']),
|
|
109
|
-
...mapGetters('product', ['product', 'usedSimpleProducts', 'template']),
|
|
112
|
+
...mapGetters(['shop', 'country', 'currency', 'SETTINGS']),
|
|
113
|
+
...mapGetters('product', ['product', 'usedSimpleProducts', 'template', 'defaultSimpleProduct']),
|
|
110
114
|
hasSelection() {
|
|
111
|
-
return (this.usedSimpleProducts || []).length > 0;
|
|
115
|
+
return (this.usedSimpleProducts || []).length > 0 || this.value;
|
|
112
116
|
},
|
|
113
117
|
hasSuppliersWithRates() {
|
|
114
118
|
return this.suppliersWithRates.length > 0;
|
|
@@ -128,13 +132,21 @@ export default {
|
|
|
128
132
|
this.calculateShipping();
|
|
129
133
|
}
|
|
130
134
|
}
|
|
135
|
+
this.$emit('input', null);
|
|
131
136
|
},
|
|
132
137
|
deep: true
|
|
138
|
+
},
|
|
139
|
+
value() {
|
|
140
|
+
if (this.pricing) {
|
|
141
|
+
this.recalcNeeded = true;
|
|
142
|
+
} else {
|
|
143
|
+
this.calculateShipping();
|
|
144
|
+
}
|
|
133
145
|
}
|
|
134
146
|
},
|
|
135
|
-
|
|
136
|
-
if (this.
|
|
137
|
-
this.
|
|
147
|
+
created() {
|
|
148
|
+
if (this.SETTINGS.DEFAULT_POSTCODE) {
|
|
149
|
+
this.suburb = { postcode: this.SETTINGS.DEFAULT_POSTCODE };
|
|
138
150
|
}
|
|
139
151
|
},
|
|
140
152
|
methods: {
|
|
@@ -154,7 +166,18 @@ export default {
|
|
|
154
166
|
this.calculating = true;
|
|
155
167
|
this.recalcNeeded = false;
|
|
156
168
|
try {
|
|
157
|
-
|
|
169
|
+
let usedSimpleProducts = this.usedSimpleProducts;
|
|
170
|
+
if (this.value) {
|
|
171
|
+
if (this.value?.color) {
|
|
172
|
+
usedSimpleProducts = usedSimpleProducts.filter(c => c.color._id === this.value?.color?._id);
|
|
173
|
+
}
|
|
174
|
+
if (this.value?.size) {
|
|
175
|
+
usedSimpleProducts = usedSimpleProducts.filter(c => c.size._id === this.value?.size?._id);
|
|
176
|
+
}
|
|
177
|
+
const simpleProduct = usedSimpleProducts[0] || this.usedSimpleProducts[0] || this.defaultSimpleProduct;
|
|
178
|
+
usedSimpleProducts = simpleProduct ? [{ ...simpleProduct, amount: simpleProduct.amount || 1 }] : [];
|
|
179
|
+
}
|
|
180
|
+
const entities = getProductsForCalculatePricing(this.product, usedSimpleProducts);
|
|
158
181
|
const payload = {
|
|
159
182
|
entities: entities.map(e => ({ ...e, brand: this.product.brand })),
|
|
160
183
|
postcode: this.suburb?.postcode,
|
|
@@ -169,10 +169,10 @@ export default {
|
|
|
169
169
|
const amount = this.usedSimpleProductsQuantity;
|
|
170
170
|
const pricing = this.pricing;
|
|
171
171
|
const price = (pricing.find(({ min, max }) => (!min || min <= amount) && (!max || max >= amount)) || pricing[0] || {}).price || 0;
|
|
172
|
-
return this.withGst ? tax(price, this.gstTax) : price;
|
|
172
|
+
return +(this.withGst ? tax(price, this.gstTax) : price);
|
|
173
173
|
},
|
|
174
174
|
productPrintsPrice() {
|
|
175
|
-
return this.withGst ? tax(this.printsPrice, this.gstTax) : this.printsPrice;
|
|
175
|
+
return +(this.withGst ? tax(this.printsPrice, this.gstTax) : this.printsPrice);
|
|
176
176
|
},
|
|
177
177
|
disabled() {
|
|
178
178
|
return !this.product.quantityStock || !this.productPrice;
|
package/feeds/google-shopping.js
CHANGED
|
@@ -102,10 +102,14 @@ async function googleShoppingFeed(axios, config, availableStores, country, isEdi
|
|
|
102
102
|
info['g:gtin'] = { _text: sp.gtin || '' };
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
const isClearance = sp.clearancePrice > 0 || product.isClearance;
|
|
106
|
+
|
|
107
|
+
if (isClearance && sp.clearancePrice !== sp.price) {
|
|
106
108
|
info['g:sale_price'] = { _text: `${(sp.clearancePrice)} ${sp.currencyCode || 'AUD'}` };
|
|
107
109
|
}
|
|
108
110
|
|
|
111
|
+
info['g:return_policy_label'] = { _text: isClearance ? 'clearance' : '' };
|
|
112
|
+
|
|
109
113
|
if (!config.IGNORE_STORE_CODE) {
|
|
110
114
|
if (sp.storeCode) {
|
|
111
115
|
info['g:store_code'] = { _text: sp.storeCode };
|
package/package.json
CHANGED
package/plugins/save-state.js
CHANGED