mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-17 16:13:48 +08:00
提交产品以及搜索
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
<template>
|
||||
<div>
|
||||
<transition name="fade">
|
||||
<div class="userloding" v-show="isLoading"></div>
|
||||
|
||||
</transition>
|
||||
|
||||
<Myheader></Myheader>
|
||||
<div class="rc-top"></div>
|
||||
<div class="rc-max-width--xl rc-main">
|
||||
@@ -11,6 +16,7 @@
|
||||
class="rc-cat"
|
||||
v-for="(item, index) in userproduct"
|
||||
:key="index"
|
||||
ref="userclicks"
|
||||
@click="selectGoods(item, index)"
|
||||
:class="activeIndex == index ? 'active' : 'unactive'"
|
||||
>
|
||||
@@ -27,7 +33,7 @@
|
||||
v-for="(item, index) in prefecture"
|
||||
:key="index"
|
||||
@click="selectproduct(item, index)"
|
||||
:class="activeIndexb == index ? 'active' : 'unactive'"
|
||||
:class="item.checked ? 'active' : 'unactive'"
|
||||
ref="chosebox"
|
||||
>
|
||||
{{ item.tagName }}
|
||||
@@ -42,7 +48,7 @@
|
||||
v-for="(item, index) in catage"
|
||||
:key="index"
|
||||
@click="selectage(item, index)"
|
||||
:class="activeIndexc == index ? 'active' : 'unactive'"
|
||||
:class="item.checked ? 'active' : 'unactive'"
|
||||
ref="chosebox1"
|
||||
>
|
||||
{{ item.tagName }}
|
||||
@@ -57,8 +63,8 @@
|
||||
v-for="(item, index) in catagea"
|
||||
:key="index"
|
||||
@click="selectagc(item, index)"
|
||||
:class="activeIndexd == index ? 'active' : 'unactive'"
|
||||
ref="chosebox2"
|
||||
:class="item.checked ? 'active' : 'unactive'"
|
||||
ref="cgosebox4"
|
||||
>
|
||||
{{ item.tagName }}
|
||||
</li>
|
||||
@@ -72,7 +78,7 @@
|
||||
v-for="(item, index) in catageb"
|
||||
:key="index"
|
||||
@click="selectagd(item, index)"
|
||||
:class="activeIndexe == index ? 'active' : 'unactive'"
|
||||
:class="item.checked ? 'active' : 'unactive'"
|
||||
ref="chosebox3"
|
||||
>
|
||||
{{ item.tagName }}
|
||||
@@ -181,7 +187,7 @@
|
||||
:key="index"
|
||||
@click="selectagc(item, index)"
|
||||
:class="activeIndexd == index ? 'active' : 'unactive'"
|
||||
ref="chosebox2"
|
||||
ref="cgosebox4"
|
||||
>
|
||||
{{ item.tagName }}
|
||||
</li>
|
||||
@@ -219,6 +225,7 @@
|
||||
v-for="(item, index) in userproduct"
|
||||
:key="index"
|
||||
@click="selectGoodsa(item, index)"
|
||||
ref="usercliak"
|
||||
:class="activeIndex1 == index ? 'active' : 'unactive'"
|
||||
>
|
||||
<img :src="item.name" alt="" />
|
||||
@@ -262,7 +269,7 @@
|
||||
:key="index"
|
||||
@click="selectagc(item, index)"
|
||||
:class="activeIndexd == index ? 'active' : 'unactive'"
|
||||
ref="chosebox2"
|
||||
ref="cgosebox4"
|
||||
>
|
||||
{{ item.tagName }}
|
||||
</li>
|
||||
@@ -299,7 +306,7 @@ import Myheader from "~/components/header.vue";
|
||||
import $ from "jquery";
|
||||
import {
|
||||
userstype,
|
||||
biaomessa,
|
||||
biaome,
|
||||
biaomessage,
|
||||
searchchanpin,
|
||||
} from "../../ajax/getData";
|
||||
@@ -307,6 +314,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
value: "",
|
||||
isLoading: true,
|
||||
userstype: [],
|
||||
activeIndex: "0",
|
||||
allacindex:0,
|
||||
@@ -314,7 +322,14 @@ export default {
|
||||
userishwo1: true,
|
||||
userishwo2: true,
|
||||
userishwo3: true,
|
||||
userserachlist: [{}],
|
||||
userishwo4: true,
|
||||
userserachlist: [{
|
||||
categoryName:'', //专区
|
||||
tagUsedAge:'',//年龄
|
||||
tagFunction:'',//功能
|
||||
tagBreed:'', //品种
|
||||
|
||||
}],
|
||||
activeIndex1: 0,
|
||||
activeIndexa: "-1",
|
||||
dialogInfo1: false,
|
||||
@@ -504,13 +519,14 @@ export default {
|
||||
|
||||
},
|
||||
methods: {
|
||||
async usersearch(stype) {
|
||||
let data = await searchchanpin(stype);
|
||||
async usersearch(stype,usertype) {
|
||||
let data = await searchchanpin(stype,usertype,1,10);
|
||||
if (data) {
|
||||
this.rccontair = data;
|
||||
}
|
||||
},
|
||||
async userst() {
|
||||
this.isLoading = true;
|
||||
let pinzhong = [];
|
||||
let zhuanqu = [];
|
||||
let age = [];
|
||||
@@ -518,39 +534,59 @@ export default {
|
||||
let data = await userstype();
|
||||
if (data) {
|
||||
this.userstype = data;
|
||||
this.isLoading = false;
|
||||
}
|
||||
this.usercatlist = this.userstype.filter((item) => item.petType == "0");
|
||||
this.usercatlist.map((element) => {
|
||||
if (element.name == "品种") {
|
||||
pinzhong.push(element);
|
||||
this.catageb = pinzhong;
|
||||
this.catageb.forEach(element => {
|
||||
element.checked=false;
|
||||
})
|
||||
}
|
||||
if (element.name == "功能") {
|
||||
gonneg.push(element);
|
||||
this.catagea = gonneg;
|
||||
this.catagea.forEach(element => {
|
||||
element.checked=false;
|
||||
})
|
||||
}
|
||||
if (element.name == "年龄") {
|
||||
age.push(element);
|
||||
this.catage = age;
|
||||
this.catage.forEach(element => {
|
||||
element.checked=false;
|
||||
})
|
||||
}
|
||||
if (element.name == "专区") {
|
||||
zhuanqu.push(element);
|
||||
this.prefecture = gonneg;
|
||||
this.prefecture = zhuanqu;
|
||||
this.prefecture.forEach(element => {
|
||||
element.checked=false;
|
||||
})
|
||||
|
||||
}
|
||||
console.log(pinzhong);
|
||||
// debugger
|
||||
});
|
||||
this.userdoglisgt = this.userstype.filter((item) => item.petType == "1");
|
||||
},
|
||||
|
||||
async usetmessage() {
|
||||
let data = await biaomessa();
|
||||
this.isLoading = true;
|
||||
let data = await biaome(this.activeIndex1,'', 1, 10);
|
||||
if (data) {
|
||||
this.rccontair = data;
|
||||
this.isLoading = false;
|
||||
}
|
||||
},
|
||||
async onmessage(stype) {
|
||||
let data = await biaomessage(stype);
|
||||
this.isLoading = true;
|
||||
let data = await biaomessage(stype,'',1,10);
|
||||
if (data) {
|
||||
this.rccontair = data;
|
||||
this.isLoading = false;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -615,18 +651,87 @@ export default {
|
||||
},
|
||||
|
||||
selectGoods(item, index) {
|
||||
this.activeIndex1 = index;
|
||||
this.activeIndex = index;
|
||||
this.allacindex=index
|
||||
console;
|
||||
let petType = {
|
||||
petType: this.allacindex,
|
||||
};
|
||||
for (let i = 0; i < this.userserachlist.length; i++) {
|
||||
if (!this.userserachlist.includes(petType)) {
|
||||
this.userserachlist.push(petType);
|
||||
this.allacindex=index;
|
||||
this.usersearch(this.userserachlist,this.activeIndex1);
|
||||
|
||||
|
||||
// for (let i = 0; i < this.userserachlist.length; i++) {
|
||||
// if (!this.userserachlist.includes(petType)) {
|
||||
// this.userserachlist.push(petType);
|
||||
// }
|
||||
// }
|
||||
this.userserachlist=[
|
||||
{
|
||||
categoryName:'', //专区
|
||||
tagUsedAge:'',//年龄
|
||||
tagFunction:'',//功能
|
||||
tagBreed:'', //品种
|
||||
}
|
||||
]
|
||||
let pinzhong = [];
|
||||
let zhuanqu = [];
|
||||
let age = [];
|
||||
let gonneg = [];
|
||||
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 = zhuanqu;
|
||||
|
||||
}
|
||||
});
|
||||
} else if (this.activeIndex1 == 1) {
|
||||
this.userdoglisgt.map((element) => {
|
||||
if (element.name == "品种") {
|
||||
pinzhong.push(element);
|
||||
this.catageb = pinzhong;
|
||||
this.catageb.forEach((element) => {
|
||||
element.checked = false;
|
||||
});
|
||||
}
|
||||
if (element.name == "功能") {
|
||||
gonneg.push(element);
|
||||
this.catagea = gonneg;
|
||||
this.catagea.forEach((element) => {
|
||||
element.checked = false;
|
||||
});
|
||||
}
|
||||
if (element.name == "年龄") {
|
||||
age.push(element);
|
||||
this.catage = age;
|
||||
this.catage.forEach((element) => {
|
||||
element.checked = false;
|
||||
});
|
||||
}
|
||||
if (element.name == "专区") {
|
||||
zhuanqu.push(element);
|
||||
this.prefecture = zhuanqu;
|
||||
this.prefecture.forEach((element) => {
|
||||
element.checked = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
this.usersearch(this.userserachlist);
|
||||
|
||||
this.activeIndex = index;
|
||||
|
||||
},
|
||||
selectGoodsa(item, index) {
|
||||
this.activeIndex1 = index;
|
||||
@@ -652,99 +757,107 @@ export default {
|
||||
this.activeIndexc = index;
|
||||
this.userishwo1 = !this.userishwo1;
|
||||
console.log(this.userishwo1);
|
||||
if (this.userishwo1 == false) {
|
||||
tagUsedAge = {
|
||||
petType: this.allacindex,
|
||||
tagUsedAge: item.tagName,
|
||||
};
|
||||
} else {
|
||||
console.log("这是false");
|
||||
tagUsedAge = {
|
||||
petType: this.allacindex,
|
||||
};
|
||||
if(item.checked==false){
|
||||
item.checked = true;
|
||||
this.userserachlist[0].tagUsedAge=item.tagName;
|
||||
this.$refs.chosebox1[index].className = "active";
|
||||
}else{
|
||||
this.userserachlist[0].tagUsedAge='';
|
||||
item.checked = false;
|
||||
this.$refs.chosebox1[index].className = "unactive";
|
||||
}
|
||||
this.$refs.chosebox1[index].className = "unactive";
|
||||
for (let i = 0; i < this.userserachlist.length; i++) {
|
||||
if (!this.userserachlist.includes(tagUsedAge)) {
|
||||
this.userserachlist.push(tagUsedAge);
|
||||
}
|
||||
}
|
||||
this.usersearch(this.userserachlist);
|
||||
|
||||
// for (let i = 0; i < this.userserachlist.length; i++) {
|
||||
// if (!this.userserachlist.includes(tagUsedAge)) {
|
||||
// this.userserachlist.push(tagUsedAge);
|
||||
// }
|
||||
// }
|
||||
this.usersearch(this.userserachlist,this.activeIndex1);
|
||||
},
|
||||
selectagc(item, index) {
|
||||
let tagFunction = {};
|
||||
// let tagFunction = {};
|
||||
this.activeIndexd = index;
|
||||
this.userishwo2 = !this.userishwo2;
|
||||
if (this.userishwo2 == false) {
|
||||
tagFunction = {
|
||||
petType: this.allacindex,
|
||||
tagFunction: item.tagName,
|
||||
};
|
||||
} else {
|
||||
console.log("这是false");
|
||||
tagFunction = {
|
||||
petType: this.allacindex,
|
||||
};
|
||||
if(item.checked==false){
|
||||
item.checked = true;
|
||||
this.$refs.cgosebox4[index].className = "active";
|
||||
this.userserachlist[0].tagFunction=item.tagName;
|
||||
}else{
|
||||
item.checked = false;
|
||||
this.$refs.cgosebox4[index].className = "unactive";
|
||||
this.userserachlist[0].tagFunction='';
|
||||
}
|
||||
this.$refs.chosebox2[index].className = "unactive";
|
||||
|
||||
for (let i = 0; i < this.userserachlist.length; i++) {
|
||||
if (!this.userserachlist.includes(tagFunction)) {
|
||||
this.userserachlist.push(tagFunction);
|
||||
}
|
||||
}
|
||||
this.usersearch(this.userserachlist);
|
||||
// if (this.userishwo2 == false) {
|
||||
// tagFunction = {
|
||||
// petType: this.allacindex,
|
||||
// tagFunction: item.tagName,
|
||||
// };
|
||||
// } else {
|
||||
// console.log("这是false");
|
||||
// tagFunction = {
|
||||
// petType: this.allacindex,
|
||||
// };
|
||||
// }
|
||||
// for (let i = 0; i < this.userserachlist.length; i++) {
|
||||
// if (!this.userserachlist.includes(tagFunction)) {
|
||||
// this.userserachlist.push(tagFunction);
|
||||
// }
|
||||
// }
|
||||
this.usersearch(this.userserachlist,this.activeIndex1);
|
||||
},
|
||||
selectagd(item, index) {
|
||||
let tagBreed = {};
|
||||
this.activeIndexe = index;
|
||||
this.userishwo3 = !this.userishwo3;
|
||||
if (this.userishwo3 == false) {
|
||||
tagBreed = {
|
||||
petType: this.allacindex,
|
||||
tagBreed: item.tagName,
|
||||
};
|
||||
} else {
|
||||
console.log("这是false");
|
||||
tagBreed = {
|
||||
petType: this.allacindex,
|
||||
};
|
||||
}
|
||||
this.$refs.chosebox3[index].className = "unactive";
|
||||
for (let i = 0; i < this.userserachlist.length; i++) {
|
||||
if (!this.userserachlist.includes(tagBreed)) {
|
||||
this.userserachlist.push(tagBreed);
|
||||
}
|
||||
}
|
||||
this.usersearch(this.userserachlist);
|
||||
},
|
||||
selectproduct(item, index) {
|
||||
// console.log(this.userishwo=!this.userishwo)
|
||||
let categoryName = {};
|
||||
this.activeIndexb = index;
|
||||
console.log(this.activeIndex);
|
||||
this.userishwo = !this.userishwo;
|
||||
console.log(this.userishwo);
|
||||
if (this.userishwo == false) {
|
||||
console.log("====");
|
||||
categoryName = {
|
||||
petType: this.allacindex,
|
||||
categoryName: item.tagName,
|
||||
};
|
||||
} else {
|
||||
categoryName = {
|
||||
petType: this.allacindex,
|
||||
};
|
||||
}
|
||||
console.log(this.$refs.chosebox);
|
||||
this.$refs.chosebox[index].className = "unactive";
|
||||
for (let i = 0; i < this.userserachlist.length; i++) {
|
||||
if (!this.userserachlist.includes(categoryName)) {
|
||||
this.userserachlist.push(categoryName);
|
||||
}
|
||||
if(item.checked==false){
|
||||
item.checked = true;
|
||||
this.$refs.chosebox3[index].className = "active";
|
||||
this.userserachlist[0].tagBreed=item.tagName;
|
||||
}else{
|
||||
item.checked = false;
|
||||
this.$refs.chosebox3[index].className = "unactive";
|
||||
this.userserachlist[0].tagBreed='';
|
||||
}
|
||||
|
||||
this.usersearch(this.userserachlist);
|
||||
// this.$refs.chosebox3[index].className = "unactive";
|
||||
// for (let i = 0; i < this.userserachlist.length; i++) {
|
||||
// if (!this.userserachlist.includes(tagBreed)) {
|
||||
// this.userserachlist.push(tagBreed);
|
||||
// }
|
||||
// }
|
||||
this.usersearch(this.userserachlist,this.activeIndex1);
|
||||
},
|
||||
selectproduct(item, index) {
|
||||
this.activeIndexb = index;
|
||||
// console.log(this.userishwo=!this.userishwo)
|
||||
if(item.checked==false){
|
||||
item.checked = true;
|
||||
this.$refs.chosebox[index].className = "active";
|
||||
this.userserachlist[0].categoryName=item.tagName;
|
||||
}else{
|
||||
item.checked = false;
|
||||
this.$refs.chosebox[index].className = "unactive";
|
||||
this.userserachlist[0].categoryName='';
|
||||
}
|
||||
// if (this.userishwo == false) {
|
||||
// console.log("====");
|
||||
// categoryName = {
|
||||
// petType: this.allacindex,
|
||||
// categoryName: item.tagName,
|
||||
// };
|
||||
// } else {
|
||||
// categoryName = {
|
||||
// petType: this.allacindex,
|
||||
// };
|
||||
// }
|
||||
// this.$refs.chosebox[index].className = "unactive";
|
||||
// for (let i = 0; i < this.userserachlist.length; i++) {
|
||||
// if (!this.userserachlist.includes(categoryName)) {
|
||||
// this.userserachlist.push(categoryName);
|
||||
// }
|
||||
// }
|
||||
|
||||
this.usersearch(this.userserachlist,this.activeIndex1);
|
||||
},
|
||||
|
||||
//弹框的显示隐藏
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user