查看更多
@@ -275,7 +271,7 @@
-
{{dogtitle}}
+ {{dogtitle}}
@@ -328,21 +324,20 @@
-
全价犬湿粮
-
-
+ 全价犬湿粮
+
-
+
-
-
- {{ item.title }}
+
+ {{ dogListitem.title }}
@@ -425,12 +420,11 @@
-
-
-
- 查看更多
-
-
+
+
+ 查看更多
+
+
@@ -445,20 +439,20 @@
-
全价犬干粮
-
-
+ 全价犬干粮
+
+
-
-
- {{ item.title }}
+
+ {{ userDogListItem.title }}
@@ -538,12 +532,11 @@
-
-
-
- 查看更多
-
-
+
+
+ 查看更多
+
+
@@ -556,8 +549,8 @@
-
处方用粮
-
+ 处方用粮
+
@@ -701,7 +694,11 @@
回到顶部
-
+
@@ -718,6 +715,8 @@
meta: {title: '首页'},
data(){
return{
+ fixedHeader:false,
+ dataLoaded:true,
useraindex:0,
usertitle:'明星猫粮',
dogtitle:'明星犬粮',
@@ -740,18 +739,22 @@
userserachlist:[{}],
doggan:[],
dogtype:[
- {
- title: "幼犬",
-
- },
- {
- title: "成犬",
- },
- {
- title: "老年犬",
- },
-
- ],
+ {
+ title: "幼犬",
+ },
+ {
+ title: "成犬",
+ },
+ {
+ title: "老年犬",
+ },
+ {
+ title: "品种犬",
+ },
+ {
+ title: "亚健康",
+ }
+ ],
anchor:'',
dogshi:[],
catlist:[],
@@ -800,43 +803,43 @@
]
},
showingBanners:[],
+ maoganCurIndex:0,
+ maoshiCurIndex:0,
+ quanshiCurIndex:0,
+ quanganCurIndex:0,
userdoglist: [
- {
- title: "小型犬",
- catimage: "/images/dog/small.png",
- },
- {
- title: "中型犬",
- catimage: "/images/dog/medium.png",
- },
- {
- title: "大型犬",
- catimage: "/images/dog/big.png",
- },
-
- ],
- discoun: [
- {
- title: "幼猫",
- },
- {
- title: "成猫",
- },
- {
- title: "老年猫",
- },
- {
- title: "品种猫",
-
-
- },
- {
- title: "亚健康猫",
-
-
- },
-
- ],
+ {
+ title: "小型犬",
+ catimage: "/images/dog/small.png",
+ },
+ {
+ title: "中型犬",
+ catimage: "/images/dog/medium.png",
+ },
+ {
+ title: "大型犬",
+ catimage: "/images/dog/big.png",
+ },
+ ],
+ discoun: [
+ {
+ title: "幼猫",
+ },
+ {
+ title: "成猫",
+ },
+ {
+ title: "老年猫",
+ },
+ {
+ title: "品种猫",
+
+
+ },
+ {
+ title: "亚健康猫"
+ },
+ ],
discountlist: [
{
@@ -1147,8 +1150,14 @@
}
window.addEventListener("scroll", this.handleScroll, true);
this.userchufang();//查询处方粮商品信息
+
this.catmessage();//查询猫的信息
+ this.catclickGan();
+ this.catclickShi();
+
this.dogmessage();//查询狗的信息
+ this.userdogShi();
+ this.userdogGan();
},
destroyed () {
window.removeEventListener('scroll', this.scrollToTop);
@@ -1200,8 +1209,6 @@
ifadroind(item,index,order){
//console.log(item,index,order);
-
-
var sUserAgent = navigator.userAgent.toLowerCase();
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
@@ -1212,8 +1219,8 @@
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
- if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) {
- //console.log("当前是电脑打开啊啊啊")
+ if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) {
+ //console.log("当前是电脑打开啊啊啊")
if(item.title=='明星猫粮'){
this.catproduct=true;
this.twomao=false;
@@ -1298,19 +1305,43 @@
let dogtop=document.querySelector('.oc-top');
//console.log(dogtop);
//console.log(mingxin.offsetTop);
+
+ let positionIdentifier=document.querySelectorAll('.ts-position-identifier');
+ let tmpTitle='';
+ let scrollToTop=0;
+ let _self=this;
+ let transition = 230;
+ positionIdentifier.forEach(function(ele,index){
+ tmpTitle = ele.getAttribute("data-rel");
+ if(item.title==tmpTitle)
+ {
+ if(_self.fixedHeader && item.title!='明星猫粮')
+ {
+ transition+=130;
+ }
+ scrollToTop = _self.heightToTop(positionIdentifier[index]) - transition;
+ //positionIdentifier[index].scrollIntoView(true);
+ window.scrollTo({
+ top:scrollToTop,
+ behavior:'smooth'
+ })
+ //document.body.scrollTop = oPos;
+ }
+ })
+ /*
if(item.title=='犬湿粮'||item.title=='犬干粮'||item.title=='处方用粮'){
- userindex=userindex-2
+ userindex=userindex-2
}else{
- userindex=userindex-1
+ userindex=userindex-1
}
if(item.title=='明星猫粮'){
- mingxin.scrollIntoView(true);
+ mingxin.scrollIntoView(true);
}else{
- let catshiid=document.querySelectorAll('.selectionswitch');
- catshiid[userindex].scrollIntoView(true);
+ let catshiid=document.querySelectorAll('.selectionswitch');
+ catshiid[userindex].scrollIntoView(true);
}
if(item.title=='明星犬粮')
- dogtop.scrollIntoView(true);
+ dogtop.scrollIntoView(true);
// if(item.title=="猫湿粮"){
// this.catproduct=false;
// this.catfood=true;
@@ -1320,83 +1351,117 @@
// }
//console.log("当前是手机打开")
+ */
}
},
- userdog(item,index){
+ heightToTop(ele){
+ //ele为指定跳转到该位置的DOM节点
+ let root = document.body;
+ let height = 0;
+ do{
+ height += ele.offsetTop;
+ ele = ele.offsetParent;
+ }while( ele !== root )
+ return height;
+ },
+ userdogShi(){
+ this.activeIndex5=(this.activeIndex5?this.activeIndex5:0);
+ let apiDogSize=this.userdoglist[this.activeIndex5].title;
+ let apiDogFoodType=this.dogtype[this.quanshiCurIndex].title;
+
this.userstype=1;
let petType={
petType:1,
- name:index,
+ categoryName:"皇家犬湿粮",
+ name:apiDogFoodType,
}
for(let i =0;i
0)
- {
- this.gotop = true
- this.searchBar=false
- }
- else
- {
- this.gotop = false;
- this.searchBar=true
- }
- },
- toTop() {
- let top = document.documentElement.scrollTop || document.body.scrollTop;
- // 实现滚动效果
- const timeTop = setInterval(() => {
- document.body.scrollTop = document.documentElement.scrollTop = top -= 400;
- if (top <= 0) {
- clearInterval(timeTop);
- }
- }, 10);
- },
- async courseId(item) {
- let data = await postCourseId(this.productCode,1,this.usermessage.data.id,this.usermessage.data.mobile,item.picFile,item.name,item.basePrice,item.specifications);
- if(data){
- this.productlist=data;
- }
- },
- //请求猫
- async catmessage(stype) {
+ let fixedCatbarSeperator = document.getElementById("fixed-catbar-seperator");
+ if(!fixedCatbarSeperator)
+ {
+ return;
+ }
+ let scrolltop = document.documentElement.scrollTop || document.body.scrollTop;
+ if((scrolltop-fixedCatbarSeperator.offsetTop)>0)
+ {
+ this.fixedHeader=false;
+ this.gotop = true
+ this.searchBar=false
+ }
+ else
+ {
+ this.fixedHeader=true;
+ this.gotop = false;
+ this.searchBar=true
+ }
+ },
+ toTop() {
+ let top = document.documentElement.scrollTop || document.body.scrollTop;
+ // 实现滚动效果
+ const timeTop = setInterval(() => {
+ document.body.scrollTop = document.documentElement.scrollTop = top -= 400;
+ if (top <= 0) {
+ clearInterval(timeTop);
+ }
+ }, 10);
+ },
+ async courseId(item) {
+ this.dataLoaded=false;
+ let data = await postCourseId(this.productCode,1,this.usermessage.data.id,this.usermessage.data.mobile,item.picFile,item.name,item.basePrice,item.specifications);
+ if(data){
+ this.productlist=data;
+ this.dataLoaded=true;
+ }
+ },
+ //请求猫
+ async catmessage(stype,dataType) {
+ this.dataLoaded=false;
let data=[];
if(stype==undefined||stype==null){
data = await biaomessage(0,'',1,6);
@@ -1404,33 +1469,55 @@
data = await biaomessage(this.userserachlist,'',1,6);
}
if(data){
- this.catlist=data;
let userlist=[];
- userlist=data.slice(0,6);
- this.catshi=userlist;
- this.catgan=userlist;
+ //userlist=data.slice(0,6);
+ if(dataType)
+ {
+ if(dataType=='Shi')
+ this.catshi=data;
+ else if(dataType=='Gan')
+ this.catgan=data;
+ }
+ else
+ {
+ this.catlist=data;
+ //this.catgan=userlist;
+ //this.catshi=userlist;
+ }
+ this.dataLoaded=true;
}
},
- //请求犬
- async dogmessage(stype) {
- let data=[];
- if(stype==undefined||stype==null){
-
- data = await biaomessage(1);
- }else{
- data = await biaomessage(this.userserachlist);
- }
- if(data){
- let userlist=[];
- userlist=data.slice(0,6);
- this.doglist=data;
- this.doggan=userlist;
- this.dogshi=userlist;
- }
- },
+ //请求犬
+ async dogmessage(stype,dataType) {
+ this.dataLoaded=false;
+ let data=[];
+ if(stype==undefined||stype==null){
+ data = await biaomessage(1,'',1,6);
+ }else{
+ data = await biaomessage(this.userserachlist,'',1,6);
+ }
+ if(data){
+ let userlist=[];
+ //userlist=data.slice(0,6);
+ if(dataType)
+ {
+ if(dataType=='Shi')
+ this.dogshi=data;
+ else if(dataType=='Gan')
+ this.doggan=data;
+ }
+ else
+ {
+ this.doglist=data;
+ //this.doggan=userlist;
+ //this.dogshi=userlist;
+ }
+ this.dataLoaded=true;
+ }
+ },
- selectproduce(item,index){
+ selectproduce(item,index){
if(item.productList[0]==undefined){
item.productlist[0].productCode=0;
}
@@ -1444,107 +1531,118 @@
productCode:item.productList[0].productCode
},
});
- },
+ },
- //请求处方量信息数据
- async userchufang() {
- let list=[];
- let data = await userque();
- if(data){
- list=data.slice(0,6);
- this.processinformation=list;
- this.chufanlist=data;
-
- }
-
- },
-
- //点击请求处方量标签信息数据
- async userquery(item) {
- let data = await userquery(item);
- if(data){
- this.processinformation=data;
- }
-
- },
+ //请求处方量信息数据
+ async userchufang() {
+ this.dataLoaded=false;
+ let list=[];
+ let data = await userque();
+ if(data){
+ list=data.slice(0,6);
+ this.processinformation=list;
+ this.chufanlist=data;
+ this.dataLoaded=true;
+ }
+ },
+ //点击请求处方量标签信息数据
+ async userquery(item) {
+ this.dataLoaded=false;
+ let data = await userquery(item);
+ if(data){
+ this.processinformation=data;
+ this.dataLoaded=true;
+ }
+ },
//处方用粮筛选
userclick(item,index){
this.userquery(index)
},
- //全价猫湿粮筛选
- catclick(item,index){
+ //全价猫干粮筛选
+ catclickGan(){
this.userstype=0;
+ this.maoganCurIndex=this.maoganCurIndex?this.maoganCurIndex:0;
+ let apiCatType=this.discoun[this.maoganCurIndex].title;
let petType={
petType:0,
- name:index,
+ name:apiCatType,
}
for(let i =0;i