Commit 3c5d6b001a886f3b1b17dce8635dfd20c47d956e

Authored by vking
1 parent bdf39b61

search

<!--components/reserve/search/item.wxml-->
<wxs src="../../../utils/util.wxs" module="util" />
<view class="history flex-lr" bindtap="detailGo" wx:if="{{hasHistory}}">
<view class="icon icon{{item.type}}"></view>
<view class="text">{{item.title}}</view>
... ... @@ -7,9 +8,20 @@
<view class="icon"></view>
<view class="flex-lr item-info">
<view class="info">
<view class="title">{{item.title}}</view>
<view class="addr">{{item.addr}}</view>
<view class="title {{item.activity.length>0?'activity':''}}">
<block wx:if="{{item.titles}}">
<text>{{item.titles[1]}}</text>
<text class="light">{{item.titles[2]}}</text>
<text>{{item.titles[3]}}</text>
</block>
<text wx:else="">{{item.title}}</text>
</view>
<view class="addr flex-ll" wx:if="{{item.type==-1}}">
<view class="txt" wx:if="{{item.category}}">{{item.category}}</view>
<view class="txt">{{util.distance(item.distance)}}</view>
</view>
<view class="addr" wx:else="">{{item.addr}}</view>
</view>
<view class="reserve-but" wx:if="{{item.type==-1}}" catchtap="reserveGo">包间预订</view>
<view class="reserve-but" wx:if="{{item.is_online_reserve==1}}" catchtap="reserveGo">包间预订</view>
</view>
</view>
... ...
... ... @@ -31,6 +31,16 @@
overflow: hidden;
text-overflow:ellipsis;
}
.item .addr .txt{
border-right: 2rpx solid #979797;
margin-right: 10rpx;
padding-right: 10rpx;
height: 24rpx;
line-height: 24rpx;
}
.item .addr .txt:last-child{
border-right-width: 0;
}
.item .icon{
margin-right: 20rpx;
width: 22rpx;
... ... @@ -94,4 +104,21 @@
height: 18rpx;
min-width: 24rpx;
background-image: url("http://qn.colorcun.com/reserve/images/his-se.png");
}
.activity{
position: relative;
}
.activity:after{
content: "";
position:absolute;
height: 32rpx;
width: 32rpx;
margin-left: 10rpx;
min-width: 32rpx;
background-image: url("http://qn.colorcun.com/reserve/images/huizi.png");
background-size: 100% 100%;
top:4rpx;
}
.title .light{
color: #C0A369;
}
\ No newline at end of file
... ...
... ... @@ -97,7 +97,6 @@ Page({
inputVal:'',
//触发关键词输入提示事件
getsuggest: function (e) {
var _this = this;
//调用关键词提示接口
this.inputVal=e.detail.value;
if(e.detail.value.length<1){
... ... @@ -124,18 +123,14 @@ Page({
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,
addr: res.data[i].address,
city: res.data[i].city,
district: res.data[i].district,
latitude: res.data[i].location.lat,
longitude: res.data[i].location.lng,
type:res.data[i].type,
});
let item=res.data[i]
item.latitude=item.location.lat
item.longitude=item.location.lng
item.addr=item.address
item.titles=item.title.match(new RegExp('(.*)('+this.inputVal+')(.*)'))
sug.push(item);
}
_this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示
this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示
suggestion: sug,
hasSellerMore:hasSellerMore,
keyword:this.inputVal,
... ... @@ -154,7 +149,6 @@ Page({
orderby:'_distance',
key:map_key,
}).then(res=>{
res.data=res.data.data
var mks = []
for (var i = 0; i < res.data.length; i++) {
mks.push({ // 获取返回结果,放到mks数组中
... ... @@ -166,6 +160,7 @@ Page({
latitude: res.data[i].location.lat,
longitude: res.data[i].location.lng,
type:res.data[i].type,
category:res.data[i].category,
})
}
this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示
... ...
... ... @@ -18,6 +18,7 @@
<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 class="see-more bottom" wx:if="{{suggestion.length>0}}"></view>
</view>
</view>
<view class="history" wx:if="{{history.length>0 && suggestion.length<1}}">
... ...
... ... @@ -7,9 +7,11 @@
.searchAddrView{
position: fixed;
top:100rpx;
width: 90%;
width: 110%;
height: 110rpx;
background-color: #fefefe;
z-index: 10;
margin-left: -5%;
}
.searchAddr {
position: fixed;
... ... @@ -23,6 +25,7 @@
line-height: 60rpx;
font-size: 28rpx;
z-index: 99;
left: 5%;
}
.searchAddr .icon{
min-width: 26rpx;
... ... @@ -86,6 +89,11 @@
top:0;
text-align: center;
}
.see-more.bottom:after{
width:200rpx;
content: "我是有底线的";
left:calc(50% - 100rpx);
}
.see-split{
width: 100%;
height: 20rpx;
... ...
... ... @@ -71,4 +71,16 @@ module.exports = {
}
return name
},
distance:function(mi){
if(mi>=0){
mi=mi*1
var gl='m'
if(mi>=1000){
mi=mi/1000
gl='km'
}
return mi.toFixed(2)+gl
}
return '';
},
};
\ No newline at end of file
... ...