Showing
8 changed files
with
66 additions
and
98 deletions
| 1 | // components/common/feedback.js | 1 | // components/common/feedback.js |
| 2 | const mans=[ | 2 | const mans=[ |
| 3 | 'oB-xJ5KJCIasaEdgMRckqoL1cwg8', | 3 | 'oB-xJ5KJCIasaEdgMRckqoL1cwg8', |
| 4 | - 'oB-xJ5BjnTvdgQGLHsjioNHH0eE8', | 4 | + //'oB-xJ5BjnTvdgQGLHsjioNHH0eE8', |
| 5 | 'oB-xJ5MEi2mTMrBTiYImD9cpGH6o', | 5 | 'oB-xJ5MEi2mTMrBTiYImD9cpGH6o', |
| 6 | 'oB-xJ5OE1pM_17vNyWSMGqLH1vOg', //驴肉火烧多少钱一斤 MI 8 | 6 | 'oB-xJ5OE1pM_17vNyWSMGqLH1vOg', //驴肉火烧多少钱一斤 MI 8 |
| 7 | 'oB-xJ5DIWrC6MECaXfql2GvTmQTU', //红旗 Redmi Note 7 Pro | 7 | 'oB-xJ5DIWrC6MECaXfql2GvTmQTU', //红旗 Redmi Note 7 Pro |
| 1 | <!--components/reserve/search/item.wxml--> | 1 | <!--components/reserve/search/item.wxml--> |
| 2 | -<view class="item item{{item.type}} flex-ll" bindtap="detailGo"> | 2 | +<view class="history flex-lr" bindtap="detailGo" wx:if="{{hasHistory}}"> |
| 3 | + <view class="icon icon{{item.type}}"></view> | ||
| 4 | + <view class="text">{{item.title}}</view> | ||
| 5 | +</view> | ||
| 6 | +<view class="item item{{item.type}} flex-ll" bindtap="detailGo" wx:else=""> | ||
| 3 | <view class="icon"></view> | 7 | <view class="icon"></view> |
| 4 | <view class="flex-lr item-info"> | 8 | <view class="flex-lr item-info"> |
| 5 | <view class="info"> | 9 | <view class="info"> |
| @@ -35,7 +35,8 @@ | @@ -35,7 +35,8 @@ | ||
| 35 | margin-right: 20rpx; | 35 | margin-right: 20rpx; |
| 36 | width: 22rpx; | 36 | width: 22rpx; |
| 37 | height:26rpx; | 37 | height:26rpx; |
| 38 | - background-image: url("http://qn.colorcun.com/custom/lite-online/image/addr.png"); | 38 | + background-image: url("http://qn.colorcun.com/reserve/images/addr.png"); |
| 39 | + background-size: 100% 100%; | ||
| 39 | } | 40 | } |
| 40 | .item-1 .info{ | 41 | .item-1 .info{ |
| 41 | width: calc(100% - 140rpx); | 42 | width: calc(100% - 140rpx); |
| @@ -48,7 +49,7 @@ | @@ -48,7 +49,7 @@ | ||
| 48 | padding: 20rpx; | 49 | padding: 20rpx; |
| 49 | } | 50 | } |
| 50 | .item-1 .icon { | 51 | .item-1 .icon { |
| 51 | - background-color: #C0A369; | 52 | + background-image: url("http://qn.colorcun.com/reserve/images/sea-se.png"); |
| 52 | width: 36rpx; | 53 | width: 36rpx; |
| 53 | height: 36rpx; | 54 | height: 36rpx; |
| 54 | min-width: 36rpx; | 55 | min-width: 36rpx; |
| @@ -66,4 +67,31 @@ | @@ -66,4 +67,31 @@ | ||
| 66 | text-align: center; | 67 | text-align: center; |
| 67 | min-width: 120rpx; | 68 | min-width: 120rpx; |
| 68 | margin-left: 20rpx; | 69 | margin-left: 20rpx; |
| 70 | +} | ||
| 71 | + | ||
| 72 | +.history{ | ||
| 73 | + line-height: 50rpx; | ||
| 74 | + font-size: 28rpx; | ||
| 75 | + height:50rpx; | ||
| 76 | + background:rgba(245,245,245,1); | ||
| 77 | + border-radius:4px; | ||
| 78 | + font-weight:500; | ||
| 79 | + float: left; | ||
| 80 | + padding: 0 10rpx; | ||
| 81 | + margin-right: 20rpx; | ||
| 82 | + margin-bottom: 20rpx; | ||
| 83 | +} | ||
| 84 | +.history .icon{ | ||
| 85 | + background-size: 100% 100%; | ||
| 86 | + margin-right: 10rpx; | ||
| 87 | + width: 20rpx; | ||
| 88 | + height: 22rpx; | ||
| 89 | + min-width: 22rpx; | ||
| 90 | + background-image: url("http://qn.colorcun.com/reserve/images/addr.png"); | ||
| 91 | +} | ||
| 92 | +.history .icon-1{ | ||
| 93 | + width: 24rpx; | ||
| 94 | + height: 18rpx; | ||
| 95 | + min-width: 24rpx; | ||
| 96 | + background-image: url("http://qn.colorcun.com/reserve/images/his-se.png"); | ||
| 69 | } | 97 | } |
| @@ -8,8 +8,6 @@ var qqmapsdk = new QQMapWX({ | @@ -8,8 +8,6 @@ var qqmapsdk = new QQMapWX({ | ||
| 8 | }); | 8 | }); |
| 9 | import util from '../../utils/util'; | 9 | import util from '../../utils/util'; |
| 10 | import App from '../../utils/api'; | 10 | import App from '../../utils/api'; |
| 11 | -const {regeneratorRuntime} = global | ||
| 12 | -const search_history_cache_key='SEARCH_HISTORY_CACHE_KEY'; | ||
| 13 | Page({ | 11 | Page({ |
| 14 | 12 | ||
| 15 | /** | 13 | /** |
| @@ -60,26 +58,24 @@ Page({ | @@ -60,26 +58,24 @@ Page({ | ||
| 60 | }, | 58 | }, |
| 61 | getHistory(){ | 59 | getHistory(){ |
| 62 | App.Customer.GetHistorySearch().then(res=>{ | 60 | App.Customer.GetHistorySearch().then(res=>{ |
| 61 | + let mks=[] | ||
| 62 | + res.data.forEach(h=>{ | ||
| 63 | + mks.push({ // 获取返回结果,放到mks数组中 | ||
| 64 | + title: h.name, | ||
| 65 | + id: h.sid, | ||
| 66 | + addr: '', | ||
| 67 | + city: '', | ||
| 68 | + district: 0, | ||
| 69 | + latitude: h.latitude, | ||
| 70 | + longitude: h.longitude, | ||
| 71 | + type:h.type==1?-1:h.type, | ||
| 72 | + }) | ||
| 73 | + }) | ||
| 63 | this.setData({ | 74 | this.setData({ |
| 64 | - history:res.data | 75 | + history:mks |
| 65 | }) | 76 | }) |
| 66 | }) | 77 | }) |
| 67 | }, | 78 | }, |
| 68 | - setHistory(item){ | ||
| 69 | - let newca=[item]; | ||
| 70 | - let ca=this.data.history; | ||
| 71 | - let maxL=20; | ||
| 72 | - for(let i=0;i<ca.length;i++){ | ||
| 73 | - if(ca[i].id!=item.id){ | ||
| 74 | - newca.push(ca[i]); | ||
| 75 | - } | ||
| 76 | - if(newca.length>maxL) break; | ||
| 77 | - } | ||
| 78 | - util.cache(search_history_cache_key,newca); | ||
| 79 | - this.setData({ | ||
| 80 | - history:newca, | ||
| 81 | - }) | ||
| 82 | - }, | ||
| 83 | //在Page({})中使用下列代码 | 79 | //在Page({})中使用下列代码 |
| 84 | //数据回填方法 | 80 | //数据回填方法 |
| 85 | backfill: function (e) { | 81 | backfill: function (e) { |
| @@ -87,7 +83,6 @@ Page({ | @@ -87,7 +83,6 @@ Page({ | ||
| 87 | for (var i = 0; i < this.data.suggestion.length; i++) { | 83 | for (var i = 0; i < this.data.suggestion.length; i++) { |
| 88 | if (i == id) { | 84 | if (i == id) { |
| 89 | console.log('backfill,this.data.suggestion[i]:',this.data.suggestion[i]) | 85 | console.log('backfill,this.data.suggestion[i]:',this.data.suggestion[i]) |
| 90 | - this.setHistory(this.data.suggestion[i]) | ||
| 91 | let pages = getCurrentPages(); | 86 | let pages = getCurrentPages(); |
| 92 | let p = pages[pages.length - 2]; | 87 | let p = pages[pages.length - 2]; |
| 93 | p.setSuggestion(this.data.suggestion[i]) | 88 | p.setSuggestion(this.data.suggestion[i]) |
| @@ -99,25 +94,6 @@ Page({ | @@ -99,25 +94,6 @@ Page({ | ||
| 99 | } | 94 | } |
| 100 | } | 95 | } |
| 101 | }, | 96 | }, |
| 102 | - backHistoryFill: function (e) { | ||
| 103 | - var i = util.attr(e,'index'); | ||
| 104 | - let item=this.data.history[i]; | ||
| 105 | - item.title=item.name | ||
| 106 | - console.log(item) | ||
| 107 | - if(item.type==1){ | ||
| 108 | - | ||
| 109 | - }else{ | ||
| 110 | - | ||
| 111 | - } | ||
| 112 | - this.setData({ | ||
| 113 | - backfill: item.title | ||
| 114 | - }); | ||
| 115 | - | ||
| 116 | - let pages = getCurrentPages(); | ||
| 117 | - let p = pages[pages.length - 2]; | ||
| 118 | - p.setSuggestion(item) | ||
| 119 | - wx.navigateBack(); | ||
| 120 | - }, | ||
| 121 | inputVal:'', | 97 | inputVal:'', |
| 122 | //触发关键词输入提示事件 | 98 | //触发关键词输入提示事件 |
| 123 | getsuggest: function (e) { | 99 | getsuggest: function (e) { |
| @@ -283,4 +259,7 @@ Page({ | @@ -283,4 +259,7 @@ Page({ | ||
| 283 | }) | 259 | }) |
| 284 | } | 260 | } |
| 285 | }, | 261 | }, |
| 262 | + historyEmpty(){ | ||
| 263 | + App.Customer.DelHistorySearch() | ||
| 264 | + }, | ||
| 286 | }) | 265 | }) |
| @@ -24,16 +24,11 @@ | @@ -24,16 +24,11 @@ | ||
| 24 | <view class="pages"> | 24 | <view class="pages"> |
| 25 | <view class="flex-lr"> | 25 | <view class="flex-lr"> |
| 26 | <view class="history-title">最近搜索</view> | 26 | <view class="history-title">最近搜索</view> |
| 27 | - <view class="history-empty"></view> | 27 | + <view class="history-empty" bindtap="historyEmpty"></view> |
| 28 | </view> | 28 | </view> |
| 29 | <view class="history-list"> | 29 | <view class="history-list"> |
| 30 | - <view class="flex-ll item" wx:for="{{history}}" wx:key="history.key" | ||
| 31 | - bindtap="backHistoryFill" data-index="{{index}}"> | ||
| 32 | - <view class="icon-view icon-view-{{item.type}}"></view> | ||
| 33 | - <view class="info">{{item.name}}</view> | ||
| 34 | - </view> | ||
| 35 | <block wx:for="{{history}}" wx:key="history.key"> | 30 | <block wx:for="{{history}}" wx:key="history.key"> |
| 36 | - <search-item item="{{item}}" bindclick="searchItemClick"></search-item> | 31 | + <search-item item="{{item}}" hasHistory bindclick="searchItemClick"></search-item> |
| 37 | </block> | 32 | </block> |
| 38 | </view> | 33 | </view> |
| 39 | </view> | 34 | </view> |
| @@ -33,18 +33,7 @@ | @@ -33,18 +33,7 @@ | ||
| 33 | .res-view{ | 33 | .res-view{ |
| 34 | margin-top: 110rpx; | 34 | margin-top: 110rpx; |
| 35 | } | 35 | } |
| 36 | -.res-item{ | ||
| 37 | - width: 100%; | ||
| 38 | - border-bottom: 2rpx solid #cccccc; | ||
| 39 | - padding: 20rpx 0; | ||
| 40 | -} | ||
| 41 | -.res-item .label{ | ||
| 42 | - font-size: 30rpx; | ||
| 43 | -} | ||
| 44 | -.res-item .address{ | ||
| 45 | - font-size: 24rpx; | ||
| 46 | - color:#4C4E4F; | ||
| 47 | -} | 36 | + |
| 48 | .search-but{ | 37 | .search-but{ |
| 49 | min-width: 140rpx; | 38 | min-width: 140rpx; |
| 50 | color:#000000; | 39 | color:#000000; |
| @@ -65,41 +54,7 @@ | @@ -65,41 +54,7 @@ | ||
| 65 | font-weight:600; | 54 | font-weight:600; |
| 66 | margin-bottom: 20rpx; | 55 | margin-bottom: 20rpx; |
| 67 | } | 56 | } |
| 68 | -.hr-one{ | ||
| 69 | - height: 2rpx; | ||
| 70 | - background-color: #F5F5F5; | ||
| 71 | - width: 110%; | ||
| 72 | - margin: 18rpx -5% 0; | ||
| 73 | -} | ||
| 74 | -.history .item{ | ||
| 75 | - line-height: 50rpx; | ||
| 76 | - font-size: 28rpx; | ||
| 77 | - height:50rpx; | ||
| 78 | - background:rgba(245,245,245,1); | ||
| 79 | - border-radius:4px; | ||
| 80 | - font-weight:500; | ||
| 81 | - float: left; | ||
| 82 | - padding: 0 10rpx; | ||
| 83 | - margin-right: 20rpx; | ||
| 84 | - margin-bottom: 20rpx; | ||
| 85 | -} | ||
| 86 | -.history .icon-view{ | ||
| 87 | - width: 20rpx; | ||
| 88 | - height: 22rpx; | ||
| 89 | - min-width: 22rpx; | ||
| 90 | - margin-right: 10rpx; | ||
| 91 | - background-image: url("http://qn.colorcun.com/custom/lite-online/image/addr.png"); | ||
| 92 | - background-size: 100% 100%; | ||
| 93 | -} | ||
| 94 | -.history .icon-view-1{ | ||
| 95 | - width: 24rpx; | ||
| 96 | - height: 18rpx; | ||
| 97 | - min-width: 24rpx; | ||
| 98 | - margin-right: 10rpx; | ||
| 99 | - background-image: none; | ||
| 100 | - background-color: #999; | ||
| 101 | - background-size: 100% 100%; | ||
| 102 | -} | 57 | + |
| 103 | .see-more{ | 58 | .see-more{ |
| 104 | width: 100%; | 59 | width: 100%; |
| 105 | height: 34rpx; | 60 | height: 34rpx; |
| @@ -138,5 +93,6 @@ | @@ -138,5 +93,6 @@ | ||
| 138 | .history-empty{ | 93 | .history-empty{ |
| 139 | width: 28rpx; | 94 | width: 28rpx; |
| 140 | height: 28rpx; | 95 | height: 28rpx; |
| 141 | - background-color: #999; | 96 | + background-image: url("http://qn.colorcun.com/reserve/images/empty.png"); |
| 97 | + background-size: 100% 100%; | ||
| 142 | } | 98 | } |
| @@ -329,7 +329,9 @@ export default { | @@ -329,7 +329,9 @@ export default { | ||
| 329 | openid:'openid' | 329 | openid:'openid' |
| 330 | }, | 330 | }, |
| 331 | //搜索相关 | 331 | //搜索相关 |
| 332 | - 'App.Customer.DelHistorySearch':null, | 332 | + 'App.Customer.DelHistorySearch':{ |
| 333 | + openid:'openid' | ||
| 334 | + }, | ||
| 333 | //搜索相关 | 335 | //搜索相关 |
| 334 | 'App.Customer.GetHistorySearch':{ | 336 | 'App.Customer.GetHistorySearch':{ |
| 335 | openid:'openid', | 337 | openid:'openid', |
-
Please register or login to post a comment