@viur/shop-components 0.0.1-dev.9 → 0.1.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.
Files changed (56) hide show
  1. package/.editorconfig +16 -0
  2. package/.github/workflows/npm-publish.yml +42 -0
  3. package/.gitmodules +3 -0
  4. package/LICENSE +21 -0
  5. package/README.md +13 -2
  6. package/package.json +23 -11
  7. package/src/Shop.vue +232 -0
  8. package/src/ShopOrderStepper.vue +114 -0
  9. package/src/ShopSummary.vue +196 -0
  10. package/src/Steps/ShopCart.vue +57 -0
  11. package/src/Steps/ShopOrderComplete.vue +32 -0
  12. package/src/Steps/ShopOrderConfirm.vue +300 -0
  13. package/src/Steps/ShopPaymentProvider.vue +56 -0
  14. package/src/Steps/ShopShippingMethod.vue +67 -0
  15. package/src/Steps/ShopUserDataGuest.vue +82 -0
  16. package/src/Steps/index.js +15 -0
  17. package/src/components/AddressForm.vue +95 -0
  18. package/src/components/AddressFormLayout.vue +107 -0
  19. package/src/components/CardSelector.vue +68 -0
  20. package/src/components/CartItem.vue +353 -0
  21. package/src/components/CartItemSmall.vue +257 -0
  22. package/src/components/DiscountInput.vue +91 -0
  23. package/src/components/LoadingHandler.vue +76 -0
  24. package/src/components/PaymentOption.vue +78 -0
  25. package/src/components/PaymentProviderUnzer.vue +201 -0
  26. package/src/components/PaymentSelector.vue +55 -0
  27. package/src/components/ShopAlert.vue +30 -0
  28. package/src/components/StepperTab.vue +132 -0
  29. package/src/components/dialogButton.vue +49 -0
  30. package/src/composables/address.js +95 -0
  31. package/src/composables/cart.js +189 -0
  32. package/src/composables/order.js +80 -0
  33. package/src/composables/payment.js +75 -0
  34. package/src/composables/shipping.js +40 -0
  35. package/src/main.js +44 -0
  36. package/src/shop.js +252 -0
  37. package/src/translations/de.js +36 -0
  38. package/src/translations/en.js +5 -0
  39. package/src/utils.js +56 -0
  40. package/vite.config.js +51 -0
  41. package/src/components/cart/CartView.vue +0 -693
  42. package/src/components/cart/ConfirmView.vue +0 -314
  43. package/src/components/order/category/CategoryList.vue +0 -83
  44. package/src/components/order/category/CategoryView.vue +0 -143
  45. package/src/components/order/information/UserInfoMulti.vue +0 -427
  46. package/src/components/order/information/UserInformation.vue +0 -332
  47. package/src/components/order/information/adress/ShippingAdress.vue +0 -143
  48. package/src/components/order/item/ItemCard.vue +0 -168
  49. package/src/components/order/item/ItemView.vue +0 -233
  50. package/src/components/order/process/ExampleUsage.vue +0 -100
  51. package/src/components/order/process/OrderComplete.vue +0 -41
  52. package/src/components/order/process/OrderTabHeader.vue +0 -7
  53. package/src/components/order/process/OrderView.vue +0 -210
  54. package/src/router/index.js +0 -103
  55. package/src/stores/cart.js +0 -119
  56. package/src/views/ViewMissing.vue +0 -20
@@ -0,0 +1,196 @@
1
+ <template>
2
+ <LoadingHandler :isLoading="!state.items.length">
3
+ <h2 class="viur-shop-cart-sidebar-headline headline">Zusammenfassung</h2>
4
+ <div class="viur-shop-cart-sidebar-summary">
5
+ <div class="viur-shop-cart-sidebar-summary-item" v-for="item in state.items">
6
+ <template v-if="(!shopStore.state.showNodes && item.skel_type === 'leaf') || shopStore.state.showNodes">
7
+ <div class="viur-shop-cart-sidebar-summary-item-amount" v-if="item.skel_type === 'leaf'">{{ item.quantity }}x
8
+ </div>
9
+ <div class="viur-shop-cart-sidebar-summary-item-name" v-html="item.skel_type === 'node' ? item.name : item.shop_name"></div>
10
+ <div class="viur-shop-cart-sidebar-summary-item-price">
11
+ <sl-format-number lang="de" type="currency" currency="EUR"
12
+ :value="item.total ? item.total : item.price?.current">
13
+ </sl-format-number>
14
+ </div>
15
+ </template>
16
+ </div>
17
+ </div>
18
+ <div class="viur-shop-cart-sidebar-info-line">
19
+ <span>Zwischensumme</span>
20
+ <sl-format-number lang="de" type="currency" currency="EUR" :value="state.cartTotal">
21
+ </sl-format-number>
22
+ </div>
23
+ <div class="viur-shop-cart-sidebar-info-line">
24
+ <span>Versandkosten</span>
25
+ <sl-format-number lang="de" type="currency" currency="EUR" :value="state.shippingTotal">
26
+ </sl-format-number>
27
+ </div>
28
+ <div class="viur-shop-cart-shipping-item" v-if="shopStore.state.order?.cart?.dest?.shipping">
29
+ <span>Lieferzeit </span>
30
+ <span>
31
+ {{
32
+ shopStore.state.order?.cart?.dest?.shipping?.dest?.delivery_time_range ?
33
+ shopStore.state.order?.cart?.dest?.shipping?.dest?.delivery_time_range :
34
+ 0
35
+ }} {{ shopStore.state.order?.cart?.dest?.shipping?.dest?.delivery_time_range === 1 ? "Tag" : "Tage" }}
36
+ </span>
37
+ </div>
38
+ <div class="viur-shop-cart-sidebar-info-line" v-if="shopStore.state.cartRoot.discount">
39
+ <span>Rabatt</span>
40
+ <sl-format-number lang="de" type="currency" currency="EUR" :value="state.discount">
41
+ </sl-format-number>
42
+ </div>
43
+ <discount-input v-if="shopStore.state.currentTab!=='complete'"></discount-input>
44
+ <div class="viur-shop-cart-sidebar-info-line">
45
+ </div>
46
+
47
+ <div class="viur-shop-cart-sidebar-info-line total">
48
+ <span>Gesamt:</span>
49
+ <sl-format-number lang="de" type="currency" currency="EUR" :value="state.total">
50
+ </sl-format-number>
51
+ </div>
52
+ <div class="viur-shop-cart-sidebar-info-line ">
53
+ <span>inkl. MwSt:</span>
54
+ <sl-format-number lang="de" type="currency" currency="EUR" :value="state.vat">
55
+ </sl-format-number>
56
+ </div>
57
+ <slot name="action-buttons" >
58
+ <div class="viur-shop-cart-sidebar-btn-wrap" v-if="false && !shopStore.state.order?.['is_paid']">
59
+ <sl-button variant="primary" size="medium">Bestellen</sl-button>
60
+ </div>
61
+ </slot>
62
+ </LoadingHandler>
63
+ </template>
64
+
65
+ <script setup>
66
+ import { reactive, computed, onBeforeMount } from 'vue'
67
+ import { useViurShopStore } from "./shop";
68
+ import { useCart } from "./composables/cart";
69
+ import LoadingHandler from "./components/LoadingHandler.vue"
70
+ import DiscountInput from './components/DiscountInput.vue';
71
+
72
+ const shopStore = useViurShopStore();
73
+ const { fetchCart, addItem, state: cartState } = useCart();
74
+
75
+ const state = reactive({
76
+ items: computed(() => { return shopStore.state.cartList }),
77
+ cartTotal: computed(() => {
78
+ let sum = state.items.reduce((acc,item)=>{
79
+ if (item.skel_type==="leaf"){
80
+ acc+=item.price.current *item.quantity
81
+ }
82
+
83
+ return acc;
84
+ },0)
85
+ return sum
86
+ }),
87
+ shippingTotal: computed(() => {
88
+ let total = 0
89
+
90
+ // let hasOrder = Object.keys(shopStore.state.order).length ? true : false
91
+ // let hasShipping = Object.keys(shopStore.state.order.cart.dest.shipping).length ? true : false
92
+
93
+ if( shopStore.state?.order?.cart?.dest?.shipping?.dest?.shipping_cost > 0 ) {
94
+ total += shopStore.state.order.cart.dest.shipping.dest.shipping_cost
95
+ }
96
+
97
+ return total
98
+ }),
99
+ discount:computed(()=> (state.cartTotal - shopStore.state.cartRoot.total_discount_price)*-1),
100
+ total: computed(() => {
101
+ return shopStore.state.cartRoot.total
102
+ }),
103
+ vat:computed(()=>{
104
+ return shopStore.state.cartRoot.vat?.[0].value // why is this a list
105
+ }),
106
+ sum:computed(()=>{
107
+ let sum = state.items.reduce((acc,item)=>{
108
+ if (item.skel_type==="leaf"){
109
+ acc+=item.price.current *item.quantity
110
+ }
111
+
112
+ return acc;
113
+ },0)
114
+ return sum
115
+ })
116
+ })
117
+
118
+ onBeforeMount(() => {
119
+ if (!shopStore.state.cartList.length) {
120
+ fetchCart()
121
+ }
122
+ })
123
+ </script>
124
+
125
+ <style scoped>
126
+ .viur-shop-cart-sidebar-info-line {
127
+ display: flex;
128
+ flex-direction: row;
129
+ flex-wrap: nowrap;
130
+ margin: var(--sl-spacing-2x-small) 0;
131
+
132
+ &.total {
133
+ font-weight: 600;
134
+ border-top: 1px solid var(--sl-color-neutral-300);
135
+ border-bottom: 1px solid var(--sl-color-neutral-300);
136
+ padding: var(--sl-spacing-x-small) 0;
137
+ margin: var(--sl-spacing-small) 0;
138
+ }
139
+
140
+ span {
141
+ margin-right: auto;
142
+ }
143
+ }
144
+
145
+ .viur-shop-cart-sidebar-btn-wrap {
146
+ display: flex;
147
+ flex-direction: column;
148
+ margin-top: var(--sl-spacing-large);
149
+
150
+ sl-button {
151
+ margin-bottom: var(--sl-spacing-x-small);
152
+ }
153
+ }
154
+
155
+ .viur-shop-cart-sidebar-headline {
156
+ margin: 0 0 var(--sl-spacing-large) 0;
157
+ }
158
+
159
+ .viur-shop-cart-sidebar-summary {
160
+ display: flex;
161
+ flex-direction: column;
162
+ overflow: auto;
163
+ margin-bottom: var(--sl-spacing-small);
164
+ padding-right: 4px;
165
+ margin-right: -4px;
166
+
167
+ &::-webkit-scrollbar {
168
+ width: 3px;
169
+ }
170
+
171
+ &::-webkit-scrollbar-track {
172
+ background: transparent;
173
+ }
174
+
175
+ &::-webkit-scrollbar-thumb {
176
+ background: var(--sl-color-neutral-300);
177
+ transition: background ease .3s;
178
+ }
179
+
180
+ &::-webkit-scrollbar-thumb:hover {
181
+ background: var(--sl-color-neutral-400);
182
+ }
183
+ }
184
+
185
+ .viur-shop-cart-sidebar-summary-item {
186
+ display: flex;
187
+ flex-direction: row;
188
+ flex-wrap: nowrap;
189
+ gap: var(--sl-spacing-medium);
190
+ margin-bottom: var(--sl-spacing-small);
191
+ }
192
+
193
+ .viur-shop-cart-sidebar-summary-item-name {
194
+ margin-right: auto;
195
+ }
196
+ </style>
@@ -0,0 +1,57 @@
1
+ <template>
2
+ <loading-handler :isLoading="cartState.isLoading" :isUpdating="cartState.isUpdating">
3
+ <div class="item-wrapper" v-if="state.items.length>0">
4
+ <cart-item v-for="item in state.items" :item="item"
5
+ :edit="!shopStore.state.order?.['is_checkout_in_progress']"
6
+ >
7
+
8
+ </cart-item>
9
+ </div>
10
+ <shop-alert v-else variant="info" duration="Infinity">
11
+ <template #alertMsg>
12
+ {{ $t('shop.cart_empty') }}
13
+ </template>
14
+ </shop-alert>
15
+ </loading-handler>
16
+
17
+ <slot name="template_cart">
18
+ </slot>
19
+
20
+ <slot
21
+ nextName="weiter"
22
+ :activefunction="()=>state.items.length>0"
23
+ :nextfunction="()=>true"
24
+ >
25
+ </slot>
26
+
27
+ </template>
28
+
29
+ <script setup>
30
+ import { useViurShopStore } from '../shop'
31
+ import {computed, onBeforeMount, onMounted, reactive, watch} from 'vue'
32
+ import { useCart } from '../composables/cart';
33
+ import LoadingHandler from '../components/LoadingHandler.vue';
34
+ import CartItem from '../components/CartItem.vue';
35
+ import CartItemSmall from '../components/CartItemSmall.vue';
36
+ import ShopAlert from '../components/ShopAlert.vue';
37
+
38
+ const shopStore = useViurShopStore()
39
+ const {fetchCart,addItem, state:cartState} = useCart()
40
+
41
+ const state = reactive({
42
+ items: computed(()=>shopStore.state.cartList.filter(i=>i['skel_type']==='leaf'))
43
+ })
44
+
45
+ onBeforeMount(()=>{
46
+ fetchCart()
47
+ })
48
+
49
+ </script>
50
+ <style scoped>
51
+ .item-wrapper{
52
+ display:flex;
53
+ flex-direction: column;
54
+ gap: 20px;
55
+ }
56
+
57
+ </style>
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <div>
3
+ <h1 class="viur-shop-success-headline headline">
4
+ {{ $t('shop.order_thanks') }}
5
+ </h1>
6
+ <p class="paragraph"><strong>{{ $t('shop.order_number') }}:</strong> {{ shopStore.state.order?.["order_uid"] }}</p>
7
+ <p class="paragraph" v-html=" $t('shop.order_message')">
8
+ </p>
9
+
10
+ <p class="paragraph" v-if="shopStore.state.order?.['is_paid']">
11
+ {{ $t('shop.order_paid') }}
12
+ </p>
13
+
14
+ <p class="paragraph" v-if="shopStore.state.order?.['is_rts']">
15
+ {{ $t('shop.order_ready_to_ship') }}
16
+ </p>
17
+
18
+ <slot name="template_complete">
19
+ </slot>
20
+
21
+ <sl-details :summary="$t('shop.order_summary')">
22
+ <shop-summary ></shop-summary>
23
+ </sl-details>
24
+ </div>
25
+ </template>
26
+
27
+ <script setup>
28
+ import {computed, reactive} from 'vue'
29
+ import { useViurShopStore } from '../shop';
30
+ import ShopSummary from '../ShopSummary.vue';
31
+ const shopStore = useViurShopStore()
32
+ </script>
@@ -0,0 +1,300 @@
1
+ <template>
2
+ <div class="list">
3
+ <h2 class="viur-shop-cart-headline headline">{{ $t('shop.check_order')}}</h2>
4
+ <div class="viur-shop-cart-address-wrap">
5
+ <div class="viur-shop-cart-address">
6
+ <div class="viur-shop-cart-address-headline">
7
+ {{ $t('viur.shop.skeleton.cartnode.shipping_address') }}
8
+ </div>
9
+ <template v-if="state.shippingAddress">
10
+ {{ state.shippingAddress?.firstname }}
11
+ {{ state.shippingAddress?.lastname }}<br />
12
+ {{ state.shippingAddress?.street_name }}
13
+ {{ state.shippingAddress?.street_number }}<br />
14
+ {{ state.shippingAddress?.zip_code }}
15
+ {{ state.shippingAddress?.city }}<br />
16
+ {{ getDescrName('country',state.shippingAddress?.country) }}<br />
17
+ </template>
18
+ </div>
19
+ <div class="viur-shop-cart-address">
20
+ <div class="viur-shop-cart-address-headline">
21
+ {{ $t('viur.shop.skeleton.order.billing_address') }}
22
+ </div>
23
+ <template v-if="state.billingAddress">
24
+ {{ state.billingAddress.firstname }}
25
+ {{ state.billingAddress.lastname }}<br />
26
+ {{ state.billingAddress.street_name }}
27
+ {{ state.billingAddress.street_number }}<br />
28
+ {{ state.billingAddress.zip_code }}
29
+ {{ state.billingAddress.city }}<br />
30
+ {{ getDescrName('country',state.billingAddress.country) }}<br />
31
+ </template>
32
+ </div>
33
+ </div>
34
+
35
+ <div class="viur-shop-cart-payment">
36
+ <div class="viur-shop-cart-payment-method">
37
+ <span>{{ $t('viur.shop.skeleton.order.payment') }} </span>
38
+ <p>
39
+ {{ shopStore.state['paymentMeta']?.[state.payment]?.['title']}}
40
+ </p>
41
+ </div>
42
+ </div>
43
+
44
+ <div class="viur-shop-cart-payment">
45
+ <div class="viur-shop-cart-payment-method">
46
+ <span>{{ $t('viur.shop.module.shipping') }}</span>
47
+ <p>
48
+ {{ state.shipping?.name }}
49
+ -
50
+ <sl-format-number
51
+ type="currency"
52
+ currency="EUR"
53
+ :value="
54
+ state.shipping?.shipping_cost
55
+ "
56
+ lang="de"
57
+ >
58
+ </sl-format-number>
59
+ </p>
60
+ </div>
61
+ </div>
62
+
63
+ <sl-details :summary="$t('viur.shop.skeleton.order.cart')">
64
+ <template v-for="item in state.cartList">
65
+ <cart-item-small v-if="item.skel_type==='leaf'" :item="item" @sl-show="getOrderCart">
66
+ </cart-item-small>
67
+ </template>
68
+ </sl-details>
69
+ </div>
70
+
71
+ <div class="wrapper">
72
+ <sl-button size="small" @click="startCheckout" :disabled="!shopStore.state.canCheckout" variant="success">{{ $t('shop.order_pay') }}</sl-button>
73
+ </div>
74
+
75
+ <template v-if="shopStore.state.order?.['payment_provider'] !== null && shopStore.state.order?.['payment_provider'].startsWith('unzer-')">
76
+ <sl-dialog v-if="state.paymentPopup" label="Zahlung" :open="state.paymentPopup" @sl-after-hide="state.paymentPopup=false">
77
+ <payment-provider-unzer @cancel="paymentCanceled"></payment-provider-unzer>
78
+ </sl-dialog>
79
+ </template>
80
+
81
+ <slot name="template_confirm">
82
+ </slot>
83
+ </template>
84
+ <script setup>
85
+ import {computed, onBeforeMount, reactive, watch} from 'vue'
86
+ import { useViurShopStore } from '../shop';
87
+ import boneUtils from '@viur/vue-utils/bones/utils'
88
+ import {Request} from '@viur/vue-utils'
89
+ import CartItemSmall from '../components/CartItemSmall.vue';
90
+ import PaymentProviderUnzer from '../components/PaymentProviderUnzer.vue';
91
+ const shopStore = useViurShopStore()
92
+
93
+
94
+ // collected data from order Object > Session cart is not available anymore
95
+ const state = reactive({
96
+ shippingAddress: computed(()=>shopStore.state.order?.['cart']?.['dest']?.['shipping_address']?.['dest']),
97
+ shipping: computed(()=>shopStore.state.order?.['cart']?.['dest']?.['shipping']?.['dest']),
98
+ billingAddress: computed(()=>shopStore.state.order?.['billing_address']?.['dest']),
99
+ payment: computed(()=>shopStore.state.order?.['payment_provider']),
100
+ cartList:[],
101
+ paymentPopup:false
102
+ })
103
+
104
+
105
+ // simple wrapper for value rendering
106
+ function getDescrName(boneName, val) {
107
+ if (!shopStore.state.addressStructure || !val) return val
108
+ return boneUtils.getDescr(shopStore.state.addressStructure[boneName],val)
109
+ }
110
+
111
+ // fetch cart from order
112
+ function getOrderCart(){
113
+ let cartKey = shopStore.state.order?.['cart']?.['dest']?.['key']
114
+ Request.get(`${shopStore.state.shopApiUrl}/cart_list`,{dataObj:{
115
+ cart_key:cartKey
116
+ }}).then(async( resp) =>{
117
+ let data = await resp.json()
118
+ state.cartList=data
119
+ })
120
+ }
121
+
122
+ function paymentCanceled(){
123
+ state.paymentPopup=false
124
+ }
125
+
126
+ //open popup and freeze cart
127
+ function startCheckout(){
128
+ state.paymentPopup=true
129
+ shopStore.checkout()
130
+ }
131
+
132
+ //close popup if payment successfull
133
+ watch(()=>shopStore.state.order?.['is_paid'],(newVal,oldVal)=>{
134
+ if(newVal){
135
+ state.paymentPopup=false
136
+ }
137
+ })
138
+
139
+ onBeforeMount(()=>{
140
+ getOrderCart()
141
+ })
142
+
143
+ </script>
144
+
145
+ <style scoped>
146
+ .wrapper{
147
+ padding:20px;
148
+ }
149
+
150
+ .viur-shop-cart-sidebar-btn-wrap {
151
+ display: flex;
152
+ flex-direction: column;
153
+ margin-top: var(--sl-spacing-large);
154
+
155
+ sl-button {
156
+ margin-bottom: var(--sl-spacing-x-small);
157
+ }
158
+ }
159
+
160
+ sl-alert {
161
+ margin-top: var(--sl-spacing-medium);
162
+ margin-bottom: var(--sl-spacing-medium);
163
+ }
164
+
165
+ sl-tooltip {
166
+ &::part(body) {
167
+ line-height: 1.2;
168
+ font-weight: 400;
169
+ padding: 10px;
170
+ }
171
+ }
172
+
173
+ sl-menu-item {
174
+ &::part(base) {
175
+ padding: 0.2em 0.9em 0.2em 0.8em;
176
+ }
177
+
178
+ &::part(checked-icon) {
179
+ display: none;
180
+ }
181
+
182
+ &::part(prefix) {
183
+ margin-right: 10px;
184
+ }
185
+
186
+ &::part(suffix) {
187
+ margin-right: -1.5em;
188
+ }
189
+ }
190
+
191
+ .viur-shop-cart-sidebar-info-line {
192
+ display: flex;
193
+ flex-direction: row;
194
+ flex-wrap: nowrap;
195
+ margin: var(--sl-spacing-2x-small) 0;
196
+
197
+ span {
198
+ margin-right: auto;
199
+ }
200
+
201
+ &.total {
202
+ font-weight: 600;
203
+ border-top: 1px solid var(--sl-color-neutral-300);
204
+ border-bottom: 1px solid var(--sl-color-neutral-300);
205
+ padding: var(--sl-spacing-x-small) 0;
206
+ margin: var(--sl-spacing-small) 0;
207
+ }
208
+ }
209
+
210
+ .viur-shop-cart-mini-card {
211
+ margin-bottom: var(--sl-spacing-x-large);
212
+
213
+ &::part(header) {
214
+ border-bottom: none;
215
+ padding-top: 0;
216
+ padding-right: 0;
217
+ }
218
+
219
+ &::part(image) {
220
+ flex-basis: 25%;
221
+ max-width: 90px;
222
+ }
223
+
224
+ &::part(body) {
225
+ display: flex;
226
+ flex: 1;
227
+ padding-top: 0;
228
+ padding-bottom: 0;
229
+ padding-right: 0;
230
+ }
231
+
232
+ &::part(group) {
233
+ padding: var(--sl-spacing-small) 0;
234
+ }
235
+ }
236
+
237
+ .viur-shop-cart-mini-card-body-row {
238
+ display: grid;
239
+ grid-template-columns: 1fr auto auto;
240
+ gap: var(--sl-spacing-large);
241
+ flex: 1;
242
+ }
243
+
244
+ .viur-shop-cart-mini-card-body-info {
245
+ display: flex;
246
+ flex-direction: column;
247
+ height: 100%;
248
+ }
249
+
250
+ .viur-shop-cart-mini-card-info-wrap {
251
+ display: flex;
252
+ flex-wrap: nowrap;
253
+ gap: var(--sl-spacing-medium);
254
+ }
255
+
256
+ .viur-shop-cart-mini-card-info {
257
+ display: flex;
258
+ flex-direction: row;
259
+ flex-wrap: nowrap;
260
+
261
+ span {
262
+ margin-right: var(--sl-spacing-x-small);
263
+ font-weight: 600;
264
+ }
265
+ }
266
+
267
+ .viur-shop-cart-address-wrap {
268
+ display: grid;
269
+ grid-template-columns: 1fr 1fr;
270
+ gap: var(--sl-spacing-x-large);
271
+ margin-bottom: var(--sl-spacing-x-large);
272
+ }
273
+
274
+ .viur-shop-cart-address-headline {
275
+ display: flex;
276
+ flex-direction: row;
277
+ flex-wrap: nowrap;
278
+ align-items: center;
279
+ justify-content: space-between;
280
+ font-weight: 600;
281
+ }
282
+
283
+ .viur-shop-cart-payment {
284
+ display: flex;
285
+ flex-direction: row;
286
+ flex-wrap: nowrap;
287
+ align-items: center;
288
+ justify-content: space-between;
289
+ margin-bottom: var(--sl-spacing-x-large);
290
+
291
+ span {
292
+ font-weight: 600;
293
+ }
294
+ }
295
+
296
+ .viur-shop-cart-headline {
297
+ margin: 0 0 var(--sl-spacing-x-large) 0;
298
+ font-size: var(--shop-form-headline-size);
299
+ }
300
+ </style>
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <sl-radio-group :value="state.selection">
3
+ <sl-details-group>
4
+
5
+ <payment-option v-for="option in paymentState.paymentData" :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
+ </payment-option>
15
+
16
+ </sl-details-group>
17
+ </sl-radio-group>
18
+
19
+ <slot name="template_paymentprovider">
20
+ </slot>
21
+
22
+ <slot
23
+ nextName="weiter"
24
+ :activefunction="()=>shopStore.state.order?.['payment_provider']"
25
+ :nextfunction="()=>true"
26
+ >
27
+ </slot>
28
+
29
+ </template>
30
+ <script setup>
31
+ import {computed, reactive, onBeforeMount} from 'vue'
32
+ import PaymentOption from "../components/PaymentOption.vue";
33
+ import {usePayment} from "../composables/payment";
34
+ import {useOrder} from "../composables/order";
35
+ import {useViurShopStore} from "../shop";
36
+
37
+ const {state:paymentState, fetchPaymentData} = usePayment()
38
+ const {addOrUpdateOrder} = useOrder()
39
+ const shopStore = useViurShopStore()
40
+
41
+ const state = reactive({
42
+ selection:null,
43
+ })
44
+
45
+ function optionChanged(type){
46
+ shopStore.state.order['payment_provider'] = null
47
+ state.selection=type
48
+ addOrUpdateOrder({payment_provider:type})
49
+ }
50
+
51
+ onBeforeMount(()=>{
52
+ fetchPaymentData().then(()=>{
53
+ state.selection = shopStore.state.order?.['payment_provider']
54
+ })
55
+ })
56
+ </script>