搜索筛选功能数据对接

This commit is contained in:
952108534@qq.com 2022-01-11 15:24:00 +08:00
parent 1d659446ae
commit 629f8f0085
3 changed files with 114 additions and 32 deletions

View File

@ -211,18 +211,38 @@ export const biaomessage = (stype,name) => {
return fetch('product/query?petType='+stype, data, 'POST' ) return fetch('product/query?petType='+stype, data, 'POST' )
} }
export const searchchanpin = (stype,categoryName,tagUsedAge,tagFunction,tagBreed) => { export const searchchanpin = (stype) => {
console.log(stype);
let list={};
stype.map(item=>{
console.log(item);
list=item
})
var str = "?";
for(var key in list){
str = str + key + "=" + list[key] + "&";
}
str = str.substr(0,str.length-1);
var data = { var data = {
petType:stype,
page:1, page:1,
row:10 row:10
} }
// return fetch('product/query?petType='+stype+'&categoryName='+categoryName+'&tagUsedAge='+tagUsedAge+'&tagFunction='+tagFunction+'&tagBreed='+tagBreed, data, 'POST' ) return fetch('product/query'+ str, data, 'POST' )
} }
// var str = "?";
// for(var key in data){
// str = str + key + "=" + data[key] + "&";
// }
// str = str.substr(0,str.length-1);
//查询订单 //查询订单
export const userindent = (phoneNumber,orderNumber,) => { export const userindent = (phoneNumber,orderNumber,) => {
var data = { var data = {

View File

@ -16,6 +16,18 @@
margin: 0 auto; margin: 0 auto;
overflow: hidden; overflow: hidden;
} }
.active{
border: 2px solid #E2001A;
color: #E2001A;
cursor: pointer;
}
.unactive{
border: 2px solid #d7d7d7;
color:#999999;
cursor: pointer;
}
} }
//手机端 //手机端
@media screen and (max-width: 768px) { @media screen and (max-width: 768px) {
@ -65,18 +77,7 @@
.rc-cat{ .rc-cat{
margin-top: 0.24rem; margin-top: 0.24rem;
} }
.active{
border: 2px solid #E2001A;
color: #E2001A;
cursor: pointer;
}
.unactive{
border: 2px solid #d7d7d7;
color:#999999;
cursor: pointer;
}
.rc-productcat { .rc-productcat {
display: flex; display: flex;

View File

@ -96,7 +96,7 @@
<div class="rc-bottom rc-main" v-if="isshow"> <div class="rc-bottom rc-main" v-if="isshow">
<div class="rc-bottoma" > <div class="rc-bottoma" >
<div class="rc-productcat ts-scrollable"> <div class="rc-productcat ts-scrollable">
<div class="rc-cat" v-for="(item, index) in userproduct" :key="index" @click="selectGoodsa(item, index)" :class="activeIndex1 == index ? 'active' : 'unactive'" > <div class="rc-cat" v-for="(item, index) in userproduct" :key="index" @click="selectGoods(item, index)" :class="activeIndex1 == index ? 'active' : 'unactive'" >
<img :src="item.catimage" alt="" /> <img :src="item.catimage" alt="" />
<span>{{ item.title }}</span> <span>{{ item.title }}</span>
</div> </div>
@ -215,10 +215,15 @@ export default {
data() { data() {
return { return {
value: "", value: "",
userserachlist:[
{
}
],
userstype:[], userstype:[],
activeIndex:0, activeIndex:0,
activeIndex1:0, activeIndex1:0,
activeIndexa:'-1', activeIndexa:0,
dialogInfo1:false, dialogInfo1:false,
activeIndexb:'-1', activeIndexb:'-1',
activeIndexc:'-1', activeIndexc:'-1',
@ -401,10 +406,13 @@ this.userst();
}, },
methods: { methods: {
async usersearch(stype,categoryName,tagUsedAge,tagFunction,tagBreed){ async usersearch(stype){
let data=await searchchanpin(stype,categoryName,tagUsedAge,tagFunction,tagBreed); let data=await searchchanpin(stype);
console.log(data); console.log(data);
if(data){
this.rccontair=data;
}
}, },
async userst() { async userst() {
let pinzhong=[]; let pinzhong=[];
@ -532,11 +540,22 @@ this.dialogInfo1=false;
console.log(e); console.log(e);
}, },
selectGoods(item, index) { selectGoods(item, index) {
this.activeIndex1=index;
let petType={
petType:this.activeIndex1,
}
for(let i =0;i<this.userserachlist.length;i++){
if(!this.userserachlist.includes(petType)){
this.userserachlist.push(petType)
}
console.log(this.userserachlist);
}
this.usersearch(this.userserachlist)
console.log(index);
let pinzhong=[]; let pinzhong=[];
let zhuanqu=[]; let zhuanqu=[];
let age=[]; let age=[];
let gonneg=[]; let gonneg=[];
this.activeIndex1=index;
if(this.activeIndex1==0){ if(this.activeIndex1==0){
this.usercatlist.map(element=>{ this.usercatlist.map(element=>{
if(element.name=='品种'){ if(element.name=='品种'){
@ -655,36 +674,78 @@ this.dialogInfo1=false;
selectsearch(item, index) { selectsearch(item, index) {
console.log(item) console.log(item)
this.value=item.title;
this.activeIndexa=index; this.activeIndexa=index;
}, },
selectage(item, index) { selectage(item, index) {
console.log(item) console.log(item)
let tagUsedAge={
petType:this.activeIndex1,
tagUsedAge:item.tagName
}
for(let i =0;i<this.userserachlist.length;i++){
if(!this.userserachlist.includes(tagUsedAge)){
this.userserachlist.push(tagUsedAge)
}
console.log(this.userserachlist);
}
this.usersearch(this.userserachlist)
this.activeIndexc=index; this.activeIndexc=index;
}, },
selectagc(item, index) { selectagc(item, index) {
console.log(item) console.log(item)
let tagFunction={
petType:this.activeIndex1,
tagFunction:item.tagName
}
for(let i =0;i<this.userserachlist.length;i++){
if(!this.userserachlist.includes(tagFunction)){
this.userserachlist.push(tagFunction)
}
console.log(this.userserachlist);
}
this.usersearch(this.userserachlist)
this.activeIndexd=index; this.activeIndexd=index;
}, },
selectagd(item, index) { selectagd(item, index) {
console.log(item) console.log(item)
let tagBreed={
petType:this.activeIndex1,
tagBreed:item.tagName
}
for(let i =0;i<this.userserachlist.length;i++){
if(!this.userserachlist.includes(tagBreed)){
this.userserachlist.push(tagBreed)
}
console.log(this.userserachlist);
}
this.usersearch(this.userserachlist)
this.activeIndexe=index; this.activeIndexe=index;
}, },
selectproduct(item, index){ selectproduct(item, index){
console.log(item) console.log(item)
this.activeIndexb=index; this.activeIndexb=index;
this.usersearch(this.activeIndex1,item.tagName,'','','') let categoryName={
petType:this.activeIndex1,
categoryName:item.tagName,
}
for(let i =0;i<this.userserachlist.length;i++){
if(!this.userserachlist.includes(categoryName)){
this.userserachlist.push(categoryName)
}
console.log(this.userserachlist);
}
this.usersearch(this.userserachlist)
}, },
selectage(item, index) { // selectage(item, index) {
this.activeIndexc=index; // this.activeIndexc=index;
}, // },
selectage(item, index) { // selectage(item, index) {
this.activeIndexc=index; // this.activeIndexc=index;
}, // },
// //
}, },