@viur/shop-components 0.10.0 → 0.11.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viur/shop-components",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Frontend Vue components for the shop module of ViUR",
5
5
  "repository": {
6
6
  "type": "git",
@@ -5,7 +5,6 @@
5
5
  :nextfunction="nextStep"
6
6
  >
7
7
  </slot>
8
-
9
8
  <loading-handler :isLoading="cartState.isLoading" :isUpdating="cartState.isUpdating">
10
9
  <div class="viur-shop-item-wrapper" v-if="state.items.length>0">
11
10
  <cart-item v-for="item in state.items" :item="item"
@@ -55,7 +54,7 @@ const props = defineProps({
55
54
  })
56
55
 
57
56
  const state = reactive({
58
- items: computed(()=>shopStore.state.cartList.filter(i=>i['skel_type']==='leaf'))
57
+ items: computed(()=>shopStore.state.cartList)
59
58
  })
60
59
 
61
60
  onBeforeMount(()=>{
@@ -36,9 +36,10 @@
36
36
  import { reactive } from "vue";
37
37
  import { useViurShopStore } from "../shop";
38
38
  import { useCart } from '../composables/cart';
39
+ import {useI18n} from 'vue-i18n';
39
40
  const shopStore = useViurShopStore();
40
41
  const {addDiscount, removeDiscount} = useCart()
41
-
42
+ const i18n = useI18n();
42
43
  import ShopAlert from "./ShopAlert.vue";
43
44
 
44
45
  const state = reactive({
@@ -56,7 +57,7 @@ function addDiscountAction() {
56
57
  .catch((error) => {
57
58
  state.loading=false
58
59
  console.log("error bei rabatt", error);
59
- state.alert.msg = "not found";
60
+ state.alert.msg = i18n.t('viur.shop.discount_not_found');
60
61
  state.alert.show = true;
61
62
  state.alert.variant = "danger";
62
63
  });
@@ -74,7 +75,7 @@ function removeDiscountAction(){
74
75
  .catch((error) => {
75
76
  state.loading=false
76
77
  console.log("error bei rabatt", error);
77
- state.alert.msg = "not found";
78
+ state.alert.msg = $t('viur.shop.discount_not_found');
78
79
  state.alert.show = true;
79
80
  state.alert.variant = "danger";
80
81
  });
@@ -69,11 +69,24 @@ export function useCart() {
69
69
 
70
70
  function fetchCartItems(key, parentKey=null){
71
71
  //fetch cart items
72
+ if (key === shopStore.state.cartRoot["key"]){ // initial
73
+ shopStore.state.cartList = []
74
+ }
72
75
  return Request.get(`${shopStore.state.shopApiUrl}/cart_list`,{dataObj:{
73
76
  cart_key:key
74
77
  }}).then(async( resp) =>{
75
78
  let data = await resp.clone().json()
76
- shopStore.state.cartList=data
79
+
80
+ let currentLeafs = []
81
+ for (const item of data){
82
+ if (item["skel_type"]==="leaf"){
83
+ currentLeafs.push(item)
84
+ }else{
85
+ await fetchCartItems(item['key'])
86
+ }
87
+ }
88
+
89
+ shopStore.state.cartList=shopStore.state.cartList.concat(currentLeafs)
77
90
  return resp
78
91
  })
79
92
  }
@@ -37,7 +37,7 @@ export default {
37
37
  'summary_headline': 'Zusammenfassung',
38
38
  'summary_subtotal': 'Zwischensumme',
39
39
  'summary_shipping_total': 'Versand- und Bearbeitungspauschale',
40
- 'summary_delivery_time': 'Lieferzeit',
40
+ 'summary_delivery_time': 'Voraussichtliche Lieferzeit',
41
41
  'summary_discount': 'Sie sparen bei Ihrem Einkauf im Aktionszeitraum',
42
42
  'summary_checkout': 'Zur Kasse gehen',
43
43
  'summary_total': 'Gesamtbetrag',
@@ -40,7 +40,7 @@ export default {
40
40
  'summary_delivery_time': 'Délai de livraison estimé',
41
41
  'summary_discount': 'Vous économisez sur votre achat',
42
42
  'summary_checkout': 'Acheter cet article',
43
- 'summary_total': 'Montant total',
43
+ 'summary_total': 'Montant TTC',
44
44
  'summary_vat': 'TVA incluse ({percentage})',
45
45
  'discount_not_found': 'Ce code promo n’existe pas.',
46
46
  'discount_not_active': 'Ce code promo n’est pas actif.',