Index bug fixed

This commit is contained in:
Vion 2022-01-18 22:57:23 +08:00
parent a1f6e32213
commit 37a7e4706d
3 changed files with 458 additions and 335 deletions

View File

@ -8,17 +8,35 @@ body{
.fade-leave-active { .fade-leave-active {
opacity: 0; opacity: 0;
} }
.ts-mask{
width:100%;
height:100%;
position: fixed;
top:0;
left:0;
display:flex;
flex-direction: column;
justify-content: center;
align-items: center;
z-index:99;
.ts-mask-bg{
background-color:#000;
opacity:.6;
width:100%;
height:100%;
z-index:0;
position:absolute;
left:0;
top:0;
}
}
.userloding { .userloding {
position: fixed;
left: 50%;
margin-left: -1.56rem;
top: 50%;
margin-top: -3.75rem;
background: url(../image/onloading.png) center center no-repeat; background: url(../image/onloading.png) center center no-repeat;
width: 3.12rem; width: 3.12rem;
background-size: contain; background-size: contain;
height: 7.5rem; height: 3.12rem;
z-index: 1000;
animation: rolling 4s infinite; animation: rolling 4s infinite;
-webkit-animation:rolling 4s infinite; -webkit-animation:rolling 4s infinite;
} }
@ -229,13 +247,12 @@ img, picture {
right: 0; right: 0;
top: 30%; top: 30%;
background: #FFFFFF; background: #FFFFFF;
box-shadow: 0px 0px .62rem rgba(0, 0, 0, 0.16); box-shadow: 0 0 10px rgba(0, 0, 0, 0.16);
border-radius: .25rem; border-radius: .25rem;
z-index:3; z-index:3;
ul{ ul{
width: 60px; width: 60px;
height: 181px; height: 181px;
box-shadow: 0px 0px 6px rgb(0 0 0 / 10%);
background-color: white; background-color: white;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -323,9 +340,7 @@ img, picture {
margin-top: 90px; margin-top: 90px;
} }
.rc-list__header { .rc-list__header {
background: none;
padding: .5rem 0;
border-bottom: none;
} }
.ts-right-arr { .ts-right-arr {
border-bottom:1px solid #E1001A; border-bottom:1px solid #E1001A;

View File

@ -18,28 +18,31 @@
text-align: center; text-align: center;
} }
} }
.ts-position-identifier{
li{ }
background: unset;; .ul-zhuan,.ul-dog{
img{ li{
border-radius: 50%; background: unset;
}
&.active {
img{ img{
border: 3px solid #E2001A; border-radius: 50%;
} }
color: #E2001A; &.active {
img{
} border: 3px solid #E2001A;
&.unactive { }
color: #444444; color: #E2001A;
img{
border: 3px solid #D7D7D7; }
&.unactive {
color: #444444;
img{
border: 3px solid #D7D7D7;
}
} }
} }
} }
.uservideo{ .uservideo{
overflow: hidden; overflow: hidden;
video{ video{
@ -47,9 +50,40 @@ li{
width:auto; width:auto;
} }
} }
.ul-dog{
width: 100%;
display: flex;
justify-content: center;
flex-wrap: wrap;
flex-direction: row;
span{
margin-top: .5rem;
display: block;
}
img{
width: 9.5rem;
height: auto;
display: block;
}
li{
cursor: pointer;
font-size: 16px;
text-align: center;
margin-top:3rem;
margin-left:3rem;
}
}
@media screen and (max-width:768px){ @media screen and (max-width:768px){
.ul-dog{ .ul-dog{
display: none; justify-content: space-evenly;
img{
width:4rem;
height:auto;
}
li{
margin-top:1.875rem;
}
} }
.ts-banner-swiper-container{ .ts-banner-swiper-container{
margin-bottom:2.5rem; margin-bottom:2.5rem;
@ -57,9 +91,9 @@ li{
.searchBara{ .searchBara{
width: 100%; width: 100%;
position: fixed; position: fixed;
top:66px; top:3.75rem;
background: white; background: white;
z-index: 9999; z-index: 60;
overflow-x: auto; overflow-x: auto;
white-space: nowrap; white-space: nowrap;
overflow-y:hidden; overflow-y:hidden;
@ -76,7 +110,6 @@ li{
display: inline-block; display: inline-block;
margin-left: 0.20rem; margin-left: 0.20rem;
text-align: center; text-align: center;
background: #F6F6F6;
border-radius: 50%; border-radius: 50%;
opacity: 1; opacity: 1;
} }
@ -203,7 +236,7 @@ li{
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: flex-start;
align-items: center; align-items: center;
} }
img{ img{
@ -560,30 +593,7 @@ img{
} }
.usermain{ .usermain{
.ul-dog{
width: 100%;
display: flex;
justify-content: center;
flex-wrap: wrap;
flex-direction: row;
span{
margin-top: .5rem;
display: block;
}
img{
width: 9.5rem;
height: 9.5rem;
display: block;
}
li{
cursor: pointer;
font-size: 16px;
text-align: center;
margin-top:3rem;
margin-left:3rem;
}
}
} }
.rc-main{ .rc-main{
width: 100%; width: 100%;

View File

@ -37,7 +37,7 @@
<div class="online bold rc-md-up" v-show="catproduct"></div> <div class="online bold rc-md-up" v-show="catproduct"></div>
<div class="rc-full-width"> <div class="rc-full-width">
<div class="rc-lunbo rc-full-width"> <div class="rc-lunbo rc-full-width ts-position-identifier" data-rel="明星猫粮">
<!-- <h2>明星猫粮</h2> --> <!-- <h2>明星猫粮</h2> -->
<div class="pageFullScreen" id="xxxFullScreen" v-show="catproduct" ref="mingxing"> <div class="pageFullScreen" id="xxxFullScreen" v-show="catproduct" ref="mingxing">
<!-- 内容 --> <!-- 内容 -->
@ -91,8 +91,8 @@
<div class="online bold" v-show="onemao"></div> <div class="online bold" v-show="onemao"></div>
<div class="selectionswitch rc-full-width rc-max-width--xl rc-padding-y--md" ref="usercontent" v-show="onemao"> <div class="selectionswitch rc-full-width rc-max-width--xl rc-padding-y--md" ref="usercontent" v-show="onemao">
<h2 class="rc-beta rc-text--center" >全价猫湿粮</h2> <h2 class="rc-beta rc-text--center ts-position-identifier" data-rel="猫湿粮" >全价猫湿粮</h2>
<van-tabs @change='catclick' class="van-tabs" v-if="onemao"> <van-tabs @click='catclickShi' class="van-tabs" v-if="onemao" v-model="maoshiCurIndex">
<van-tab v-for="(item,index) in discoun" :key="index" :title="item.title"> <van-tab v-for="(item,index) in discoun" :key="index" :title="item.title">
<div class="rc-contair"> <div class="rc-contair">
<ul class="ts-product-list rc-margin-bottom--lg"> <ul class="ts-product-list rc-margin-bottom--lg">
@ -165,22 +165,18 @@
</div> </div>
</li> </li>
</ul> </ul>
<nuxt-link :to="`/productdetails/productlist/`">
<nuxt-link :to="`/productdetails/productlist/`"> <div class="userserlect">
<div class="userserlect"> <span class="ts-standard-btn center">查看更多</span>
<span class="ts-standard-btn center">查看更多</span> </div>
</div> </nuxt-link>
</nuxt-link>
</div> </div>
</div>
</div>
</div> </div>
<div class="online bold" v-show="twomao"></div> <div class="online bold" v-show="twomao"></div>
<div class="selectionswitch rc-full-width rc-max-width--xl rc-padding-y--md" v-show="twomao" ref="catgan"> <div class="selectionswitch rc-full-width rc-max-width--xl rc-padding-y--md" v-show="twomao" ref="catgan">
<h2 class="rc-beta rc-text--center">全价猫干粮</h2> <h2 class="rc-beta rc-text--center ts-position-identifier" data-rel="猫干粮">全价猫干粮</h2>
<van-tabs @change='catclick' class="van-tabs" v-if="twomao"> <van-tabs @click='catclickGan' class="van-tabs" v-if="twomao" v-model="maoganCurIndex">
<van-tab v-for="(item,index) in discoun" :key="index" :title="item.title"> <van-tab v-for="(item,index) in discoun" :key="index" :title="item.title">
<div class="rc-contair"> <div class="rc-contair">
<ul class="ts-product-list rc-margin-bottom--lg"> <ul class="ts-product-list rc-margin-bottom--lg">
@ -255,7 +251,7 @@
<strong class="ts-standard-btn ts-standard-btn--two rc-margin-y--md center" @click="selectproduce(item,index)">立即购买</strong> <strong class="ts-standard-btn ts-standard-btn--two rc-margin-y--md center" @click="selectproduce(item,index)">立即购买</strong>
</div> </div>
</li> </li>
</ul> </ul>
<nuxt-link :to="`/productdetails/productlist/`"> <nuxt-link :to="`/productdetails/productlist/`">
<div class="userserlect"> <div class="userserlect">
<span class="ts-standard-btn center">查看更多</span> <span class="ts-standard-btn center">查看更多</span>
@ -275,7 +271,7 @@
<!-- 内容 --> <!-- 内容 -->
<div class="swiper-container rc-full-width rc-padding-y--md" id="swiper2"> <div class="swiper-container rc-full-width rc-padding-y--md" id="swiper2">
<div class="oc-top"> <div class="oc-top">
<h2 class="rc-beta rc-text--center">{{dogtitle}}</h2> <h2 class="rc-beta rc-text--center ts-position-identifier" data-rel="明星犬粮">{{dogtitle}}</h2>
</div> </div>
<!-- 轮播图 --> <!-- 轮播图 -->
<div class="ts-carousel-container"> <div class="ts-carousel-container">
@ -328,21 +324,20 @@
<div class="selectionswitch rc-full-width rc-max-width--xl rc-padding-y--md" v-show="threemao" ref="doggshi"> <div class="selectionswitch rc-full-width rc-max-width--xl rc-padding-y--md" v-show="threemao" ref="doggshi">
<h2 class="rc-beta rc-text--center">全价犬湿粮</h2> <h2 class="rc-beta rc-text--center ts-position-identifier" data-rel="犬湿粮">全价犬湿粮</h2>
<van-tabs @change='userdog' class="van-tabs" v-if="threemao"> <van-tabs @click='userdogShi' class="van-tabs" v-if="threemao" v-model="quanshiCurIndex">
<div class="online bold rc-md-down" v-show="threemao"></div>
<van-tab v-for="(item,index) in dogtype" :key="index" :title="item.title"> <van-tab v-for="(item,index) in dogtype" :key="index" :title="item.title">
<div class="online bold" v-show="threemao"></div> <div class="online bold rc-md-up" v-show="threemao"></div>
<div class="usermain"> <div class="usermain">
<ul class="ul-dog usermain"> <ul class="ul-dog usermain">
<li <li
v-for="(item, index) in userdoglist" v-for="(dogListitem, dogListIndex) in userdoglist"
:key="index" :key="dogListIndex"
@click="quanshi(item, index)" @click="quanshi(dogListitem, dogListIndex)"
:class="activeIndex5 == index ? 'active' : 'unactive'" :class="activeIndex5 == dogListIndex ? 'active' : 'unactive'"
> >
<img :src="item.catimage" alt=""> <img :src="dogListitem.catimage" alt="">
<span>{{ item.title }}</span> <span>{{ dogListitem.title }}</span>
</li> </li>
</ul> </ul>
</div> </div>
@ -425,12 +420,11 @@
</li> </li>
</ul> </ul>
<nuxt-link :to="`/productdetails/productlist/`">
<nuxt-link :to="`/productdetails/productlist/`"> <div class="userserlect">
<div class="userserlect"> <span class="ts-standard-btn center">查看更多</span>
<span class="ts-standard-btn center">查看更多</span> </div>
</div> </nuxt-link>
</nuxt-link>
</div> </div>
@ -445,20 +439,20 @@
<div class="online bold" v-show="fourmao"></div> <div class="online bold" v-show="fourmao"></div>
<div class="selectionswitch rc-full-width rc-max-width--xl rc-padding-y--md" v-show="fourmao" ref="dogan"> <div class="selectionswitch rc-full-width rc-max-width--xl rc-padding-y--md" v-show="fourmao" ref="dogan">
<h2 class="rc-beta rc-text--center">全价犬干粮</h2> <h2 class="rc-beta rc-text--center ts-position-identifier" data-rel="犬干粮">全价犬干粮</h2>
<van-tabs @change='userdog' class="van-tabs" v-if="fourmao"> <van-tabs @click='userdogGan' class="van-tabs" v-if="fourmao" v-model="quanganCurIndex">
<div class="online bold" v-show="fourmao"></div> <div class="online bold rc-md-up" v-show="fourmao"></div>
<van-tab v-for="(item,index) in dogtype" :key="index" :title="item.title"> <van-tab v-for="(item,index) in dogtype" :key="index" :title="item.title">
<div class="usermain"> <div class="usermain">
<ul class="ul-dog usermain"> <ul class="ul-dog usermain">
<li <li
v-for="(item, index) in userdoglist" v-for="(userDogListItem, userDogListIndex) in userdoglist"
:key="index" :key="userDogListIndex"
@click="userdoghot(item, index)" @click="userdoghot(userDogListItem, userDogListIndex)"
:class="activeIndex6 == index ? 'active' : 'unactive'" :class="activeIndex6 == userDogListIndex ? 'active' : 'unactive'"
> >
<img :src="item.catimage" alt=""> <img :src="userDogListItem.catimage" alt="">
<span>{{ item.title }}</span> <span>{{ userDogListItem.title }}</span>
</li> </li>
</ul> </ul>
</div> </div>
@ -538,12 +532,11 @@
</div> </div>
</li> </li>
</ul> </ul>
<nuxt-link :to="`/productdetails/productlist/`">
<nuxt-link :to="`/productdetails/productlist/`"> <div class="userserlect">
<div class="userserlect"> <span class="ts-standard-btn center">查看更多</span>
<span class="ts-standard-btn center">查看更多</span> </div>
</div> </nuxt-link>
</nuxt-link>
</div> </div>
@ -556,8 +549,8 @@
<div class="online bold" v-show="fivemao"></div> <div class="online bold" v-show="fivemao"></div>
<div class="selectionswitch rc-full-width rc-max-width--xl rc-padding-y--md" v-show="fivemao" ref="chufang"> <div class="selectionswitch rc-full-width rc-max-width--xl rc-padding-y--md" v-show="fivemao" ref="chufang">
<h2 class="rc-beta rc-text--center">处方用粮</h2> <h2 class="rc-beta rc-text--center ts-position-identifier" data-rel="处方用粮">处方用粮</h2>
<van-tabs @change='userclick' class="van-tabs" v-if="fivemao"> <van-tabs @click='userclick' class="van-tabs" v-if="fivemao">
<van-tab v-for="(item,index) in discounchufang" :key="index" :title="item.title"> <van-tab v-for="(item,index) in discounchufang" :key="index" :title="item.title">
<div class="rc-contair"> <div class="rc-contair">
<ul class="ts-product-list rc-margin-bottom--lg"> <ul class="ts-product-list rc-margin-bottom--lg">
@ -701,7 +694,11 @@
<span>回到顶部</span> <span>回到顶部</span>
</div> </div>
</div> </div>
<div v-if="!dataLoaded" class="ts-mask">
<div class="ts-mask-bg"></div>
<div class="userloding"></div>
<span>数据加载中</span>
</div>
<Myfooter v-on:litentop='showmesg'></Myfooter> <Myfooter v-on:litentop='showmesg'></Myfooter>
</div> </div>
</template> </template>
@ -718,6 +715,8 @@
meta: {title: '首页'}, meta: {title: '首页'},
data(){ data(){
return{ return{
fixedHeader:false,
dataLoaded:true,
useraindex:0, useraindex:0,
usertitle:'明星猫粮', usertitle:'明星猫粮',
dogtitle:'明星犬粮', dogtitle:'明星犬粮',
@ -740,18 +739,22 @@
userserachlist:[{}], userserachlist:[{}],
doggan:[], doggan:[],
dogtype:[ dogtype:[
{ {
title: "幼犬", title: "幼犬",
},
}, {
{ title: "成犬",
title: "成犬", },
}, {
{ title: "老年犬",
title: "老年犬", },
}, {
title: "品种犬",
], },
{
title: "亚健康",
}
],
anchor:'', anchor:'',
dogshi:[], dogshi:[],
catlist:[], catlist:[],
@ -800,43 +803,43 @@
] ]
}, },
showingBanners:[], showingBanners:[],
maoganCurIndex:0,
maoshiCurIndex:0,
quanshiCurIndex:0,
quanganCurIndex:0,
userdoglist: [ userdoglist: [
{ {
title: "小型犬", title: "小型犬",
catimage: "/images/dog/small.png", catimage: "/images/dog/small.png",
}, },
{ {
title: "中型犬", title: "中型犬",
catimage: "/images/dog/medium.png", catimage: "/images/dog/medium.png",
}, },
{ {
title: "大型犬", title: "大型犬",
catimage: "/images/dog/big.png", catimage: "/images/dog/big.png",
}, },
],
], discoun: [
discoun: [ {
{ title: "幼猫",
title: "幼猫", },
}, {
{ title: "成猫",
title: "成猫", },
}, {
{ title: "老年猫",
title: "老年猫", },
}, {
{ title: "品种猫",
title: "品种猫",
},
}, {
{ title: "亚健康猫"
title: "亚健康猫", },
],
},
],
discountlist: [ discountlist: [
{ {
@ -1147,8 +1150,14 @@
} }
window.addEventListener("scroll", this.handleScroll, true); window.addEventListener("scroll", this.handleScroll, true);
this.userchufang();// this.userchufang();//
this.catmessage();// this.catmessage();//
this.catclickGan();
this.catclickShi();
this.dogmessage();// this.dogmessage();//
this.userdogShi();
this.userdogGan();
}, },
destroyed () { destroyed () {
window.removeEventListener('scroll', this.scrollToTop); window.removeEventListener('scroll', this.scrollToTop);
@ -1200,8 +1209,6 @@
ifadroind(item,index,order){ ifadroind(item,index,order){
//console.log(item,index,order); //console.log(item,index,order);
var sUserAgent = navigator.userAgent.toLowerCase(); var sUserAgent = navigator.userAgent.toLowerCase();
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
@ -1212,8 +1219,8 @@
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"; var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile"; var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) { if (!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) {
//console.log("") //console.log("")
if(item.title=='明星猫粮'){ if(item.title=='明星猫粮'){
this.catproduct=true; this.catproduct=true;
this.twomao=false; this.twomao=false;
@ -1298,19 +1305,43 @@
let dogtop=document.querySelector('.oc-top'); let dogtop=document.querySelector('.oc-top');
//console.log(dogtop); //console.log(dogtop);
//console.log(mingxin.offsetTop); //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=='处方用粮'){ if(item.title=='犬湿粮'||item.title=='犬干粮'||item.title=='处方用粮'){
userindex=userindex-2 userindex=userindex-2
}else{ }else{
userindex=userindex-1 userindex=userindex-1
} }
if(item.title=='明星猫粮'){ if(item.title=='明星猫粮'){
mingxin.scrollIntoView(true); mingxin.scrollIntoView(true);
}else{ }else{
let catshiid=document.querySelectorAll('.selectionswitch'); let catshiid=document.querySelectorAll('.selectionswitch');
catshiid[userindex].scrollIntoView(true); catshiid[userindex].scrollIntoView(true);
} }
if(item.title=='明星犬粮') if(item.title=='明星犬粮')
dogtop.scrollIntoView(true); dogtop.scrollIntoView(true);
// if(item.title=="湿"){ // if(item.title=="湿"){
// this.catproduct=false; // this.catproduct=false;
// this.catfood=true; // this.catfood=true;
@ -1320,83 +1351,117 @@
// } // }
//console.log("") //console.log("")
*/
} }
}, },
userdog(item,index){ heightToTop(ele){
//eleDOM
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; this.userstype=1;
let petType={ let petType={
petType:1, petType:1,
name:index, categoryName:"皇家犬湿粮",
name:apiDogFoodType,
} }
for(let i =0;i<this.userserachlist.length;i++){ for(let i =0;i<this.userserachlist.length;i++){
if(!this.userserachlist.includes(petType)){ if(!this.userserachlist.includes(petType)){
this.userserachlist.push(petType) this.userserachlist.push(petType)
} }
} }
this.dogmessage(this.userserachlist) //TODO how to combine "apiName" here?
}, this.dogmessage(this.userserachlist,"Shi");
},
userdogGan(){
userlook(order){ this.activeIndex6=(this.activeIndex6?this.activeIndex6:0);
if(order==0){ let apiDogSize=this.userdoglist[this.activeIndex6].title;
this.catshi=this.catlist; let apiDogFoodType=this.dogtype[this.quanganCurIndex].title;
}
if(order==1){ this.userstype=1;
this.catgan=this.catlist; let petType={
petType:1,
}else if(order==2){ name:apiDogFoodType,
this.dogshi=this.doglist }
} for(let i =0;i<this.userserachlist.length;i++){
else if(order==3){ if(!this.userserachlist.includes(petType)){
this.doggan=this.doglist this.userserachlist.push(petType)
} }
else if(order==4){ }
this.processinformation=this.chufanlist //TODO how to combine "apiName" here?
} this.dogmessage(this.userserachlist,"Gan");
},
}, userlook(order){
if(order==0){
this.catshi=this.catlist;
showmesg(){ }
this.toTop(); if(order==1){
}, this.catgan=this.catlist;
handleScroll(e) }else if(order==2){
{ this.dogshi=this.doglist
let fixedCatbarSeperator = document.getElementById("fixed-catbar-seperator"); }
if(!fixedCatbarSeperator) else if(order==3){
this.doggan=this.doglist
}
else if(order==4){
this.processinformation=this.chufanlist
}
},
showmesg(){
this.toTop();
},
handleScroll(e)
{ {
return; let fixedCatbarSeperator = document.getElementById("fixed-catbar-seperator");
} if(!fixedCatbarSeperator)
let scrolltop = document.documentElement.scrollTop || document.body.scrollTop; {
if((scrolltop-fixedCatbarSeperator.offsetTop)>0) return;
{ }
this.gotop = true let scrolltop = document.documentElement.scrollTop || document.body.scrollTop;
this.searchBar=false if((scrolltop-fixedCatbarSeperator.offsetTop)>0)
} {
else this.fixedHeader=false;
{ this.gotop = true
this.gotop = false; this.searchBar=false
this.searchBar=true }
} else
}, {
toTop() { this.fixedHeader=true;
let top = document.documentElement.scrollTop || document.body.scrollTop; this.gotop = false;
// this.searchBar=true
const timeTop = setInterval(() => { }
document.body.scrollTop = document.documentElement.scrollTop = top -= 400; },
if (top <= 0) { toTop() {
clearInterval(timeTop); let top = document.documentElement.scrollTop || document.body.scrollTop;
} //
}, 10); const timeTop = setInterval(() => {
}, document.body.scrollTop = document.documentElement.scrollTop = top -= 400;
async courseId(item) { if (top <= 0) {
let data = await postCourseId(this.productCode,1,this.usermessage.data.id,this.usermessage.data.mobile,item.picFile,item.name,item.basePrice,item.specifications); clearInterval(timeTop);
if(data){ }
this.productlist=data; }, 10);
} },
}, async courseId(item) {
// this.dataLoaded=false;
async catmessage(stype) { 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=[]; let data=[];
if(stype==undefined||stype==null){ if(stype==undefined||stype==null){
data = await biaomessage(0,'',1,6); data = await biaomessage(0,'',1,6);
@ -1404,33 +1469,55 @@
data = await biaomessage(this.userserachlist,'',1,6); data = await biaomessage(this.userserachlist,'',1,6);
} }
if(data){ if(data){
this.catlist=data;
let userlist=[]; let userlist=[];
userlist=data.slice(0,6); //userlist=data.slice(0,6);
this.catshi=userlist; if(dataType)
this.catgan=userlist; {
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) { async dogmessage(stype,dataType) {
let data=[]; this.dataLoaded=false;
if(stype==undefined||stype==null){ let data=[];
if(stype==undefined||stype==null){
data = await biaomessage(1); data = await biaomessage(1,'',1,6);
}else{ }else{
data = await biaomessage(this.userserachlist); data = await biaomessage(this.userserachlist,'',1,6);
} }
if(data){ if(data){
let userlist=[]; let userlist=[];
userlist=data.slice(0,6); //userlist=data.slice(0,6);
this.doglist=data; if(dataType)
this.doggan=userlist; {
this.dogshi=userlist; 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){ if(item.productList[0]==undefined){
item.productlist[0].productCode=0; item.productlist[0].productCode=0;
} }
@ -1444,107 +1531,118 @@
productCode:item.productList[0].productCode productCode:item.productList[0].productCode
}, },
}); });
}, },
// //
async userchufang() { async userchufang() {
let list=[]; this.dataLoaded=false;
let data = await userque(); let list=[];
if(data){ let data = await userque();
list=data.slice(0,6); if(data){
this.processinformation=list; list=data.slice(0,6);
this.chufanlist=data; this.processinformation=list;
this.chufanlist=data;
} this.dataLoaded=true;
}
}, },
//
// async userquery(item) {
async userquery(item) { this.dataLoaded=false;
let data = await userquery(item); let data = await userquery(item);
if(data){ if(data){
this.processinformation=data; this.processinformation=data;
} this.dataLoaded=true;
}
}, },
// //
userclick(item,index){ userclick(item,index){
this.userquery(index) this.userquery(index)
}, },
//湿 //
catclick(item,index){ catclickGan(){
this.userstype=0; this.userstype=0;
this.maoganCurIndex=this.maoganCurIndex?this.maoganCurIndex:0;
let apiCatType=this.discoun[this.maoganCurIndex].title;
let petType={ let petType={
petType:0, petType:0,
name:index, name:apiCatType,
} }
for(let i =0;i<this.userserachlist.length;i++){ for(let i =0;i<this.userserachlist.length;i++){
if(!this.userserachlist.includes(petType)){ if(!this.userserachlist.includes(petType)){
this.userserachlist.push(petType) this.userserachlist.push(petType)
} }
} }
this.catmessage(this.userserachlist) this.catmessage(this.userserachlist,'Gan')
},
catclickShi(){
this.userstype=0;
this.maoshiCurIndex=this.maoshiCurIndex?this.maoshiCurIndex:0;
let apiCatType=this.discoun[this.maoshiCurIndex].title;
let petType={
petType:0,
categoryName:"皇家猫湿粮",
name:apiCatType,
}
for(let i =0;i<this.userserachlist.length;i++){
if(!this.userserachlist.includes(petType)){
this.userserachlist.push(petType)
}
}
this.catmessage(this.userserachlist,'Shi')
}, },
lianxi(item,index){ lianxi(item,index){
if(item.title=='在线客服'){ if(item.title=='在线客服'){
var option = { var option = {
customer: {id: '', name: '', email: '', mobile: '', memberId: '999999'} customer: {id: '', name: '', email: '', mobile: '', memberId: '999999'}
} }
dis_livchat(option); dis_livchat(option);
} }
if(item.title=='购物车'){ if(item.title=='购物车'){
this.$router.push({ this.$router.push({
path: "/myorder/userrecord", path: "/myorder/userrecord",
});
}
if(item.title=='营养专家'){
var option = {
customer: {id: '', name: '', email: '', mobile: '', memberId: '999999'}
}
dis_livchat(option);
}
},
userbuy(item){
let user= localStorage.getItem("userInfo");
this.courseId(item)
this.$router.push({
path: "/myorder/userrecord",
});
},
}); selectGoods(item,index){
} //console.log(item,index);
if(item.title=='营养专家'){ this.activeIndex=index;
var option = { //console.log(item.title);
customer: {id: '', name: '', email: '', mobile: '', memberId: '999999'} this.ifadroind(item,index,this.useraindex)
} // this.ifAdoid(item,index);
dis_livchat(option); },
} quanshi(item,index){
this.activeIndex5=index;
}, this.userdogShi();
userbuy(item){ },
let user= localStorage.getItem("userInfo"); userdoghot(item,index){
this.courseId(item) this.activeIndex6=index;
this.$router.push({ this.userdogGan();
path: "/myorder/userrecord", },
selectGo(item,index){
}); this.activeInde2=index;
}, },
selectGoo(item,index){
selectGoods(item,index){ this.activeInde3=index;
console.log(item,index); }
this.activeIndex=index; },
console.log(item.title);
this.ifadroind(item,index,this.useraindex)
// this.ifAdoid(item,index);
},
quanshi(item,index){
console.log(item,index);
this.activeIndex5=index
console.log(this.activeIndex5);
},
userdoghot(item,index){
this.activeIndex6=index
},
selectGo(item,index){
this.activeInde2=index;
},
selectGoo(item,index){
this.activeInde3=index;
}
},
} }