new Vue({ el: '#headerWrapper', data: { token:false, listNav:'', productUrl:"https://bestpeatsk.click/product_details/", urlNav:"https://bestpeatsk.click/category", searchData:{ page:'1', num:'20', keywords:'', }, searchDataShow:false, tokenTime:{ token:'', expiration:'', }, navShow:false, navListShow:false, countryShow:false, cartData:{ list:[], num:0, }, cartDataShow:false, cartListCheckbox:[], country:'', cartHove :false, countryImg:'https://bestpeatsk.click/static/shopa/img/USD.png', }, async created() { this.$http.get('/api/item/secondCate').then(function(response){ if(response.data.code == 200){ this.listNav = response.data.data }else{ this.$toast({message: response.data.message,icon: 'warning-o',}); } },function(res){ this.$toast({message: res.data.message,icon: 'warning-o',}); }); var cookieArray=document.cookie.split("; "); for (var i=0;i0){ window.event.returnValue = true; }else{ window.event.returnValue = false; this.$toast({message: 'Please select the item you want to purchase',icon: 'warning-o'}) } }, cartRemove:function(row){ let data = []; if(Array.isArray(row) == false){ data.push({ cart_id:row.cart_id, }) }else{ for(var i=0;i{ return item.cart_id }) this.cartHove = true } this.cartDataShow = true; }else{ this.$toast({message: response.data.message,icon: 'warning-o',}); } }, function (res) { this.$toast({message: response.data.message,icon: 'warning-o',}); window.location.href = "https://bestpeatsk.click/login"; }); var key = ' '; if(key.length>1){ this.searchData.keywords = key; } }, //搜索 searchFn:function(){ if(this.searchData.keywords){ this.$http.post('/api/item/search',this.searchData,{emulateJSON:true}).then(function(response){ if(response.data.code == 200){ if(response.data.data.total >= 1){ console.log("https://bestpeatsk.click/advanced_search_result",1) window.location.href="https://bestpeatsk.click/advanced_search_result"+"?keywords="+encodeURIComponent(this.searchData.keywords)+"&page="+this.searchData.page+"&num="+this.searchData.num; }else{ console.log("https://bestpeatsk.click/advanced_search",2) window.location.href="https://bestpeatsk.click/advanced_search"+"?keywords="+this.searchData.keywords; } this.searchDataShow = true; }else{ this.$toast({message: response.data.message,icon: 'warning-o',}); } },function(res){ this.$toast({message: res.data.message,icon: 'warning-o',}); }); }else{ console.log("https://bestpeatsk.click/advanced_search",3) window.location.href="https://bestpeatsk.click/advanced_search"+"?keywords="+this.searchData.keywords; } }, authorizationFn:function(){//get token console.log('123') var cookieArray=document.cookie.split("; "); for (var i=0;i0){ window.event.returnValue = true; }else{ window.event.returnValue = false; this.$toast({message: 'Please select the item you want to purchase',icon: 'warning-o'}) } }, } })