This commit is contained in:
952108534@qq.com
2022-01-07 19:48:22 +08:00
parent bd6e653dc1
commit a49efd47b2
22 changed files with 2039 additions and 211 deletions

View File

@@ -49,7 +49,7 @@
<h2>专区:</h2>
<ol>
<li v-for="(item, index) in prefecture" :key="index" @click="selectproduct(item, index)" :class="activeIndexb == index ? 'active' : 'unactive'" >
{{ item.title }}
{{ item.tagName }}
</li>
</ol>
</div>
@@ -58,7 +58,7 @@
<h2>年龄:</h2>
<ol>
<li v-for="(item, index) in catage" :key="index" @click="selectage(item, index)" :class="activeIndexc == index ? 'active' : 'unactive'">
{{ item.title }}
{{ item.tagName }}
</li>
</ol>
</div>
@@ -106,7 +106,7 @@
<h2>专区:</h2>
<ol>
<li v-for="(item, index) in prefecture" :key="index" @click="selectproduct(item, index)" :class="activeIndexb == index ? 'active' : 'unactive'" >
{{ item.title }}
{{ item.tagName }}
</li>
</ol>
</div>
@@ -115,7 +115,7 @@
<h2>年龄:</h2>
<ol>
<li v-for="(item, index) in catage" :key="index" @click="selectage(item, index)" :class="activeIndexc == index ? 'active' : 'unactive'">
{{ item.title }}
{{ item.tagName }}
</li>
</ol>
</div>
@@ -123,7 +123,7 @@
<h2>功能:</h2>
<ol>
<li v-for="(item, index) in catagea" :key="index" @click="selectagc(item, index)" :class="activeIndexd == index ? 'active' : 'unactive'">
{{ item.title }}
{{ item.tagName }}
</li>
</ol>
</div>
@@ -132,7 +132,7 @@
<h2>品种:</h2>
<ol>
<li v-for="(item, index) in catageb" :key="index" @click="selectagd(item, index)" :class="activeIndexe == index ? 'active' : 'unactive'">
{{ item.title }}
{{ item.tagName }}
</li>
</ol>
</div>
@@ -210,11 +210,12 @@
<script>
import Myheader from '~/components/header.vue'
import { biaome } from "../../ajax/getData";
import { biaome,userstype,searchchanpin } from "../../ajax/getData";
export default {
data() {
return {
value: "",
userstype:[],
activeIndex:0,
activeIndex1:0,
activeIndexa:'-1',
@@ -387,6 +388,8 @@ export default {
catimage: require("../../assets/image/rc-dog.png"),
},
],
usercatlist:[],
userdoglisgt:[],
};
},
components: {
@@ -394,9 +397,72 @@ export default {
},
mounted(){
this.usetmessage();
this.userst();
},
methods: {
async usetmessage() {
async usersearch(stype,categoryName,tagUsedAge,tagFunction,tagBreed){
let data=await searchchanpin(stype,categoryName,tagUsedAge,tagFunction,tagBreed);
console.log(data);
},
async userst() {
let pinzhong=[];
let zhuanqu=[];
let age=[];
let gonneg=[];
let data = await userstype();
if(data){
this.userstype=data;
}
this.usercatlist=this.userstype.filter(item=>item.petType=='0')
this.usercatlist.map(element=>{
if(element.name=='品种'){
pinzhong.push(element);
this.catageb=pinzhong
}
if(element.name=='功能'){
gonneg.push(element);
this.catagea=gonneg
}
if(element.name=='年龄'){
age.push(element);
this.catage=age
}
if(element.name=='专区'){
zhuanqu.push(element);
this.prefecture=gonneg
}
})
this.userdoglisgt=this.userstype.filter(item=>item.petType=='1')
// console.log(this.userdoglisgt)
// console.log(this.usercatlist,this.userdoglisgt);
// if(this.userstype[i].name=='品种'){
// pinzhong.push(this.userstype[i]);
//
// }
// else if(this.userstype[i].name=='专区'){
// zhuanqu.push(this.userstype[i]);
// this.prefecture=zhuanqu
// }
// else if(this.userstype[i].name=='年龄'){
// age.push(this.userstype[i]);
// this.catage=age;
// }
// else if(this.userstype[i].name=='功能'){
// gonneg.push(this.userstype[i]);
// this.catagea=gonneg;
// }
console.log(pinzhong,zhuanqu,age,gonneg);
console.log(this.userstype);
},
async usetmessage() {
let data = await biaome(this.value,10);
if(data){
this.rccontair=data;
@@ -466,13 +532,109 @@ this.dialogInfo1=false;
console.log(e);
},
selectGoods(item, index) {
let pinzhong=[];
let zhuanqu=[];
let age=[];
let gonneg=[];
this.activeIndex1=index;
if(this.activeIndex1==0){
this.usercatlist.map(element=>{
if(element.name=='品种'){
pinzhong.push(element);
this.catageb=pinzhong
}
if(element.name=='功能'){
gonneg.push(element);
this.catagea=gonneg
}
if(element.name=='年龄'){
age.push(element);
this.catage=age
}
if(element.name=='专区'){
zhuanqu.push(element);
this.prefecture=gonneg
}
})
console.log(pinzhong);
}else if(this.activeIndex1==1){
this.userdoglisgt.map(element=>{
if(element.name=='品种'){
pinzhong.push(element);
this.catageb=pinzhong
}
if(element.name=='功能'){
gonneg.push(element);
this.catagea=gonneg
}
if(element.name=='年龄'){
age.push(element);
this.catage=age
}
if(element.name=='专区'){
zhuanqu.push(element);
this.prefecture=gonneg
}
})
}
console.log(index);
console.log('----');
this.activeIndex=index;
console.log('----');
},
selectGoodsa(item, index) {
let pinzhong=[];
let zhuanqu=[];
let age=[];
let gonneg=[];
this.activeIndex1=index;
if(this.activeIndex1==0){
this.usercatlist.map(element=>{
if(element.name=='品种'){
pinzhong.push(element);
this.catageb=pinzhong
}
if(element.name=='功能'){
gonneg.push(element);
this.catagea=gonneg
}
if(element.name=='年龄'){
age.push(element);
this.catage=age
}
if(element.name=='专区'){
zhuanqu.push(element);
this.prefecture=gonneg
}
})
console.log(pinzhong);
}else if(this.activeIndex1==1){
this.userdoglisgt.map(element=>{
if(element.name=='品种'){
pinzhong.push(element);
this.catageb=pinzhong
}
if(element.name=='功能'){
gonneg.push(element);
this.catagea=gonneg
}
if(element.name=='年龄'){
age.push(element);
this.catage=age
}
if(element.name=='专区'){
zhuanqu.push(element);
this.prefecture=gonneg
}
})
}
console.log(index);
console.log('----');
},
userselect(){
@@ -492,20 +654,30 @@ this.dialogInfo1=false;
},
selectsearch(item, index) {
console.log(item)
this.activeIndexa=index;
},
selectage(item, index) {
console.log(item)
this.activeIndexc=index;
},
selectagc(item, index) {
console.log(item)
this.activeIndexd=index;
},
selectagd(item, index) {
console.log(item)
this.activeIndexe=index;
},
selectproduct(item, index){
console.log(item)
this.activeIndexb=index;
this.usersearch(this.activeIndex1,item.tagName,'','','')
},
selectage(item, index) {
this.activeIndexc=index;