@viur/shop-components 0.0.1-dev.5 → 0.0.1-dev.51
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/dist/CategoryView-DX_XoGWC.mjs +60 -0
- package/dist/ItemCard-BXlP3aQy.mjs +64 -0
- package/dist/ItemView-NbPreO2T.mjs +1848 -0
- package/dist/ItemView.css +1 -0
- package/dist/main-CuU2Dx6p.mjs +3195 -0
- package/dist/main.css +1 -0
- package/dist/viur-shop-components.es.js +10 -0
- package/dist/viur-shop-components.umd.js +417 -0
- package/package.json +37 -22
- package/src/components/cart/CartView.vue +0 -692
- package/src/components/cart/ConfirmView.vue +0 -314
- package/src/components/order/category/CategoryList.vue +0 -83
- package/src/components/order/category/CategoryView.vue +0 -143
- package/src/components/order/information/UserInfoMulti.vue +0 -427
- package/src/components/order/information/UserInformation.vue +0 -332
- 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 -233
- package/src/components/order/process/ExampleUsage.vue +0 -100
- package/src/components/order/process/OrderComplete.vue +0 -41
- package/src/components/order/process/OrderTabHeader.vue +0 -7
- package/src/components/order/process/OrderView.vue +0 -210
- package/src/router/index.js +0 -103
- package/src/stores/cart.js +0 -111
- package/src/views/ViewMissing.vue +0 -20
package/src/stores/cart.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { reactive } from "vue";
|
|
2
|
-
import { Request, ListRequest } from "@viur/vue-utils";
|
|
3
|
-
import { defineStore } from "pinia";
|
|
4
|
-
import { ViURShopClient } from "@viur/viur-shop-client";
|
|
5
|
-
|
|
6
|
-
export const useCartStore = defineStore("cartstore", () => {
|
|
7
|
-
const shopClient = new ViURShopClient({
|
|
8
|
-
host_url: window.location.origin === "http://localhost:8081"
|
|
9
|
-
? "http://localhost:8080"
|
|
10
|
-
: window.location.origin,
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const state = reactive({
|
|
14
|
-
basket: "",
|
|
15
|
-
carts: {},
|
|
16
|
-
structure: { address: {}, cart: {} },
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
async function init() {
|
|
20
|
-
await getCarts();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async function getCarts() {
|
|
24
|
-
let carts = await shopClient.cart_list();
|
|
25
|
-
carts.forEach(async (cart) => {
|
|
26
|
-
state.carts[cart.key] = {};
|
|
27
|
-
state.carts[cart.key].info = cart;
|
|
28
|
-
if (cart.cart_type === "basket") {
|
|
29
|
-
state.basket = cart.key;
|
|
30
|
-
}
|
|
31
|
-
await getCartItems(cart.key);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async function getCartItems(cartKey) {
|
|
36
|
-
let cartItems = await shopClient.cart_list({ cart_key: cartKey });
|
|
37
|
-
state.carts[cartKey].items = cartItems;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async function addToCart(articleKey, cartKey) {
|
|
41
|
-
let resp = await shopClient.article_add({
|
|
42
|
-
article_key: articleKey,
|
|
43
|
-
parent_cart_key: cartKey,
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
await updateCart(cartKey);
|
|
47
|
-
console.log("addToCart", resp); //TODO: Errorhandling as soon as shop module works again
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async function getArticleView(articleKey, cartKey) {
|
|
51
|
-
let article = await shopClient.article_view({
|
|
52
|
-
article_key: articleKey,
|
|
53
|
-
parent_cart_key: cartKey,
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
console.log("getArticleView", article); // ? Talk about necessarity
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async function removeItem(articleKey, cartKey) {
|
|
60
|
-
let resp = await shopClient.article_remove({
|
|
61
|
-
article_key: articleKey,
|
|
62
|
-
parent_cart_key: cartKey,
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
await updateCart(cartKey);
|
|
66
|
-
|
|
67
|
-
console.log("remove Resp", resp); //TODO: Errorhandling as soon as shop module works again
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async function updateItem(articleKey, cartKey, quantity) {
|
|
71
|
-
let resp = await shopClient.article_update({
|
|
72
|
-
article_key: articleKey,
|
|
73
|
-
parent_cart_key: cartKey,
|
|
74
|
-
quantity: quantity,
|
|
75
|
-
quantity_mode: "replace",
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
if (quantity === 0) {
|
|
79
|
-
await updateCart(cartKey);
|
|
80
|
-
}
|
|
81
|
-
console.log("update Resp", resp); //TODO: Errorhandling as soon as shop module works again
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
async function updateCart(cartKey) {
|
|
85
|
-
await getCartItems(cartKey);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
async function getAdressStructure() {
|
|
89
|
-
let addSkel = await shopClient.address_structure()
|
|
90
|
-
state.structure.address = addSkel.addSkel
|
|
91
|
-
|
|
92
|
-
console.log("adress add", state.structure.address);
|
|
93
|
-
|
|
94
|
-
// Request.getStructure("shop.address").then(async (resp) => {
|
|
95
|
-
// let data = await resp.json();
|
|
96
|
-
// state.structure.address = data.addSkel;
|
|
97
|
-
|
|
98
|
-
// console.log("adress add", state.structure.address);
|
|
99
|
-
// });
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return {
|
|
103
|
-
state,
|
|
104
|
-
addToCart,
|
|
105
|
-
getArticleView,
|
|
106
|
-
removeItem,
|
|
107
|
-
updateItem,
|
|
108
|
-
init,
|
|
109
|
-
getAdressStructure,
|
|
110
|
-
};
|
|
111
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="home">View {{ route.path }} is missing.</div>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
import { defineComponent, reactive } from "vue"
|
|
7
|
-
import { useRoute } from "vue-router"
|
|
8
|
-
|
|
9
|
-
export default defineComponent({
|
|
10
|
-
props: {},
|
|
11
|
-
components: {},
|
|
12
|
-
setup(props, context) {
|
|
13
|
-
const route = useRoute()
|
|
14
|
-
const state = reactive({})
|
|
15
|
-
return { state, route }
|
|
16
|
-
}
|
|
17
|
-
})
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<style scoped></style>
|