Showing
6 changed files
with
72 additions
and
17 deletions
| 1 | <!--components/reserve/search/item.wxml--> | 1 | <!--components/reserve/search/item.wxml--> |
| 2 | +<wxs src="../../../utils/util.wxs" module="util" /> | ||
| 2 | <view class="history flex-lr" bindtap="detailGo" wx:if="{{hasHistory}}"> | 3 | <view class="history flex-lr" bindtap="detailGo" wx:if="{{hasHistory}}"> |
| 3 | <view class="icon icon{{item.type}}"></view> | 4 | <view class="icon icon{{item.type}}"></view> |
| 4 | <view class="text">{{item.title}}</view> | 5 | <view class="text">{{item.title}}</view> |
| @@ -7,9 +8,20 @@ | @@ -7,9 +8,20 @@ | ||
| 7 | <view class="icon"></view> | 8 | <view class="icon"></view> |
| 8 | <view class="flex-lr item-info"> | 9 | <view class="flex-lr item-info"> |
| 9 | <view class="info"> | 10 | <view class="info"> |
| 10 | - <view class="title">{{item.title}}</view> | ||
| 11 | - <view class="addr">{{item.addr}}</view> | 11 | + <view class="title {{item.activity.length>0?'activity':''}}"> |
| 12 | + <block wx:if="{{item.titles}}"> | ||
| 13 | + <text>{{item.titles[1]}}</text> | ||
| 14 | + <text class="light">{{item.titles[2]}}</text> | ||
| 15 | + <text>{{item.titles[3]}}</text> | ||
| 16 | + </block> | ||
| 17 | + <text wx:else="">{{item.title}}</text> | ||
| 18 | + </view> | ||
| 19 | + <view class="addr flex-ll" wx:if="{{item.type==-1}}"> | ||
| 20 | + <view class="txt" wx:if="{{item.category}}">{{item.category}}</view> | ||
| 21 | + <view class="txt">{{util.distance(item.distance)}}</view> | ||
| 22 | + </view> | ||
| 23 | + <view class="addr" wx:else="">{{item.addr}}</view> | ||
| 12 | </view> | 24 | </view> |
| 13 | - <view class="reserve-but" wx:if="{{item.type==-1}}" catchtap="reserveGo">包间预订</view> | 25 | + <view class="reserve-but" wx:if="{{item.is_online_reserve==1}}" catchtap="reserveGo">包间预订</view> |
| 14 | </view> | 26 | </view> |
| 15 | </view> | 27 | </view> |
| @@ -31,6 +31,16 @@ | @@ -31,6 +31,16 @@ | ||
| 31 | overflow: hidden; | 31 | overflow: hidden; |
| 32 | text-overflow:ellipsis; | 32 | text-overflow:ellipsis; |
| 33 | } | 33 | } |
| 34 | +.item .addr .txt{ | ||
| 35 | + border-right: 2rpx solid #979797; | ||
| 36 | + margin-right: 10rpx; | ||
| 37 | + padding-right: 10rpx; | ||
| 38 | + height: 24rpx; | ||
| 39 | + line-height: 24rpx; | ||
| 40 | +} | ||
| 41 | +.item .addr .txt:last-child{ | ||
| 42 | + border-right-width: 0; | ||
| 43 | +} | ||
| 34 | .item .icon{ | 44 | .item .icon{ |
| 35 | margin-right: 20rpx; | 45 | margin-right: 20rpx; |
| 36 | width: 22rpx; | 46 | width: 22rpx; |
| @@ -94,4 +104,21 @@ | @@ -94,4 +104,21 @@ | ||
| 94 | height: 18rpx; | 104 | height: 18rpx; |
| 95 | min-width: 24rpx; | 105 | min-width: 24rpx; |
| 96 | background-image: url("http://qn.colorcun.com/reserve/images/his-se.png"); | 106 | background-image: url("http://qn.colorcun.com/reserve/images/his-se.png"); |
| 107 | +} | ||
| 108 | +.activity{ | ||
| 109 | + position: relative; | ||
| 110 | +} | ||
| 111 | +.activity:after{ | ||
| 112 | + content: ""; | ||
| 113 | + position:absolute; | ||
| 114 | + height: 32rpx; | ||
| 115 | + width: 32rpx; | ||
| 116 | + margin-left: 10rpx; | ||
| 117 | + min-width: 32rpx; | ||
| 118 | + background-image: url("http://qn.colorcun.com/reserve/images/huizi.png"); | ||
| 119 | + background-size: 100% 100%; | ||
| 120 | + top:4rpx; | ||
| 121 | +} | ||
| 122 | +.title .light{ | ||
| 123 | + color: #C0A369; | ||
| 97 | } | 124 | } |
| @@ -97,7 +97,6 @@ Page({ | @@ -97,7 +97,6 @@ Page({ | ||
| 97 | inputVal:'', | 97 | inputVal:'', |
| 98 | //触发关键词输入提示事件 | 98 | //触发关键词输入提示事件 |
| 99 | getsuggest: function (e) { | 99 | getsuggest: function (e) { |
| 100 | - var _this = this; | ||
| 101 | //调用关键词提示接口 | 100 | //调用关键词提示接口 |
| 102 | this.inputVal=e.detail.value; | 101 | this.inputVal=e.detail.value; |
| 103 | if(e.detail.value.length<1){ | 102 | if(e.detail.value.length<1){ |
| @@ -124,18 +123,14 @@ Page({ | @@ -124,18 +123,14 @@ Page({ | ||
| 124 | if((i==1 || i==2) && res.data[i-1].type==-1 && res.data[i].type!=-1){ | 123 | if((i==1 || i==2) && res.data[i-1].type==-1 && res.data[i].type!=-1){ |
| 125 | sellerSplit=i-1 | 124 | sellerSplit=i-1 |
| 126 | } | 125 | } |
| 127 | - sug.push({ // 获取返回结果,放到sug数组中 | ||
| 128 | - title: res.data[i].title, | ||
| 129 | - id: res.data[i].id, | ||
| 130 | - addr: res.data[i].address, | ||
| 131 | - city: res.data[i].city, | ||
| 132 | - district: res.data[i].district, | ||
| 133 | - latitude: res.data[i].location.lat, | ||
| 134 | - longitude: res.data[i].location.lng, | ||
| 135 | - type:res.data[i].type, | ||
| 136 | - }); | 126 | + let item=res.data[i] |
| 127 | + item.latitude=item.location.lat | ||
| 128 | + item.longitude=item.location.lng | ||
| 129 | + item.addr=item.address | ||
| 130 | + item.titles=item.title.match(new RegExp('(.*)('+this.inputVal+')(.*)')) | ||
| 131 | + sug.push(item); | ||
| 137 | } | 132 | } |
| 138 | - _this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示 | 133 | + this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示 |
| 139 | suggestion: sug, | 134 | suggestion: sug, |
| 140 | hasSellerMore:hasSellerMore, | 135 | hasSellerMore:hasSellerMore, |
| 141 | keyword:this.inputVal, | 136 | keyword:this.inputVal, |
| @@ -154,7 +149,6 @@ Page({ | @@ -154,7 +149,6 @@ Page({ | ||
| 154 | orderby:'_distance', | 149 | orderby:'_distance', |
| 155 | key:map_key, | 150 | key:map_key, |
| 156 | }).then(res=>{ | 151 | }).then(res=>{ |
| 157 | - res.data=res.data.data | ||
| 158 | var mks = [] | 152 | var mks = [] |
| 159 | for (var i = 0; i < res.data.length; i++) { | 153 | for (var i = 0; i < res.data.length; i++) { |
| 160 | mks.push({ // 获取返回结果,放到mks数组中 | 154 | mks.push({ // 获取返回结果,放到mks数组中 |
| @@ -166,6 +160,7 @@ Page({ | @@ -166,6 +160,7 @@ Page({ | ||
| 166 | latitude: res.data[i].location.lat, | 160 | latitude: res.data[i].location.lat, |
| 167 | longitude: res.data[i].location.lng, | 161 | longitude: res.data[i].location.lng, |
| 168 | type:res.data[i].type, | 162 | type:res.data[i].type, |
| 163 | + category:res.data[i].category, | ||
| 169 | }) | 164 | }) |
| 170 | } | 165 | } |
| 171 | this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示 | 166 | this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示 |
| @@ -18,6 +18,7 @@ | @@ -18,6 +18,7 @@ | ||
| 18 | <view wx:if="{{index==1 && hasSellerMore}}" class="see-more" bindtap="gotoList"></view> | 18 | <view wx:if="{{index==1 && hasSellerMore}}" class="see-more" bindtap="gotoList"></view> |
| 19 | <view wx:if="{{index==sellerSplit && sellerSplit>-1}}" class="see-split"></view> | 19 | <view wx:if="{{index==sellerSplit && sellerSplit>-1}}" class="see-split"></view> |
| 20 | </block> | 20 | </block> |
| 21 | + <view class="see-more bottom" wx:if="{{suggestion.length>0}}"></view> | ||
| 21 | </view> | 22 | </view> |
| 22 | </view> | 23 | </view> |
| 23 | <view class="history" wx:if="{{history.length>0 && suggestion.length<1}}"> | 24 | <view class="history" wx:if="{{history.length>0 && suggestion.length<1}}"> |
| @@ -7,9 +7,11 @@ | @@ -7,9 +7,11 @@ | ||
| 7 | .searchAddrView{ | 7 | .searchAddrView{ |
| 8 | position: fixed; | 8 | position: fixed; |
| 9 | top:100rpx; | 9 | top:100rpx; |
| 10 | - width: 90%; | 10 | + width: 110%; |
| 11 | height: 110rpx; | 11 | height: 110rpx; |
| 12 | background-color: #fefefe; | 12 | background-color: #fefefe; |
| 13 | + z-index: 10; | ||
| 14 | + margin-left: -5%; | ||
| 13 | } | 15 | } |
| 14 | .searchAddr { | 16 | .searchAddr { |
| 15 | position: fixed; | 17 | position: fixed; |
| @@ -23,6 +25,7 @@ | @@ -23,6 +25,7 @@ | ||
| 23 | line-height: 60rpx; | 25 | line-height: 60rpx; |
| 24 | font-size: 28rpx; | 26 | font-size: 28rpx; |
| 25 | z-index: 99; | 27 | z-index: 99; |
| 28 | + left: 5%; | ||
| 26 | } | 29 | } |
| 27 | .searchAddr .icon{ | 30 | .searchAddr .icon{ |
| 28 | min-width: 26rpx; | 31 | min-width: 26rpx; |
| @@ -86,6 +89,11 @@ | @@ -86,6 +89,11 @@ | ||
| 86 | top:0; | 89 | top:0; |
| 87 | text-align: center; | 90 | text-align: center; |
| 88 | } | 91 | } |
| 92 | +.see-more.bottom:after{ | ||
| 93 | + width:200rpx; | ||
| 94 | + content: "我是有底线的"; | ||
| 95 | + left:calc(50% - 100rpx); | ||
| 96 | +} | ||
| 89 | .see-split{ | 97 | .see-split{ |
| 90 | width: 100%; | 98 | width: 100%; |
| 91 | height: 20rpx; | 99 | height: 20rpx; |
| @@ -71,4 +71,16 @@ module.exports = { | @@ -71,4 +71,16 @@ module.exports = { | ||
| 71 | } | 71 | } |
| 72 | return name | 72 | return name |
| 73 | }, | 73 | }, |
| 74 | + distance:function(mi){ | ||
| 75 | + if(mi>=0){ | ||
| 76 | + mi=mi*1 | ||
| 77 | + var gl='m' | ||
| 78 | + if(mi>=1000){ | ||
| 79 | + mi=mi/1000 | ||
| 80 | + gl='km' | ||
| 81 | + } | ||
| 82 | + return mi.toFixed(2)+gl | ||
| 83 | + } | ||
| 84 | + return ''; | ||
| 85 | + }, | ||
| 74 | }; | 86 | }; |
-
Please register or login to post a comment