@viur/shop-components 0.0.1-dev.2 → 0.0.1-dev.4

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.
@@ -0,0 +1,314 @@
1
+ <template>
2
+ <Loader v-if="!state.cartIsInit"></Loader>
3
+
4
+ <template v-else>
5
+ <div class="list">
6
+ <h2 class="viur-shop-cart-headline headline">Bestellung prüfen</h2>
7
+ <br />
8
+
9
+ <div class="viur-shop-cart-address-wrap">
10
+ <div class="viur-shop-cart-address">
11
+ <div class="viur-shop-cart-address-headline">
12
+ Versandadresse
13
+ <sl-button outline size="small">
14
+ <sl-icon name="pencil" slot="prefix"></sl-icon>
15
+ </sl-button>
16
+ </div>
17
+ Roland Brose<br />
18
+ Speicherstraße 33<br />
19
+ 44147 Dortmund, DE<br />
20
+ <br />
21
+ rb@mausbrand.de<br />
22
+ 0231 21 34 68 90
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
+ Roland Brose<br />
32
+ Speicherstraße 33<br />
33
+ 44147 Dortmund, DE<br />
34
+ <br />
35
+ rb@mausbrand.de<br />
36
+ 0231 21 34 68 90
37
+ </div>
38
+ </div>
39
+
40
+ <div class="viur-shop-cart-payment">
41
+ <div class="viur-shop-cart-payment-method">
42
+ <span>Zahlungsmethode:</span>
43
+ Paypal
44
+ </div>
45
+ <sl-button outline size="small">
46
+ <sl-icon name="pencil" slot="prefix"></sl-icon>
47
+ </sl-button>
48
+ </div>
49
+
50
+ <h2 class="viur-shop-cart-headline headline">Warenkorb</h2>
51
+ <br />
52
+
53
+ <sl-card
54
+ horizontal
55
+ class="viur-shop-cart-mini-card"
56
+ v-for="item in cartStore.state.carts[cartStore.state.basket].items"
57
+ >
58
+ <img
59
+ class="viur-shop-cart-mini-card-img"
60
+ slot="image"
61
+ :src="getImage(item.article.dest.key)"
62
+ />
63
+
64
+ <div class="viur-shop-cart-mini-cart-header" slot="header">
65
+ <h4 class="viur-shop-cart-mini-headline headline">{{ item.article.dest.shop_name }} | 425018</h4>
66
+ </div>
67
+ <div class="viur-shop-cart-mini-card-body-row">
68
+ <div class="viur-shop-cart-mini-card-body-info">
69
+ <div class="viur-shop-cart-mini-card-info-wrap">
70
+ <div class="viur-shop-cart-mini-card-info">
71
+ <span>Anzahl: </span>
72
+ 1
73
+ </div>
74
+ <div class="viur-shop-cart-mini-card-info">
75
+ <span>Preis: </span>
76
+ {{ item.article.dest.shop_price_recommended }} €
77
+ </div>
78
+ </div>
79
+ </div>
80
+ </div>
81
+ </sl-card>
82
+
83
+ <teleport to="#order_sidebar">
84
+ <h2 class="viur-shop-cart-sidebar-headline headline">Jetzt Bestellen</h2>
85
+ <br />
86
+ <div class="viur-shop-cart-sidebar-info-line">
87
+ <span>Zwischensumme</span>
88
+ {{ cartStore.state.carts[cartStore.state.basket].info.total }} €
89
+ </div>
90
+ <div class="viur-shop-cart-sidebar-info-line">
91
+ <span>Rabatt</span>
92
+ 0 €
93
+ </div>
94
+ <div class="viur-shop-cart-sidebar-info-line">
95
+ <span>Versandkosten</span>
96
+ 0 €
97
+ </div>
98
+ <div class="viur-shop-cart-sidebar-info-line total">
99
+ <span>Gesamt:</span>
100
+ {{ cartStore.state.carts[cartStore.state.basket].info.total }} €
101
+ </div>
102
+
103
+ <sl-checkbox @sl-change="onTosAccept">
104
+ Ich akzeptiere die geltenden AGBs und Datenschutzbestimmungen
105
+ </sl-checkbox>
106
+
107
+ <div class="viur-shop-cart-sidebar-btn-wrap">
108
+ <sl-button
109
+ :variant="state.showOrderButton ? 'info' : 'disabled'"
110
+ size="small"
111
+ :disabled="!state.showOrderButton"
112
+ >
113
+ Zahlungspflichtig bestellen
114
+ </sl-button>
115
+ </div>
116
+ </teleport>
117
+ </div>
118
+ </template>
119
+ </template>
120
+
121
+ <script setup>
122
+ import { reactive, onBeforeMount, computed } from "vue";
123
+ import Loader from "@viur/vue-utils/generic/Loader.vue";
124
+ import { useCartStore } from "../../stores/cart.js";
125
+ import { Request } from "@viur/vue-utils";
126
+
127
+ const cartStore = useCartStore();
128
+
129
+ // const searchWarning = ref()
130
+ const state = reactive({
131
+ cartIsInit: computed(() => {
132
+ return cartStore.state.basket.length ? true : false;
133
+ }),
134
+ itemsIsInit: computed(() => {
135
+ return cartStore.state.carts[cartStore.state.basket].items ? true : false;
136
+ }),
137
+ images: {},
138
+ showOrderButton: false,
139
+ });
140
+
141
+ function getImage(item) {
142
+ Request.get(`/json/dk_variante/view/${item}`).then(async (resp) => {
143
+ let data = await resp.json();
144
+
145
+ data = data.values;
146
+
147
+ let imageUrl = data.dk_artikel.dest.image
148
+ ? Request.downloadUrlFor(data.dk_artikel.dest.image)
149
+ : "https://images.unsplash.com/photo-1559209172-0ff8f6d49ff7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=80";
150
+
151
+ state.images[item] = imageUrl;
152
+ });
153
+
154
+ return state.images[item];
155
+ }
156
+
157
+ function onTosAccept(e) {
158
+ if (e.target.checked) state.showOrderButton = true;
159
+ if (!e.target.checked) state.showOrderButton = false;
160
+ }
161
+
162
+ onBeforeMount(async () => {
163
+ await cartStore.init();
164
+ });
165
+ </script>
166
+
167
+ <style scoped>
168
+
169
+ .viur-shop-cart-sidebar-btn-wrap {
170
+ display: flex;
171
+ flex-direction: column;
172
+ margin-top: var(--sl-spacing-large);
173
+
174
+ sl-button {
175
+ margin-bottom: var(--sl-spacing-x-small);
176
+ }
177
+ }
178
+
179
+ sl-alert {
180
+ margin-top: var(--sl-spacing-medium);
181
+ margin-bottom: var(--sl-spacing-medium);
182
+ }
183
+
184
+ sl-tooltip {
185
+ &::part(body) {
186
+ line-height: 1.2;
187
+ font-weight: 400;
188
+ padding: 10px;
189
+ }
190
+ }
191
+
192
+ sl-menu-item {
193
+ &::part(base) {
194
+ padding: 0.2em 0.9em 0.2em 0.8em;
195
+ }
196
+
197
+ &::part(checked-icon) {
198
+ display: none;
199
+ }
200
+
201
+ &::part(prefix) {
202
+ margin-right: 10px;
203
+ }
204
+
205
+ &::part(suffix) {
206
+ margin-right: -1.5em;
207
+ }
208
+ }
209
+
210
+ .viur-shop-cart-sidebar-info-line {
211
+ display: flex;
212
+ flex-direction: row;
213
+ flex-wrap: nowrap;
214
+ margin: var(--sl-spacing-2x-small) 0;
215
+
216
+ span {
217
+ margin-right: auto;
218
+ }
219
+
220
+ &.total {
221
+ font-weight: 600;
222
+ border-top: 1px solid var(--sl-color-neutral-300);
223
+ border-bottom: 1px solid var(--sl-color-neutral-300);
224
+ padding: var(--sl-spacing-x-small) 0;
225
+ margin: var(--sl-spacing-small) 0;
226
+ }
227
+ }
228
+
229
+ .viur-shop-cart-mini-card {
230
+ margin-bottom: var(--sl-spacing-x-large);
231
+
232
+ &::part(header) {
233
+ border-bottom: none;
234
+ padding-top: 0;
235
+ padding-right: 0;
236
+ }
237
+
238
+ &::part(image) {
239
+ flex-basis: 25%;
240
+ max-width: 90px;
241
+ }
242
+
243
+ &::part(body) {
244
+ display: flex;
245
+ flex: 1;
246
+ padding-top: 0;
247
+ padding-bottom: 0;
248
+ padding-right: 0;
249
+ }
250
+
251
+ &::part(group) {
252
+ padding: var(--sl-spacing-small) 0;
253
+ }
254
+ }
255
+
256
+ .viur-shop-cart-mini-card-body-row {
257
+ display: grid;
258
+ grid-template-columns: 1fr auto auto;
259
+ gap: var(--sl-spacing-large);
260
+ flex: 1;
261
+ }
262
+
263
+ .viur-shop-cart-mini-card-body-info {
264
+ display: flex;
265
+ flex-direction: column;
266
+ height: 100%;
267
+ }
268
+
269
+ .viur-shop-cart-mini-card-info-wrap {
270
+ display: flex;
271
+ flex-wrap: nowrap;
272
+ gap: var(--sl-spacing-medium);
273
+ }
274
+
275
+ .viur-shop-cart-mini-card-info {
276
+ display: flex;
277
+ flex-direction: row;
278
+ flex-wrap: nowrap;
279
+
280
+ span {
281
+ margin-right: var(--sl-spacing-x-small);
282
+ font-weight: 600;
283
+ }
284
+ }
285
+
286
+ .viur-shop-cart-address-wrap {
287
+ display: grid;
288
+ grid-template-columns: 1fr 1fr;
289
+ gap: var(--sl-spacing-x-large);
290
+ margin-bottom: var(--sl-spacing-x-large);
291
+ }
292
+
293
+ .viur-shop-cart-address-headline {
294
+ display: flex;
295
+ flex-direction: row;
296
+ flex-wrap: nowrap;
297
+ align-items: center;
298
+ justify-content: space-between;
299
+ font-weight: 600;
300
+ }
301
+
302
+ .viur-shop-cart-payment {
303
+ display: flex;
304
+ flex-direction: row;
305
+ flex-wrap: nowrap;
306
+ align-items: center;
307
+ justify-content: space-between;
308
+ margin-bottom: var(--sl-spacing-x-large);
309
+
310
+ span {
311
+ font-weight: 600;
312
+ }
313
+ }
314
+ </style>
@@ -2,17 +2,17 @@
2
2
  <RouterLink :to="{ name: 'CategoryView', params: { identifier: 'dk' } }"
3
3
  v-for="item in list"
4
4
  :key="item"
5
- class="item-link"
5
+ class="viur-shop-category-list-item-link"
6
6
  >
7
- <sl-card class="item">
7
+ <sl-card class="viur-shop-category-list-item">
8
8
  <img
9
9
  slot="image"
10
10
  src="https://images.unsplash.com/photo-1559209172-0ff8f6d49ff7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=80"
11
11
  alt="A kitten."
12
- class="item-img"
12
+ class="viur-shop-category-list-item-img"
13
13
  />
14
- <h2 class="item-headline"> {{ item }}</h2>
15
- <div class="fake-link">Alle anzeigen &raquo;</div>
14
+ <h2 class="viur-shop-category-list-item-headline"> {{ item }}</h2>
15
+ <div class="viur-shop-category-list-fake-link">Alle anzeigen &raquo;</div>
16
16
 
17
17
  </sl-card>
18
18
  </RouterLink>
@@ -29,29 +29,29 @@ const props = defineProps({
29
29
  });
30
30
 
31
31
  onBeforeMount(async () => {
32
- // cartStore.init();
32
+ await cartStore.init();
33
33
  });
34
34
  </script>
35
35
 
36
36
  <style scoped>
37
37
 
38
- .item-link{
38
+ .viur-shop-category-list-item-link{
39
39
  display: flex;
40
40
  flex-direction: column;
41
41
  width: 100%;
42
42
 
43
43
  &:hover{
44
- .fake-link{
44
+ .viur-shop-category-list-fake-link{
45
45
  text-decoration: underline;
46
46
  }
47
47
 
48
- .item-img{
48
+ .viur-shop-category-list-item-img{
49
49
  transform: scale(1.02);
50
50
  }
51
51
  }
52
52
  }
53
53
 
54
- .item{
54
+ .viur-shop-category-list-item{
55
55
  width: 100%;
56
56
 
57
57
  &::part(header){
@@ -67,13 +67,13 @@ onBeforeMount(async () => {
67
67
  }
68
68
  }
69
69
 
70
- .item-headline{
70
+ .viur-shop-category-list-item-headline{
71
71
  font-size: 1.4em;
72
72
  margin-bottom: var(--sl-spacing-medium);
73
73
  color: var(--ignt-basic-color-text);
74
74
  }
75
75
 
76
- .item-img{
76
+ .viur-shop-category-list-item-img{
77
77
  aspect-ratio: 1;
78
78
  object-fit: cover;
79
79
  transition: all ease .3s;
@@ -1,21 +1,40 @@
1
1
  <template>
2
- <div class="item-list">
3
- <router-link
4
- v-for="item in state.skellist"
5
- :key="item.shop_name"
6
- :to="{ name: 'itemView', params: { item: item.key } }"
7
- >
8
- <ItemCard :item="item"> </ItemCard>
9
- </router-link>
2
+ <div class="viur-shop-loading-wrap" v-if="state.loading">
3
+ <sl-spinner></sl-spinner>
10
4
  </div>
11
5
 
12
- <sl-button
13
- @click="loadMore"
14
- :loading="state.loading"
15
- :disabled="state.isLastItem"
16
- >
17
- Mehr anzeigen
18
- </sl-button>
6
+ <div class="bind" v-else>
7
+ <div class="page-header">
8
+ <h1>{{ pageHeader }}</h1>
9
+ </div>
10
+ <slot name="filter" v-if="filter">
11
+ text-transform text-transform TEST
12
+ </slot>
13
+ <div class="viur-shop-category-view-list">
14
+ <!-- <router-link
15
+ v-for="item in state.skellist"
16
+ :key="item.shop_name"
17
+ :to="{ name: 'itemView', params: { item: item.key } }"
18
+ > -->
19
+
20
+ <ItemCard
21
+ v-for="item in state.skellist"
22
+ :key="item.shop_name"
23
+ :item="item"
24
+ >
25
+ </ItemCard>
26
+ <!-- </router-link> -->
27
+ </div>
28
+
29
+ <sl-button
30
+ @click="loadMore"
31
+ :loading="state.loading"
32
+ :disabled="state.isLastItem"
33
+ class="viur-shop-category-view-more-button"
34
+ >
35
+ Mehr anzeigen
36
+ </sl-button>
37
+ </div>
19
38
  </template>
20
39
 
21
40
  <script setup>
@@ -28,6 +47,13 @@ import { Request, ListRequest } from "@viur/vue-utils";
28
47
  // component imports
29
48
  import ItemCard from "../item/ItemCard.vue";
30
49
 
50
+ const props = defineProps({
51
+ skellist: { type: Array },
52
+ filter: { type: Boolean, default: true },
53
+ pageHeader: { type: String, default: "Artikel Liste" },
54
+ listHandler: { type: Object, required: true },
55
+ });
56
+
31
57
  const route = useRoute();
32
58
 
33
59
  const cartStore = useCartStore();
@@ -41,10 +67,7 @@ const state = reactive({
41
67
  itemType: computed(() => route.params.identifier),
42
68
  });
43
69
 
44
- const categoryList = ListRequest("categorystore", {
45
- module: "variante",
46
- params: { type: state.itemType, limit: state.itemCount },
47
- });
70
+ const categoryList = props.listHandler;
48
71
 
49
72
  function listItems() {
50
73
  let params = {
@@ -85,6 +108,7 @@ async function loadMore() {
85
108
  }
86
109
 
87
110
  onMounted(async () => {
111
+ await cartStore.init();
88
112
  await categoryList.fetch(true);
89
113
  state.skellist = categoryList.state.skellist;
90
114
  state.loading = false;
@@ -94,10 +118,26 @@ onMounted(async () => {
94
118
  </script>
95
119
 
96
120
  <style scoped>
97
- .item-list {
121
+ .viur-shop-category-view-list {
98
122
  display: grid;
99
123
  width: 100%;
100
124
  grid-gap: var(--sl-spacing-medium);
101
125
  grid-template-columns: repeat(4, 1fr);
102
126
  }
127
+
128
+ .viur-shop-loading-wrap {
129
+ position: absolute;
130
+ top: 0;
131
+ bottom: 0;
132
+ left: 0;
133
+ right: 0;
134
+ display: flex;
135
+ align-items: center;
136
+ justify-content: center;
137
+
138
+ sl-spinner {
139
+ font-size: 3.5em;
140
+ --track-width: 4px;
141
+ }
142
+ }
103
143
  </style>