增加新功能
This commit is contained in:
+32
-7
@@ -12,7 +12,7 @@
|
||||
'border-radius': '20rpx !important',
|
||||
'width': '590rpx',
|
||||
}"
|
||||
v-model="searchVal"
|
||||
v-model="form.keyword"
|
||||
>
|
||||
<template #prefix>
|
||||
<up-image src="/static/common/search.png" width="20" height="20" bgColor="#f1f6ff00" @click="jumpHome"></up-image>
|
||||
@@ -24,7 +24,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<!-- 历史搜索 -->
|
||||
<view class="search_history" v-if="!searchVal">
|
||||
<view class="search_history" v-if="!poductList || poductList.length === 0">
|
||||
<view class="search_history_title">
|
||||
<view>历史搜索</view>
|
||||
<up-image src="/static/common/delete.png" width="20" height="20" bgColor="#f1f6ff00" @click="isShowSearch = true;"></up-image>
|
||||
@@ -123,12 +123,25 @@
|
||||
name:'会心一笑',
|
||||
},
|
||||
],// 搜索历史记录
|
||||
form:{
|
||||
keyword:null,
|
||||
type:null,
|
||||
categoryId:null,//
|
||||
page:1,
|
||||
pageSize:20,
|
||||
},
|
||||
isShowSearch:false,
|
||||
searchVal:null,
|
||||
poductList:[],// 产品列表
|
||||
imgSize:"min",// big:大,min:笑
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
const id = option.categoryId;
|
||||
if(id && id !==0){
|
||||
this.form.categoryId = id;
|
||||
this.searchClickFun();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
jumpHome(){
|
||||
uni.switchTab({
|
||||
@@ -145,17 +158,29 @@
|
||||
* 查询产品
|
||||
*/
|
||||
async searchClick(item){
|
||||
this.searchVal = item.name;
|
||||
this.form.keyword = item.name;
|
||||
this.searchClickFun();
|
||||
},
|
||||
/**
|
||||
* 查询产品
|
||||
*/
|
||||
async searchClickFun(){
|
||||
const param = {
|
||||
keyword:this.searchVal,
|
||||
const form = this.form;
|
||||
|
||||
const params = {
|
||||
page:form.page,
|
||||
pageSize:form.pageSize,
|
||||
}
|
||||
const resp = await searchList(param);
|
||||
if(form.categoryId){
|
||||
params.categoryId = form.categoryId;
|
||||
}
|
||||
if(form.keyword){
|
||||
params.keyword = form.keyword;
|
||||
}
|
||||
if(form.type){
|
||||
params.type = form.type;
|
||||
}
|
||||
const resp = await searchList(params);
|
||||
if(resp && resp.bizcode === 100){
|
||||
this.poductList = resp.data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user