@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,91 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<sl-spinner v-if="state.loading"></sl-spinner>
|
|
3
|
+
<CartTree v-model="state.data" v-else-if="!state.loading && tree"></CartTree>
|
|
4
|
+
<CartView
|
|
5
|
+
v-model="state.data"
|
|
6
|
+
:standalone="standalone"
|
|
7
|
+
:customComponent="customComponent"
|
|
8
|
+
v-else
|
|
9
|
+
>
|
|
10
|
+
</CartView>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup>
|
|
14
|
+
import { reactive, onBeforeMount, watch } from "vue";
|
|
15
|
+
import { useCartStore } from "../stores/cart.js";
|
|
16
|
+
import { useOrderStore } from "../stores/order.js";
|
|
17
|
+
import CartTree from "./cart/CartTree.vue";
|
|
18
|
+
import CartView from "./cart/CartView.vue";
|
|
19
|
+
|
|
20
|
+
const props = defineProps({
|
|
21
|
+
tree: { type: Boolean, default: false },
|
|
22
|
+
cartKey: { type: String },
|
|
23
|
+
standalone: { type: Boolean, default: true },
|
|
24
|
+
customComponent: { default: undefined },
|
|
25
|
+
});
|
|
26
|
+
const emits = defineEmits(["valid", "invalid"]);
|
|
27
|
+
|
|
28
|
+
const cartStore = useCartStore();
|
|
29
|
+
const orderStore = useOrderStore();
|
|
30
|
+
|
|
31
|
+
const state = reactive({
|
|
32
|
+
currentItem: {},
|
|
33
|
+
currentNode: {},
|
|
34
|
+
data: [],
|
|
35
|
+
loading: true,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
async function getChildren(parentKey = props.cartKey) {
|
|
39
|
+
state.loading = true;
|
|
40
|
+
if (orderStore.state.currentbasketKey && orderStore.state.currentbasketKey!==props.cartKey){
|
|
41
|
+
parentKey = orderStore.state.currentbasketKey
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const children = await cartStore.getChildren(parentKey);
|
|
45
|
+
|
|
46
|
+
children.forEach(async (child) => {
|
|
47
|
+
if (child.skel_type === "node") {
|
|
48
|
+
if (!Object.keys(cartStore.state.childrenByNode.includes(parentKey))) {
|
|
49
|
+
cartStore.state.childrenByNode[parentKey] = [];
|
|
50
|
+
}
|
|
51
|
+
cartStore.state.childrenByNode[parentKey].push(child);
|
|
52
|
+
state.data.push(child);
|
|
53
|
+
await getChildren(child.key);
|
|
54
|
+
} else {
|
|
55
|
+
state.data.push(child);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
state.loading = false;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function getCart() {
|
|
62
|
+
state.data = [];
|
|
63
|
+
await getChildren();
|
|
64
|
+
if (state.data.length) {
|
|
65
|
+
state.data.push(cartStore.state.basket);
|
|
66
|
+
emits("valid", true);
|
|
67
|
+
} else {
|
|
68
|
+
emits("valid", false);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
watch(
|
|
73
|
+
() => props.cartKey,
|
|
74
|
+
async (newVal, oldVal) => {
|
|
75
|
+
if (newVal) {
|
|
76
|
+
await getCart();
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
onBeforeMount(async () => {
|
|
82
|
+
if (!props.standalone) {
|
|
83
|
+
await getCart();
|
|
84
|
+
}
|
|
85
|
+
if (props.cartKey && props.standalone) {
|
|
86
|
+
await getCart();
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<style scoped></style>
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="list">
|
|
3
|
+
<h2 class="viur-shop-cart-headline headline">Bestellung prüfen</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
|
+
Versandadresse
|
|
8
|
+
<!-- <sl-button
|
|
9
|
+
outline
|
|
10
|
+
size="small"
|
|
11
|
+
@click="editShippingAddress(tabName)"
|
|
12
|
+
>
|
|
13
|
+
<sl-icon name="pencil" slot="prefix"></sl-icon>
|
|
14
|
+
</sl-button> -->
|
|
15
|
+
</div>
|
|
16
|
+
{{ addressStore.state.active.shipping.firstname }}
|
|
17
|
+
{{ addressStore.state.active.shipping.lastname }}<br />
|
|
18
|
+
{{ addressStore.state.active.shipping.street_name }}
|
|
19
|
+
{{ addressStore.state.active.shipping.street_number }}<br />
|
|
20
|
+
{{ addressStore.state.active.shipping.zip_code }}
|
|
21
|
+
{{ addressStore.state.active.shipping.city }}<br />
|
|
22
|
+
{{ getCountryName(addressStore.state.active.shipping.country) }}<br />
|
|
23
|
+
</div>
|
|
24
|
+
<div class="viur-shop-cart-address">
|
|
25
|
+
<div class="viur-shop-cart-address-headline">
|
|
26
|
+
Rechnungsadresse
|
|
27
|
+
<sl-button outline size="small">
|
|
28
|
+
<sl-icon name="pencil" slot="prefix"></sl-icon>
|
|
29
|
+
</sl-button>
|
|
30
|
+
</div>
|
|
31
|
+
{{ addressStore.state.active.billing.firstname }}
|
|
32
|
+
{{ addressStore.state.active.billing.lastname }}<br />
|
|
33
|
+
{{ addressStore.state.active.billing.street_name }}
|
|
34
|
+
{{ addressStore.state.active.billing.street_number }}<br />
|
|
35
|
+
{{ addressStore.state.active.billing.zip_code }}
|
|
36
|
+
{{ addressStore.state.active.billing.city }}<br />
|
|
37
|
+
{{ getCountryName(addressStore.state.active.billing.country) }}<br />
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div class="viur-shop-cart-payment">
|
|
42
|
+
<div class="viur-shop-cart-payment-method">
|
|
43
|
+
<span>Zahlungsmethode:</span>
|
|
44
|
+
<img
|
|
45
|
+
:src="state.selectedPaymentProvider[1].image_path"
|
|
46
|
+
style="width: 100px"
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
<sl-button outline size="small">
|
|
50
|
+
<sl-icon name="pencil" slot="prefix"></sl-icon>
|
|
51
|
+
</sl-button>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div class="viur-shop-cart-payment">
|
|
55
|
+
<div class="viur-shop-cart-payment-method">
|
|
56
|
+
<span>Versandart:</span>
|
|
57
|
+
<p>
|
|
58
|
+
{{ shippingStore.state.selectedShippingMethod.dest.name }}
|
|
59
|
+
-
|
|
60
|
+
<sl-format-number
|
|
61
|
+
type="currency"
|
|
62
|
+
currency="EUR"
|
|
63
|
+
:value="
|
|
64
|
+
shippingStore.state.selectedShippingMethod.dest.shipping_cost
|
|
65
|
+
"
|
|
66
|
+
lang="de"
|
|
67
|
+
>
|
|
68
|
+
</sl-format-number>
|
|
69
|
+
</p>
|
|
70
|
+
</div>
|
|
71
|
+
<sl-button outline size="small">
|
|
72
|
+
<sl-icon name="pencil" slot="prefix"></sl-icon>
|
|
73
|
+
</sl-button>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<h2 class="viur-shop-cart-headline headline">Warenkorb</h2>
|
|
77
|
+
|
|
78
|
+
<sl-spinner v-if="state.loading"></sl-spinner>
|
|
79
|
+
<CartList :list="state.data" :limit="1" v-else></CartList>
|
|
80
|
+
<sl-button size="small" @click=""> Zahlungspflichtig bestellen </sl-button>
|
|
81
|
+
</div>
|
|
82
|
+
</template>
|
|
83
|
+
|
|
84
|
+
<script setup>
|
|
85
|
+
import { computed, onBeforeMount, reactive } from "vue";
|
|
86
|
+
import CartList from "./ui/generic/CartList.vue";
|
|
87
|
+
import { usePaymentStore } from "../stores/payment.js";
|
|
88
|
+
import { useAddressStore } from "../stores/address.js";
|
|
89
|
+
import { useOrderStore } from "../stores/order.js";
|
|
90
|
+
import { useCartStore } from "../stores/cart.js";
|
|
91
|
+
import { useShippingStore } from "../stores/shipping.js";
|
|
92
|
+
|
|
93
|
+
const emit = defineEmits(["editAddress"]);
|
|
94
|
+
|
|
95
|
+
const props = defineProps({});
|
|
96
|
+
|
|
97
|
+
const cartStore = useCartStore();
|
|
98
|
+
const paymentStore = usePaymentStore();
|
|
99
|
+
const addressStore = useAddressStore();
|
|
100
|
+
const orderStore = useOrderStore();
|
|
101
|
+
const shippingStore = useShippingStore();
|
|
102
|
+
|
|
103
|
+
// const searchWarning = ref()
|
|
104
|
+
const state = reactive({
|
|
105
|
+
loading: true,
|
|
106
|
+
selectedPaymentProvider: computed(() => {
|
|
107
|
+
/* fixme this compute generates an error
|
|
108
|
+
Uncaught (in promise) TypeError: Cannot set properties of null (setting '__vnode')
|
|
109
|
+
but the value is correct.
|
|
110
|
+
*/
|
|
111
|
+
return paymentStore.state.paymentSelection;
|
|
112
|
+
}),
|
|
113
|
+
images: {},
|
|
114
|
+
showOrderButton: false,
|
|
115
|
+
data: [],
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
function editShippingAddress(e) {
|
|
119
|
+
emit("editAddress", e);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function getCountryName(val) {
|
|
123
|
+
if (!addressStore.state.structure || !val) {
|
|
124
|
+
return val;
|
|
125
|
+
}
|
|
126
|
+
for (const country of addressStore.state.structure.country.values) {
|
|
127
|
+
if (val === country[0]) {
|
|
128
|
+
return country[1];
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return val;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async function getOrderCart(
|
|
135
|
+
parentKey = orderStore.state.currentOrder.cart.dest.key,
|
|
136
|
+
) {
|
|
137
|
+
state.loading = true;
|
|
138
|
+
const children = await cartStore.getChildren(parentKey);
|
|
139
|
+
|
|
140
|
+
children.forEach(async (child) => {
|
|
141
|
+
if (child.skel_type === "node") {
|
|
142
|
+
if (!Object.keys(cartStore.state.childrenByNode.includes(parentKey))) {
|
|
143
|
+
cartStore.state.childrenByNode[parentKey] = [];
|
|
144
|
+
}
|
|
145
|
+
cartStore.state.childrenByNode[parentKey].push(child);
|
|
146
|
+
state.data.push(child);
|
|
147
|
+
await getChildren(child.key);
|
|
148
|
+
} else {
|
|
149
|
+
state.data.push(child);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
state.loading = false;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
onBeforeMount(async () => {
|
|
156
|
+
await getOrderCart();
|
|
157
|
+
});
|
|
158
|
+
</script>
|
|
159
|
+
|
|
160
|
+
<style scoped>
|
|
161
|
+
.viur-shop-cart-sidebar-btn-wrap {
|
|
162
|
+
display: flex;
|
|
163
|
+
flex-direction: column;
|
|
164
|
+
margin-top: var(--sl-spacing-large);
|
|
165
|
+
|
|
166
|
+
sl-button {
|
|
167
|
+
margin-bottom: var(--sl-spacing-x-small);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
sl-alert {
|
|
172
|
+
margin-top: var(--sl-spacing-medium);
|
|
173
|
+
margin-bottom: var(--sl-spacing-medium);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
sl-tooltip {
|
|
177
|
+
&::part(body) {
|
|
178
|
+
line-height: 1.2;
|
|
179
|
+
font-weight: 400;
|
|
180
|
+
padding: 10px;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
sl-menu-item {
|
|
185
|
+
&::part(base) {
|
|
186
|
+
padding: 0.2em 0.9em 0.2em 0.8em;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
&::part(checked-icon) {
|
|
190
|
+
display: none;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
&::part(prefix) {
|
|
194
|
+
margin-right: 10px;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
&::part(suffix) {
|
|
198
|
+
margin-right: -1.5em;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.viur-shop-cart-sidebar-info-line {
|
|
203
|
+
display: flex;
|
|
204
|
+
flex-direction: row;
|
|
205
|
+
flex-wrap: nowrap;
|
|
206
|
+
margin: var(--sl-spacing-2x-small) 0;
|
|
207
|
+
|
|
208
|
+
span {
|
|
209
|
+
margin-right: auto;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
&.total {
|
|
213
|
+
font-weight: 600;
|
|
214
|
+
border-top: 1px solid var(--sl-color-neutral-300);
|
|
215
|
+
border-bottom: 1px solid var(--sl-color-neutral-300);
|
|
216
|
+
padding: var(--sl-spacing-x-small) 0;
|
|
217
|
+
margin: var(--sl-spacing-small) 0;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.viur-shop-cart-mini-card {
|
|
222
|
+
margin-bottom: var(--sl-spacing-x-large);
|
|
223
|
+
|
|
224
|
+
&::part(header) {
|
|
225
|
+
border-bottom: none;
|
|
226
|
+
padding-top: 0;
|
|
227
|
+
padding-right: 0;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
&::part(image) {
|
|
231
|
+
flex-basis: 25%;
|
|
232
|
+
max-width: 90px;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
&::part(body) {
|
|
236
|
+
display: flex;
|
|
237
|
+
flex: 1;
|
|
238
|
+
padding-top: 0;
|
|
239
|
+
padding-bottom: 0;
|
|
240
|
+
padding-right: 0;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
&::part(group) {
|
|
244
|
+
padding: var(--sl-spacing-small) 0;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.viur-shop-cart-mini-card-body-row {
|
|
249
|
+
display: grid;
|
|
250
|
+
grid-template-columns: 1fr auto auto;
|
|
251
|
+
gap: var(--sl-spacing-large);
|
|
252
|
+
flex: 1;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.viur-shop-cart-mini-card-body-info {
|
|
256
|
+
display: flex;
|
|
257
|
+
flex-direction: column;
|
|
258
|
+
height: 100%;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.viur-shop-cart-mini-card-info-wrap {
|
|
262
|
+
display: flex;
|
|
263
|
+
flex-wrap: nowrap;
|
|
264
|
+
gap: var(--sl-spacing-medium);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.viur-shop-cart-mini-card-info {
|
|
268
|
+
display: flex;
|
|
269
|
+
flex-direction: row;
|
|
270
|
+
flex-wrap: nowrap;
|
|
271
|
+
|
|
272
|
+
span {
|
|
273
|
+
margin-right: var(--sl-spacing-x-small);
|
|
274
|
+
font-weight: 600;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.viur-shop-cart-address-wrap {
|
|
279
|
+
display: grid;
|
|
280
|
+
grid-template-columns: 1fr 1fr;
|
|
281
|
+
gap: var(--sl-spacing-x-large);
|
|
282
|
+
margin-bottom: var(--sl-spacing-x-large);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.viur-shop-cart-address-headline {
|
|
286
|
+
display: flex;
|
|
287
|
+
flex-direction: row;
|
|
288
|
+
flex-wrap: nowrap;
|
|
289
|
+
align-items: center;
|
|
290
|
+
justify-content: space-between;
|
|
291
|
+
font-weight: 600;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.viur-shop-cart-payment {
|
|
295
|
+
display: flex;
|
|
296
|
+
flex-direction: row;
|
|
297
|
+
flex-wrap: nowrap;
|
|
298
|
+
align-items: center;
|
|
299
|
+
justify-content: space-between;
|
|
300
|
+
margin-bottom: var(--sl-spacing-x-large);
|
|
301
|
+
|
|
302
|
+
span {
|
|
303
|
+
font-weight: 600;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.viur-shop-cart-headline {
|
|
308
|
+
margin: 0 0 var(--sl-spacing-x-large) 0;
|
|
309
|
+
font-size: var(--shop-form-headline-size);
|
|
310
|
+
}
|
|
311
|
+
</style>
|
|
@@ -1,4 +1,47 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
<template v-for="msg in messageStore.state.errors">
|
|
3
|
+
<shop-alert
|
|
4
|
+
v-if="!messageStore.state.blacklist.includes(msg.id)"
|
|
5
|
+
:msg="msg.msg"
|
|
6
|
+
:variant="msg.variant"
|
|
7
|
+
:iconName="msg.iconName"
|
|
8
|
+
:duration="msg?.duration ? msg.duration : 3000"
|
|
9
|
+
:closeable="msg.closeable"
|
|
10
|
+
:key="msg.id"
|
|
11
|
+
@sl-hide="messageStore.state.blacklist.push(msg.id)"
|
|
12
|
+
>
|
|
13
|
+
</shop-alert>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<sl-dialog
|
|
17
|
+
no-header
|
|
18
|
+
ref="freezeCart"
|
|
19
|
+
@sl-hide="
|
|
20
|
+
cartStore.state.freeze ? () => {} : tabGroup.show(state.tabNames[0])
|
|
21
|
+
"
|
|
22
|
+
>
|
|
23
|
+
<p>Wollen sie fortfahren?</p>
|
|
24
|
+
<i>*Der Warenkorb kann nicht mehr verändert werden bei Bestätigung</i>
|
|
25
|
+
<sl-bar>
|
|
26
|
+
<sl-button
|
|
27
|
+
slot="left"
|
|
28
|
+
variant="danger"
|
|
29
|
+
@click="freezeCart.hide()"
|
|
30
|
+
size="medium"
|
|
31
|
+
>
|
|
32
|
+
Abbrechen
|
|
33
|
+
</sl-button>
|
|
34
|
+
<sl-button
|
|
35
|
+
slot="right"
|
|
36
|
+
variant="success"
|
|
37
|
+
@click="onFreezeCart"
|
|
38
|
+
size="medium"
|
|
39
|
+
>
|
|
40
|
+
Bestätigen
|
|
41
|
+
</sl-button>
|
|
42
|
+
</sl-bar>
|
|
43
|
+
</sl-dialog>
|
|
44
|
+
|
|
2
45
|
<div class="bind viur-shop-wrap">
|
|
3
46
|
<div
|
|
4
47
|
class="viur-shop-stepper-wrap"
|
|
@@ -8,28 +51,33 @@
|
|
|
8
51
|
<sl-tab-group
|
|
9
52
|
class="viur-shop-order-tabgroup"
|
|
10
53
|
noScrollControls
|
|
11
|
-
@sl-tab-
|
|
54
|
+
@sl-tab-hide="onTabHide"
|
|
55
|
+
@sl-tab-show="onTabChange"
|
|
12
56
|
ref="tabGroup"
|
|
13
57
|
>
|
|
14
58
|
<StepperTab
|
|
15
59
|
v-for="(tab, index) in state.tabNames"
|
|
16
60
|
:key="tab"
|
|
17
61
|
:tab="tab"
|
|
18
|
-
:
|
|
62
|
+
:currentTab="state.currentTab"
|
|
63
|
+
:tabs="state.tabs"
|
|
19
64
|
:tabIdx="index"
|
|
20
65
|
:stepperLength="state.tabNames.length"
|
|
66
|
+
:disabled="
|
|
67
|
+
index === 0 ? false : !state.tabs[state.tabNames[index - 1]].valid
|
|
68
|
+
"
|
|
21
69
|
>
|
|
22
70
|
</StepperTab>
|
|
23
71
|
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
</
|
|
72
|
+
<template v-for="tab in state.tabNames" :key="tab">
|
|
73
|
+
<StepperItem
|
|
74
|
+
:tab="tab"
|
|
75
|
+
:currentTab="state.currentTab"
|
|
76
|
+
:tabs="state.tabs"
|
|
77
|
+
@valid="stepIsValid"
|
|
78
|
+
>
|
|
79
|
+
</StepperItem>
|
|
80
|
+
</template>
|
|
33
81
|
</sl-tab-group>
|
|
34
82
|
</slot>
|
|
35
83
|
|
|
@@ -41,6 +89,8 @@
|
|
|
41
89
|
>
|
|
42
90
|
<StepperTrigger
|
|
43
91
|
:index="state.tabIdx"
|
|
92
|
+
:tab="state.currentTab"
|
|
93
|
+
:tabs="state.tabs"
|
|
44
94
|
@prevTab="prevTab"
|
|
45
95
|
@nextTab="nextTab"
|
|
46
96
|
>
|
|
@@ -61,6 +111,9 @@
|
|
|
61
111
|
<template #custom v-if="customComponent">
|
|
62
112
|
<component :is="customComponent"></component>
|
|
63
113
|
</template>
|
|
114
|
+
<template #action-buttons>
|
|
115
|
+
<slot name="action-buttons"></slot>
|
|
116
|
+
</template>
|
|
64
117
|
</ShopSummary>
|
|
65
118
|
</div>
|
|
66
119
|
</slot>
|
|
@@ -68,13 +121,18 @@
|
|
|
68
121
|
</template>
|
|
69
122
|
|
|
70
123
|
<script setup>
|
|
71
|
-
import { reactive, computed, ref, onBeforeMount } from "vue";
|
|
124
|
+
import { reactive, computed, ref, onBeforeMount, provide } from "vue";
|
|
72
125
|
import StepperTab from "./ui/stepper/StepperTab.vue";
|
|
73
126
|
import StepperItem from "./ui/stepper/StepperItem.vue";
|
|
74
127
|
import StepperTrigger from "./ui/stepper/StepperTrigger.vue";
|
|
75
|
-
import ShopSummary from "./
|
|
128
|
+
import ShopSummary from "./ShopSummary.vue";
|
|
129
|
+
import ShopAlert from "./ui/generic/alerts/ShopAlert.vue";
|
|
130
|
+
import { useMessageStore } from "../stores/message";
|
|
131
|
+
import { useOrderStore } from "../stores/order";
|
|
76
132
|
import { useCartStore } from "../stores/cart";
|
|
77
133
|
|
|
134
|
+
const messageStore = useMessageStore();
|
|
135
|
+
const orderStore = useOrderStore();
|
|
78
136
|
const cartStore = useCartStore();
|
|
79
137
|
|
|
80
138
|
const props = defineProps({
|
|
@@ -108,16 +166,20 @@ const props = defineProps({
|
|
|
108
166
|
const emit = defineEmits(["tabChange"]);
|
|
109
167
|
|
|
110
168
|
const state = reactive({
|
|
111
|
-
tabNames: computed(() => sortTabs(
|
|
169
|
+
tabNames: computed(() => sortTabs(state.tabs)),
|
|
170
|
+
currentTabObj: computed(() => state.tabs[state.tabNames[state.tabIdx]]), //dont use as prop, cause of multiple rerenderings
|
|
112
171
|
tabIdx: 0,
|
|
113
172
|
currentTab: "",
|
|
173
|
+
tabs: {},
|
|
114
174
|
});
|
|
175
|
+
provide("stepperState", state);
|
|
115
176
|
|
|
116
177
|
const tabGroup = ref(null);
|
|
178
|
+
const freezeCart = ref(null);
|
|
117
179
|
|
|
118
180
|
function sortTabs(tabs) {
|
|
119
|
-
|
|
120
|
-
|
|
181
|
+
const sortedArray = [];
|
|
182
|
+
const outputArray = [];
|
|
121
183
|
|
|
122
184
|
for (const tab in tabs) {
|
|
123
185
|
if (tabs[tab].position) {
|
|
@@ -134,17 +196,34 @@ function sortTabs(tabs) {
|
|
|
134
196
|
sortedArray.forEach((tab) => {
|
|
135
197
|
outputArray.push(tab[0]);
|
|
136
198
|
});
|
|
137
|
-
|
|
138
199
|
return outputArray;
|
|
139
200
|
}
|
|
140
201
|
|
|
141
202
|
function onTabChange(e) {
|
|
142
|
-
|
|
143
|
-
|
|
203
|
+
let tab = e?.detail.name;
|
|
204
|
+
|
|
205
|
+
state.currentTab = tab;
|
|
206
|
+
state.tabIdx = state.tabNames.indexOf(tab);
|
|
144
207
|
|
|
145
208
|
emit("tabChange", e);
|
|
146
209
|
}
|
|
147
210
|
|
|
211
|
+
function onTabHide(e) {
|
|
212
|
+
if (state.currentTab==='cart'){
|
|
213
|
+
orderStore.add_or_update()
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/*if (state.tabIdx === 0 && !cartStore.state.freeze) {
|
|
217
|
+
freezeCart.value.show();
|
|
218
|
+
}*/
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function onFreezeCart() {
|
|
222
|
+
cartStore.state.freeze = true;
|
|
223
|
+
orderStore.handler();
|
|
224
|
+
freezeCart.value.hide();
|
|
225
|
+
}
|
|
226
|
+
|
|
148
227
|
function prevTab() {
|
|
149
228
|
if (state.tabIdx > 0) {
|
|
150
229
|
tabGroup.value.show(state.tabNames[state.tabIdx - 1]);
|
|
@@ -165,10 +244,19 @@ function editAddress(e) {
|
|
|
165
244
|
tabGroup.value.show(e);
|
|
166
245
|
}
|
|
167
246
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
247
|
+
function stepIsValid(e) {
|
|
248
|
+
console.log("stepIsValid", e);
|
|
249
|
+
|
|
250
|
+
state.tabs[state.currentTab].valid = e;
|
|
251
|
+
if (cartStore.state.freeze) {
|
|
252
|
+
orderStore.handler();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
onBeforeMount(() => {
|
|
257
|
+
state.tabs = { ...props.tabs }; //make reactive so we can save states to tabs
|
|
258
|
+
|
|
259
|
+
const tabNames = sortTabs(state.tabs);
|
|
172
260
|
state.currentTab = tabNames[0];
|
|
173
261
|
});
|
|
174
262
|
</script>
|