Commit 1e7489a7571688d91fc33eecb6371ac8a638efe0

Authored by vking
1 parent ac4392db

search

@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
35 margin-right: 20rpx; 35 margin-right: 20rpx;
36 width: 22rpx; 36 width: 22rpx;
37 height:26rpx; 37 height:26rpx;
38 - background-color: #ccc; 38 + background-image: url("http://qn.colorcun.com/custom/lite-online/image/addr.png");
39 } 39 }
40 .item-1 .info{ 40 .item-1 .info{
41 width: calc(100% - 140rpx); 41 width: calc(100% - 140rpx);
@@ -20,6 +20,7 @@ Page({ @@ -20,6 +20,7 @@ Page({
20 suggestion:[], 20 suggestion:[],
21 hasSellerMore:false, 21 hasSellerMore:false,
22 keyword:'', 22 keyword:'',
  23 + sellerSplit:-1,
23 }, 24 },
24 25
25 /** 26 /**
@@ -58,13 +59,11 @@ Page({ @@ -58,13 +59,11 @@ Page({
58 59
59 }, 60 },
60 getHistory(){ 61 getHistory(){
61 - App.Customer.GetHistorySearch()  
62 - let ca=util.cache(search_history_cache_key);  
63 - if(ca){ 62 + App.Customer.GetHistorySearch().then(res=>{
64 this.setData({ 63 this.setData({
65 - history:ca 64 + history:res.data
66 }) 65 })
67 - } 66 + })
68 }, 67 },
69 setHistory(item){ 68 setHistory(item){
70 let newca=[item]; 69 let newca=[item];
@@ -103,8 +102,13 @@ Page({ @@ -103,8 +102,13 @@ Page({
103 backHistoryFill: function (e) { 102 backHistoryFill: function (e) {
104 var i = util.attr(e,'index'); 103 var i = util.attr(e,'index');
105 let item=this.data.history[i]; 104 let item=this.data.history[i];
  105 + item.title=item.name
106 console.log(item) 106 console.log(item)
107 - this.setHistory(item) 107 + if(item.type==1){
  108 +
  109 + }else{
  110 +
  111 + }
108 this.setData({ 112 this.setData({
109 backfill: item.title 113 backfill: item.title
110 }); 114 });
@@ -135,12 +139,15 @@ Page({ @@ -135,12 +139,15 @@ Page({
135 key:map_key, 139 key:map_key,
136 }).then(res=>{ 140 }).then(res=>{
137 res.data=res.data.data 141 res.data=res.data.data
138 - var sug = [],hasSellerMore=false 142 + var sug = [],hasSellerMore=false,sellerSplit=-1
139 for (var i = 0; i < res.data.length; i++) { 143 for (var i = 0; i < res.data.length; i++) {
140 if(i==2 && res.data[i].type==-1){ 144 if(i==2 && res.data[i].type==-1){
141 hasSellerMore=true 145 hasSellerMore=true
142 continue; 146 continue;
143 } 147 }
  148 + if((i==1 || i==2) && res.data[i-1].type==-1 && res.data[i].type!=-1){
  149 + sellerSplit=i-1
  150 + }
144 sug.push({ // 获取返回结果,放到sug数组中 151 sug.push({ // 获取返回结果,放到sug数组中
145 title: res.data[i].title, 152 title: res.data[i].title,
146 id: res.data[i].id, 153 id: res.data[i].id,
@@ -156,6 +163,7 @@ Page({ @@ -156,6 +163,7 @@ Page({
156 suggestion: sug, 163 suggestion: sug,
157 hasSellerMore:hasSellerMore, 164 hasSellerMore:hasSellerMore,
158 keyword:this.inputVal, 165 keyword:this.inputVal,
  166 + sellerSplit:sellerSplit,
159 }); 167 });
160 }) 168 })
161 }, 169 },
@@ -16,24 +16,25 @@ @@ -16,24 +16,25 @@
16 bindtap="backfill" id="{{index}}"> 16 bindtap="backfill" id="{{index}}">
17 <search-item item="{{item}}" keyword="{{keyword}}" bindclick="searchItemClick"></search-item> 17 <search-item item="{{item}}" keyword="{{keyword}}" bindclick="searchItemClick"></search-item>
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 </block> 20 </block>
20 </view> 21 </view>
21 </view> 22 </view>
22 <view class="history" wx:if="{{history.length>0 && suggestion.length<1}}"> 23 <view class="history" wx:if="{{history.length>0 && suggestion.length<1}}">
23 <view class="pages"> 24 <view class="pages">
24 - <view class="history-title">历史记录</view>  
25 - <view class="hr-one"></view> 25 + <view class="flex-lr">
  26 + <view class="history-title">最近搜索</view>
  27 + <view class="history-empty"></view>
  28 + </view>
26 <view class="history-list"> 29 <view class="history-list">
27 <view class="flex-ll item" wx:for="{{history}}" wx:key="history.key" 30 <view class="flex-ll item" wx:for="{{history}}" wx:key="history.key"
28 bindtap="backHistoryFill" data-index="{{index}}"> 31 bindtap="backHistoryFill" data-index="{{index}}">
29 - <view class="icon-view">  
30 - <image class="icon" src="http://qn.colorcun.com/custom/lite-online/image/addr.png"></image>  
31 - </view>  
32 - <view class="info">  
33 - <view class="title">{{item.title}}</view>  
34 - <view class="addr">{{item.addr}}</view>  
35 - </view> 32 + <view class="icon-view icon-view-{{item.type}}"></view>
  33 + <view class="info">{{item.name}}</view>
36 </view> 34 </view>
  35 + <block wx:for="{{history}}" wx:key="history.key">
  36 + <search-item item="{{item}}" bindclick="searchItemClick"></search-item>
  37 + </block>
37 </view> 38 </view>
38 </view> 39 </view>
39 </view> 40 </view>
@@ -62,6 +62,8 @@ @@ -62,6 +62,8 @@
62 color:#999999; 62 color:#999999;
63 height: 40rpx; 63 height: 40rpx;
64 line-height: 40rpx; 64 line-height: 40rpx;
  65 + font-weight:600;
  66 + margin-bottom: 20rpx;
65 } 67 }
66 .hr-one{ 68 .hr-one{
67 height: 2rpx; 69 height: 2rpx;
@@ -70,28 +72,34 @@ @@ -70,28 +72,34 @@
70 margin: 18rpx -5% 0; 72 margin: 18rpx -5% 0;
71 } 73 }
72 .history .item{ 74 .history .item{
73 - height: 120rpx;  
74 - line-height: 120rpx;  
75 -}  
76 -.history .icon{  
77 - width: 22rpx;  
78 - height: 26rpx;  
79 - min-width: 22rpx;  
80 - margin-right: 20rpx;  
81 -}  
82 -.history .title{ 75 + line-height: 50rpx;
83 font-size: 28rpx; 76 font-size: 28rpx;
84 - height: 40rpx;  
85 - line-height: 40rpx;  
86 - margin-bottom: 4rpx; 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;
87 } 85 }
88 -.history .addr{  
89 - font-size: 24rpx;  
90 - color:#999999;  
91 - height: 34rpx;  
92 - line-height: 34rpx; 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%;
93 } 102 }
94 -  
95 .see-more{ 103 .see-more{
96 width: 100%; 104 width: 100%;
97 height: 34rpx; 105 height: 34rpx;
@@ -122,4 +130,13 @@ @@ -122,4 +130,13 @@
122 left:calc(50% - 68rpx); 130 left:calc(50% - 68rpx);
123 top:0; 131 top:0;
124 text-align: center; 132 text-align: center;
  133 +}
  134 +.see-split{
  135 + width: 100%;
  136 + height: 20rpx;
  137 +}
  138 +.history-empty{
  139 + width: 28rpx;
  140 + height: 28rpx;
  141 + background-color: #999;
125 } 142 }
@@ -333,7 +333,7 @@ export default { @@ -333,7 +333,7 @@ export default {
333 //搜索相关 333 //搜索相关
334 'App.Customer.GetHistorySearch':{ 334 'App.Customer.GetHistorySearch':{
335 openid:'openid', 335 openid:'openid',
336 - cachetime: -1, 336 + //cachetime: -1,
337 }, 337 },
338 338
339 } 339 }