|
@@ -3,8 +3,8 @@
|
|
<view class="search-main">
|
|
<view class="search-main">
|
|
<view class="search-input">
|
|
<view class="search-input">
|
|
<text class="iconfont icon-iconfonticonfontsousuo1"></text>
|
|
<text class="iconfont icon-iconfonticonfontsousuo1"></text>
|
|
- <input maxlength="20" focus type="text" value="" confirm-type="search" @focus="onFocus" @input="onShowClose" @confirm="subMitSearch()" placeholder="请输入商品关键词" v-model.trim="searchInputVal"/>
|
|
|
|
- <text class="iconfont icon-shanchu1" v-if="isShowClose" @click="delInputText()"></text>
|
|
|
|
|
|
+ <input maxlength="20" :focus="isFocus" type="text" value="" confirm-type="search" @focus="onFocus" @input="onShowClose" @confirm="subMitSearch()" placeholder="请输入商品关键词" v-model.trim="searchInputVal"/>
|
|
|
|
+ <text class="iconfont icon-shanchu1" v-if="isShowClose" @click.stop="delInputText()"></text>
|
|
</view>
|
|
</view>
|
|
<view class="search-btn" @click="subMitSearch()">搜索</view>
|
|
<view class="search-btn" @click="subMitSearch()">搜索</view>
|
|
</view>
|
|
</view>
|
|
@@ -110,6 +110,7 @@
|
|
serachRecordList:[],//历史搜索记录
|
|
serachRecordList:[],//历史搜索记录
|
|
isShowWrapper:false,
|
|
isShowWrapper:false,
|
|
isModallayer:false,
|
|
isModallayer:false,
|
|
|
|
+ isFocus:false,
|
|
priceLoading:true,
|
|
priceLoading:true,
|
|
windowHeight: '',
|
|
windowHeight: '',
|
|
showEmpty: false,
|
|
showEmpty: false,
|
|
@@ -119,7 +120,7 @@
|
|
showLoading: false,
|
|
showLoading: false,
|
|
loadingNow: true,
|
|
loadingNow: true,
|
|
loadingText: '上拉加载更多',
|
|
loadingText: '上拉加载更多',
|
|
- pageSize: 10,
|
|
|
|
|
|
+ pageSize: 20,
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
hasNextPage: false,
|
|
hasNextPage: false,
|
|
totalPage: 1,
|
|
totalPage: 1,
|
|
@@ -127,6 +128,7 @@
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onLoad() {
|
|
onLoad() {
|
|
|
|
+ this.isFocus = true
|
|
this.initGetSerachRecord()
|
|
this.initGetSerachRecord()
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -155,11 +157,12 @@
|
|
}else{
|
|
}else{
|
|
this.listData =[]
|
|
this.listData =[]
|
|
this.setSearchHistoryAdd()
|
|
this.setSearchHistoryAdd()
|
|
- this.getListFromServer(false)
|
|
|
|
|
|
+ this.getListFromServer()
|
|
|
|
+ this.isFocus = false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
scrolltolower() {
|
|
scrolltolower() {
|
|
- if(this.totalPage>this.pageNum && this.pullFlag) {
|
|
|
|
|
|
+ if(this.totalPage>this.listData.length && this.pullFlag) {
|
|
this.getListFromServer(true);
|
|
this.getListFromServer(true);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -171,12 +174,19 @@
|
|
if(loadMore) {
|
|
if(loadMore) {
|
|
this.pageNum += 1;
|
|
this.pageNum += 1;
|
|
}
|
|
}
|
|
- let params = {identity:this.identity,keyword:this.searchInputVal,pageNum:this.pageNum,pageSize:this.pageSize,sortField:'',sortType:''}
|
|
|
|
|
|
+ let params = {
|
|
|
|
+ identity:this.identity,
|
|
|
|
+ keyword:this.searchInputVal,
|
|
|
|
+ pageNum:this.pageNum,
|
|
|
|
+ pageSize:this.pageSize,
|
|
|
|
+ sortField:'',
|
|
|
|
+ sortType:'',
|
|
|
|
+ }
|
|
queryNewSearchProduct(params).then(response =>{
|
|
queryNewSearchProduct(params).then(response =>{
|
|
this.isShowWrapper = true
|
|
this.isShowWrapper = true
|
|
const resData = JSON.parse(response.data);
|
|
const resData = JSON.parse(response.data);
|
|
const resList = resData.items;
|
|
const resList = resData.items;
|
|
- console.log(resData)
|
|
|
|
|
|
+ // console.log(resData)
|
|
if(resList && resList.length > 0){
|
|
if(resList && resList.length > 0){
|
|
this.totalPage = resData.total;
|
|
this.totalPage = resData.total;
|
|
this.showEmpty = false;
|
|
this.showEmpty = false;
|
|
@@ -191,7 +201,8 @@
|
|
this.pullFlag = false;
|
|
this.pullFlag = false;
|
|
setTimeout(()=>{ this.pullFlag = true; },500)
|
|
setTimeout(()=>{ this.pullFlag = true; },500)
|
|
// 底部提示文案
|
|
// 底部提示文案
|
|
- if(this.totalPage>this.pageNum) {
|
|
|
|
|
|
+ if(this.totalPage>this.listData.length) {
|
|
|
|
+ console.log('1111111111')
|
|
this.loadingText = '上拉加载更多';
|
|
this.loadingText = '上拉加载更多';
|
|
} else {
|
|
} else {
|
|
this.showLoading = true;
|
|
this.showLoading = true;
|
|
@@ -246,7 +257,7 @@
|
|
this.$util.msg(error.msg,2000)
|
|
this.$util.msg(error.msg,2000)
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- onShowClose () {//输入框失去焦点时触发
|
|
|
|
|
|
+ onShowClose () {//输入框输入时触发
|
|
this.inputEmpty(this.searchInputVal)
|
|
this.inputEmpty(this.searchInputVal)
|
|
},
|
|
},
|
|
onFocus () { //输入框获取焦点时触发
|
|
onFocus () { //输入框获取焦点时触发
|
|
@@ -279,8 +290,10 @@
|
|
this.isShowWrapper = false
|
|
this.isShowWrapper = false
|
|
if(val != ''){
|
|
if(val != ''){
|
|
this.isShowClose = true
|
|
this.isShowClose = true
|
|
|
|
+ this.isFocus = true
|
|
}else{
|
|
}else{
|
|
this.isShowClose = false
|
|
this.isShowClose = false
|
|
|
|
+ this.isFocus = true
|
|
}
|
|
}
|
|
},
|
|
},
|
|
isInterceptHtmlFn(text){
|
|
isInterceptHtmlFn(text){
|
|
@@ -335,6 +348,8 @@
|
|
background: #F0F0F0;
|
|
background: #F0F0F0;
|
|
float: left;
|
|
float: left;
|
|
.icon-iconfonticonfontsousuo1{
|
|
.icon-iconfonticonfontsousuo1{
|
|
|
|
+ display: block;
|
|
|
|
+ width: 68rpx;
|
|
font-size: 36rpx;
|
|
font-size: 36rpx;
|
|
color: #8A8A8A;
|
|
color: #8A8A8A;
|
|
position: absolute;
|
|
position: absolute;
|
|
@@ -342,13 +357,15 @@
|
|
z-index: 10;
|
|
z-index: 10;
|
|
}
|
|
}
|
|
.icon-shanchu1{
|
|
.icon-shanchu1{
|
|
|
|
+ display: block;
|
|
|
|
+ width: 68rpx;
|
|
font-size: 36rpx;
|
|
font-size: 36rpx;
|
|
- color: #8A8A8A;
|
|
|
|
|
|
+ text-align: center;
|
|
|
|
+ color: #999;
|
|
position: absolute;
|
|
position: absolute;
|
|
- right: 24rpx;
|
|
|
|
|
|
+ right: 0;
|
|
top: 0;
|
|
top: 0;
|
|
- padding: 0 10rpx;
|
|
|
|
- z-index: 10;
|
|
|
|
|
|
+ z-index: 60;
|
|
}
|
|
}
|
|
input{
|
|
input{
|
|
width: 448rpx;
|
|
width: 448rpx;
|