@shopbite-de/storefront 1.31.3 → 2.0.1
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/.github/workflows/ci.yaml +87 -0
- package/.gitignore +5 -0
- package/CLAUDE.md +27 -8
- package/app/app.vue +10 -6
- package/app/assets/css/main.css +103 -61
- package/app/components/AddToWishlist.vue +15 -25
- package/app/components/Address/Card.vue +6 -11
- package/app/components/Address/Detail.vue +23 -23
- package/app/components/Address/Fields.vue +175 -73
- package/app/components/Address/Form.vue +107 -106
- package/app/components/Cart/Bar.vue +6 -9
- package/app/components/Cart/Item.vue +48 -63
- package/app/components/Cart/QuickView.vue +38 -25
- package/app/components/Cart/Upsell.vue +24 -62
- package/app/components/Category/Breadcrumb.vue +29 -3
- package/app/components/Category/FilterGroup.vue +20 -41
- package/app/components/Category/Listing.vue +100 -130
- package/app/components/Category/SearchInput.vue +22 -19
- package/app/components/Checkout/DeliveryTimeSelect.vue +55 -77
- package/app/components/Checkout/LoginOrRegister.vue +28 -29
- package/app/components/Checkout/PaymentAndDelivery.vue +114 -86
- package/app/components/Checkout/Summary.vue +90 -60
- package/app/components/Checkout/VoucherInput.vue +40 -27
- package/app/components/Contact/Form.vue +164 -192
- package/app/components/DemoBanner.vue +5 -5
- package/app/components/Footer/StoreStatus.vue +2 -2
- package/app/components/Footer.vue +125 -57
- package/app/components/Header.vue +283 -18
- package/app/components/Home/Categories.vue +116 -0
- package/app/components/Home/Facts.vue +71 -0
- package/app/components/Home/Faq.vue +34 -16
- package/app/components/Home/Hero.vue +172 -0
- package/app/components/Home/Highlights.vue +29 -37
- package/app/components/Home/Restaurant.vue +102 -0
- package/app/components/Menu/BonCard.vue +180 -0
- package/app/components/Menu/CartPanel.vue +24 -0
- package/app/components/Menu/CategoryIndex.vue +54 -0
- package/app/components/Menu/OrderMode.vue +20 -0
- package/app/components/Menu/SectionHeader.vue +38 -0
- package/app/components/Navigation/MobileTop.vue +23 -15
- package/app/components/Order/Confirmation.vue +119 -0
- package/app/components/Order/Detail.vue +80 -88
- package/app/components/Product/CardSkeleton.vue +8 -12
- package/app/components/Product/Configurator.vue +8 -16
- package/app/components/Product/CrossSelling.vue +75 -83
- package/app/components/Product/DeselectIngredient.vue +17 -22
- package/app/components/Product/Detail.vue +35 -27
- package/app/components/Product/QuickView.vue +80 -51
- package/app/components/SalesChannelSwitch.vue +14 -28
- package/app/components/Sb/Button.vue +70 -0
- package/app/components/Sb/Checkbox.vue +73 -0
- package/app/components/Sb/Chip.vue +51 -0
- package/app/components/Sb/ChoiceGroup.vue +82 -0
- package/app/components/Sb/ConfirmDialog.vue +60 -0
- package/app/components/Sb/Field.vue +77 -0
- package/app/components/Sb/Icon.vue +66 -0
- package/app/components/Sb/IconButton.vue +55 -0
- package/app/components/Sb/Input.vue +23 -0
- package/app/components/Sb/SegmentedControl.vue +34 -0
- package/app/components/Sb/Select.vue +49 -0
- package/app/components/Sb/Sheet.vue +83 -0
- package/app/components/Sb/Stars.vue +60 -0
- package/app/components/Sb/StatusPill.vue +38 -0
- package/app/components/Sb/Stepper.vue +72 -0
- package/app/components/User/AccountHeader.vue +16 -0
- package/app/components/User/AuthPanel.vue +41 -0
- package/app/components/User/Detail.vue +32 -29
- package/app/components/User/LoginForm.vue +92 -98
- package/app/components/User/RegistrationForm.vue +285 -249
- package/app/components/Wishlist.vue +55 -155
- package/app/composables/useCartMutations.ts +9 -27
- package/app/composables/useCheckoutMethodGuard.ts +2 -24
- package/app/composables/useContactForm.ts +66 -0
- package/app/composables/useHomeMenuCategories.ts +41 -0
- package/app/composables/useNavigation.ts +10 -2
- package/app/composables/useOrderMode.ts +65 -0
- package/app/composables/useRegistrationForm.ts +161 -0
- package/app/composables/useRestaurantSchema.ts +1 -1
- package/app/composables/useShareLink.ts +3 -13
- package/app/composables/useSortingSelection.ts +13 -0
- package/app/composables/useThemePreset.ts +24 -0
- package/app/composables/useVoucherCode.ts +7 -16
- package/app/composables/useWishlistActions.ts +0 -51
- package/app/error.vue +31 -9
- package/app/layouts/account.vue +45 -50
- package/app/layouts/default.vue +2 -3
- package/app/layouts/listing.vue +3 -5
- package/app/pages/[...all].vue +8 -4
- package/app/pages/account/recover/password/index.vue +113 -80
- package/app/pages/anmelden.vue +11 -10
- package/app/pages/bestellung/[id]/erfolg.vue +1 -15
- package/app/pages/bestellung/[id]/fehler.vue +63 -51
- package/app/pages/bestellung/[id]/index.vue +3 -85
- package/app/pages/bestellung/kasse.vue +29 -0
- package/app/pages/bestellung.vue +8 -60
- package/app/pages/index.vue +12 -52
- package/app/pages/kontakt.vue +27 -7
- package/app/pages/konto/adressen.vue +106 -102
- package/app/pages/konto/bestellung/[id].vue +9 -43
- package/app/pages/konto/bestellungen.vue +55 -33
- package/app/pages/konto/index.vue +47 -62
- package/app/pages/konto/profil.vue +162 -100
- package/app/pages/maintenance.vue +8 -6
- package/app/pages/merkliste.vue +7 -8
- package/app/pages/passwort-vergessen.vue +92 -75
- package/app/pages/registrierung/bestaetigen.vue +20 -48
- package/app/pages/registrierung/index.vue +16 -7
- package/app/pages/suche.vue +94 -95
- package/app/plugins/theme-preset.ts +9 -0
- package/app/utils/highlight.ts +25 -0
- package/app/utils/product.ts +9 -0
- package/app/validation/registrationSchema.ts +1 -1
- package/modules/theme.ts +123 -0
- package/nuxt.config.ts +30 -16
- package/package.json +6 -8
- package/playwright.config.ts +11 -0
- package/server/api/listing/[categoryId].get.ts +3 -0
- package/shared/theme/presets.ts +303 -0
- package/test/a11y/presets.test.ts +225 -0
- package/test/layer/nuxt.config.ts +8 -0
- package/test/nuxt/AccountPagesPreset.test.ts +191 -0
- package/test/nuxt/AuthPagesPreset.test.ts +87 -0
- package/test/nuxt/CartCheckoutPreset.test.ts +154 -0
- package/test/nuxt/CartItem.test.ts +18 -3
- package/test/nuxt/CartUpsell.test.ts +1 -2
- package/test/nuxt/CheckoutFormsPreset.test.ts +120 -0
- package/test/nuxt/CheckoutOnePage.test.ts +115 -0
- package/test/nuxt/CheckoutSummary.test.ts +6 -6
- package/test/nuxt/CheckoutVoucherInput.test.ts +20 -32
- package/test/nuxt/ContactFormPreset.test.ts +115 -0
- package/test/nuxt/FooterStoreStatus.test.ts +2 -2
- package/test/nuxt/HeaderFooterPreset.test.ts +134 -0
- package/test/nuxt/HomeFaq.test.ts +3 -2
- package/test/nuxt/MenuBonCard.test.ts +122 -0
- package/test/nuxt/OrderPagesPreset.test.ts +132 -0
- package/test/nuxt/PaymentAndDelivery.test.ts +0 -4
- package/test/nuxt/ProductCrossSelling.test.ts +2 -1
- package/test/nuxt/ProductDeselectIngredient.test.ts +5 -3
- package/test/nuxt/ProductSheetPreset.test.ts +105 -0
- package/test/nuxt/RegisterConfirmPage.test.ts +0 -8
- package/test/nuxt/RegistrationForm.test.ts +89 -270
- package/test/nuxt/SbBaseComponents.test.ts +170 -0
- package/test/nuxt/SbStars.test.ts +25 -0
- package/test/nuxt/useCartMutations.test.ts +3 -17
- package/test/nuxt/useCartUpsell.test.ts +1 -1
- package/test/nuxt/useCheckoutMethodGuard.test.ts +0 -27
- package/test/nuxt/useShareLink.test.ts +1 -9
- package/test/nuxt/useWishlistActions.test.ts +3 -26
- package/test/unit/highlight.spec.ts +31 -0
- package/test/unit/product.spec.ts +12 -0
- package/test/unit/themePresets.spec.ts +61 -0
- package/app/app.config.ts +0 -19
- package/app/components/AnimatedSection.vue +0 -74
- package/app/components/BottomNavi.vue +0 -70
- package/app/components/Category/Header.vue +0 -48
- package/app/components/Checkout/PaymentMethod.vue +0 -30
- package/app/components/Checkout/ShippingMethod.vue +0 -30
- package/app/components/Cta.vue +0 -30
- package/app/components/Feature/Card.vue +0 -121
- package/app/components/Features.vue +0 -42
- package/app/components/Footer/Contact.vue +0 -82
- package/app/components/Header/Body.vue +0 -82
- package/app/components/Header/Right.vue +0 -187
- package/app/components/Header/Title.vue +0 -10
- package/app/components/Hero.vue +0 -233
- package/app/components/Home/MenuCategories.vue +0 -148
- package/app/components/ImageGallery.vue +0 -63
- package/app/components/Loading.vue +0 -29
- package/app/components/Navigation/DesktopLeft.vue +0 -39
- package/app/components/Product/Card.vue +0 -177
- package/app/components/Product/CardCompact.vue +0 -72
- package/app/components/Product/CardDietBadges.vue +0 -43
- package/app/components/Product/CardIngredients.vue +0 -35
- package/app/components/Product/CardKitchen.vue +0 -34
- package/app/components/Product/SearchBar.vue +0 -95
- package/app/components/PublicAnnouncement.vue +0 -17
- package/app/pages/bestellung/bestaetigen.vue +0 -16
- package/app/pages/bestellung/warenkorb.vue +0 -49
- package/app/pages/bestellung/zahlung-versand.vue +0 -25
- package/test/nuxt/AddressFields.test.ts +0 -222
- package/test/nuxt/AnimatedSection.test.ts +0 -67
- package/test/nuxt/ContactForm.test.ts +0 -207
- package/test/nuxt/FooterContact.test.ts +0 -102
- package/test/nuxt/HeaderRight.test.ts +0 -142
- package/test/nuxt/Hero.test.ts +0 -126
- package/test/nuxt/HomeMenuCategories.test.ts +0 -94
- package/test/nuxt/LoginForm.test.ts +0 -159
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
RadioGroupItem,
|
|
4
|
-
RadioGroupValue,
|
|
5
|
-
} from "#ui/components/RadioGroup.vue";
|
|
6
2
|
import type { Schemas } from "#shopware";
|
|
7
3
|
|
|
4
|
+
// The one-page checkout of the presets shows shipping and payment as
|
|
5
|
+
// separate numbered sections (#443).
|
|
6
|
+
const props = withDefaults(
|
|
7
|
+
defineProps<{ part?: "both" | "shipping" | "payment" }>(),
|
|
8
|
+
{ part: "both" },
|
|
9
|
+
);
|
|
10
|
+
|
|
8
11
|
const {
|
|
9
12
|
paymentMethods,
|
|
10
13
|
getPaymentMethods,
|
|
@@ -19,7 +22,36 @@ const {
|
|
|
19
22
|
const { refreshCart } = useCart();
|
|
20
23
|
const { ensureAvailableCheckoutMethods } = useCheckoutMethodGuard();
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
// Presets: shipping first (payment rules can depend on it), as cards (#443).
|
|
26
|
+
const shippingOptions = computed(() =>
|
|
27
|
+
(shippingMethods.value ?? []).map((method: Schemas["ShippingMethod"]) => ({
|
|
28
|
+
value: method.id,
|
|
29
|
+
label: method.translated?.name ?? method.name,
|
|
30
|
+
description:
|
|
31
|
+
method.translated?.description ?? method.description ?? undefined,
|
|
32
|
+
})),
|
|
33
|
+
);
|
|
34
|
+
const paymentOptions = computed(() =>
|
|
35
|
+
(paymentMethods.value ?? []).map((method: Schemas["PaymentMethod"]) => ({
|
|
36
|
+
value: method.id,
|
|
37
|
+
label: method.distinguishableName ?? method.name,
|
|
38
|
+
description:
|
|
39
|
+
method.translated?.description ?? method.description ?? undefined,
|
|
40
|
+
})),
|
|
41
|
+
);
|
|
42
|
+
const shippingModel = computed({
|
|
43
|
+
get: () =>
|
|
44
|
+
(selectedShippingMethodId.value as string | undefined) ?? undefined,
|
|
45
|
+
set: (value: string | undefined) => {
|
|
46
|
+
selectedShippingMethodId.value = value;
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
const paymentModel = computed({
|
|
50
|
+
get: () => (selectedPaymentMethodId.value as string | undefined) ?? undefined,
|
|
51
|
+
set: (value: string | undefined) => {
|
|
52
|
+
selectedPaymentMethodId.value = value;
|
|
53
|
+
},
|
|
54
|
+
});
|
|
23
55
|
|
|
24
56
|
onMounted(async () => {
|
|
25
57
|
try {
|
|
@@ -30,26 +62,10 @@ onMounted(async () => {
|
|
|
30
62
|
}
|
|
31
63
|
});
|
|
32
64
|
|
|
33
|
-
const
|
|
34
|
-
return paymentMethods.value?.map((method: Schemas["PaymentMethod"]) => ({
|
|
35
|
-
label: method.distinguishableName,
|
|
36
|
-
description: method.description,
|
|
37
|
-
value: method.id,
|
|
38
|
-
}));
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const selectableShippingMethods = computed<RadioGroupItem[]>(() => {
|
|
42
|
-
return shippingMethods.value?.map((method: Schemas["ShippingMethod"]) => ({
|
|
43
|
-
label: method.name,
|
|
44
|
-
description: method.description,
|
|
45
|
-
value: method.id,
|
|
46
|
-
}));
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
const selectedPaymentMethodId = ref<RadioGroupValue | undefined>(
|
|
65
|
+
const selectedPaymentMethodId = ref<string | undefined>(
|
|
50
66
|
selectedPaymentMethod.value?.id,
|
|
51
67
|
);
|
|
52
|
-
const selectedShippingMethodId = ref<
|
|
68
|
+
const selectedShippingMethodId = ref<string | undefined>(
|
|
53
69
|
selectedShippingMethod.value?.id,
|
|
54
70
|
);
|
|
55
71
|
|
|
@@ -62,76 +78,88 @@ watch(selectedShippingMethod, (method) => {
|
|
|
62
78
|
selectedShippingMethodId.value = method?.id;
|
|
63
79
|
});
|
|
64
80
|
|
|
65
|
-
watch(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
await setPaymentMethod({ id: newValue as string });
|
|
72
|
-
toast.add({
|
|
73
|
-
title: "Zahlart geändert",
|
|
74
|
-
description:
|
|
75
|
-
selectedPaymentMethod.value.distinguishableName + " ausgewählt",
|
|
76
|
-
color: "success",
|
|
77
|
-
progress: false,
|
|
78
|
-
});
|
|
79
|
-
},
|
|
80
|
-
);
|
|
81
|
+
watch(selectedPaymentMethodId, async (newValue: string | undefined) => {
|
|
82
|
+
if (newValue === undefined) return;
|
|
83
|
+
if (selectedPaymentMethod.value === null) return;
|
|
84
|
+
if (newValue === selectedPaymentMethod.value.id) return;
|
|
85
|
+
await setPaymentMethod({ id: newValue as string });
|
|
86
|
+
});
|
|
81
87
|
|
|
82
|
-
watch(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
await refreshCart();
|
|
90
|
-
toast.add({
|
|
91
|
-
title: "Versandart geändert",
|
|
92
|
-
description: selectedShippingMethod.value.name + " ausgewählt",
|
|
93
|
-
color: "success",
|
|
94
|
-
progress: false,
|
|
95
|
-
});
|
|
96
|
-
},
|
|
97
|
-
);
|
|
88
|
+
watch(selectedShippingMethodId, async (newValue: string | undefined) => {
|
|
89
|
+
if (newValue === undefined) return;
|
|
90
|
+
if (selectedShippingMethod.value === null) return;
|
|
91
|
+
if (newValue === selectedShippingMethod.value.id) return;
|
|
92
|
+
await setShippingMethod({ id: newValue as string });
|
|
93
|
+
await refreshCart();
|
|
94
|
+
});
|
|
98
95
|
</script>
|
|
99
96
|
|
|
100
97
|
<template>
|
|
101
|
-
<div
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
98
|
+
<div
|
|
99
|
+
v-if="props.part !== 'both'"
|
|
100
|
+
class="flex flex-col gap-3 font-body text-sb-ink"
|
|
101
|
+
>
|
|
102
|
+
<SbChoiceGroup
|
|
103
|
+
v-if="props.part === 'shipping'"
|
|
104
|
+
v-model="shippingModel"
|
|
105
|
+
legend="Versandarten"
|
|
106
|
+
hide-legend
|
|
107
|
+
variant="cards"
|
|
108
|
+
:options="shippingOptions"
|
|
109
|
+
/>
|
|
110
|
+
<SbChoiceGroup
|
|
111
|
+
v-else
|
|
112
|
+
v-model="paymentModel"
|
|
113
|
+
legend="Zahlungsarten"
|
|
114
|
+
hide-legend
|
|
115
|
+
variant="cards"
|
|
116
|
+
:options="paymentOptions"
|
|
117
|
+
/>
|
|
118
|
+
<NuxtLink
|
|
119
|
+
to="/zahlung-und-versand"
|
|
120
|
+
class="inline-flex min-h-11 items-center self-start text-sm font-semibold text-sb-primary-ink underline underline-offset-4 focus-visible:outline-3 focus-visible:outline-sb-focus"
|
|
121
|
+
>
|
|
122
|
+
{{
|
|
123
|
+
props.part === "shipping"
|
|
124
|
+
? "Liefergebiet und Versandkosten"
|
|
125
|
+
: "Mehr zu den Zahlungsarten"
|
|
126
|
+
}}
|
|
127
|
+
</NuxtLink>
|
|
128
|
+
</div>
|
|
129
|
+
<div v-else class="flex flex-col gap-8 font-body text-sb-ink">
|
|
130
|
+
<section class="flex flex-col gap-3" aria-labelledby="checkout-shipping">
|
|
131
|
+
<div class="flex items-center justify-between gap-3">
|
|
132
|
+
<h2 id="checkout-shipping" class="font-display text-[28px]">
|
|
133
|
+
Lieferung oder Abholung
|
|
134
|
+
</h2>
|
|
135
|
+
<SbButton variant="ghost" to="/zahlung-und-versand">
|
|
136
|
+
Versandarten erklärt
|
|
137
|
+
</SbButton>
|
|
112
138
|
</div>
|
|
113
|
-
<
|
|
114
|
-
v-model="
|
|
115
|
-
|
|
116
|
-
|
|
139
|
+
<SbChoiceGroup
|
|
140
|
+
v-model="shippingModel"
|
|
141
|
+
legend="Versandarten"
|
|
142
|
+
hide-legend
|
|
143
|
+
variant="cards"
|
|
144
|
+
:options="shippingOptions"
|
|
117
145
|
/>
|
|
118
|
-
</
|
|
119
|
-
<
|
|
120
|
-
<div class="flex items-center gap-
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
icon="i-lucide-circle-help"
|
|
128
|
-
/>
|
|
146
|
+
</section>
|
|
147
|
+
<section class="flex flex-col gap-3" aria-labelledby="checkout-payment">
|
|
148
|
+
<div class="flex items-center justify-between gap-3">
|
|
149
|
+
<h2 id="checkout-payment" class="font-display text-[28px]">
|
|
150
|
+
Bezahlung
|
|
151
|
+
</h2>
|
|
152
|
+
<SbButton variant="ghost" to="/zahlung-und-versand">
|
|
153
|
+
Zahlungsarten erklärt
|
|
154
|
+
</SbButton>
|
|
129
155
|
</div>
|
|
130
|
-
<
|
|
131
|
-
v-model="
|
|
132
|
-
|
|
133
|
-
|
|
156
|
+
<SbChoiceGroup
|
|
157
|
+
v-model="paymentModel"
|
|
158
|
+
legend="Zahlungsarten"
|
|
159
|
+
hide-legend
|
|
160
|
+
variant="cards"
|
|
161
|
+
:options="paymentOptions"
|
|
134
162
|
/>
|
|
135
|
-
</
|
|
163
|
+
</section>
|
|
136
164
|
</div>
|
|
137
165
|
</template>
|
|
@@ -21,7 +21,13 @@ const {
|
|
|
21
21
|
public: { storeUrl },
|
|
22
22
|
} = useRuntimeConfig();
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
// The one-page checkout (#443): errors show in the form, next to the order
|
|
25
|
+
// button.
|
|
26
|
+
const orderError = ref<{ title: string; description: string } | null>(null);
|
|
27
|
+
|
|
28
|
+
function reportError(message: { title: string; description: string }) {
|
|
29
|
+
orderError.value = message;
|
|
30
|
+
}
|
|
25
31
|
|
|
26
32
|
onMounted(() => {
|
|
27
33
|
refresh();
|
|
@@ -55,21 +61,15 @@ const { handlePayment, paymentUrl } = useOrderPayment(
|
|
|
55
61
|
async function hasAvailableCheckoutMethods(): Promise<boolean> {
|
|
56
62
|
try {
|
|
57
63
|
if (await ensureAvailableCheckoutMethods()) return true;
|
|
58
|
-
|
|
64
|
+
reportError({
|
|
59
65
|
title: `Keine ${blockedMethodLabel.value} verfügbar`,
|
|
60
66
|
description: `Für deine Bestellung ist aktuell keine ${blockedMethodLabel.value} verfügbar. Bitte prüfe deine Adresse und deinen Warenkorb.`,
|
|
61
|
-
color: "error",
|
|
62
|
-
icon: blockedMethodIcon.value,
|
|
63
|
-
progress: false,
|
|
64
67
|
});
|
|
65
68
|
} catch (error) {
|
|
66
69
|
console.error("[checkout][ensureAvailableCheckoutMethods]", error);
|
|
67
|
-
|
|
70
|
+
reportError({
|
|
68
71
|
title: "Versand- und Zahlart konnten nicht geprüft werden",
|
|
69
72
|
description: "Bitte versuche es in einem Moment erneut.",
|
|
70
|
-
color: "error",
|
|
71
|
-
icon: "i-lucide-x-circle",
|
|
72
|
-
progress: false,
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
return false;
|
|
@@ -77,6 +77,7 @@ async function hasAvailableCheckoutMethods(): Promise<boolean> {
|
|
|
77
77
|
|
|
78
78
|
async function handleCreateOrder() {
|
|
79
79
|
isPlacingOrder.value = true;
|
|
80
|
+
orderError.value = null;
|
|
80
81
|
try {
|
|
81
82
|
if (!(await hasAvailableCheckoutMethods())) return;
|
|
82
83
|
|
|
@@ -98,22 +99,13 @@ async function handleCreateOrder() {
|
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
await refreshCart();
|
|
101
|
-
toast.add({
|
|
102
|
-
title: "Bestellung aufgegeben!",
|
|
103
|
-
icon: "i-lucide-shopping-cart",
|
|
104
|
-
color: "success",
|
|
105
|
-
progress: false,
|
|
106
|
-
});
|
|
107
102
|
navigateTo(`/bestellung/${order.id}/erfolg`);
|
|
108
103
|
} catch (error) {
|
|
109
104
|
console.error("[checkout][createOrder]", error);
|
|
110
|
-
|
|
105
|
+
reportError({
|
|
111
106
|
title: "Bestellung fehlgeschlagen",
|
|
112
107
|
description:
|
|
113
108
|
"Deine Bestellung konnte nicht aufgegeben werden. Bitte prüfe deine Angaben und versuche es erneut.",
|
|
114
|
-
color: "error",
|
|
115
|
-
icon: "i-lucide-x-circle",
|
|
116
|
-
progress: false,
|
|
117
109
|
});
|
|
118
110
|
await refreshCart().catch(() => {});
|
|
119
111
|
} finally {
|
|
@@ -142,9 +134,6 @@ const isValidToProceed = computed(
|
|
|
142
134
|
const blockedMethodLabel = computed(() =>
|
|
143
135
|
isShippingMethodBlocked.value ? "Versandart" : "Zahlart",
|
|
144
136
|
);
|
|
145
|
-
const blockedMethodIcon = computed(() =>
|
|
146
|
-
isShippingMethodBlocked.value ? "i-lucide-truck" : "i-lucide-badge-euro",
|
|
147
|
-
);
|
|
148
137
|
|
|
149
138
|
const isPlacingOrder = ref(false);
|
|
150
139
|
const selectedDeliveryTime = ref("");
|
|
@@ -153,9 +142,16 @@ const selectedDeliveryTime = ref("");
|
|
|
153
142
|
// order button differently on the server and at hydration (#339).
|
|
154
143
|
const isValidTime = ref(false);
|
|
155
144
|
|
|
145
|
+
const checkoutSections = [
|
|
146
|
+
{ id: "versand", number: 1, title: "Lieferung oder Abholung" },
|
|
147
|
+
{ id: "zeit", number: 2, title: "Wann?" },
|
|
148
|
+
{ id: "angaben", number: 3, title: "Ihre Angaben" },
|
|
149
|
+
{ id: "bezahlung", number: 4, title: "Bezahlung" },
|
|
150
|
+
] as const;
|
|
151
|
+
|
|
156
152
|
const checkoutButtonLabel = computed<string>(() => {
|
|
157
153
|
if (!customerDataAvailable.value) {
|
|
158
|
-
return "Bitte
|
|
154
|
+
return "Bitte zuerst Ihre Angaben speichern";
|
|
159
155
|
}
|
|
160
156
|
|
|
161
157
|
// app.vue loads business hours and holidays after mounting. Until then (or
|
|
@@ -181,59 +177,93 @@ const checkoutButtonLabel = computed<string>(() => {
|
|
|
181
177
|
return `Aktuell ist keine ${blockedMethodLabel.value} verfügbar`;
|
|
182
178
|
}
|
|
183
179
|
|
|
184
|
-
return "
|
|
180
|
+
return "Zahlungspflichtig bestellen";
|
|
185
181
|
});
|
|
186
182
|
</script>
|
|
187
183
|
|
|
188
184
|
<template>
|
|
189
|
-
<div
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
<
|
|
200
|
-
|
|
201
|
-
|
|
185
|
+
<div
|
|
186
|
+
class="grid grid-cols-1 gap-8 font-body text-sb-ink lg:grid-cols-[minmax(0,1fr)_400px] lg:gap-12"
|
|
187
|
+
>
|
|
188
|
+
<div class="flex min-w-0 flex-col gap-4">
|
|
189
|
+
<section
|
|
190
|
+
v-for="section in checkoutSections"
|
|
191
|
+
:key="section.id"
|
|
192
|
+
:aria-labelledby="`kasse-${section.id}`"
|
|
193
|
+
class="rounded-sb-card border border-sb-line bg-sb-surface p-5 sm:p-7"
|
|
194
|
+
>
|
|
195
|
+
<h2
|
|
196
|
+
:id="`kasse-${section.id}`"
|
|
197
|
+
class="mb-4 flex items-baseline gap-3 font-display text-2xl leading-tight sm:text-[28px]"
|
|
198
|
+
>
|
|
199
|
+
<span class="text-sb-accent">{{ section.number }}</span>
|
|
200
|
+
{{ section.title }}
|
|
201
|
+
</h2>
|
|
202
|
+
<CheckoutPaymentAndDelivery
|
|
203
|
+
v-if="section.id === 'versand'"
|
|
204
|
+
part="shipping"
|
|
205
|
+
/>
|
|
202
206
|
<CheckoutDeliveryTimeSelect
|
|
207
|
+
v-else-if="section.id === 'zeit'"
|
|
203
208
|
v-model:valid="isValidTime"
|
|
204
209
|
v-model="selectedDeliveryTime"
|
|
205
210
|
/>
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
:with-delete-button="false"
|
|
214
|
-
:with-upsell="true"
|
|
211
|
+
<template v-else-if="section.id === 'angaben'">
|
|
212
|
+
<UserDetail v-if="customerDataAvailable" :with-edit-button="true" />
|
|
213
|
+
<CheckoutLoginOrRegister v-else />
|
|
214
|
+
</template>
|
|
215
|
+
<CheckoutPaymentAndDelivery
|
|
216
|
+
v-else-if="section.id === 'bezahlung'"
|
|
217
|
+
part="payment"
|
|
215
218
|
/>
|
|
216
|
-
</
|
|
219
|
+
</section>
|
|
220
|
+
</div>
|
|
221
|
+
<section
|
|
222
|
+
class="flex h-max flex-col gap-4 rounded-sb-card border border-sb-line bg-sb-surface p-6 lg:sticky lg:top-24"
|
|
223
|
+
aria-labelledby="kasse-bestellung"
|
|
224
|
+
>
|
|
225
|
+
<h2 id="kasse-bestellung" class="font-display text-[28px] leading-none">
|
|
226
|
+
Ihre Bestellung
|
|
227
|
+
</h2>
|
|
228
|
+
<QuickView :with-upsell="true" />
|
|
217
229
|
<CheckoutVoucherInput />
|
|
218
|
-
<
|
|
219
|
-
|
|
230
|
+
<div
|
|
231
|
+
v-if="orderError"
|
|
232
|
+
role="alert"
|
|
233
|
+
class="flex gap-3 rounded-sb-control border-[1.5px] border-sb-danger p-4 text-sm"
|
|
234
|
+
>
|
|
235
|
+
<span class="font-bold text-sb-danger">!</span>
|
|
236
|
+
<span>
|
|
237
|
+
<strong class="block">{{ orderError.title }}</strong>
|
|
238
|
+
{{ orderError.description }}
|
|
239
|
+
</span>
|
|
240
|
+
</div>
|
|
241
|
+
<SbButton
|
|
242
|
+
block
|
|
243
|
+
size="lg"
|
|
244
|
+
class="min-h-14"
|
|
220
245
|
:disabled="!isValidToProceed || isPlacingOrder"
|
|
221
246
|
:loading="
|
|
222
247
|
isPlacingOrder || (customerDataAvailable && isLoadingOpeningHours)
|
|
223
248
|
"
|
|
224
|
-
:label="checkoutButtonLabel"
|
|
225
|
-
size="xl"
|
|
226
|
-
block
|
|
227
249
|
@click="handleCreateOrder"
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
250
|
+
>
|
|
251
|
+
{{
|
|
252
|
+
isValidToProceed ? "Zahlungspflichtig bestellen" : checkoutButtonLabel
|
|
253
|
+
}}
|
|
254
|
+
</SbButton>
|
|
255
|
+
<p class="text-sm text-sb-ink-muted">
|
|
256
|
+
Mit der Bestellung akzeptieren Sie unsere
|
|
257
|
+
<NuxtLink to="/agb" class="font-semibold text-sb-primary-ink underline"
|
|
258
|
+
>AGB</NuxtLink
|
|
234
259
|
>
|
|
235
|
-
|
|
260
|
+
und die
|
|
261
|
+
<NuxtLink
|
|
262
|
+
to="/datenschutz"
|
|
263
|
+
class="font-semibold text-sb-primary-ink underline"
|
|
264
|
+
>Datenschutzerklärung</NuxtLink
|
|
265
|
+
>.
|
|
236
266
|
</p>
|
|
237
|
-
</
|
|
267
|
+
</section>
|
|
238
268
|
</div>
|
|
239
269
|
</template>
|
|
@@ -2,47 +2,60 @@
|
|
|
2
2
|
const {
|
|
3
3
|
voucherCode,
|
|
4
4
|
voucherLoading,
|
|
5
|
+
voucherError,
|
|
5
6
|
applyVoucher,
|
|
6
7
|
appliedPromotionCodes,
|
|
7
8
|
removeItem,
|
|
8
9
|
} = useVoucherCode();
|
|
10
|
+
const voucherId = useId();
|
|
9
11
|
</script>
|
|
10
12
|
|
|
11
13
|
<template>
|
|
12
|
-
<div class="flex flex-col gap-2">
|
|
13
|
-
<
|
|
14
|
-
<
|
|
14
|
+
<div class="flex flex-col gap-2 font-body text-sb-ink">
|
|
15
|
+
<form class="flex gap-2" @submit.prevent="applyVoucher">
|
|
16
|
+
<label :for="voucherId" class="sr-only">Gutscheincode</label>
|
|
17
|
+
<SbInput
|
|
18
|
+
:id="voucherId"
|
|
15
19
|
v-model="voucherCode"
|
|
20
|
+
name="voucher"
|
|
16
21
|
placeholder="Gutscheincode"
|
|
22
|
+
autocomplete="off"
|
|
17
23
|
class="flex-1"
|
|
24
|
+
:invalid="!!voucherError"
|
|
25
|
+
:aria-describedby="voucherError ? `${voucherId}-fehler` : undefined"
|
|
18
26
|
:disabled="voucherLoading"
|
|
19
|
-
@keyup.enter="applyVoucher"
|
|
20
27
|
/>
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
variant="
|
|
28
|
+
<SbButton
|
|
29
|
+
type="submit"
|
|
30
|
+
variant="secondary"
|
|
24
31
|
:loading="voucherLoading"
|
|
25
32
|
:disabled="!voucherCode.trim() || voucherLoading"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</
|
|
29
|
-
<
|
|
30
|
-
v-
|
|
31
|
-
:
|
|
32
|
-
|
|
33
|
+
>Einlösen</SbButton
|
|
34
|
+
>
|
|
35
|
+
</form>
|
|
36
|
+
<p
|
|
37
|
+
v-if="voucherError"
|
|
38
|
+
:id="`${voucherId}-fehler`"
|
|
39
|
+
role="alert"
|
|
40
|
+
class="text-sm font-semibold text-sb-danger"
|
|
33
41
|
>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
{{ voucherError }}
|
|
43
|
+
</p>
|
|
44
|
+
<ul v-if="appliedPromotionCodes.length" class="flex flex-col gap-1">
|
|
45
|
+
<li
|
|
46
|
+
v-for="promo in appliedPromotionCodes"
|
|
47
|
+
:key="promo.id"
|
|
48
|
+
class="flex items-center justify-between gap-2 rounded-sb-control bg-sb-primary-tint ps-3 text-sm font-semibold text-sb-primary-ink"
|
|
49
|
+
>
|
|
50
|
+
<span>Gutschein: {{ promo.label }}</span>
|
|
51
|
+
<SbIconButton
|
|
52
|
+
:label="`Gutschein ${promo.label} entfernen`"
|
|
53
|
+
variant="ghost"
|
|
54
|
+
@click="removeItem(promo)"
|
|
55
|
+
>
|
|
56
|
+
<SbIcon name="close" :size="16" />
|
|
57
|
+
</SbIconButton>
|
|
58
|
+
</li>
|
|
59
|
+
</ul>
|
|
47
60
|
</div>
|
|
48
61
|
</template>
|