{{item.title}}

{{item.link}}

stock: {{stock}}

current price: THB {{formatPrice(promoPrice)}} {{formatPrice(item.price[0].price)}}

{{sku.group}}
Quantity :
{{sku.group}}
, quantity : 1, total : 0, disabledCart : true, group : [], options : [], rate : 5.1, option_qty : [] }, mounted(){ var el = this this.item.sku[this.item.sku.length-1].value.forEach(function(elem,idx){ el.option_qty.push(0); }); }, methods : { formatPrice : function(price){ return (price * this.rate).toFixed(2).toString(); }, imageId : function(id) { return "pic-" + id; }, minusId : function(id){ return "minus-" + id; }, plusId : function(id){ return "plus-" + id; }, targetId : function(id) { return "#pic-" + id; }, optionName : function(idx,index){ return "variants_" + idx + "_" + index }, decreaseQuantity : function(index){ console.log(index + ":" + this.option_qty[index]); this.option_qty[index]--; }, increaseQuantity : function(index){ console.log(index + ":" + this.option_qty[index]); this.option_qty[index]++; }, bindOptions : function(idx){ var opt_arr = _.map(this.options, function(opt){ return opt.data; }); var opt = opt_arr.join(";") var v = this this.item.skuMap.map(function(value,key){ if(value.skuMap == opt){ v.promoPrice = (value.promoPrice * v.rate).toFixed(2) v.price = (value.price * v.rate).toFixed(2) v.stock = value.stock if(value.stock > 0){ v.disabledCart = false }else{ v.disabledCart = true } } }); }, addCart : function(e){ var postData = { title : this.item.title, image : this.item.mainImage, price : this.promoPrice, quantity : this.quantity, total : (this.promoPrice * this.quantity).toFixed(2), options : this.options, shop : this.item.vendor, url : this.item.link } axios.post('/frontend/web/cart/add', Qs.stringify(postData), { headers: { 'Content-type': 'application/x-www-form-urlencoded'} }) .then(function (response) { window.location.href = '/frontend/web/cart'; //console.log(response); }) .catch(function (error) { console.log(error); }); }, qtyId : function(index){ return "option_qty_" + index; }, optionPriceId : function(index){ return "option_price_" + index; } } })