搜索筛选功能数据对接

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' )
}
export const searchchanpin = (stype,categoryName,tagUsedAge,tagFunction,tagBreed) => {
console.log(stype);
export const searchchanpin = (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 = {
petType:stype,
page:1,
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,) => {
var data = {

View File

@ -16,6 +16,18 @@
margin: 0 auto;
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) {
@ -65,18 +77,7 @@
.rc-cat{
margin-top: 0.24rem;
}
.active{
border: 2px solid #E2001A;
color: #E2001A;
cursor: pointer;
}
.unactive{
border: 2px solid #d7d7d7;
color:#999999;
cursor: pointer;
}
.rc-productcat {
display: flex;

View File

@ -96,7 +96,7 @@
<div class="rc-bottom rc-main" v-if="isshow">
<div class="rc-bottoma" >
<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="" />
<span>{{ item.title }}</span>
</div>
@ -215,10 +215,15 @@ export default {
data() {
return {
value: "",
userserachlist:[
{
}
],
userstype:[],
activeIndex:0,
activeIndex1:0,
activeIndexa:'-1',
activeIndexa:0,
dialogInfo1:false,
activeIndexb:'-1',
activeIndexc:'-1',
@ -401,10 +406,13 @@ this.userst();
},
methods: {
async usersearch(stype,categoryName,tagUsedAge,tagFunction,tagBreed){
let data=await searchchanpin(stype,categoryName,tagUsedAge,tagFunction,tagBreed);
async usersearch(stype){
let data=await searchchanpin(stype);
console.log(data);
if(data){
this.rccontair=data;
}
},
async userst() {
let pinzhong=[];
@ -532,11 +540,22 @@ this.dialogInfo1=false;
console.log(e);
},
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 zhuanqu=[];
let age=[];
let gonneg=[];
this.activeIndex1=index;
if(this.activeIndex1==0){
this.usercatlist.map(element=>{
if(element.name=='品种'){
@ -655,36 +674,78 @@ this.dialogInfo1=false;
selectsearch(item, index) {
console.log(item)
this.value=item.title;
this.activeIndexa=index;
},
selectage(item, index) {
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;
},
selectagc(item, index) {
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;
},
selectagd(item, index) {
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;
},
selectproduct(item, index){
console.log(item)
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) {
this.activeIndexc=index;
},
selectage(item, index) {
this.activeIndexc=index;
},
// selectage(item, index) {
// this.activeIndexc=index;
// },
// selectage(item, index) {
// this.activeIndexc=index;
// },
//
},