Commit 1e7489a7571688d91fc33eecb6371ac8a638efe0

Authored by vking
1 parent ac4392db

search

... ... @@ -35,7 +35,7 @@
margin-right: 20rpx;
width: 22rpx;
height:26rpx;
background-color: #ccc;
background-image: url("http://qn.colorcun.com/custom/lite-online/image/addr.png");
}
.item-1 .info{
width: calc(100% - 140rpx);
... ...
... ... @@ -20,6 +20,7 @@ Page({
suggestion:[],
hasSellerMore:false,
keyword:'',
sellerSplit:-1,
},
/**
... ... @@ -58,13 +59,11 @@ Page({
},
getHistory(){
App.Customer.GetHistorySearch()
let ca=util.cache(search_history_cache_key);
if(ca){
App.Customer.GetHistorySearch().then(res=>{
this.setData({
history:ca
history:res.data
})
}
})
},
setHistory(item){
let newca=[item];
... ... @@ -103,8 +102,13 @@ Page({
backHistoryFill: function (e) {
var i = util.attr(e,'index');
let item=this.data.history[i];
item.title=item.name
console.log(item)
this.setHistory(item)
if(item.type==1){
}else{
}
this.setData({
backfill: item.title
});
... ... @@ -135,12 +139,15 @@ Page({
key:map_key,
}).then(res=>{
res.data=res.data.data
var sug = [],hasSellerMore=false
var sug = [],hasSellerMore=false,sellerSplit=-1
for (var i = 0; i < res.data.length; i++) {
if(i==2 && res.data[i].type==-1){
hasSellerMore=true
continue;
}
if((i==1 || i==2) && res.data[i-1].type==-1 && res.data[i].type!=-1){
sellerSplit=i-1
}
sug.push({ // 获取返回结果,放到sug数组中
title: res.data[i].title,
id: res.data[i].id,
... ... @@ -156,6 +163,7 @@ Page({
suggestion: sug,
hasSellerMore:hasSellerMore,
keyword:this.inputVal,
sellerSplit:sellerSplit,
});
})
},
... ...
... ... @@ -16,24 +16,25 @@
bindtap="backfill" id="{{index}}">
<search-item item="{{item}}" keyword="{{keyword}}" bindclick="searchItemClick"></search-item>
<view wx:if="{{index==1 && hasSellerMore}}" class="see-more" bindtap="gotoList"></view>
<view wx:if="{{index==sellerSplit && sellerSplit>-1}}" class="see-split"></view>
</block>
</view>
</view>
<view class="history" wx:if="{{history.length>0 && suggestion.length<1}}">
<view class="pages">
<view class="history-title">历史记录</view>
<view class="hr-one"></view>
<view class="flex-lr">
<view class="history-title">最近搜索</view>
<view class="history-empty"></view>
</view>
<view class="history-list">
<view class="flex-ll item" wx:for="{{history}}" wx:key="history.key"
bindtap="backHistoryFill" data-index="{{index}}">
<view class="icon-view">
<image class="icon" src="http://qn.colorcun.com/custom/lite-online/image/addr.png"></image>
</view>
<view class="info">
<view class="title">{{item.title}}</view>
<view class="addr">{{item.addr}}</view>
</view>
<view class="icon-view icon-view-{{item.type}}"></view>
<view class="info">{{item.name}}</view>
</view>
<block wx:for="{{history}}" wx:key="history.key">
<search-item item="{{item}}" bindclick="searchItemClick"></search-item>
</block>
</view>
</view>
</view>
... ...
... ... @@ -62,6 +62,8 @@
color:#999999;
height: 40rpx;
line-height: 40rpx;
font-weight:600;
margin-bottom: 20rpx;
}
.hr-one{
height: 2rpx;
... ... @@ -70,28 +72,34 @@
margin: 18rpx -5% 0;
}
.history .item{
height: 120rpx;
line-height: 120rpx;
}
.history .icon{
width: 22rpx;
height: 26rpx;
min-width: 22rpx;
margin-right: 20rpx;
}
.history .title{
line-height: 50rpx;
font-size: 28rpx;
height: 40rpx;
line-height: 40rpx;
margin-bottom: 4rpx;
height:50rpx;
background:rgba(245,245,245,1);
border-radius:4px;
font-weight:500;
float: left;
padding: 0 10rpx;
margin-right: 20rpx;
margin-bottom: 20rpx;
}
.history .addr{
font-size: 24rpx;
color:#999999;
height: 34rpx;
line-height: 34rpx;
.history .icon-view{
width: 20rpx;
height: 22rpx;
min-width: 22rpx;
margin-right: 10rpx;
background-image: url("http://qn.colorcun.com/custom/lite-online/image/addr.png");
background-size: 100% 100%;
}
.history .icon-view-1{
width: 24rpx;
height: 18rpx;
min-width: 24rpx;
margin-right: 10rpx;
background-image: none;
background-color: #999;
background-size: 100% 100%;
}
.see-more{
width: 100%;
height: 34rpx;
... ... @@ -122,4 +130,13 @@
left:calc(50% - 68rpx);
top:0;
text-align: center;
}
.see-split{
width: 100%;
height: 20rpx;
}
.history-empty{
width: 28rpx;
height: 28rpx;
background-color: #999;
}
\ No newline at end of file
... ...
... ... @@ -333,7 +333,7 @@ export default {
//搜索相关
'App.Customer.GetHistorySearch':{
openid:'openid',
cachetime: -1,
//cachetime: -1,
},
}
\ No newline at end of file
... ...