@lancom/shared 0.0.308 → 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/editor/editor_product_details/editor-product-details.vue +67 -53
- 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/components/order/order_view/order_product_prints/order_product_print/order-product-print.vue +4 -1
- package/components/order/order_view/order_view_product/order-view-product.vue +4 -1
- package/components/product/products_size_selector_color/product_size_selector_color/product-size-selector-color.vue +42 -18
- package/components/products/product_list_product/product-list-product.vue +3 -3
- package/layouts/products.vue +10 -2
- package/mixins/product-preview.js +6 -2
- package/mixins/product-view.js +2 -2
- package/package.json +1 -1
- package/store/product.js +16 -13
|
@@ -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
|
},
|
|
@@ -10,57 +10,6 @@
|
|
|
10
10
|
<img :src="product.brand.logo | staticLink" />
|
|
11
11
|
</div>
|
|
12
12
|
<div class="EditorProductDetails__header-info">
|
|
13
|
-
<div class="EditorProductDetails__header-row">
|
|
14
|
-
<span
|
|
15
|
-
v-if="defaultSimpleProductPricing"
|
|
16
|
-
class="lc_regular16 lc_grey1">
|
|
17
|
-
From {{ currency.isoCode }}
|
|
18
|
-
<v-popover
|
|
19
|
-
ref="popover"
|
|
20
|
-
trigger="hover"
|
|
21
|
-
:delay="{ show: 200, hide: 400 }"
|
|
22
|
-
popover-class="tooltip popover white"
|
|
23
|
-
class="EditorProductDetails__discounts-table">
|
|
24
|
-
<price
|
|
25
|
-
class="lc_semibold22 lc_black EditorProductDetails__dashed-underline"
|
|
26
|
-
:price="defaultSimpleProductPricing[0].price"
|
|
27
|
-
:with-gst="inclGST" />
|
|
28
|
-
<template slot="popover">
|
|
29
|
-
<pricing-discounts-table
|
|
30
|
-
:prices="defaultSimpleProductPricing"
|
|
31
|
-
:with-gst="inclGST" />
|
|
32
|
-
</template>
|
|
33
|
-
</v-popover>
|
|
34
|
-
</span>
|
|
35
|
-
<span class="lc_regular16 lc_grey1 ml-6">
|
|
36
|
-
+
|
|
37
|
-
<v-popover
|
|
38
|
-
ref="popover"
|
|
39
|
-
trigger="hover"
|
|
40
|
-
:delay="{ show: 200, hide: 400 }"
|
|
41
|
-
popover-class="tooltip popover white no-paddings"
|
|
42
|
-
class="EditorProductDetails__discounts-table">
|
|
43
|
-
<span class="EditorProductDetails__dashed-underline">
|
|
44
|
-
Printing
|
|
45
|
-
</span>
|
|
46
|
-
<template slot="popover">
|
|
47
|
-
<pricing-table
|
|
48
|
-
:items="printTypePrices"
|
|
49
|
-
:bordered="true"
|
|
50
|
-
:striped="false"
|
|
51
|
-
:with-gst="inclGST"
|
|
52
|
-
class="EditorProductDetails__prints-table" />
|
|
53
|
-
</template>
|
|
54
|
-
</v-popover>
|
|
55
|
-
</span>
|
|
56
|
-
<span class="ml-10">
|
|
57
|
-
<checkbox
|
|
58
|
-
v-model="inclGST"
|
|
59
|
-
:dark="true">
|
|
60
|
-
<div class="ml-5">Inc. {{ taxName }}</div>
|
|
61
|
-
</checkbox>
|
|
62
|
-
</span>
|
|
63
|
-
</div>
|
|
64
13
|
<div class="EditorProductDetails__header-row">
|
|
65
14
|
<span class="EditorProductDetails__product-link">
|
|
66
15
|
SKU:
|
|
@@ -81,6 +30,68 @@
|
|
|
81
30
|
</div>
|
|
82
31
|
</div>
|
|
83
32
|
</div>
|
|
33
|
+
<div class="EditorProductDetails__header-row">
|
|
34
|
+
<span
|
|
35
|
+
v-if="defaultSimpleProductPricing"
|
|
36
|
+
class="lc_regular16 lc_grey1">
|
|
37
|
+
From {{ currency.isoCode }}
|
|
38
|
+
<price
|
|
39
|
+
v-if="printsPrice"
|
|
40
|
+
class="lc_black lc_semibold22"
|
|
41
|
+
:price="printsPrice + defaultSimpleProductPricing[0].price"
|
|
42
|
+
:with-gst="inclGST" />
|
|
43
|
+
<v-popover
|
|
44
|
+
ref="popover"
|
|
45
|
+
trigger="hover"
|
|
46
|
+
:delay="{ show: 200, hide: 400 }"
|
|
47
|
+
popover-class="tooltip popover white"
|
|
48
|
+
class="EditorProductDetails__discounts-table">
|
|
49
|
+
<price
|
|
50
|
+
class="lc_black EditorProductDetails__dashed-underline"
|
|
51
|
+
:class="[printsPrice ? 'lc_semibold16' : 'lc_semibold22']"
|
|
52
|
+
:price="defaultSimpleProductPricing[0].price"
|
|
53
|
+
:with-gst="inclGST" />
|
|
54
|
+
<template slot="popover">
|
|
55
|
+
<pricing-discounts-table
|
|
56
|
+
:prices="defaultSimpleProductPricing"
|
|
57
|
+
:with-gst="inclGST" />
|
|
58
|
+
</template>
|
|
59
|
+
</v-popover>
|
|
60
|
+
</span>
|
|
61
|
+
<span class="lc_regular16 lc_grey1 ml-6">
|
|
62
|
+
+
|
|
63
|
+
<v-popover
|
|
64
|
+
ref="popover"
|
|
65
|
+
trigger="hover"
|
|
66
|
+
:delay="{ show: 200, hide: 400 }"
|
|
67
|
+
popover-class="tooltip popover white no-paddings"
|
|
68
|
+
class="EditorProductDetails__discounts-table">
|
|
69
|
+
<span class="EditorProductDetails__dashed-underline">
|
|
70
|
+
Printing
|
|
71
|
+
</span>
|
|
72
|
+
<price
|
|
73
|
+
v-if="printsPrice"
|
|
74
|
+
class="lc_black lc_semibold16 EditorProductDetails__dashed-underline"
|
|
75
|
+
:price="printsPrice"
|
|
76
|
+
:with-gst="inclGST" />
|
|
77
|
+
<template slot="popover">
|
|
78
|
+
<pricing-table
|
|
79
|
+
:items="printTypePrices"
|
|
80
|
+
:bordered="true"
|
|
81
|
+
:striped="false"
|
|
82
|
+
:with-gst="inclGST"
|
|
83
|
+
class="EditorProductDetails__prints-table" />
|
|
84
|
+
</template>
|
|
85
|
+
</v-popover>
|
|
86
|
+
</span>
|
|
87
|
+
<span class="ml-10">
|
|
88
|
+
<checkbox
|
|
89
|
+
v-model="inclGST"
|
|
90
|
+
:dark="true">
|
|
91
|
+
<div class="ml-5">Inc. {{ taxName }}</div>
|
|
92
|
+
</checkbox>
|
|
93
|
+
</span>
|
|
94
|
+
</div>
|
|
84
95
|
<!-- <div
|
|
85
96
|
v-if="!productAvailableInCurrentCountry"
|
|
86
97
|
class="EditorProductDetails__available-warning">
|
|
@@ -126,7 +137,7 @@ import ProductColorsSelector from '@lancom/shared/components/product/product_col
|
|
|
126
137
|
import EditorPricing from '@lancom/shared/components/product/editor_pricing/editor-pricing';
|
|
127
138
|
import PricingDiscountsTable from '@lancom/shared/components/common/pricing_discounts_table/pricing-discounts-table';
|
|
128
139
|
import modals from '@lancom/shared/mixins/modals';
|
|
129
|
-
import { staticLink, priceWithTax } from '@lancom/shared/assets/js/utils/filters';
|
|
140
|
+
import { staticLink, priceWithTax, price, tax } from '@lancom/shared/assets/js/utils/filters';
|
|
130
141
|
import PricingTable from '@lancom/shared/components/common/pricing_table/pricing-table';
|
|
131
142
|
import { generateProductLink } from '@lancom/shared/assets/js/utils/product';
|
|
132
143
|
import Price from '@lancom/shared/components/common/price';
|
|
@@ -146,6 +157,7 @@ export default {
|
|
|
146
157
|
RichText
|
|
147
158
|
},
|
|
148
159
|
filters: {
|
|
160
|
+
price,
|
|
149
161
|
priceWithTax,
|
|
150
162
|
staticLink
|
|
151
163
|
},
|
|
@@ -165,12 +177,14 @@ export default {
|
|
|
165
177
|
'productDetailsLoaded',
|
|
166
178
|
'defaultSimpleProduct',
|
|
167
179
|
'selectedPrintType',
|
|
168
|
-
'isPrintPricing'
|
|
180
|
+
'isPrintPricing',
|
|
181
|
+
'printsPrice'
|
|
169
182
|
]),
|
|
170
183
|
...mapGetters('layers', [
|
|
171
184
|
'layerThumbnails'
|
|
172
185
|
]),
|
|
173
186
|
...mapGetters([
|
|
187
|
+
'gstTax',
|
|
174
188
|
'pricingSettings',
|
|
175
189
|
'country'
|
|
176
190
|
]),
|
|
@@ -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/components/order/order_view/order_product_prints/order_product_print/order-product-print.vue
CHANGED
|
@@ -72,7 +72,10 @@ export default {
|
|
|
72
72
|
return this.print.costType === 'setup only' ? 0 : (this.print.printCost || 0);
|
|
73
73
|
},
|
|
74
74
|
setupCost() {
|
|
75
|
-
|
|
75
|
+
let isFreePricing = this.print.freeSetupOver >= 0 && this.amount > this.print.freeSetupOver;
|
|
76
|
+
if ((this.print.products || []).indexOf(this.entity.guid) > 0) {
|
|
77
|
+
isFreePricing = true;
|
|
78
|
+
}
|
|
76
79
|
return (this.print.costType === 'item cost only' || isFreePricing) ? 0 : (this.print.setupCost || 0);
|
|
77
80
|
},
|
|
78
81
|
total() {
|
|
@@ -128,7 +128,10 @@ export default {
|
|
|
128
128
|
},
|
|
129
129
|
totalPrice() {
|
|
130
130
|
const printsTotal = (this.product.prints || []).reduce((total, print) => {
|
|
131
|
-
|
|
131
|
+
let isFreePricing = print.freeSetupOver >= 0 && this.amount > print.freeSetupOver;
|
|
132
|
+
if ((print.products || []).indexOf(this.product.guid) > 0) {
|
|
133
|
+
isFreePricing = true;
|
|
134
|
+
}
|
|
132
135
|
const printCost = print.costType === 'setup only' ? 0 : print.printCost;
|
|
133
136
|
const setupCost = (print.costType === 'item cost only' || isFreePricing) ? 0 : print.setupCost;
|
|
134
137
|
return total + this.amount * printCost + setupCost;
|
|
@@ -18,23 +18,45 @@
|
|
|
18
18
|
<div class="lc_regular14 hidden-md-and-up">
|
|
19
19
|
{{ product.size.shortName }}
|
|
20
20
|
</div>
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
21
|
+
<div>
|
|
22
|
+
<div v-if="printsPrice > 0">
|
|
23
|
+
<price
|
|
24
|
+
class="lc_semibold17 ProductSizeSelectorColor__price"
|
|
25
|
+
:price="printsPrice + productPrice"
|
|
26
|
+
:with-gst="withGst" />
|
|
27
|
+
</div>
|
|
28
|
+
<div>
|
|
29
|
+
<v-popover
|
|
30
|
+
trigger="hover"
|
|
31
|
+
:delay="{ show: 200, hide: 400 }"
|
|
32
|
+
popover-class="tooltip popover white"
|
|
33
|
+
class="ProductSizeSelectorColor__price"
|
|
34
|
+
:style="{
|
|
35
|
+
display: productPrice ? 'inline-block' : 'block'
|
|
36
|
+
}">
|
|
37
|
+
<span :class="[printsPrice ? 'lc_regular13' : 'lc_semibold17']">
|
|
38
|
+
{{ productPrice | price(currency) }}
|
|
39
|
+
</span>
|
|
40
|
+
<template slot="popover">
|
|
41
|
+
<div>
|
|
42
|
+
<pricing-discounts-table
|
|
43
|
+
:with-gst="withGst"
|
|
44
|
+
:prices="pricing"
|
|
45
|
+
:amount="usedSimpleProductsQuantity" />
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
</v-popover>
|
|
49
|
+
<span
|
|
50
|
+
v-if="printsPrice > 0"
|
|
51
|
+
class="lc_regular13">
|
|
52
|
+
+
|
|
53
|
+
<price
|
|
54
|
+
:price="printsPrice"
|
|
55
|
+
:with-gst="withGst" />
|
|
56
|
+
</span>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
</div>
|
|
38
60
|
<div class="hidden-md-and-up">
|
|
39
61
|
<div
|
|
40
62
|
v-if="product.quantityStock"
|
|
@@ -77,6 +99,7 @@ import PricingDiscountsTable from '@lancom/shared/components/common/pricing_disc
|
|
|
77
99
|
import { price } from '@lancom/shared/assets/js/utils/filters';
|
|
78
100
|
import ProductSizeSelectorColorCell from '@lancom/shared/components/product/product_size_selector/product_size_selector_color/product_size_selector_color_cell/product-size-selector-color-cell';
|
|
79
101
|
import { tax } from '@lancom/shared/assets/js/utils/filters';
|
|
102
|
+
import Price from '@lancom/shared/components/common/price';
|
|
80
103
|
|
|
81
104
|
export default {
|
|
82
105
|
name: 'ProductSizeSelectorColor',
|
|
@@ -84,6 +107,7 @@ export default {
|
|
|
84
107
|
price
|
|
85
108
|
},
|
|
86
109
|
components: {
|
|
110
|
+
Price,
|
|
87
111
|
PricingDiscountsTable,
|
|
88
112
|
ProductSizeSelectorColorCell
|
|
89
113
|
},
|
|
@@ -102,7 +126,7 @@ export default {
|
|
|
102
126
|
}
|
|
103
127
|
},
|
|
104
128
|
computed: {
|
|
105
|
-
...mapGetters('product', ['isPrintPricing', 'usedSimpleProductsQuantity']),
|
|
129
|
+
...mapGetters('product', ['isPrintPricing', 'usedSimpleProductsQuantity', 'printsPrice']),
|
|
106
130
|
...mapGetters(['gstTax', 'currency']),
|
|
107
131
|
currentQuantityStockLabel() {
|
|
108
132
|
return this.currentQuantityStock > 100 ? '100+' : this.currentQuantityStock;
|
|
@@ -82,14 +82,14 @@
|
|
|
82
82
|
</a>
|
|
83
83
|
</div>
|
|
84
84
|
<div
|
|
85
|
-
v-if="
|
|
85
|
+
v-if="minPrice === maxPrice"
|
|
86
86
|
class="ProductListProduct__info-item lc_h4">
|
|
87
|
-
{{
|
|
87
|
+
{{ minPrice | price(currency) }}
|
|
88
88
|
</div>
|
|
89
89
|
<div
|
|
90
90
|
v-else
|
|
91
91
|
class="ProductListProduct__info-item lc_h4">
|
|
92
|
-
{{
|
|
92
|
+
{{ minPrice | price(currency) }} - {{ maxPrice | price(currency) }}
|
|
93
93
|
</div>
|
|
94
94
|
<div class="ProductListProduct__info-item mt-2 lc_caption">
|
|
95
95
|
{{ product.colors.length }} {{ product.colors.length === 1 ? 'Colour' : 'Colours' }} | Size: {{ product.sizes | sizesRange }}
|
package/layouts/products.vue
CHANGED
|
@@ -194,6 +194,14 @@
|
|
|
194
194
|
numberOfItems: this.count,
|
|
195
195
|
itemListOrder: 'ItemListUnordered',
|
|
196
196
|
itemListElement: this.products.map(product => {
|
|
197
|
+
const minPrintsPrice = product.minPrintsPrice || 0;
|
|
198
|
+
const minProductPrice = product.isClearance ? product.minPriceWithoutClearance : product.minPrice;
|
|
199
|
+
const minPrice = minProductPrice + minPrintsPrice;
|
|
200
|
+
|
|
201
|
+
const maxPrintsPrice = product.maxPrintsPrice || 0;
|
|
202
|
+
const maxProductPrice = product.isClearance ? product.maxPriceWithoutClearance : product.maxPrice;
|
|
203
|
+
const maxPrice = maxProductPrice + maxPrintsPrice;
|
|
204
|
+
|
|
197
205
|
const schema = {
|
|
198
206
|
'@type': 'Product',
|
|
199
207
|
name: product.name,
|
|
@@ -203,8 +211,8 @@
|
|
|
203
211
|
'@type': 'AggregateOffer',
|
|
204
212
|
offerCount: 1,
|
|
205
213
|
name: product.name,
|
|
206
|
-
highPrice:
|
|
207
|
-
lowPrice:
|
|
214
|
+
highPrice: maxPrice,
|
|
215
|
+
lowPrice: minPrice,
|
|
208
216
|
priceCurrency: this.currency?.isoCode || 'AUD',
|
|
209
217
|
availability: 'InStock'
|
|
210
218
|
}
|
|
@@ -82,10 +82,14 @@ const productPreview = {
|
|
|
82
82
|
return this.product?.tags.length > 0;
|
|
83
83
|
},
|
|
84
84
|
minPrice() {
|
|
85
|
-
|
|
85
|
+
const printsPrice = this.product.minPrintsPrice || 0;
|
|
86
|
+
const productPrice = this.product.isClearance ? this.product.minPriceWithoutClearance : this.product.minPrice;
|
|
87
|
+
return productPrice + printsPrice;
|
|
86
88
|
},
|
|
87
89
|
maxPrice() {
|
|
88
|
-
|
|
90
|
+
const printsPrice = this.product.maxPrintsPrice || 0;
|
|
91
|
+
const productPrice = this.product.isClearance ? this.product.maxPriceWithoutClearance : this.product.maxPrice;
|
|
92
|
+
return productPrice + printsPrice;
|
|
89
93
|
}
|
|
90
94
|
},
|
|
91
95
|
mounted() {
|
package/mixins/product-view.js
CHANGED
|
@@ -65,7 +65,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING) => ({
|
|
|
65
65
|
},
|
|
66
66
|
computed: {
|
|
67
67
|
...mapGetters(['shop', 'gstTax', 'country', 'currency']),
|
|
68
|
-
...mapGetters('product', ['product', 'simpleProducts', 'productDetails', 'editableColor', 'images', 'preSetPrints', '
|
|
68
|
+
...mapGetters('product', ['product', 'simpleProducts', 'productDetails', 'editableColor', 'images', 'preSetPrints', 'editorSize', 'printsPrice']),
|
|
69
69
|
pageItemImage() {
|
|
70
70
|
return this.mainProductImageSrc;
|
|
71
71
|
},
|
|
@@ -209,7 +209,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING) => ({
|
|
|
209
209
|
name,
|
|
210
210
|
offers: this.productDetails?.simpleProducts.map(sp => {
|
|
211
211
|
const spMaxPrice = (sp.pricing || []).reduce((price, pricing) => Math.max(price, pricing.price), 0);
|
|
212
|
-
const maxPrice = this.
|
|
212
|
+
const maxPrice = this.printsPrice ? spMaxPrice + this.printsPrice : spMaxPrice;
|
|
213
213
|
const availability = sp.quantityStock > 0 ? 'InStock' : 'OutOfStock';
|
|
214
214
|
|
|
215
215
|
const offer = {
|
package/package.json
CHANGED
package/store/product.js
CHANGED
|
@@ -53,16 +53,6 @@ export const getters = {
|
|
|
53
53
|
calculatingPrice: ({ calculatingPrice }) => calculatingPrice,
|
|
54
54
|
product: ({ product }) => product,
|
|
55
55
|
preSetPrints: ({ preSetPrints }) => preSetPrints,
|
|
56
|
-
preSetPrintsPriceRange: ({ preSetPrints, product }) => {
|
|
57
|
-
const [preSetPrint] = preSetPrints || [];
|
|
58
|
-
const printType = product.printTypes.find(pt => pt._id === preSetPrint?.printType);
|
|
59
|
-
const { printCost = [] } = (printType?.printAreas || [])
|
|
60
|
-
.find(({ printSizes }) => (printSizes || []).some(ps => ps?._id === preSetPrint?.printSize)) || {};
|
|
61
|
-
return {
|
|
62
|
-
min: Math.min(...printCost.map(({ price }) => price)),
|
|
63
|
-
max: Math.max(...printCost.map(({ price }) => price))
|
|
64
|
-
};
|
|
65
|
-
},
|
|
66
56
|
loadError: ({ loadError }) => loadError,
|
|
67
57
|
productDetails: ({ productDetails }) => productDetails,
|
|
68
58
|
productDetailsLoaded: ({ productDetails }) => !!productDetails,
|
|
@@ -150,7 +140,13 @@ export const getters = {
|
|
|
150
140
|
},
|
|
151
141
|
editableSide: ({ editableSide }) => editableSide,
|
|
152
142
|
priceIncludeGST: ({ priceIncludeGST }) => priceIncludeGST,
|
|
153
|
-
hasUnprintedPrice: ({ product }) => product.minUnprintedPrice || product.maxUnprintedPrice
|
|
143
|
+
hasUnprintedPrice: ({ product }) => product.minUnprintedPrice || product.maxUnprintedPrice,
|
|
144
|
+
printsPrice: ({ productPricing, product }) => {
|
|
145
|
+
const maxPrintsPrice = +product.maxPrintsPrice || 0;
|
|
146
|
+
const pricing = (productPricing?.products || {})[product._id];
|
|
147
|
+
const price = pricing?.prints?.prints?.reduce((sum , print) => sum + (+print.priceWithoutTax || 0), 0) || maxPrintsPrice;
|
|
148
|
+
return price;
|
|
149
|
+
},
|
|
154
150
|
};
|
|
155
151
|
|
|
156
152
|
export const actions = {
|
|
@@ -160,7 +156,12 @@ export const actions = {
|
|
|
160
156
|
const query = { country, currency };
|
|
161
157
|
const product = await api.fetchProduct(shop, slug, query);
|
|
162
158
|
commit('setProduct', product);
|
|
163
|
-
|
|
159
|
+
|
|
160
|
+
const prints = (product.prints || []).filter(({ _id, printTemplate }) => _id === print || (!print && !!printTemplate));
|
|
161
|
+
commit('setPreSetPrints', prints);
|
|
162
|
+
if (prints?.length > 0) {
|
|
163
|
+
commit('setIsPrintPricing', true);
|
|
164
|
+
}
|
|
164
165
|
} catch (e) {
|
|
165
166
|
console.log(e);
|
|
166
167
|
const { status, data } = e?.response || {};
|
|
@@ -204,7 +205,9 @@ export const actions = {
|
|
|
204
205
|
},
|
|
205
206
|
async calculateProductPrice({ state: { template, product, isPrintPricing }, commit, getters }, { shop, country, currency }) {
|
|
206
207
|
commit('setCalculatingPrice', true);
|
|
207
|
-
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
|
+
|
|
208
211
|
const response = await api.calculateProductPrice({ entities, country: country?._id, currency: currency?._id }, shop._id);
|
|
209
212
|
commit('setProductPricing', response);
|
|
210
213
|
commit('setCalculatingPrice', false);
|