@viur/shop-components 0.0.1-dev.60 → 0.0.1-dev.61
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/old/client/HttpClient.js +111 -0
- package/old/client/ViURShopClient.js +472 -0
- package/old/client/index.js +23 -0
- package/old/client/types.js +10 -0
- package/old/components/ExampleUsage.vue +95 -0
- package/old/components/ShopCart.vue +91 -0
- package/old/components/ShopOrderConfirm.vue +311 -0
- package/{src → old}/components/ShopOrderStepper.vue +111 -23
- package/old/components/ShopPaymentProvider.vue +113 -0
- package/old/components/ShopShippingMethod.vue +52 -0
- package/{src/components/ui → old/components}/ShopSummary.vue +28 -35
- package/{src → old}/components/ShopUserData.vue +51 -65
- package/{src → old}/components/cart/CartLeafModel.vue +24 -16
- package/{src → old}/components/cart/CartNode.vue +1 -0
- package/{src → old}/components/cart/CartTree.vue +13 -0
- package/old/components/cart/CartView.vue +82 -0
- package/{src → old}/components/cart/Discount.vue +8 -8
- package/old/components/generic/loadinghandler.vue +76 -0
- package/old/components/paymentProvider/prepayment.vue +0 -0
- package/old/components/paymentProvider/unzerPayment.vue +140 -0
- package/old/components/simple/ShopUserData.vue +161 -0
- package/old/components/simple/SimpleDefaultLayout.vue +116 -0
- package/old/components/ui/generic/CardSelector.vue +52 -0
- package/old/components/ui/generic/CartList.vue +69 -0
- package/old/components/ui/generic/ShippingInfo.vue +56 -0
- package/old/components/ui/generic/alerts/ShopAlert.vue +30 -0
- package/old/components/ui/payment/PaymentOption.vue +79 -0
- package/old/components/ui/payment/PaymentSelector.vue +158 -0
- package/old/components/ui/stepper/StepperItem.vue +90 -0
- package/{src → old}/components/ui/stepper/StepperTab.vue +30 -2
- package/old/components/ui/stepper/StepperTrigger.vue +69 -0
- package/old/components/ui/userdata/AddForm.vue +160 -0
- package/old/components/ui/userdata/AddressBox.vue +137 -0
- package/{src → old}/components/ui/userdata/BaseLayout.vue +15 -32
- package/old/stores/address.js +122 -0
- package/old/stores/cart.js +266 -0
- package/old/stores/message.js +21 -0
- package/old/stores/order.js +202 -0
- package/old/stores/payment.js +79 -0
- package/old/stores/shipping.js +78 -0
- package/package.json +3 -5
- package/src/Shop.vue +212 -0
- package/src/ShopOrderStepper.vue +89 -0
- package/src/ShopSummary.vue +170 -0
- package/src/Steps/ShopCart.vue +60 -0
- package/src/Steps/ShopOrderComplete.vue +24 -0
- package/src/Steps/ShopOrderConfirm.vue +295 -0
- package/src/Steps/ShopPaymentProvider.vue +53 -0
- package/src/Steps/ShopShippingMethod.vue +53 -0
- package/src/Steps/ShopUserDataGuest.vue +78 -0
- package/src/Steps/index.js +15 -0
- package/src/components/AddressForm.vue +84 -0
- package/src/components/AddressFormLayout.vue +107 -0
- package/src/components/CardSelector.vue +68 -0
- package/src/components/CartItem.vue +325 -0
- package/src/components/CartItemSmall.vue +257 -0
- package/src/components/LoadingHandler.vue +76 -0
- package/src/components/PaymentOption.vue +78 -0
- package/src/components/PaymentProviderUnzer.vue +201 -0
- package/src/components/PaymentSelector.vue +55 -0
- package/src/components/ShopAlert.vue +30 -0
- package/src/components/StepperTab.vue +132 -0
- package/src/components/dialogButton.vue +49 -0
- package/src/composables/address.js +95 -0
- package/src/composables/cart.js +132 -0
- package/src/composables/order.js +80 -0
- package/src/composables/payment.js +75 -0
- package/src/composables/shipping.js +32 -0
- package/src/main.js +32 -38
- package/src/shop.js +251 -0
- package/src/translations/de.js +15 -0
- package/src/translations/en.js +5 -0
- package/src/utils.js +49 -0
- package/vite.config.js +0 -2
- package/src/components/ShopCart.vue +0 -512
- package/src/components/ShopOrderConfirm.vue +0 -291
- package/src/components/cart/CartView.vue +0 -723
- package/src/components/order/OrderSidebar.vue +0 -102
- package/src/components/order/category/CategoryList.vue +0 -83
- package/src/components/order/category/CategoryView.vue +0 -143
- package/src/components/order/information/adress/ShippingAdress.vue +0 -143
- package/src/components/order/item/ItemCard.vue +0 -168
- package/src/components/order/item/ItemView.vue +0 -232
- package/src/components/order/process/ConfirmView.vue +0 -312
- package/src/components/order/process/ExampleUsage.vue +0 -113
- package/src/components/order/process/OrderTabHeader.vue +0 -16
- package/src/components/order/process/SelectPaymentProvider.vue +0 -62
- package/src/components/order/process/Shipping.vue +0 -46
- package/src/components/ui/generic/ArticleList.vue +0 -222
- package/src/components/ui/generic/ExamplePagination.vue +0 -236
- package/src/components/ui/generic/alerts/ShopAlert.vue +0 -19
- package/src/components/ui/generic/makeData.js +0 -39
- package/src/components/ui/stepper/StepperItem.vue +0 -39
- package/src/components/ui/stepper/StepperTrigger.vue +0 -35
- package/src/components/ui/userdata/AddForm.vue +0 -125
- package/src/components/ui/userdata/AddressBox.vue +0 -117
- package/src/router/index.js +0 -103
- package/src/stores/cart.js +0 -336
- package/src/views/ViewMissing.vue +0 -20
- /package/{src → old}/components/ShopOrderComplete.vue +0 -0
- /package/{src → old}/components/cart/CartLeaf.vue +0 -0
- /package/{src → old}/components/cart/CartTreeWrapper.vue +0 -0
- /package/{src/components/lib/utils.js → old/components/paymentProvider/paypalplus.vue} +0 -0
- /package/{src → old}/components/ui/generic/ShopPriceFormatter.vue +0 -0
- /package/{src → old}/components/ui/userdata/CustomBooleanBone.vue +0 -0
- /package/{src → old}/components/ui/userdata/CustomSelectBone.vue +0 -0
- /package/{src → old}/components/ui/userdata/CustomStringBone.vue +0 -0
- /package/{src → old}/components/ui/userdata/DefaultLayout.vue +0 -0
- /package/{src → old}/components/ui/userdata/SelectAddress.vue +0 -0
- /package/{src → old}/components/ui/userdata/multi/ActionBar.vue +0 -0
- /package/{src → old}/components/ui/userdata/multi/CartSelection.vue +0 -0
- /package/{src/style → old}/ignite/.editorconfig +0 -0
- /package/{src/style → old}/ignite/.github/workflows/ignite.yml +0 -0
- /package/{src/style → old}/ignite/.github/workflows/node.yml +0 -0
- /package/{src/style → old}/ignite/.postcssrc.cjs +0 -0
- /package/{src/style → old}/ignite/CHANGELOG.md +0 -0
- /package/{src/style → old}/ignite/LICENSE +0 -0
- /package/{src/style → old}/ignite/README.md +0 -0
- /package/{src/style → old}/ignite/dist/ignite.css +0 -0
- /package/{src/style → old}/ignite/dist/ignite.min.css +0 -0
- /package/{src/style → old}/ignite/foundation/basic.css +0 -0
- /package/{src/style → old}/ignite/foundation/color.css +0 -0
- /package/{src/style → old}/ignite/foundation/config.css +0 -0
- /package/{src/style → old}/ignite/foundation/grid.css +0 -0
- /package/{src/style → old}/ignite/foundation/mediaqueries.css +0 -0
- /package/{src/style → old}/ignite/foundation/reset.css +0 -0
- /package/{src/style → old}/ignite/ignite.css +0 -0
- /package/{src/style → old}/ignite/ignite.css.map +0 -0
- /package/{src/style → old}/ignite/package-lock.json +0 -0
- /package/{src/style → old}/ignite/package.json +0 -0
- /package/{src/style → old}/ignite/shoelace.css +0 -0
- /package/{src/style → old}/ignite/themes/dark.css +0 -0
- /package/{src/style → old}/ignite/themes/light.css +0 -0
- /package/{src/style → old}/ignite/utilities/shoelace.css +0 -0
- /package/{src/style → old}/ignite/utilities/utilities.css +0 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="item-wrapper">
|
|
3
|
+
<sl-card horizontal class="viur-shop-cart-leaf-small">
|
|
4
|
+
<img
|
|
5
|
+
class="viur-shop-cart-leaf-image"
|
|
6
|
+
slot="image"
|
|
7
|
+
:src="
|
|
8
|
+
getImage(
|
|
9
|
+
item?.shop_image
|
|
10
|
+
? item.shop_image
|
|
11
|
+
: undefined,
|
|
12
|
+
)
|
|
13
|
+
"
|
|
14
|
+
/>
|
|
15
|
+
<h4
|
|
16
|
+
class="viur-shop-cart-leaf-headline headline"
|
|
17
|
+
v-html="getValue(item.shop_name)"
|
|
18
|
+
></h4>
|
|
19
|
+
|
|
20
|
+
<sl-input
|
|
21
|
+
:disabled="!edit"
|
|
22
|
+
class="viur-shop-cart-leaf-value viur-shop-cart-leaf-value--quantity"
|
|
23
|
+
type="number"
|
|
24
|
+
placeholder="Number"
|
|
25
|
+
min="0"
|
|
26
|
+
noSpinButtons
|
|
27
|
+
:value="item.quantity"
|
|
28
|
+
@sl-change="changeAmount($event.target.value)"
|
|
29
|
+
>
|
|
30
|
+
<dialog-Button slot="prefix" class="decent" v-if="item.quantity===1" variant="danger" outline>
|
|
31
|
+
<sl-icon name="trash"></sl-icon>
|
|
32
|
+
<template #dialog="{close}">
|
|
33
|
+
Wollen sie den Artikel wirklich entfernen?
|
|
34
|
+
<sl-bar>
|
|
35
|
+
<sl-button slot="left" @click="close">Abbrechen</sl-button>
|
|
36
|
+
<sl-button slot="right" variant="danger" @click="removeArticle(); close()">Löschen</sl-button>
|
|
37
|
+
</sl-bar>
|
|
38
|
+
</template>
|
|
39
|
+
</dialog-Button>
|
|
40
|
+
<sl-button slot="prefix" v-else @click="changeAmount(item.quantity-=1)">
|
|
41
|
+
<sl-icon name="dash-lg"></sl-icon>
|
|
42
|
+
</sl-button>
|
|
43
|
+
<sl-button slot="suffix" @click="changeAmount(item.quantity+=1)">
|
|
44
|
+
<sl-icon name="plus-lg"></sl-icon>
|
|
45
|
+
</sl-button>
|
|
46
|
+
</sl-input>
|
|
47
|
+
|
|
48
|
+
<div class="viur-shop-cart-leaf-article-number">
|
|
49
|
+
<div class="viur-shop-cart-leaf-label">Artikelnummer</div>
|
|
50
|
+
{{ getValue(item.shop_art_no_or_gtin) }}
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<div class="viur-shop-cart-leaf-unitprice">
|
|
54
|
+
<div class="viur-shop-cart-leaf-label">Stückpreis</div>
|
|
55
|
+
<sl-format-number
|
|
56
|
+
class="viur-shop-cart-leaf-value viur-shop-cart-leaf-value--unitprice"
|
|
57
|
+
lang="de"
|
|
58
|
+
type="currency"
|
|
59
|
+
currency="EUR"
|
|
60
|
+
:value="item.shop_price_retail"
|
|
61
|
+
>
|
|
62
|
+
</sl-format-number>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
<div class="viur-shop-cart-leaf-price">
|
|
67
|
+
<div class="viur-shop-cart-leaf-label">Gesamtpreis</div>
|
|
68
|
+
<sl-format-number
|
|
69
|
+
class="viur-shop-cart-leaf-value viur-shop-cart-leaf-value--price"
|
|
70
|
+
lang="de"
|
|
71
|
+
type="currency"
|
|
72
|
+
currency="EUR"
|
|
73
|
+
:value="item.shop_price_retail * item.quantity"
|
|
74
|
+
>
|
|
75
|
+
</sl-format-number>
|
|
76
|
+
</div>
|
|
77
|
+
</sl-card>
|
|
78
|
+
<div class="loading" v-if="cartState.isUpdating">
|
|
79
|
+
<sl-spinner></sl-spinner>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</template>
|
|
83
|
+
<script setup>
|
|
84
|
+
import { useDebounceFn } from '@vueuse/core'
|
|
85
|
+
import { getImage } from '../utils';
|
|
86
|
+
import { useCart } from '../composables/cart';
|
|
87
|
+
import dialogButton from './dialogButton.vue';
|
|
88
|
+
|
|
89
|
+
const {addItem, removeItem, state:cartState, getValue} = useCart()
|
|
90
|
+
|
|
91
|
+
const changeAmount = useDebounceFn((amount) => {
|
|
92
|
+
props.item.quantity = amount
|
|
93
|
+
addItem(props.item['article']['dest']['key'],amount)
|
|
94
|
+
}, 1000)
|
|
95
|
+
|
|
96
|
+
const props = defineProps({
|
|
97
|
+
item:{
|
|
98
|
+
required:true
|
|
99
|
+
},
|
|
100
|
+
edit:{
|
|
101
|
+
type:Boolean,
|
|
102
|
+
default:false //true
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
function removeArticle(){
|
|
107
|
+
removeItem(props.item['article']['dest']['key'])
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
</script>
|
|
111
|
+
<style scoped>
|
|
112
|
+
@layer foundation.shop {
|
|
113
|
+
.viur-shop-cart-leaf-small {
|
|
114
|
+
--shop-leaf-label-color: var(--ignt-color-primary);
|
|
115
|
+
--shop-leaf-label-font-weight: 600;
|
|
116
|
+
--shop-leaf-label-font-size: 1em;
|
|
117
|
+
--shop-leaf-price-font-size: 1em;
|
|
118
|
+
--shop-leaf-headline-font-size: 1.3em;
|
|
119
|
+
|
|
120
|
+
&::part(base) {
|
|
121
|
+
display: flex;
|
|
122
|
+
position: relative;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&::part(header) {
|
|
126
|
+
border-bottom: none;
|
|
127
|
+
padding-top: 0;
|
|
128
|
+
padding-right: 0;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&::part(image) {
|
|
132
|
+
aspect-ratio: 1;
|
|
133
|
+
flex-basis: 120px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&::part(body) {
|
|
137
|
+
display: grid;
|
|
138
|
+
grid-template-columns: repeat(5, minmax(0, 1fr));
|
|
139
|
+
gap: var(--sl-spacing-medium);
|
|
140
|
+
padding: var(--sl-spacing-large);
|
|
141
|
+
height: 100%;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&::part(group) {
|
|
145
|
+
padding: 0;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@media (max-width: 600px) {
|
|
149
|
+
&::part(body) {
|
|
150
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
151
|
+
gap: var(--sl-spacing-medium);
|
|
152
|
+
padding: var(--sl-spacing-large);
|
|
153
|
+
height: 100%;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&::part(image) {
|
|
157
|
+
border-radius: var(--border-radius);
|
|
158
|
+
align-self: baseline;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.viur-shop-cart-leaf-image {
|
|
164
|
+
aspect-ratio: 1;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.viur-shop-cart-leaf-headline {
|
|
168
|
+
grid-column: 1 / span 4;
|
|
169
|
+
order: -2;
|
|
170
|
+
margin: 0;
|
|
171
|
+
font-size: var(--shop-leaf-headline-font-size);
|
|
172
|
+
|
|
173
|
+
@media (max-width: 600px) {
|
|
174
|
+
grid-column: 1 / span 2;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.viur-shop-cart-leaf-price {
|
|
179
|
+
grid-column: 5 / span 1;
|
|
180
|
+
align-self: flex-end;
|
|
181
|
+
text-align: right;
|
|
182
|
+
font-size: var(--shop-leaf-price-font-size);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.viur-shop-cart-leaf-article-number {
|
|
186
|
+
align-self: center;
|
|
187
|
+
grid-column: span 2;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.viur-shop-cart-leaf-quantity {
|
|
191
|
+
align-self: center;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.viur-shop-cart-leaf-unitprice {
|
|
195
|
+
align-self: center;
|
|
196
|
+
grid-column: 4 / span 1;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.viur-shop-cart-leaf-label,
|
|
200
|
+
.viur-shop-cart-leaf-value--quantity::part(form-control-label) {
|
|
201
|
+
color: var(--shop-leaf-label-color);
|
|
202
|
+
font-weight: var(--shop-leaf-label-font-weight);
|
|
203
|
+
font-size: calc(var(--shop-leaf-label-font-size) *.75);
|
|
204
|
+
margin-bottom: var(--ignt-spacing-2x-small);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.loading{
|
|
208
|
+
position: absolute;
|
|
209
|
+
top: 0;
|
|
210
|
+
background: #ffffffcc;
|
|
211
|
+
width: 100%;
|
|
212
|
+
height: 100%;
|
|
213
|
+
display: flex;
|
|
214
|
+
flex-direction: row;
|
|
215
|
+
flex-wrap: nowrap;
|
|
216
|
+
justify-content: center;
|
|
217
|
+
align-items: center;
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
& sl-spinner{
|
|
221
|
+
font-size:3rem;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.item-wrapper{
|
|
226
|
+
position: relative;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.viur-shop-cart-leaf-value--quantity{
|
|
230
|
+
align-self: center;
|
|
231
|
+
grid-column: span 1;
|
|
232
|
+
|
|
233
|
+
&::part(input){
|
|
234
|
+
text-align: center;
|
|
235
|
+
padding: 0;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
sl-button{
|
|
239
|
+
margin: 0;
|
|
240
|
+
transition: all ease .3s;
|
|
241
|
+
|
|
242
|
+
&::part(base){
|
|
243
|
+
background-color: transparent;
|
|
244
|
+
border: none;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
&::part(label){
|
|
248
|
+
padding: 0;
|
|
249
|
+
height: var(--sl-input-height-medium);
|
|
250
|
+
width: calc(var(--sl-input-height-medium) / 5 * 4);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
}
|
|
257
|
+
</style>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<template v-if="isLoading">
|
|
3
|
+
<slot name="loading">
|
|
4
|
+
<shop-alert duration="Infinity" variant="info" :closeable="false">
|
|
5
|
+
<template #icon>
|
|
6
|
+
<sl-spinner class="spinner-loading" slot="icon"></sl-spinner>
|
|
7
|
+
</template>
|
|
8
|
+
<template #alertMsg>
|
|
9
|
+
Daten werden abgefragt...
|
|
10
|
+
</template>
|
|
11
|
+
</shop-alert>
|
|
12
|
+
</slot>
|
|
13
|
+
</template>
|
|
14
|
+
<template v-else-if="isUpdating">
|
|
15
|
+
<slot name="updating">
|
|
16
|
+
<shop-alert duration="Infinity" variant="info" :closeable="false">
|
|
17
|
+
<template #icon>
|
|
18
|
+
<sl-spinner class="spinner-loading" slot="icon"></sl-spinner>
|
|
19
|
+
</template>
|
|
20
|
+
<template #alertMsg>
|
|
21
|
+
Daten werden aktualisiert...
|
|
22
|
+
</template>
|
|
23
|
+
</shop-alert>
|
|
24
|
+
</slot>
|
|
25
|
+
</template>
|
|
26
|
+
<template v-else-if="hasError">
|
|
27
|
+
<slot name="error">
|
|
28
|
+
<shop-alert duration="Infinity" iconName="x-lg" variant="danger" :closeable="false">
|
|
29
|
+
<template #alertMsg>
|
|
30
|
+
{{ errorMessage }}
|
|
31
|
+
</template>
|
|
32
|
+
</shop-alert>
|
|
33
|
+
</slot>
|
|
34
|
+
</template>
|
|
35
|
+
<template v-else>
|
|
36
|
+
<slot>
|
|
37
|
+
</slot>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script setup>
|
|
45
|
+
import ShopAlert from './ShopAlert.vue'
|
|
46
|
+
|
|
47
|
+
const props = defineProps({
|
|
48
|
+
isLoading:{
|
|
49
|
+
type:Boolean,
|
|
50
|
+
default:true
|
|
51
|
+
},
|
|
52
|
+
isUpdating:{
|
|
53
|
+
type:Boolean,
|
|
54
|
+
default:false
|
|
55
|
+
},
|
|
56
|
+
hasError:{
|
|
57
|
+
type:Boolean,
|
|
58
|
+
default:false
|
|
59
|
+
},
|
|
60
|
+
errorMessage:{
|
|
61
|
+
type:String,
|
|
62
|
+
default:"Ein Fehler ist aufgetreten."
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
})
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<style scoped>
|
|
69
|
+
|
|
70
|
+
.spinner-loading{
|
|
71
|
+
--indicator-color:var(--sl-color-info-500);
|
|
72
|
+
}
|
|
73
|
+
.spinner-error{
|
|
74
|
+
--indicator-color:var(--sl-color-danger-500);
|
|
75
|
+
}
|
|
76
|
+
</style>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<sl-details :class="{
|
|
3
|
+
simple:widget==='simple'
|
|
4
|
+
}"
|
|
5
|
+
@sl-show="selection" >
|
|
6
|
+
<div slot="summary" class="payment-selection">
|
|
7
|
+
<div class="start">
|
|
8
|
+
<sl-icon :name="icon"></sl-icon>
|
|
9
|
+
{{ name }}
|
|
10
|
+
</div>
|
|
11
|
+
<sl-radio :value="paymenttype" ></sl-radio>
|
|
12
|
+
</div>
|
|
13
|
+
<slot>
|
|
14
|
+
{{description}}
|
|
15
|
+
</slot>
|
|
16
|
+
|
|
17
|
+
<template v-if="widget==='simple'">
|
|
18
|
+
<div slot="expand-icon" style="width:1em"></div>
|
|
19
|
+
<div slot="collapse-icon" style="width:1em"></div>
|
|
20
|
+
</template>
|
|
21
|
+
</sl-details>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script setup>
|
|
25
|
+
const emits = defineEmits(['change'])
|
|
26
|
+
const props = defineProps({
|
|
27
|
+
paymenttype: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: 'prepayment'
|
|
30
|
+
},
|
|
31
|
+
name: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: 'Paymentname'
|
|
34
|
+
},
|
|
35
|
+
icon: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: 'currency-euro'
|
|
38
|
+
},
|
|
39
|
+
description: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: 'Payment description'
|
|
42
|
+
},
|
|
43
|
+
widget:{
|
|
44
|
+
type:String,
|
|
45
|
+
default:'default' //simple
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
function selection(){
|
|
50
|
+
emits('change',props.paymenttype)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<style scoped>
|
|
58
|
+
.payment-selection{
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
flex-wrap: nowrap;
|
|
62
|
+
flex-direction: row;
|
|
63
|
+
align-content: center;
|
|
64
|
+
justify-content: space-between;
|
|
65
|
+
width: 100%;
|
|
66
|
+
|
|
67
|
+
.start{
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
flex-wrap: nowrap;
|
|
71
|
+
gap:10px;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.simple::part(content){
|
|
76
|
+
display:none;
|
|
77
|
+
}
|
|
78
|
+
</style>
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="loading-wrapper" v-if="state.loading">
|
|
3
|
+
<sl-spinner class="loading"></sl-spinner>
|
|
4
|
+
</div>
|
|
5
|
+
|
|
6
|
+
<div class="loading-wrapper" v-if="PaymentCheckIsActive">
|
|
7
|
+
<sl-spinner class="loading"></sl-spinner>
|
|
8
|
+
warte auf Zahlung...
|
|
9
|
+
</div>
|
|
10
|
+
<div class="form-wrapper">
|
|
11
|
+
<sl-alert :open="state.hasError" variant="danger">{{state.errorMessage}}</sl-alert>
|
|
12
|
+
<form class="unzerUI form" novalidate>
|
|
13
|
+
<template v-if="shopStore.state.order?.['payment_provider'] === 'unzer-card'">
|
|
14
|
+
<div class="field">
|
|
15
|
+
<div id="card-element-id-number" class="unzerInput">
|
|
16
|
+
<!-- Card number UI Element is inserted here. -->
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="two fields">
|
|
20
|
+
<div class="field ten wide">
|
|
21
|
+
<div id="card-element-id-expiry" class="unzerInput">
|
|
22
|
+
<!-- Card expiry date UI Element is inserted here. -->
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="field six wide">
|
|
26
|
+
<div id="card-element-id-cvc" class="unzerInput">
|
|
27
|
+
<!-- Card CVC UI Element is inserted here. -->
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<template v-else-if="shopStore.state.order?.['payment_provider'] === 'unzer-paypal'">
|
|
34
|
+
<div id="paypal-element" class="field"></div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<template v-else-if="shopStore.state.order?.['payment_provider'] === 'unzer-ideal'">
|
|
38
|
+
<div id="ideal-element" class="field"></div>
|
|
39
|
+
</template>
|
|
40
|
+
</form>
|
|
41
|
+
<button :disabled="state.loading" class="unzerUI primary button fluid" @click="submitFormToUnzer">Bezahlen</button>
|
|
42
|
+
<sl-button :disabled="state.loading" variant="danger" @click="cancelPayment">Abbrechen</sl-button>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script setup>
|
|
47
|
+
import {computed, onBeforeMount, onMounted, reactive} from 'vue'
|
|
48
|
+
import { useViurShopStore } from '../shop';
|
|
49
|
+
import { useOrder } from '../composables/order';
|
|
50
|
+
import {Request} from '@viur/vue-utils'
|
|
51
|
+
import { useIntervalFn } from '@vueuse/core'
|
|
52
|
+
const shopStore = useViurShopStore()
|
|
53
|
+
const {fetchOrder} = useOrder()
|
|
54
|
+
|
|
55
|
+
const emits = defineEmits(['cancel'])
|
|
56
|
+
|
|
57
|
+
const { pause:PaymentCheckPause, resume:PaymentCheckResume, isActive:PaymentCheckIsActive } = useIntervalFn(() => {
|
|
58
|
+
fetchOrder(shopStore.state.orderKey)
|
|
59
|
+
|
|
60
|
+
if (shopStore.state.order?.['is_paid']){
|
|
61
|
+
PaymentCheckPause()
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
}, 2000,{immediate:false})
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
const state = reactive({
|
|
68
|
+
unzer:computed(()=>{
|
|
69
|
+
if (!shopStore.state.paymentProviderData) return null
|
|
70
|
+
return new unzer(shopStore.state.paymentProviderData["public_key"], {locale: 'de-DE'})
|
|
71
|
+
}),
|
|
72
|
+
paymentHandler:{},
|
|
73
|
+
loading:false,
|
|
74
|
+
hasError:false,
|
|
75
|
+
errorMessage:"Bei der Zahlung ist ein Fehler aufgetreten.",
|
|
76
|
+
waitPayment:false
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
function initUnzerForm(){
|
|
81
|
+
//Unzer field definition
|
|
82
|
+
if (shopStore.state.order?.['payment_provider'] === 'unzer-card') {
|
|
83
|
+
const card = state.unzer.Card();
|
|
84
|
+
// Rendering input field card number
|
|
85
|
+
card.create('number', {
|
|
86
|
+
containerId: 'card-element-id-number',
|
|
87
|
+
onlyIframe: false,
|
|
88
|
+
});
|
|
89
|
+
// Rendering input field card expiry
|
|
90
|
+
card.create('expiry', {
|
|
91
|
+
containerId: 'card-element-id-expiry',
|
|
92
|
+
onlyIframe: false,
|
|
93
|
+
});
|
|
94
|
+
// Rendering input field card cvc
|
|
95
|
+
card.create('cvc', {
|
|
96
|
+
containerId: 'card-element-id-cvc',
|
|
97
|
+
onlyIframe: false,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
state.paymentHandler['unzer-card'] = card
|
|
101
|
+
} else if (shopStore.state.order?.['payment_provider'] === 'unzer-paypal') {
|
|
102
|
+
// Creating a PayPal instance
|
|
103
|
+
const paypal = state.unzer.Paypal()
|
|
104
|
+
// Rendering input field
|
|
105
|
+
//paypal.create('email', {
|
|
106
|
+
// containerId: 'paypal-element',
|
|
107
|
+
//});
|
|
108
|
+
state.paymentHandler['unzer-paypal']= paypal;
|
|
109
|
+
} else if (shopStore.state.order?.['payment_provider'] === 'unzer-sofort') {
|
|
110
|
+
const sofort = state.unzer.Sofort()
|
|
111
|
+
state.paymentHandler['unzer-sofort'] = sofort;
|
|
112
|
+
} else if (shopStore.state.order?.['payment_provider'] === 'unzer-ideal') {
|
|
113
|
+
const ideal = state.unzer.Ideal()
|
|
114
|
+
ideal.create('ideal', {
|
|
115
|
+
containerId: 'ideal-element',
|
|
116
|
+
});
|
|
117
|
+
state.paymentHandler['unzer-ideal'] = ideal;
|
|
118
|
+
}
|
|
119
|
+
state.loading = false
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function paymentError(error){
|
|
123
|
+
state.loading = false
|
|
124
|
+
state.hasError = true
|
|
125
|
+
//reset session id
|
|
126
|
+
//state.paymentHandler[shopStore.state.order?.['payment_provider']].jsessionId = state.paymentHandler[shopStore.state.order?.['payment_provider']].requestJSessionId()
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
function submitFormToUnzer(){
|
|
131
|
+
PaymentCheckPause()
|
|
132
|
+
state.loading = true
|
|
133
|
+
let paymenttarget = shopStore.state.order?.['payment_provider'].split("-")[1]
|
|
134
|
+
console.log(state.paymentHandler)
|
|
135
|
+
//send to unzer
|
|
136
|
+
state.paymentHandler[shopStore.state.order?.['payment_provider']].createResource().then((result)=>{
|
|
137
|
+
Request.post(`${shopStore.state.shopUrl}/pp_unzer_${paymenttarget}/save_type`, {dataObj:{
|
|
138
|
+
order_key: shopStore.state.orderKey,
|
|
139
|
+
type_id: result.id,
|
|
140
|
+
}}).then(async (resp)=>{
|
|
141
|
+
let data = await resp.json()
|
|
142
|
+
shopStore.state.order = data
|
|
143
|
+
|
|
144
|
+
shopStore.checkoutOrder().then((resp)=>{
|
|
145
|
+
state.loading = false
|
|
146
|
+
state.hasError = false
|
|
147
|
+
if(shopStore.state.paymentProviderData?.redirectUrl){
|
|
148
|
+
state.waitPayment = true
|
|
149
|
+
window.open(shopStore.state.paymentProviderData.redirectUrl,"_blank","popup")
|
|
150
|
+
PaymentCheckResume()
|
|
151
|
+
}
|
|
152
|
+
}).catch(async (error)=>{
|
|
153
|
+
paymentError(error)
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
}).catch(error => {
|
|
157
|
+
paymentError(error)
|
|
158
|
+
})
|
|
159
|
+
}).catch((error)=> {
|
|
160
|
+
paymentError(error)
|
|
161
|
+
})
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
function cancelPayment(){
|
|
166
|
+
PaymentCheckPause()
|
|
167
|
+
emits('cancel')
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
onBeforeMount(()=>{
|
|
171
|
+
state.loading = true
|
|
172
|
+
if (!shopStore.state.paymentProviderData){
|
|
173
|
+
shopStore.checkout().then(()=>{
|
|
174
|
+
initUnzerForm()
|
|
175
|
+
}).catch((error)=>{
|
|
176
|
+
console.log(error)
|
|
177
|
+
})
|
|
178
|
+
}else{
|
|
179
|
+
initUnzerForm()
|
|
180
|
+
}
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
</script>
|
|
184
|
+
|
|
185
|
+
<style scoped>
|
|
186
|
+
.loading-wrapper{
|
|
187
|
+
display:flex;
|
|
188
|
+
flex-direction: column;
|
|
189
|
+
align-items: center;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.form-wrapper{
|
|
193
|
+
display:flex;
|
|
194
|
+
flex-direction: column;
|
|
195
|
+
gap:20px;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.loading{
|
|
199
|
+
font-size:3rem;
|
|
200
|
+
}
|
|
201
|
+
</style>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<sl-radio-group :value="state.selection">
|
|
3
|
+
<sl-details-group>
|
|
4
|
+
|
|
5
|
+
<payment-option v-for="option in options" :key="option.id"
|
|
6
|
+
:paymenttype="option.paymenttype"
|
|
7
|
+
:name="option.name"
|
|
8
|
+
:icon="option.icon"
|
|
9
|
+
:widget="option.widget"
|
|
10
|
+
:description="option.description"
|
|
11
|
+
@change="optionChanged"
|
|
12
|
+
|
|
13
|
+
>
|
|
14
|
+
|
|
15
|
+
</payment-option>
|
|
16
|
+
|
|
17
|
+
</sl-details-group>
|
|
18
|
+
</sl-radio-group>
|
|
19
|
+
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup>
|
|
23
|
+
import {usePaymentStore} from "../../../stores/payment"
|
|
24
|
+
import PaymentOption from "./PaymentOption.vue"
|
|
25
|
+
import {computed, reactive, ref} from 'vue'
|
|
26
|
+
import {Request} from "@viur/vue-utils";
|
|
27
|
+
|
|
28
|
+
const paymentStore = usePaymentStore()
|
|
29
|
+
const props = defineProps({
|
|
30
|
+
selection: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: null
|
|
33
|
+
},
|
|
34
|
+
options: {
|
|
35
|
+
type: Array,
|
|
36
|
+
default: () => []
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const state = reactive({
|
|
41
|
+
selection:null,
|
|
42
|
+
hasError:false
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
function optionChanged(type){
|
|
46
|
+
state.selection=type
|
|
47
|
+
paymentStore.state.paymentSelection = state.selection
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<style scoped>
|
|
54
|
+
|
|
55
|
+
</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<sl-alert :variant="variant" open :closable="closeable" :duration="duration" @sl-hide="onHide">
|
|
3
|
+
<slot name="icon">
|
|
4
|
+
<sl-icon slot="icon" :name="iconName"></sl-icon>
|
|
5
|
+
</slot>
|
|
6
|
+
<slot name="alertMsg">{{ msg }}</slot>
|
|
7
|
+
</sl-alert>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup>
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
variant: { type: String, default: "primary" },
|
|
13
|
+
iconName: { type: String, default: "info-circle" },
|
|
14
|
+
closeable:{
|
|
15
|
+
type:Boolean,
|
|
16
|
+
default:true
|
|
17
|
+
},
|
|
18
|
+
duration:{
|
|
19
|
+
type: [Number, String],
|
|
20
|
+
default: 3000 // use "Infinity" for fix message
|
|
21
|
+
},
|
|
22
|
+
msg: { type: String, default: "ALERT!" },
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const emit = defineEmits(["onHide"]);
|
|
26
|
+
|
|
27
|
+
function onHide() {
|
|
28
|
+
emit("onHide");
|
|
29
|
+
}
|
|
30
|
+
</script>
|