@wikala/spmkt 2.11.0 → 2.11.1

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.
@@ -2,11 +2,11 @@
2
2
  <div :class="['cart-item', { 'ci-error': item.error }]">
3
3
  <div class="ci-product">
4
4
  <div class="ci-product-image">
5
- <a :href="item.slug"><img :src="item.image_url" class="image is-64x64" /></a>
5
+ <a :href="item.slug" :class="[{ 'is-link-passive': !item.storefront_visibility }]"><img :src="item.image_url" class="image is-64x64" /></a>
6
6
  </div>
7
7
  <div class="ci-name">
8
8
  <div class="ci-product-name">
9
- <a :href="item.slug">{{ item.name }}</a>
9
+ <a :href="item.slug" :class="[{ 'is-link-passive': !item.storefront_visibility }]">{{ item.name }}</a>
10
10
  </div>
11
11
  </div>
12
12
  <div class="ci-price">
@@ -14,7 +14,7 @@
14
14
  <div>{{ formatMoney(item.price, { precision: 2 }) }}</div>
15
15
  </div>
16
16
  <div class="ci-qty">
17
- <quantity-input :value="item.qty" @input="changeQty($event, item.id)"></quantity-input>
17
+ <quantity-input :value="itemQty" @input="changeQty($event, item.id)"></quantity-input>
18
18
  </div>
19
19
  </div>
20
20
  <div v-if="item.error" :class="{ 'ci-error-msg': item.error }">
@@ -41,6 +41,12 @@ export default {
41
41
  item: Object
42
42
  },
43
43
 
44
+ data() {
45
+ return {
46
+ itemQty: 0
47
+ }
48
+ },
49
+
44
50
  computed: {
45
51
  ...mapState(['cart', 'activeStep', 'steps'])
46
52
  },
@@ -48,35 +54,14 @@ export default {
48
54
  methods: {
49
55
  ...mapMutations(['setCart']),
50
56
  formatMoney,
51
- /*
52
- cartItemRemoveHover(event) {
53
- if (event.target.classList.contains('has-text-danger')) {
54
- event.target.classList.remove('has-text-danger')
55
- } else {
56
- event.target.classList.add('has-text-danger')
57
- }
58
- },
59
-
60
- cartItemRemove(productId) {
61
- let irLoading = this.$buefy.loading.open({
62
- container: this.$el
63
- })
64
- Cart.update({ id: productId, qty: 0 })
65
- .then((response) => {
66
- irLoading.close()
67
- this.setCart(response.data)
68
- })
69
- .catch((error) => {
70
- irLoading.close()
71
- console.log(error)
72
- })
73
- },*/
74
57
 
75
58
  async changeQty(qty, productId) {
76
59
  const cqLoading = this.$buefy.loading.open({
77
60
  container: this.$el
78
61
  })
79
62
 
63
+ this.itemQty = parseInt(qty)
64
+
80
65
  let requestData = {
81
66
  id: productId,
82
67
  qty: qty
@@ -96,6 +81,8 @@ export default {
96
81
  }
97
82
  this.$bus.$emit('updateTotalQty', response.data.sumQty)
98
83
  cqLoading.close()
84
+ let responseItem = response.data.items.find(item => item.id === productId)
85
+ this.itemQty = responseItem.qty
99
86
  this.setCart(response.data)
100
87
  } catch (error) {
101
88
  cqLoading.close()
@@ -128,6 +115,9 @@ export default {
128
115
  })
129
116
  }
130
117
  }
118
+ },
119
+ mounted() {
120
+ this.itemQty = this.item.qty
131
121
  }
132
122
  }
133
123
  </script>
@@ -18,7 +18,7 @@
18
18
  <div class="ci-qty has-text-right has-text-grey-light">{{ $t('global.quantity') }}</div>
19
19
  </div>
20
20
  <div class="cart-items">
21
- <CartItem v-for="item in cart.items" :key="item.id" :item="item"></CartItem>
21
+ <CartItem v-for="item in cart.items" :key="item.id+item.qty" :item="item"></CartItem>
22
22
  </div>
23
23
 
24
24
  <div v-if="cart.equivalent_qty > 0">
@@ -57,6 +57,12 @@ export default {
57
57
  }
58
58
  },
59
59
 
60
+ watch: {
61
+ value: function (nv, ov) {
62
+ this.qty = nv
63
+ }
64
+ },
65
+
60
66
  methods: {
61
67
  qtyInput(event) {
62
68
  if (event.target.value < 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikala/spmkt",
3
- "version": "2.11.0",
3
+ "version": "2.11.1",
4
4
  "private": false,
5
5
  "description": "supermarket",
6
6
  "scripts": {