@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,113 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
|
|
3
|
+
<loading-handler :isLoading="paymentStore.state.isLoading"
|
|
4
|
+
:isUpdating="paymentStore.state.isUpdating"
|
|
5
|
+
:hasError="paymentStore.state.hasError"
|
|
6
|
+
:errorMessage="paymentStore.state.errorMessage">
|
|
7
|
+
|
|
8
|
+
<PaymentSelector :options="state.options" @valid="checkPaymentIsValid">
|
|
9
|
+
|
|
10
|
+
</PaymentSelector>
|
|
11
|
+
|
|
12
|
+
</loading-handler>
|
|
13
|
+
|
|
14
|
+
<div v-if="paymentStore.state.paymentSelection?.[0].startsWith('unzer-')">
|
|
15
|
+
<unzer-payment></unzer-payment>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
<script setup>
|
|
19
|
+
import {useCartStore} from "../stores/cart";
|
|
20
|
+
import {usePaymentStore} from "../stores/payment"
|
|
21
|
+
import {onBeforeMount, reactive,computed, watch} from "vue";
|
|
22
|
+
import LoadingHandler from "./generic/loadinghandler.vue"
|
|
23
|
+
import CardSelector from "./ui/generic/CardSelector.vue"
|
|
24
|
+
import unzerPayment from './paymentProvider/unzerPayment.vue'
|
|
25
|
+
|
|
26
|
+
import PaymentSelector from "./ui/payment/PaymentSelector.vue";
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
const cartStore = useCartStore();
|
|
30
|
+
const paymentStore = usePaymentStore()
|
|
31
|
+
const emits = defineEmits(['valid'])
|
|
32
|
+
const props = defineProps({
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
let iconMap = {
|
|
37
|
+
'prepayment':'currency-euro',
|
|
38
|
+
'unzer-card':'credit-card-2-back-fill',
|
|
39
|
+
'unzer-paypal':'paypal',
|
|
40
|
+
'unzer-ideal':'bank2',
|
|
41
|
+
'unzer-sofort':'cash-coin'
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
let simpleProviders = [
|
|
45
|
+
'prepayment',
|
|
46
|
+
'unzer-paypal',
|
|
47
|
+
'unzer-sofort'
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
const state = reactive({
|
|
51
|
+
selection:null,
|
|
52
|
+
selectionValid:false,
|
|
53
|
+
options:computed(()=>{
|
|
54
|
+
let options = []
|
|
55
|
+
let option = {
|
|
56
|
+
paymenttype:null,
|
|
57
|
+
widget:"default",
|
|
58
|
+
name:null,
|
|
59
|
+
description:null,
|
|
60
|
+
icon:null
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
for (const provider of paymentStore.state.paymentProviders){
|
|
65
|
+
let currentOption = {...option}
|
|
66
|
+
currentOption.paymenttype = provider[0]
|
|
67
|
+
currentOption.name = provider[1]['title']
|
|
68
|
+
currentOption.description = provider[1]['descr']
|
|
69
|
+
currentOption.icon = iconMap[provider[0]]
|
|
70
|
+
if (simpleProviders.includes(provider[0])){
|
|
71
|
+
currentOption.widget = "simple"
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
options.push(currentOption)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
return options
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
//await orderStore.startCheckout()
|
|
84
|
+
// > on weiter
|
|
85
|
+
|
|
86
|
+
async function updatePaymentProvider(selection){
|
|
87
|
+
let update = paymentStore.updateOrder()
|
|
88
|
+
if (update){
|
|
89
|
+
emits("valid", true)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function checkPaymentIsValid(selection) {
|
|
94
|
+
console.log(selection)
|
|
95
|
+
state.selectionValid = selection
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
onBeforeMount(async () => {
|
|
100
|
+
await paymentStore.initPayment()
|
|
101
|
+
console.log("AAA")
|
|
102
|
+
const script = document.createElement('script');
|
|
103
|
+
script.src = 'https://static.unzer.com/v1/unzer.js';
|
|
104
|
+
script.addEventListener('error', e => console.log(e.error));
|
|
105
|
+
document.head.appendChild(script);
|
|
106
|
+
console.log("BBBB")
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
</script>
|
|
110
|
+
|
|
111
|
+
<style scoped>
|
|
112
|
+
|
|
113
|
+
</style>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<loading-handler :isLoading="shippingStore.state.isLoading"
|
|
3
|
+
:isUpdating="shippingStore.state.isUpdating"
|
|
4
|
+
:hasError="shippingStore.state.hasError"
|
|
5
|
+
:errorMessage="shippingStore.state.errorMessage">
|
|
6
|
+
|
|
7
|
+
<card-selector :options="shippingStore.state.shippingData"
|
|
8
|
+
v-model:selection="shippingStore.state.selectedShippingMethod"
|
|
9
|
+
@change="updateShippingMethod"
|
|
10
|
+
>
|
|
11
|
+
<template v-slot="{option, index}">
|
|
12
|
+
<img slot="image">
|
|
13
|
+
{{ option['dest']['name'] }}
|
|
14
|
+
<div slot="footer">
|
|
15
|
+
Lieferzeit: {{ option['dest']['delivery_time_range'] }}
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
</card-selector>
|
|
19
|
+
</loading-handler>
|
|
20
|
+
</template>
|
|
21
|
+
<script setup>
|
|
22
|
+
import {useCartStore} from "../stores/cart";
|
|
23
|
+
import {useShippingStore} from "../stores/shipping"
|
|
24
|
+
import {onBeforeMount, reactive,computed, watch} from "vue";
|
|
25
|
+
import LoadingHandler from "./generic/loadinghandler.vue"
|
|
26
|
+
import CardSelector from "./ui/generic/CardSelector.vue"
|
|
27
|
+
|
|
28
|
+
const cartStore = useCartStore();
|
|
29
|
+
const shippingStore = useShippingStore()
|
|
30
|
+
const emits = defineEmits(['valid'])
|
|
31
|
+
const props = defineProps({
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const state = reactive({
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
onBeforeMount(async () => {
|
|
38
|
+
await shippingStore.initShipping()
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
async function updateShippingMethod(selection){
|
|
42
|
+
let update = await shippingStore.updateCart()
|
|
43
|
+
if (update){
|
|
44
|
+
emits("valid", true)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<style scoped>
|
|
51
|
+
|
|
52
|
+
</style>
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
,
|
|
2
1
|
<template>
|
|
3
2
|
<h2 class="viur-shop-cart-sidebar-headline headline">Zusammenfassung</h2>
|
|
4
3
|
<br />
|
|
@@ -26,11 +25,11 @@
|
|
|
26
25
|
</sl-format-number>
|
|
27
26
|
</div>
|
|
28
27
|
<div class="viur-shop-cart-sidebar-info-line">
|
|
29
|
-
<
|
|
28
|
+
<shipping-info ref="shipping">
|
|
30
29
|
<template #custom v-if="customShippingComponent">
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
</
|
|
30
|
+
<component :is="customShippingComponent"></component>
|
|
31
|
+
</template>
|
|
32
|
+
</shipping-info>
|
|
34
33
|
</div>
|
|
35
34
|
<div class="viur-shop-cart-sidebar-info-line total">
|
|
36
35
|
<span>Gesamt:</span>
|
|
@@ -43,58 +42,57 @@
|
|
|
43
42
|
</sl-format-number>
|
|
44
43
|
<!-- TODO: Some project needs "VAT included" here -->
|
|
45
44
|
</div>
|
|
45
|
+
<!-- TODO: Placement of discount? -->
|
|
46
|
+
<div class="viur-shop-discount-wrap" v-if="showDiscount">
|
|
47
|
+
<Discount></Discount>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
46
50
|
<slot name="action-buttons">
|
|
47
|
-
HIER KANN DEIN BUTTON REIN
|
|
48
51
|
<div class="viur-shop-cart-sidebar-btn-wrap">
|
|
49
|
-
<!-- TODO: Placement of discount? -->
|
|
50
|
-
<div class="viur-shop-discount-wrap" v-if="showDiscount">
|
|
51
|
-
<Discount></Discount>
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
52
|
<sl-button variant="primary" size="medium"> Jetzt Bestellen</sl-button>
|
|
55
53
|
<sl-button size="medium" variant="info">
|
|
56
54
|
<sl-icon name="paypal" slot="prefix"></sl-icon>
|
|
57
55
|
Paypal
|
|
58
56
|
</sl-button>
|
|
59
57
|
</div>
|
|
60
|
-
<!-- TODO: Delivery time estimate: slot -->
|
|
61
58
|
</slot>
|
|
62
|
-
<slot name="custom"></slot>
|
|
63
59
|
</template>
|
|
64
60
|
|
|
65
61
|
<script setup>
|
|
66
|
-
import Discount from "
|
|
67
|
-
import
|
|
62
|
+
import Discount from "./cart/Discount.vue";
|
|
63
|
+
import ShippingInfo from "./ui/generic/ShippingInfo.vue";
|
|
68
64
|
import { computed, onBeforeMount, reactive, ref } from "vue";
|
|
69
|
-
import { useCartStore } from "
|
|
65
|
+
import { useCartStore } from "../stores/cart";
|
|
66
|
+
import { useShippingStore } from "../stores/shipping";
|
|
67
|
+
import { useOrderStore } from "../stores/order";
|
|
68
|
+
|
|
69
|
+
const props = defineProps({
|
|
70
|
+
showDiscount: { type: Boolean, default: true },
|
|
71
|
+
customShippingComponent: { type: Object, default: undefined },
|
|
72
|
+
});
|
|
70
73
|
|
|
71
74
|
const cartStore = useCartStore();
|
|
75
|
+
const shippingStore = useShippingStore();
|
|
76
|
+
const orderStore = useOrderStore();
|
|
72
77
|
|
|
73
78
|
const shipping = ref(null);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
|
|
80
|
+
const state = reactive({
|
|
81
|
+
node: computed(() => cartStore.state.basket),
|
|
77
82
|
});
|
|
78
|
-
console.log("csc",props.customShippingComponent)
|
|
79
|
-
const state=reactive({
|
|
80
|
-
node:{}
|
|
81
|
-
})
|
|
82
83
|
|
|
83
84
|
const totalPrice = computed(() => {
|
|
84
|
-
if (state.
|
|
85
|
+
if (shippingStore.state.selectedShippingMethod) {
|
|
85
86
|
return (
|
|
86
87
|
state.node.total +
|
|
87
|
-
state.
|
|
88
|
+
shippingStore.state.selectedShippingMethod?.dest.shipping_cost -
|
|
88
89
|
state.node.discount
|
|
89
90
|
);
|
|
90
91
|
} else {
|
|
91
|
-
|
|
92
|
-
console.log(cartStore.state.basket);
|
|
93
|
-
|
|
94
|
-
if (cartStore.state.basket.length === 1) {
|
|
92
|
+
if (Object.keys(cartStore.state.childrenByNode).includes(state.node.key)) {
|
|
95
93
|
return (
|
|
96
94
|
state.node?.total +
|
|
97
|
-
|
|
95
|
+
shippingStore.state.selectedShippingMethod?.dest.shipping_cost -
|
|
98
96
|
state.node.discount
|
|
99
97
|
);
|
|
100
98
|
} else {
|
|
@@ -102,11 +100,6 @@ const totalPrice = computed(() => {
|
|
|
102
100
|
}
|
|
103
101
|
}
|
|
104
102
|
});
|
|
105
|
-
onBeforeMount(async () => {
|
|
106
|
-
await cartStore.init();
|
|
107
|
-
state.node = cartStore.state.basketRootNode;
|
|
108
|
-
console.log("get node",state.node)
|
|
109
|
-
})
|
|
110
103
|
</script>
|
|
111
104
|
|
|
112
105
|
<style>
|
|
@@ -12,87 +12,78 @@
|
|
|
12
12
|
<div class="viur-shop-multi-adress-box" v-for="n in state.amount" :key="n">
|
|
13
13
|
<BaseLayout
|
|
14
14
|
:customer="state.customer"
|
|
15
|
-
:custom-address="!state.
|
|
16
|
-
@
|
|
17
|
-
@edit-shipping="state.editShipping = $event"
|
|
15
|
+
:custom-address="!addressStore.state.clone"
|
|
16
|
+
@valid="emit('valid', $event)"
|
|
18
17
|
>
|
|
19
|
-
<template #cart-selection v-if="multiMode">
|
|
18
|
+
<!-- <template #cart-selection v-if="multiMode">
|
|
20
19
|
<CartSelection
|
|
21
20
|
:carts="reduce(carts, n)"
|
|
22
21
|
@cart-selected="onCartSelect($event, n)"
|
|
23
22
|
>
|
|
24
23
|
</CartSelection>
|
|
25
|
-
</template>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
:ref="
|
|
30
|
-
(el) => {
|
|
31
|
-
if (el === null) return;
|
|
32
|
-
|
|
33
|
-
state.customAddress['grp' + n] = el.checked;
|
|
34
|
-
}
|
|
35
|
-
"
|
|
36
|
-
@sl-change="onCustomBillingAddress($event, n)"
|
|
37
|
-
class="viur-shop-form-bill-check"
|
|
38
|
-
v-html="$t('viur.shop.userdata.shipping_to_billaddress')"
|
|
39
|
-
>
|
|
40
|
-
</sl-checkbox>
|
|
41
|
-
</template>
|
|
42
|
-
<template
|
|
43
|
-
#shipping-address
|
|
44
|
-
v-if="
|
|
45
|
-
(state.editShipping && !state.customAddress['grp' + n]) ||
|
|
46
|
-
(!state.hasShippingAddress && !state.customAddress['grp' + n]) ||
|
|
47
|
-
cartStore.state.billingAddressList.length === 1
|
|
48
|
-
"
|
|
49
|
-
>
|
|
50
|
-
<UserDataForm
|
|
24
|
+
</template> -->
|
|
25
|
+
|
|
26
|
+
<template #billing-address v-if="state.billingList.length <= 1">
|
|
27
|
+
<AddForm
|
|
51
28
|
:customer="state.customer"
|
|
52
|
-
v-model="cartStore.state.activeShippingAddress"
|
|
53
|
-
@add-success="state.alert = $event"
|
|
54
29
|
:layout="layout"
|
|
30
|
+
v-model="addressStore.state.active.billing"
|
|
31
|
+
@add-success="state.alert = $event"
|
|
32
|
+
@valid="emit('valid', $event)"
|
|
55
33
|
>
|
|
56
|
-
</
|
|
34
|
+
</AddForm>
|
|
57
35
|
</template>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
state.editBilling ||
|
|
62
|
-
!state.hasBillingAddress ||
|
|
63
|
-
cartStore.state.billingAddressList.length === 1
|
|
64
|
-
"
|
|
65
|
-
>
|
|
66
|
-
<UserDataForm
|
|
36
|
+
|
|
37
|
+
<template #shipping-address v-if="state.shippingList.length <= 1">
|
|
38
|
+
<AddForm
|
|
67
39
|
:customer="state.customer"
|
|
68
|
-
:
|
|
69
|
-
v-model="cartStore.state.activeBillingAddress"
|
|
70
|
-
@add-success="state.alert = $event"
|
|
40
|
+
:type="'shipping'"
|
|
71
41
|
:layout="layout"
|
|
42
|
+
v-model="addressStore.state.active.shipping"
|
|
43
|
+
@add-success="state.alert = $event"
|
|
44
|
+
@valid="emit('valid', $event)"
|
|
72
45
|
>
|
|
73
|
-
</
|
|
46
|
+
</AddForm>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<template #mode-switch>
|
|
50
|
+
<sl-checkbox
|
|
51
|
+
:checked="addressStore.state.clone"
|
|
52
|
+
class="viur-shop-form-bill-check"
|
|
53
|
+
v-html="$t('viur.shop.userdata.shipping_to_billaddress')"
|
|
54
|
+
@sl-change="onCustomShipping"
|
|
55
|
+
>
|
|
56
|
+
</sl-checkbox>
|
|
74
57
|
</template>
|
|
75
58
|
</BaseLayout>
|
|
76
59
|
</div>
|
|
77
60
|
|
|
78
|
-
<ActionBar
|
|
61
|
+
<!-- <ActionBar
|
|
79
62
|
@on-address-add="addAddress"
|
|
80
63
|
@on-address-remove="removeAddress"
|
|
81
64
|
v-if="multiMode"
|
|
82
65
|
>
|
|
83
|
-
</ActionBar>
|
|
66
|
+
</ActionBar> -->
|
|
84
67
|
</div>
|
|
85
68
|
</template>
|
|
86
69
|
|
|
87
70
|
<script setup>
|
|
71
|
+
// Functions
|
|
88
72
|
import { ref, reactive, computed, onBeforeMount, watch } from "vue";
|
|
89
|
-
|
|
73
|
+
|
|
74
|
+
// Stores
|
|
75
|
+
import { useCartStore } from "../stores/cart";
|
|
76
|
+
import { useAddressStore } from "../stores/address";
|
|
77
|
+
|
|
78
|
+
// Components
|
|
90
79
|
import CartSelection from "./ui/userdata/multi/CartSelection.vue";
|
|
80
|
+
import AddForm from "./ui/userdata/AddForm.vue";
|
|
91
81
|
import ActionBar from "./ui/userdata/multi/ActionBar.vue";
|
|
92
82
|
import ShopAlert from "./ui/generic/alerts/ShopAlert.vue";
|
|
93
|
-
import { useCartStore } from "../stores/cart";
|
|
94
83
|
import BaseLayout from "./ui/userdata/BaseLayout.vue";
|
|
95
84
|
|
|
85
|
+
const emit = defineEmits(["valid"]);
|
|
86
|
+
|
|
96
87
|
const props = defineProps({
|
|
97
88
|
multiMode: {
|
|
98
89
|
type: Boolean,
|
|
@@ -104,6 +95,7 @@ const props = defineProps({
|
|
|
104
95
|
});
|
|
105
96
|
|
|
106
97
|
const cartStore = useCartStore();
|
|
98
|
+
const addressStore = useAddressStore();
|
|
107
99
|
|
|
108
100
|
const state = reactive({
|
|
109
101
|
selection: {},
|
|
@@ -125,21 +117,15 @@ const state = reactive({
|
|
|
125
117
|
return r;
|
|
126
118
|
}),
|
|
127
119
|
customAddress: {},
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
() => cartStore.state.shippingAddressList.length,
|
|
131
|
-
),
|
|
132
|
-
editBilling: false,
|
|
133
|
-
editShipping: false,
|
|
134
|
-
billingData: {},
|
|
135
|
-
shippingData: {},
|
|
120
|
+
billingList: computed(() => addressStore.getList()),
|
|
121
|
+
shippingList: computed(() => addressStore.getList("shipping")),
|
|
136
122
|
});
|
|
137
123
|
|
|
138
124
|
const carts = ref(
|
|
139
|
-
cartStore.state.childrenByNode?.[cartStore.state.
|
|
140
|
-
? cartStore.state.childrenByNode?.[
|
|
141
|
-
|
|
142
|
-
|
|
125
|
+
cartStore.state.childrenByNode?.[cartStore.state.basket.key]
|
|
126
|
+
? cartStore.state.childrenByNode?.[cartStore.state.basket.key].filter(
|
|
127
|
+
(cart) => cart.skel_type === "node",
|
|
128
|
+
)
|
|
143
129
|
: [
|
|
144
130
|
{ name: "Warenkorb1", key: "213123123123" },
|
|
145
131
|
{ name: "Warenkorb2", key: "2131231232131233123" },
|
|
@@ -206,9 +192,9 @@ function reduce(arr, grp) {
|
|
|
206
192
|
return result;
|
|
207
193
|
}
|
|
208
194
|
|
|
209
|
-
function
|
|
210
|
-
state.customAddress["grp" + grp] = e.target.checked;
|
|
211
|
-
|
|
195
|
+
function onCustomShipping(e, grp) {
|
|
196
|
+
// state.customAddress["grp" + grp] = e.target.checked;
|
|
197
|
+
addressStore.state.clone = e.target.checked;
|
|
212
198
|
}
|
|
213
199
|
|
|
214
200
|
onBeforeMount(() => {});
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
slot="image"
|
|
34
34
|
:src="
|
|
35
35
|
getImage(
|
|
36
|
-
modelValue
|
|
37
|
-
? modelValue.
|
|
36
|
+
modelValue?.shop_image
|
|
37
|
+
? modelValue.shop_image
|
|
38
38
|
: undefined,
|
|
39
39
|
)
|
|
40
40
|
"
|
|
@@ -59,6 +59,8 @@
|
|
|
59
59
|
min="0"
|
|
60
60
|
:value="modelValue.quantity"
|
|
61
61
|
@sl-change="updateItem"
|
|
62
|
+
:disabled="cartStore.state.freeze"
|
|
63
|
+
ref="itemCount"
|
|
62
64
|
>
|
|
63
65
|
</sl-input>
|
|
64
66
|
</div>
|
|
@@ -91,6 +93,7 @@
|
|
|
91
93
|
variant="primary"
|
|
92
94
|
title="Remove from cart"
|
|
93
95
|
@click="confirm.show()"
|
|
96
|
+
v-if="!cartStore.state.freeze"
|
|
94
97
|
>
|
|
95
98
|
<sl-icon name="trash" slot="prefix"></sl-icon>
|
|
96
99
|
</sl-button>
|
|
@@ -115,6 +118,7 @@
|
|
|
115
118
|
import { computed, onBeforeMount, reactive, ref } from "vue";
|
|
116
119
|
import { Request } from "@viur/vue-utils";
|
|
117
120
|
import { useCartStore } from "../../stores/cart";
|
|
121
|
+
import { useDebounceFn } from "@vueuse/core";
|
|
118
122
|
// import ShopPriceFormatter from "../ui/generic/ShopPriceFormatter.vue";
|
|
119
123
|
|
|
120
124
|
const props = defineProps(["modelValue"]);
|
|
@@ -123,6 +127,7 @@ const emit = defineEmits(["update:modelValue"]);
|
|
|
123
127
|
const cartStore = useCartStore();
|
|
124
128
|
const confirm = ref(null);
|
|
125
129
|
const isConfirmed = ref(false);
|
|
130
|
+
const itemCount = ref(null);
|
|
126
131
|
|
|
127
132
|
function getImage(image) {
|
|
128
133
|
if (image !== undefined) return Request.downloadUrlFor(image);
|
|
@@ -130,18 +135,23 @@ function getImage(image) {
|
|
|
130
135
|
return cartStore.state.placeholder;
|
|
131
136
|
}
|
|
132
137
|
|
|
133
|
-
|
|
134
|
-
|
|
138
|
+
const updateItem = useDebounceFn(
|
|
139
|
+
(ev) => {
|
|
140
|
+
console.log(ev);
|
|
141
|
+
let newEvent = { ...props.modelValue };
|
|
135
142
|
|
|
136
|
-
|
|
143
|
+
newEvent.quantity = ev.target.value;
|
|
137
144
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
+
console.log("update", newEvent.quantity);
|
|
146
|
+
if (newEvent.quantity < 1) {
|
|
147
|
+
confirm.value.show();
|
|
148
|
+
} else {
|
|
149
|
+
emit("update:modelValue", newEvent);
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
1500,
|
|
153
|
+
{ maxWait: 5000 },
|
|
154
|
+
);
|
|
145
155
|
|
|
146
156
|
function removeItem() {
|
|
147
157
|
let newEvent = { ...props.modelValue };
|
|
@@ -151,16 +161,14 @@ function removeItem() {
|
|
|
151
161
|
|
|
152
162
|
function resetItem() {
|
|
153
163
|
if (!isConfirmed.value) {
|
|
154
|
-
|
|
155
|
-
newEvent.quantity = 1;
|
|
156
|
-
emit("update:modelValue", newEvent);
|
|
164
|
+
itemCount.value.value = props.modelValue.quantity;
|
|
157
165
|
}
|
|
158
166
|
}
|
|
159
167
|
|
|
160
168
|
async function onConfirm() {
|
|
161
169
|
isConfirmed.value = true;
|
|
162
|
-
confirm.value.hide();
|
|
163
170
|
removeItem();
|
|
171
|
+
confirm.value.hide();
|
|
164
172
|
}
|
|
165
173
|
</script>
|
|
166
174
|
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<CartTreeWrapper :tree="state.tree" @update:modelValue="handleChange">
|
|
3
3
|
</CartTreeWrapper>
|
|
4
|
+
|
|
5
|
+
<sl-button
|
|
6
|
+
@click="
|
|
7
|
+
cartStore.addNode(
|
|
8
|
+
cartStore.state.basket.key,
|
|
9
|
+
(cartType = 'basket'),
|
|
10
|
+
)
|
|
11
|
+
"
|
|
12
|
+
>addbutton</sl-button
|
|
13
|
+
>
|
|
4
14
|
</template>
|
|
5
15
|
<script setup>
|
|
6
16
|
import { reactive, watch, computed } from "vue";
|
|
7
17
|
import CartTreeWrapper from "./CartTreeWrapper.vue";
|
|
18
|
+
import { useCartStore } from "../../stores/cart";
|
|
19
|
+
|
|
20
|
+
const cartStore = useCartStore();
|
|
8
21
|
|
|
9
22
|
const props = defineProps({
|
|
10
23
|
modelValue: { type: Array, required: true },
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="state.loading">keine Einträge im Warenkorb</div>
|
|
3
|
+
<template v-else>
|
|
4
|
+
<div
|
|
5
|
+
class="viur-shop-cart-node"
|
|
6
|
+
v-for="entry in modelValue"
|
|
7
|
+
:key="entry.key"
|
|
8
|
+
>
|
|
9
|
+
<CartLeafModel
|
|
10
|
+
:modelValue="entry"
|
|
11
|
+
v-if="entry.skel_type === 'leaf'"
|
|
12
|
+
@update:modelValue="handleChange"
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
<shop-summary v-if="standalone">
|
|
16
|
+
<template #custom v-if="customComponent">
|
|
17
|
+
<component :is="customComponent"></component>
|
|
18
|
+
</template>
|
|
19
|
+
</shop-summary>
|
|
20
|
+
</template>
|
|
21
|
+
</template>
|
|
22
|
+
<script setup>
|
|
23
|
+
import { reactive, computed } from "vue";
|
|
24
|
+
import CartLeafModel from "./CartLeafModel.vue";
|
|
25
|
+
import { useCartStore } from "../../stores/cart";
|
|
26
|
+
import ShopSummary from "../ShopSummary.vue";
|
|
27
|
+
|
|
28
|
+
const props = defineProps({
|
|
29
|
+
modelValue: { type: Array, required: true },
|
|
30
|
+
standalone: { type: Boolean, default: true },
|
|
31
|
+
customComponent: { default: null },
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const emits = defineEmits(["update:modelValue"]);
|
|
35
|
+
|
|
36
|
+
const cartStore = useCartStore();
|
|
37
|
+
|
|
38
|
+
const state = reactive({
|
|
39
|
+
loading: computed(() => {
|
|
40
|
+
return props.modelValue.length ? false : true;
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
async function handleChange(e) {
|
|
45
|
+
// ! NOTE: it is very important to unpack the prop (copy the array) at this point to avoid prop mutation!!!
|
|
46
|
+
let temp = [...props.modelValue];
|
|
47
|
+
|
|
48
|
+
temp.forEach(async (item, index) => {
|
|
49
|
+
if (item.key === e.key) {
|
|
50
|
+
if (item.quantity === e.quantity) {
|
|
51
|
+
return; //return if value has no changes so if value is 0 or remove button is clicked no request will be fired
|
|
52
|
+
}
|
|
53
|
+
if (e.quantity < 1) {
|
|
54
|
+
await cartStore.removeItem(e.article.dest.key, e.parententry);
|
|
55
|
+
temp.splice(index, 1);
|
|
56
|
+
} else {
|
|
57
|
+
await cartStore.updateItem(
|
|
58
|
+
e.article.dest.key,
|
|
59
|
+
e.parententry,
|
|
60
|
+
e.quantity,
|
|
61
|
+
);
|
|
62
|
+
temp[index] = e;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
emits("update:modelValue", temp);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// watch(() => props.modelValue,
|
|
71
|
+
// (oldVal, newVal) => {
|
|
72
|
+
// if(oldVal === )
|
|
73
|
+
// }
|
|
74
|
+
// );
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<style scoped>
|
|
78
|
+
.viur-shop-cart-node {
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
}
|
|
82
|
+
</style>
|