/** * Created by xw on 2020/7/22. */ var previewContainer = new Vue({ el:"#fleaMarket", data: { tabIndex:0, userId:'', shopId:'', id:window.location.href.split('=')[1], isShow:false, isRequest:false, Showlogo:false, detail:{}, previewBigimage:'', previewThumb:[], previewParams:[], recommdeImage:[], userID:JSON.parse(localStorage.getItem('userInfo')), HandType:false, ShowImage:false, recommde:false, soldImage:false, vShow_brand:false, bnameShow:false, FlagTwo:false, recommdeindex:0, current:0, }, computed: { }, methods: { InfoData: function(){ var _this = this; SecondApi.ProductDetail({productId:_this.id},function (res) { if(res.code==0){ _this.isRequest =true; }else { _this.isRequest =false; } _this.detail = res.data; _this.previewThumb = res.data.imageList; _this.previewBigimage =res.data.imageList[0]; if(_this.userID!=null){ if(res.data.secondHandType ==2){ //临期产品显示 _this.HandType =true; }else { _this.HandType =false; } } if(res.data.showContactFlag!=2){ _this.ShowImage=true; }else { _this.ShowImage=false; } if(res.data.sold == 1){//sold是否出售 0未出售,1已出售 _this.soldImage = true; }else { _this.soldImage = false; } if(res.data.brandName !=''&& res.data.brandName!=null){ _this.bnameShow = true; if(res.data.brandID ==161){ _this.vShow_brand = true; }else { _this.vShow_brand = false; } }else { _this.bnameShow = false; } if (res.data.detailTalkFlag ==1){ //是否详聊 1不开启,2开启 _this.FlagTwo==true; }else { _this.FlagTwo==false; } if(res.data.brandInfo==null||res.data.brandInfo==""){ _this.Showlogo = false; }else { _this.Showlogo = true; } }) }, changeActive:function(){ var _this = this; _this.isShow = true; }, removeActive:function(){ var _this = this; _this.isShow = false; }, ImgList:function(item,index){ var _this = this; _this.current = index; _this.previewBigimage = item; }, }, mounted: function () { var _this = this; _this.InfoData(); SecondApi.ProductRecommend({productId:_this.id},function (res) { if(res.code==0){ console.log(res) if(res.data.length > 0){ _this.recommdeImage = res.data; _this.recommde =true; }else { _this.recommde =false; } if(res.data.length<7){ var length = 7-res.data.length; _this.recommdeindex = length; }else { var remainderres=res.data.length%7; _this.recommdeindex= 7-remainderres; console.log(_this.recommdeindex) } } }); SecondApi.ProductCount({productId: _this.id},function (res) { if(res.code==0){ console.log(res) }else { console.log(res) } }); //相關推薦輪播 var mySwiper = new Swiper('.swiper-container',{ slidesPerView: 7, spaceBetween: 18, slidesPerGroup: 7, autoplay: { delay:10000, disableOnInteraction: false,//是否禁止autoplay。默认为true:停止。 }, loop: false, observer: true, //修改swiper自己或子元素时,自动初始化swiper observeParents: true, //修改swiper的父元素时,自动初始化swiper pagination: { el: '.swiper-pagination', clickable: true, }, on:{ init:function() { var length = this.slides.length; if(length < 8) { this.autoplay.stop(); } } } }) } });