@wikala/spmkt 2.31.0 → 3.0.0-beta.0
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/MIGRATION_GUIDE.md +261 -0
- package/api/product.js +1 -0
- package/api/request.js +9 -4
- package/api/user.js +1 -1
- package/components/Account/AccountDashboard.vue +101 -101
- package/components/Account/AccountStore.js +57 -31
- package/components/Account/AffiliateReport.vue +56 -60
- package/components/Account/{OrderDetail.vue → Orders/OrderDetail.vue} +44 -30
- package/components/Account/Orders/Orders.vue +124 -0
- package/components/Account/{AccountSettings.vue → Settings/AccountSettings.vue} +4 -4
- package/components/Account/Settings/ChangeEmail.vue +136 -0
- package/components/Account/Settings/ChangeName.vue +82 -0
- package/components/Account/Settings/ChangePassword.vue +91 -0
- package/components/Address/Address.vue +38 -57
- package/components/Address/AddressBook.vue +77 -57
- package/components/Address/AddressSelect.vue +94 -87
- package/components/Address/Edit.vue +253 -265
- package/components/Address/PostalCode.vue +22 -21
- package/components/AgeGate.vue +11 -5
- package/components/Auth/Login.vue +62 -44
- package/components/Auth/Register.vue +82 -60
- package/components/Auth/ResetPassword.vue +45 -30
- package/components/Cart/AgeVerification/AgeChecker.vue +3 -3
- package/components/Cart/CartBadge.vue +15 -4
- package/components/Cart/CartBox.vue +19 -11
- package/components/Cart/CartItem.vue +3 -3
- package/components/Cart/CartMode.vue +6 -5
- package/components/Cart/CartPreview.vue +24 -18
- package/components/Cart/Coupon.vue +4 -5
- package/components/Cart/CreditCard/Everyware.vue +10 -10
- package/components/Cart/CreditCard/ExtendedCreditCard.vue +5 -5
- package/components/Cart/CreditCard/SquarePay.vue +18 -16
- package/components/Cart/CreditCard/StandardCreditCard.vue +9 -9
- package/components/Cart/Delivery/Delivery.vue +16 -12
- package/components/Cart/Delivery/DeliveryAddress.vue +1 -1
- package/components/Cart/Delivery/DeliveryMethods.vue +1 -1
- package/components/Cart/Delivery/DeliveryOptions.vue +15 -9
- package/components/Cart/Delivery/DeliveryTypes.vue +8 -5
- package/components/Cart/Delivery/ReservationSlots.vue +14 -8
- package/components/Cart/Disclaimer.vue +1 -1
- package/components/Cart/OrderConfirmation.vue +1 -1
- package/components/Cart/Payment/Payment.vue +37 -33
- package/components/Cart/Payment/PaymentMethods.vue +6 -4
- package/components/Cart/ReviewAndSubmit.vue +9 -7
- package/components/Cart/ShoppingCart.vue +42 -31
- package/components/Cart/Store/actions.js +1 -1
- package/components/Cart/Store/getters.js +2 -1
- package/components/Cart/Store/index.js +1 -1
- package/components/Cart/Store/mutations.js +7 -5
- package/components/Cart/UserIdentity.vue +1 -1
- package/components/Category/CategoryFilter.vue +128 -114
- package/components/Category/CategorySort.vue +44 -32
- package/components/Category/LoadMore.vue +39 -23
- package/components/DeliverTo.vue +10 -15
- package/components/DeliveryNotice.vue +72 -68
- package/components/DobInput.vue +23 -23
- package/components/Gmaps/GmapsAutocomplete.vue +139 -78
- package/components/Gmaps/GmapsLocations.vue +1 -1
- package/components/Gmaps/GmapsSingleLocation.vue +121 -87
- package/components/ModalContainer/ModalContainer.vue +12 -9
- package/components/ModalContainer/index.js +61 -18
- package/components/Product/AddToCart.vue +237 -221
- package/components/Product/BoxAddToCart.vue +114 -86
- package/components/Product/Compare.vue +68 -48
- package/components/Product/CompareBox.vue +128 -123
- package/components/Product/Lookup.vue +92 -65
- package/components/Product/Photo.vue +105 -66
- package/components/Product/Price.vue +64 -43
- package/components/Product/ProductAutocomplete.vue +52 -57
- package/components/Product/ProductBox.vue +61 -38
- package/components/Product/ProductImages.vue +83 -86
- package/components/Product/Quantity.vue +115 -53
- package/components/Product/QuickView.vue +52 -45
- package/components/Product/RelatedProducts.vue +88 -23
- package/components/Product/SKU.vue +27 -8
- package/components/Product/Variants.vue +335 -341
- package/components/Product/reviews-questions/ProductQuestions.vue +226 -198
- package/components/Product/reviews-questions/ProductReviews.vue +122 -107
- package/components/Product/reviews-questions/Review.vue +54 -59
- package/components/Product/reviews-questions/ReviewForm.vue +222 -170
- package/components/Product/reviews-questions/ReviewImages.vue +197 -216
- package/components/Product/reviews-questions/Vote.vue +83 -57
- package/components/QuantityInput.vue +18 -8
- package/components/RangeInput.vue +15 -8
- package/components/Recaptcha.vue +8 -1
- package/components/SelectShippingCountry.vue +81 -62
- package/components/TimedOffer.vue +59 -74
- package/composables/globals.js +53 -0
- package/config.js +5 -2
- package/index.js +41 -10
- package/install.js +75 -0
- package/locales/en.json +2 -1
- package/locales/sr.json +2 -1
- package/package.json +43 -30
- package/utils/directives.js +28 -45
- package/utils/event-bus.js +56 -0
- package/utils/filters.js +24 -7
- package/utils/{gmaps.js → google/gmaps.js} +43 -10
- package/utils/{google-analytics-eec.js → google/google-analytics-eec.js} +7 -7
- package/babel.config.js +0 -5
- package/components/Account/ChangeEmail.vue +0 -133
- package/components/Account/ChangeName.vue +0 -92
- package/components/Account/ChangePassword.vue +0 -94
- package/components/Account/CreditCards.vue +0 -18
- package/components/Account/Orders.vue +0 -110
- package/components/Account/Settings.vue +0 -18
- package/components/Cart/Delivery/DeliveryAddressGuest.spec.js +0 -128
- package/components/Cart/Delivery/DeliveryTypes.spec.js +0 -83
- package/components/Cart/PCIBadge/SecurityMetrics.vue +0 -11
- package/components/Instagram.vue +0 -49
- package/components/ProductImageModal.vue +0 -41
- package/jest.config.js +0 -16
- package/test/e2e/.babelrc.js +0 -8
- package/test/e2e/.eslintrc.js +0 -11
- package/test/e2e/accAuth.spec.js +0 -64
- package/test/e2e/ageGate.spec.js +0 -26
- package/test/e2e/checkout.spec.js +0 -106
- package/test/e2e/compare.spec.js +0 -52
- package/test/e2e/config/data.js +0 -21
- package/test/e2e/config/routes.js +0 -11
- package/test/e2e/region.spec.js +0 -46
- package/test/e2e/search.spec.js +0 -32
- package/tests/vueBuefy.js +0 -4
- package/tsconfig.json +0 -8
|
@@ -1,65 +1,88 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="grid">
|
|
2
|
+
<div :class="[{[grid]: true}, 'product-box']">
|
|
3
3
|
<div class="box">
|
|
4
|
-
<a :href="
|
|
5
|
-
<img :src="product.thumb_url" />
|
|
4
|
+
<a :href="productSlug" class="image">
|
|
5
|
+
<img :src="product.thumb_url" :alt="product.name" />
|
|
6
6
|
</a>
|
|
7
7
|
<div class="desc-container">
|
|
8
|
-
<a :href="
|
|
8
|
+
<a :href="productSlug" class="description">{{ product.name }}</a>
|
|
9
9
|
</div>
|
|
10
10
|
<div class="stars-reviews">
|
|
11
11
|
<div class="rating">
|
|
12
|
-
<template v-if="
|
|
13
|
-
<a :href="
|
|
14
|
-
<i
|
|
12
|
+
<template v-if="hasReviews">
|
|
13
|
+
<a :href="reviewsHref">
|
|
14
|
+
<i
|
|
15
|
+
v-for="(sc, index) in starRating(product.rating)"
|
|
16
|
+
:key="index"
|
|
17
|
+
style="margin-right: 3px;"
|
|
18
|
+
:class="['fas', 'fa-star', sc]"
|
|
19
|
+
></i>
|
|
15
20
|
</a>
|
|
16
|
-
<a class="review-count" :href="
|
|
21
|
+
<a class="review-count" :href="reviewsHref">{{ product.reviews_count }}</a>
|
|
17
22
|
</template>
|
|
18
23
|
<template v-else>
|
|
19
|
-
<i
|
|
24
|
+
<i
|
|
25
|
+
v-for="(sc, index) in starRating(product.rating)"
|
|
26
|
+
:key="index"
|
|
27
|
+
:class="['fas', 'fa-star', sc]"
|
|
28
|
+
></i>
|
|
20
29
|
</template>
|
|
21
30
|
</div>
|
|
22
31
|
</div>
|
|
23
32
|
<div class="price-container">
|
|
24
|
-
<p class="price">${{ product.price
|
|
25
|
-
<p v-if="
|
|
33
|
+
<p class="price">${{ $filters.formatMoney(product.price) }}</p>
|
|
34
|
+
<p v-if="hasFreeShipping" class="free-delivery">FREE shipping</p>
|
|
26
35
|
</div>
|
|
27
36
|
</div>
|
|
28
37
|
</div>
|
|
29
38
|
</template>
|
|
30
39
|
|
|
31
|
-
<script>
|
|
32
|
-
|
|
33
|
-
name: 'ProductBox',
|
|
40
|
+
<script setup>
|
|
41
|
+
import { computed, toRefs } from 'vue'
|
|
34
42
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
grid: String
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
computed: {
|
|
44
|
-
getRating() {
|
|
45
|
-
return (this.product.rating / 5) * 100
|
|
46
|
-
}
|
|
43
|
+
const props = defineProps({
|
|
44
|
+
product: {
|
|
45
|
+
type: Object,
|
|
46
|
+
required: true
|
|
47
47
|
},
|
|
48
|
+
grid: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: ''
|
|
51
|
+
}
|
|
52
|
+
})
|
|
48
53
|
|
|
49
|
-
|
|
50
|
-
starRating(rating) {
|
|
51
|
-
let stars = Math.floor(rating)
|
|
52
|
-
let halfStars = (rating - stars > .40) ? 1 : 0
|
|
53
|
-
let other = 5 - stars - halfStars
|
|
54
|
-
let s = ''
|
|
55
|
-
s += 'fa-star star-on,'.repeat(stars)
|
|
56
|
-
s += 'fa-star-half-alt star-on,'.repeat(halfStars)
|
|
57
|
-
s += 'fa-star star-off,'.repeat(other)
|
|
54
|
+
const { product, grid } = toRefs(props)
|
|
58
55
|
|
|
59
|
-
|
|
56
|
+
const productSlug = computed(() => {
|
|
57
|
+
const slug = product.value?.slug || ''
|
|
58
|
+
const segments = slug.split('/').filter(Boolean)
|
|
59
|
+
return segments.length ? segments[segments.length - 1] : ''
|
|
60
|
+
})
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
const reviewsHref = computed(() => {
|
|
63
|
+
if (!product.value?.slug) {
|
|
64
|
+
return ''
|
|
63
65
|
}
|
|
66
|
+
return `${product.value.slug}/reviews`
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const hasReviews = computed(() => Boolean(product.value?.reviews_count))
|
|
70
|
+
|
|
71
|
+
const hasFreeShipping = computed(() => {
|
|
72
|
+
const price = Number(product.value?.price)
|
|
73
|
+
return !Number.isNaN(price) && price >= 50
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
function starRating(rating = 0) {
|
|
77
|
+
const normalized = Math.max(0, Math.min(5, Number(rating) || 0))
|
|
78
|
+
const stars = Math.floor(normalized)
|
|
79
|
+
const halfStars = normalized - stars > 0.4 ? 1 : 0
|
|
80
|
+
const other = Math.max(0, 5 - stars - halfStars)
|
|
81
|
+
let s = ''
|
|
82
|
+
s += 'fa-star star-on,'.repeat(stars)
|
|
83
|
+
s += 'fa-star-half-alt star-on,'.repeat(halfStars)
|
|
84
|
+
s += 'fa-star star-off,'.repeat(other)
|
|
85
|
+
|
|
86
|
+
return s.substring(0, s.length - 1).split(',').filter(Boolean)
|
|
64
87
|
}
|
|
65
88
|
</script>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
v-model="activeImage"
|
|
6
6
|
v-if="product.images.length > 0"
|
|
7
7
|
:autoplay="false"
|
|
8
|
-
:indicator="
|
|
8
|
+
:indicator="mq === 'mobile'"
|
|
9
9
|
:overlay="gallery"
|
|
10
10
|
@click="switchGallery(true)"
|
|
11
11
|
@change="changeImage"
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
<b-carousel-item v-for="(image, i) in product.images" :key="i">
|
|
16
16
|
<picture class="image">
|
|
17
17
|
<img
|
|
18
|
-
:src="image.url"
|
|
18
|
+
:src="image.url"
|
|
19
19
|
:srcset="getSrcset(image)"
|
|
20
20
|
decoding="async"
|
|
21
21
|
sizes="(min-width: 1420px) 672px, (min-width: 1220px) 576px, (min-width: 1080px) 480px, (min-width: 780px) calc(40.71vw + 48px), 100vw">
|
|
22
22
|
</picture>
|
|
23
23
|
</b-carousel-item>
|
|
24
24
|
<span v-if="gallery" @click="switchGallery(false)" class="modal-close is-large"></span>
|
|
25
|
-
<template slot
|
|
25
|
+
<template v-slot:list="props" v-if="product.images.length > 1">
|
|
26
26
|
<b-carousel-list
|
|
27
27
|
v-model="props.active"
|
|
28
28
|
v-bind="al"
|
|
@@ -43,98 +43,95 @@
|
|
|
43
43
|
</div>
|
|
44
44
|
</template>
|
|
45
45
|
|
|
46
|
-
<script>
|
|
47
|
-
import
|
|
48
|
-
import
|
|
46
|
+
<script setup>
|
|
47
|
+
import { ref, reactive, watch, onMounted, onBeforeUnmount } from 'vue'
|
|
48
|
+
import { useMq } from '../../composables/globals'
|
|
49
|
+
import { eventBus } from '../../utils/event-bus'
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
name: 'ProductImages',
|
|
52
|
-
components: { Photo },
|
|
53
|
-
props: {
|
|
54
|
-
product: {
|
|
55
|
-
type: Object,
|
|
56
|
-
default: function () {
|
|
57
|
-
return {}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
},
|
|
51
|
+
defineOptions({ name: 'ProductImages' })
|
|
61
52
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
itemsToShow: 4,
|
|
69
|
-
breakpoints: {
|
|
70
|
-
768: {
|
|
71
|
-
hasGrayscale: false,
|
|
72
|
-
itemsToShow: 6
|
|
73
|
-
},
|
|
74
|
-
960: {
|
|
75
|
-
hasGrayscale: false,
|
|
76
|
-
itemsToShow: 6
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
},
|
|
53
|
+
const props = defineProps({
|
|
54
|
+
product: {
|
|
55
|
+
type: Object,
|
|
56
|
+
default: () => ({})
|
|
57
|
+
}
|
|
58
|
+
})
|
|
82
59
|
|
|
83
|
-
|
|
84
|
-
gallery() {
|
|
85
|
-
if (this.gallery) {
|
|
86
|
-
console.log('setting items to show')
|
|
87
|
-
this.al.breakpoints['960'].itemsToShow = 12
|
|
88
|
-
} else {
|
|
89
|
-
this.al.breakpoints['960'].itemsToShow = 6
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
},
|
|
60
|
+
const emit = defineEmits(['update'])
|
|
93
61
|
|
|
94
|
-
|
|
95
|
-
changeImage(e) {
|
|
96
|
-
//console.log('changeImage ', e)
|
|
97
|
-
},
|
|
62
|
+
const mq = useMq()
|
|
98
63
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
64
|
+
// Reactive state
|
|
65
|
+
const activeImage = ref(0)
|
|
66
|
+
const gallery = ref(false)
|
|
67
|
+
const al = reactive({
|
|
68
|
+
hasGrayscale: true,
|
|
69
|
+
itemsToShow: 4,
|
|
70
|
+
breakpoints: {
|
|
71
|
+
768: {
|
|
72
|
+
hasGrayscale: false,
|
|
73
|
+
itemsToShow: 6
|
|
103
74
|
},
|
|
75
|
+
960: {
|
|
76
|
+
hasGrayscale: false,
|
|
77
|
+
itemsToShow: 6
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
})
|
|
104
81
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
82
|
+
// Watchers
|
|
83
|
+
watch(gallery, (newVal) => {
|
|
84
|
+
if (newVal) {
|
|
85
|
+
console.log('setting items to show')
|
|
86
|
+
al.breakpoints['960'].itemsToShow = 12
|
|
87
|
+
} else {
|
|
88
|
+
al.breakpoints['960'].itemsToShow = 6
|
|
89
|
+
}
|
|
90
|
+
})
|
|
113
91
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
this.gallery = value
|
|
120
|
-
if (value) {
|
|
121
|
-
document.documentElement.classList.add('is-clipped')
|
|
122
|
-
} else {
|
|
123
|
-
document.documentElement.classList.remove('is-clipped')
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
},
|
|
92
|
+
// Methods
|
|
93
|
+
const changeImage = () => {
|
|
94
|
+
//console.log('changeImage')
|
|
95
|
+
}
|
|
127
96
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
97
|
+
const getSrcset = (imgdata) => {
|
|
98
|
+
if (!imgdata.available_sizes) return
|
|
99
|
+
let srcset = []
|
|
100
|
+
imgdata.available_sizes.forEach(asize => {
|
|
101
|
+
srcset.push(`${asize.url} ${asize.width}w`)
|
|
102
|
+
})
|
|
103
|
+
return srcset.join(', ')
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const switchGallery = (value) => {
|
|
107
|
+
if (mq.value === 'mobile') {
|
|
108
|
+
gallery.value = false
|
|
109
|
+
return
|
|
110
|
+
}
|
|
111
|
+
gallery.value = value
|
|
112
|
+
if (value) {
|
|
113
|
+
document.documentElement.classList.add('is-clipped')
|
|
114
|
+
} else {
|
|
115
|
+
document.documentElement.classList.remove('is-clipped')
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const handleChangePhoto = (photoId) => {
|
|
120
|
+
let imageIndex = props.product?.images?.findIndex(img => img.id === photoId)
|
|
121
|
+
if (imageIndex >= 0) {
|
|
122
|
+
activeImage.value = imageIndex
|
|
138
123
|
}
|
|
139
124
|
}
|
|
125
|
+
|
|
126
|
+
// Lifecycle hooks
|
|
127
|
+
onMounted(() => {
|
|
128
|
+
if (window.wkl_product) {
|
|
129
|
+
emit('update', window.wkl_product)
|
|
130
|
+
}
|
|
131
|
+
eventBus.on('changePhoto', handleChangePhoto)
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
onBeforeUnmount(() => {
|
|
135
|
+
eventBus.off('changePhoto', handleChangePhoto)
|
|
136
|
+
})
|
|
140
137
|
</script>
|
|
@@ -2,63 +2,125 @@
|
|
|
2
2
|
<div class="quantity">
|
|
3
3
|
<span class="quantity-label">{{ $t('global.quantity') }}</span>
|
|
4
4
|
<div class="quantity-input">
|
|
5
|
-
<button @click="decrease"><i
|
|
6
|
-
<input type="tel" @input="qtyInput" :value="
|
|
7
|
-
<button @click="increase"><i class="
|
|
5
|
+
<button @click="decrease"><i class="fa fa-minus"></i></button>
|
|
6
|
+
<input type="tel" @input="qtyInput" :value="modelValue" />
|
|
7
|
+
<button @click="increase"><i class="fa fa-plus"></i></button>
|
|
8
8
|
</div>
|
|
9
9
|
</div>
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
|
-
<script>
|
|
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
|
-
|
|
12
|
+
<script setup>
|
|
13
|
+
|
|
14
|
+
defineOptions({ name: 'Quantity' })
|
|
15
|
+
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
modelValue: {
|
|
18
|
+
type: [Number, String],
|
|
19
|
+
default: 1
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const emit = defineEmits(['update:modelValue'])
|
|
24
|
+
|
|
25
|
+
const decrease = () => {
|
|
26
|
+
let val = 0
|
|
27
|
+
if (props.modelValue !== '') {
|
|
28
|
+
val = props.modelValue
|
|
29
|
+
}
|
|
30
|
+
if (val >= 2) {
|
|
31
|
+
emit('update:modelValue', val - 1)
|
|
32
|
+
} else {
|
|
33
|
+
emit('update:modelValue', 1)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const increase = () => {
|
|
38
|
+
let val = 0
|
|
39
|
+
if (props.modelValue !== '') {
|
|
40
|
+
val = props.modelValue
|
|
41
|
+
}
|
|
42
|
+
emit('update:modelValue', val + 1)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const qtyInput = (event) => {
|
|
46
|
+
if (event.target.value.trim() === '') {
|
|
47
|
+
emit('update:modelValue', '')
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
let val = parseInt(event.target.value, 10)
|
|
51
|
+
if (isNaN(val)) {
|
|
52
|
+
event.target.value = 1
|
|
53
|
+
props.modelValue !== 1 && emit('update:modelValue', 1)
|
|
54
|
+
return
|
|
55
|
+
}
|
|
56
|
+
if (val < 0) {
|
|
57
|
+
event.target.value = 0
|
|
58
|
+
props.modelValue !== 0 && emit('update:modelValue', 0)
|
|
59
|
+
} else if (val > 99) {
|
|
60
|
+
event.target.value = 99
|
|
61
|
+
props.modelValue !== 0 && emit('update:modelValue', 99)
|
|
62
|
+
} else {
|
|
63
|
+
event.target.value = val
|
|
64
|
+
props.modelValue !== val && emit('update:modelValue', val)
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
67
|
</script>
|
|
68
|
+
|
|
69
|
+
<style scoped>
|
|
70
|
+
.quantity {
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
gap: 0.5rem;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.quantity-label {
|
|
77
|
+
font-weight: 500;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.quantity-input {
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
border: 1px solid #dbdbdb;
|
|
84
|
+
border-radius: 4px;
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.quantity-input button {
|
|
89
|
+
background: #f5f5f5;
|
|
90
|
+
border: none;
|
|
91
|
+
padding: 0.5rem 0.75rem;
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
transition: background-color 0.2s;
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
justify-content: center;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.quantity-input button:hover {
|
|
100
|
+
background: #e8e8e8;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.quantity-input button:active {
|
|
104
|
+
background: #d8d8d8;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.quantity-input input {
|
|
108
|
+
border: none;
|
|
109
|
+
width: 60px;
|
|
110
|
+
text-align: center;
|
|
111
|
+
padding: 0.5rem;
|
|
112
|
+
font-size: 1rem;
|
|
113
|
+
appearance: textfield;
|
|
114
|
+
-moz-appearance: textfield;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.quantity-input input::-webkit-outer-spin-button,
|
|
118
|
+
.quantity-input input::-webkit-inner-spin-button {
|
|
119
|
+
-webkit-appearance: none;
|
|
120
|
+
margin: 0;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.quantity-input input:focus {
|
|
124
|
+
outline: none;
|
|
125
|
+
}
|
|
126
|
+
</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<b-modal :can-cancel="true"
|
|
3
|
+
<b-modal :can-cancel="true" v-model="showModal" @close="close" custom-class="wkl-modal-container quick-view-modal">
|
|
4
4
|
<div
|
|
5
5
|
ref="qvModal"
|
|
6
6
|
:class="['quick-view-main', 'product-main', 'product-container', { 'is-flower': product.class === 'flower' }]"
|
|
@@ -84,55 +84,62 @@
|
|
|
84
84
|
</div>
|
|
85
85
|
</template>
|
|
86
86
|
|
|
87
|
-
<script>
|
|
87
|
+
<script setup>
|
|
88
|
+
import { ref, onMounted, onBeforeUnmount } from 'vue'
|
|
89
|
+
import { useInitialState } from '../../composables/globals'
|
|
88
90
|
import config from '../../config'
|
|
89
91
|
import { request } from '../../api'
|
|
92
|
+
import { eventBus } from '../../utils/event-bus'
|
|
90
93
|
|
|
91
|
-
import AddToCart from '
|
|
92
|
-
import Price from '
|
|
93
|
-
import ProductImages from '
|
|
94
|
-
import Variants from '
|
|
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
|
-
if(variant_id) {
|
|
123
|
-
this.variant_id = variant_id
|
|
124
|
-
}
|
|
125
|
-
let resp = await request({
|
|
126
|
-
baseURL: config.BASE_URL,
|
|
127
|
-
url: '/products/' + product_id
|
|
128
|
-
})
|
|
129
|
-
this.isLoading = false
|
|
130
|
-
this.$set(this, 'product', resp.data.product_resource)
|
|
131
|
-
this.product = resp.data.product_resource
|
|
132
|
-
this.meta = resp.data.meta
|
|
133
|
-
})
|
|
94
|
+
import AddToCart from './AddToCart.vue'
|
|
95
|
+
import Price from './Price.vue'
|
|
96
|
+
import ProductImages from './ProductImages.vue'
|
|
97
|
+
import Variants from './Variants.vue'
|
|
98
|
+
|
|
99
|
+
defineOptions({ name: 'QuickView' })
|
|
100
|
+
|
|
101
|
+
const initialState = useInitialState()
|
|
102
|
+
|
|
103
|
+
// Template refs
|
|
104
|
+
const qvModal = ref(null)
|
|
105
|
+
|
|
106
|
+
// Reactive state
|
|
107
|
+
const showModal = ref(false)
|
|
108
|
+
const isLoading = ref(false)
|
|
109
|
+
const product = ref({})
|
|
110
|
+
const variant_id = ref(null)
|
|
111
|
+
const meta = ref({})
|
|
112
|
+
|
|
113
|
+
// Methods
|
|
114
|
+
const close = () => {
|
|
115
|
+
product.value = {}
|
|
116
|
+
meta.value = {}
|
|
117
|
+
showModal.value = false
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const handleQuickView = async (product_id, vid) => {
|
|
121
|
+
showModal.value = true
|
|
122
|
+
isLoading.value = true
|
|
123
|
+
if (vid) {
|
|
124
|
+
variant_id.value = vid
|
|
134
125
|
}
|
|
126
|
+
let resp = await request({
|
|
127
|
+
baseURL: config.BASE_URL,
|
|
128
|
+
url: '/products/' + product_id
|
|
129
|
+
})
|
|
130
|
+
isLoading.value = false
|
|
131
|
+
product.value = resp.data.product_resource
|
|
132
|
+
meta.value = resp.data.meta
|
|
135
133
|
}
|
|
134
|
+
|
|
135
|
+
// Lifecycle hooks
|
|
136
|
+
onMounted(() => {
|
|
137
|
+
eventBus.on('quickView', handleQuickView)
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
onBeforeUnmount(() => {
|
|
141
|
+
eventBus.off('quickView', handleQuickView)
|
|
142
|
+
})
|
|
136
143
|
</script>
|
|
137
144
|
|
|
138
145
|
<style scoped></style>
|