Commit 5b313ca7b0f0552c99b69ff25ad27140a8e6d0e9
Merge branch 'master' of http://123.56.79.57/xt/xcx-book
# By vking # Via vking * 'master' of http://123.56.79.57/xt/xcx-book: search search search search search search search search search
Showing
19 changed files
with
424 additions
and
130 deletions
| 1 | <!--components/actionSheet/index.wxml--> | 1 | <!--components/actionSheet/index.wxml--> |
| 2 | -<action-sheet hidden="{{actionSheetHidden}}" bindchange="actionSheetChange"> | ||
| 3 | - <view class="tip"><slot></slot></view> | 2 | +<action-sheet hidden="{{actionSheetHidden}}" bindchange="actionSheetChange" class="action-sheet"> |
| 3 | + <view class="tip" wx:if="{{hasTip}}"><slot></slot></view> | ||
| 4 | <block wx:for="{{items}}" wx:key="items.key"> | 4 | <block wx:for="{{items}}" wx:key="items.key"> |
| 5 | <action-sheet-item bindtap="bindItemTap" data-value="{{item}}" data-index="{{index}}">{{item}}</action-sheet-item> | 5 | <action-sheet-item bindtap="bindItemTap" data-value="{{item}}" data-index="{{index}}">{{item}}</action-sheet-item> |
| 6 | </block> | 6 | </block> |
| 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 |
components/reserve/search/item.js
0 → 100644
| 1 | +// components/reserve/search/item.js | ||
| 2 | +import App from '../../../utils/api'; | ||
| 3 | +Component({ | ||
| 4 | + /** | ||
| 5 | + * 组件的属性列表 | ||
| 6 | + */ | ||
| 7 | + properties: { | ||
| 8 | + item:{ | ||
| 9 | + type:Object, | ||
| 10 | + value:{} | ||
| 11 | + }, | ||
| 12 | + keyword:{ | ||
| 13 | + type:String, | ||
| 14 | + value:"", | ||
| 15 | + }, | ||
| 16 | + hasHistory:{ | ||
| 17 | + type:Boolean, | ||
| 18 | + value:false, | ||
| 19 | + }, | ||
| 20 | + }, | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 组件的初始数据 | ||
| 24 | + */ | ||
| 25 | + data: { | ||
| 26 | + | ||
| 27 | + }, | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 组件的方法列表 | ||
| 31 | + */ | ||
| 32 | + methods: { | ||
| 33 | + detailGo(){ | ||
| 34 | + this.SetHistorySearch(); | ||
| 35 | + this.triggerEvent('click',{act:'detail',data:this.data.item}) | ||
| 36 | + }, | ||
| 37 | + reserveGo(){ | ||
| 38 | + this.SetHistorySearch(); | ||
| 39 | + this.triggerEvent('click',{act:'reserve',data:this.data.item}) | ||
| 40 | + }, | ||
| 41 | + SetHistorySearch() { | ||
| 42 | + let item=this.data.item | ||
| 43 | + console.log('SetHistorySearch',item) | ||
| 44 | + let params={ | ||
| 45 | + keyword:this.data.keyword, | ||
| 46 | + type:item.type==-1?1:2, | ||
| 47 | + sid:item.id, | ||
| 48 | + name:item.title, | ||
| 49 | + openid:'', | ||
| 50 | + longitude:item.longitude, | ||
| 51 | + latitude:item.latitude, | ||
| 52 | + } | ||
| 53 | + App.Customer.SetHistorySearch(params) | ||
| 54 | + App.Customer.GetHistorySearch({},'clear') | ||
| 55 | + }, | ||
| 56 | + } | ||
| 57 | +}) |
components/reserve/search/item.json
0 → 100644
components/reserve/search/item.wxml
0 → 100644
| 1 | +<!--components/reserve/search/item.wxml--> | ||
| 2 | +<wxs src="../../../utils/util.wxs" module="util" /> | ||
| 3 | +<view class="history flex-lr" bindtap="detailGo" wx:if="{{hasHistory}}"> | ||
| 4 | + <view class="icon icon{{item.type}}"></view> | ||
| 5 | + <view class="text">{{item.title}}</view> | ||
| 6 | +</view> | ||
| 7 | +<view class="item item{{item.type}} flex-ll" bindtap="detailGo" wx:else=""> | ||
| 8 | + <view class="icon"></view> | ||
| 9 | + <view class="flex-lr item-info"> | ||
| 10 | + <view class="info"> | ||
| 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> | ||
| 24 | + </view> | ||
| 25 | + <view class="reserve-but" wx:if="{{item.is_online_reserve==1}}" catchtap="reserveGo">包间预订</view> | ||
| 26 | + </view> | ||
| 27 | +</view> |
components/reserve/search/item.wxss
0 → 100644
| 1 | +/* components/reserve/search/item.wxss */ | ||
| 2 | +@import "../../../app.wxss"; | ||
| 3 | +.item{ | ||
| 4 | + width: 100%; | ||
| 5 | + box-sizing: border-box; | ||
| 6 | + margin-bottom: 40rpx; | ||
| 7 | +} | ||
| 8 | +.item-1{ | ||
| 9 | + margin-bottom: 20rpx; | ||
| 10 | +} | ||
| 11 | +.item-1 .item-info{ | ||
| 12 | + width: calc(100% - 60rpx); | ||
| 13 | + max-width: calc(100% - 60rpx); | ||
| 14 | + box-sizing: border-box; | ||
| 15 | +} | ||
| 16 | +.item .title{ | ||
| 17 | + font-size: 28rpx; | ||
| 18 | + height: 40rpx; | ||
| 19 | + line-height: 40rpx; | ||
| 20 | + white-space:nowrap; | ||
| 21 | + overflow: hidden; | ||
| 22 | + text-overflow:ellipsis; | ||
| 23 | + | ||
| 24 | +} | ||
| 25 | +.item .addr{ | ||
| 26 | + font-size: 24rpx; | ||
| 27 | + height: 34rpx; | ||
| 28 | + line-height: 34rpx; | ||
| 29 | + margin-top: 4rpx; | ||
| 30 | + white-space:nowrap; | ||
| 31 | + overflow: hidden; | ||
| 32 | + text-overflow:ellipsis; | ||
| 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 | +} | ||
| 44 | +.item .icon{ | ||
| 45 | + margin-right: 20rpx; | ||
| 46 | + width: 22rpx; | ||
| 47 | + height:26rpx; | ||
| 48 | + background-image: url("http://qn.colorcun.com/reserve/images/addr.png"); | ||
| 49 | + background-size: 100% 100%; | ||
| 50 | +} | ||
| 51 | +.item-1 .info{ | ||
| 52 | + width: calc(100% - 140rpx); | ||
| 53 | + max-width: calc(100% - 140rpx); | ||
| 54 | +} | ||
| 55 | +.item-1{ | ||
| 56 | + background:rgba(255,255,255,1); | ||
| 57 | + box-shadow:0 0 8rpx 0 rgba(196,196,196,0.5); | ||
| 58 | + border-radius:10rpx; | ||
| 59 | + padding: 20rpx; | ||
| 60 | +} | ||
| 61 | +.item-1 .icon { | ||
| 62 | + background-image: url("http://qn.colorcun.com/reserve/images/sea-se.png"); | ||
| 63 | + width: 36rpx; | ||
| 64 | + height: 36rpx; | ||
| 65 | + min-width: 36rpx; | ||
| 66 | +} | ||
| 67 | +.reserve-but{ | ||
| 68 | + width:120rpx; | ||
| 69 | + height:40rpx; | ||
| 70 | + background:linear-gradient(360deg,rgba(131,131,131,1) 0%,rgba(76,76,76,1) 100%); | ||
| 71 | + border-radius:25rpx; | ||
| 72 | + font-size:24rpx; | ||
| 73 | + font-weight:500; | ||
| 74 | + color:rgba(240,206,161,1); | ||
| 75 | + line-height:40rpx; | ||
| 76 | + text-shadow:0rpx 2rpx 6rpx rgba(80,80,80,1); | ||
| 77 | + text-align: center; | ||
| 78 | + min-width: 120rpx; | ||
| 79 | + margin-left: 20rpx; | ||
| 80 | +} | ||
| 81 | + | ||
| 82 | +.history{ | ||
| 83 | + line-height: 50rpx; | ||
| 84 | + font-size: 28rpx; | ||
| 85 | + height:50rpx; | ||
| 86 | + background:rgba(245,245,245,1); | ||
| 87 | + border-radius:4px; | ||
| 88 | + font-weight:500; | ||
| 89 | + float: left; | ||
| 90 | + padding: 0 10rpx; | ||
| 91 | + margin-right: 20rpx; | ||
| 92 | + margin-bottom: 20rpx; | ||
| 93 | +} | ||
| 94 | +.history .icon{ | ||
| 95 | + background-size: 100% 100%; | ||
| 96 | + margin-right: 10rpx; | ||
| 97 | + width: 20rpx; | ||
| 98 | + height: 24rpx; | ||
| 99 | + min-width: 20rpx; | ||
| 100 | + background-image: url("http://qn.colorcun.com/reserve/images/addr.png"); | ||
| 101 | +} | ||
| 102 | +.history .icon-1{ | ||
| 103 | + width: 24rpx; | ||
| 104 | + height: 18rpx; | ||
| 105 | + min-width: 24rpx; | ||
| 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; | ||
| 124 | +} |
| @@ -204,7 +204,7 @@ | @@ -204,7 +204,7 @@ | ||
| 204 | </view> | 204 | </view> |
| 205 | 205 | ||
| 206 | </view> | 206 | </view> |
| 207 | - <as id="as" items="{{seller.seller_tel}}" bindclick="reservePhone">拨打电话预订</as> | 207 | + <as id="as" items="{{seller.seller_tel}}" bindclick="reservePhone" hasTip="{{false}}"></as> |
| 208 | <getpos bindpos="onpos" id="getpos"></getpos> | 208 | <getpos bindpos="onpos" id="getpos"></getpos> |
| 209 | <discount id="discount" seller="{{seller}}" bindhide="discountHide" bindshow="discountShow"></discount> | 209 | <discount id="discount" seller="{{seller}}" bindhide="discountHide" bindshow="discountShow"></discount> |
| 210 | <share id="share" seller_id="{{seller.id}}" seller="{{seller}}" wx:if="{{seller.id}}"></share> | 210 | <share id="share" seller_id="{{seller.id}}" seller="{{seller}}" wx:if="{{seller.id}}"></share> |
| @@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
| 26 | </cover-view> | 26 | </cover-view> |
| 27 | <cover-view class="searchAddr flex-ll"> | 27 | <cover-view class="searchAddr flex-ll"> |
| 28 | <cover-image class="icon" src="http://qn.colorcun.com/custom/lite-online/image/search26.png"></cover-image> | 28 | <cover-image class="icon" src="http://qn.colorcun.com/custom/lite-online/image/search26.png"></cover-image> |
| 29 | - <cover-view class="title">{{hasSuggestion?suggestion.title:'搜索店铺、地点或商圈'}}</cover-view> | 29 | + <cover-view class="title">{{hasSuggestion?suggestion.title:'输入餐厅名或地名,快速订包间'}}</cover-view> |
| 30 | </cover-view> | 30 | </cover-view> |
| 31 | </cover-view> | 31 | </cover-view> |
| 32 | </formids> | 32 | </formids> |
| @@ -117,7 +117,7 @@ page{ | @@ -117,7 +117,7 @@ page{ | ||
| 117 | 117 | ||
| 118 | .searchAddr { | 118 | .searchAddr { |
| 119 | margin-left: 15rpx; | 119 | margin-left: 15rpx; |
| 120 | - width: 380rpx; | 120 | + width: 400rpx; |
| 121 | height: 60rpx; | 121 | height: 60rpx; |
| 122 | background-color: #fefefe; | 122 | background-color: #fefefe; |
| 123 | border-radius: 30rpx; | 123 | border-radius: 30rpx; |
| @@ -93,19 +93,30 @@ Page({ | @@ -93,19 +93,30 @@ Page({ | ||
| 93 | let mapParam=this.options | 93 | let mapParam=this.options |
| 94 | this.offset=1 //page | 94 | this.offset=1 //page |
| 95 | this.size=20 //page size | 95 | this.size=20 //page size |
| 96 | - //计算视窗中心 | ||
| 97 | - let map=JSON.parse(mapParam.map); | ||
| 98 | - let lat=map.northeast.latitude-(map.northeast.latitude-map.southwest.latitude)/2; | ||
| 99 | - let lng=map.northeast.longitude-(map.northeast.longitude-map.southwest.longitude)/2; | ||
| 100 | - this.param={ | ||
| 101 | - lat:lat, | ||
| 102 | - lng:lng, | ||
| 103 | - lat_extend:mapParam.lat, | ||
| 104 | - lng_extend:mapParam.lng, | ||
| 105 | - offset:this.offset, | ||
| 106 | - size:this.size, | ||
| 107 | - distance:50, | ||
| 108 | - }; | 96 | + if(mapParam.keyword){ |
| 97 | + this.param={ | ||
| 98 | + lat_extend:mapParam.lat, | ||
| 99 | + lng_extend:mapParam.lng, | ||
| 100 | + keyword:mapParam.keyword, | ||
| 101 | + offset:this.offset, | ||
| 102 | + size:this.size, | ||
| 103 | + distance:5000, | ||
| 104 | + }; | ||
| 105 | + }else{ | ||
| 106 | + //计算视窗中心 | ||
| 107 | + let map=JSON.parse(mapParam.map); | ||
| 108 | + let lat=map.northeast.latitude-(map.northeast.latitude-map.southwest.latitude)/2; | ||
| 109 | + let lng=map.northeast.longitude-(map.northeast.longitude-map.southwest.longitude)/2; | ||
| 110 | + this.param={ | ||
| 111 | + lat:lat, | ||
| 112 | + lng:lng, | ||
| 113 | + lat_extend:mapParam.lat, | ||
| 114 | + lng_extend:mapParam.lng, | ||
| 115 | + offset:this.offset, | ||
| 116 | + size:this.size, | ||
| 117 | + distance:50, | ||
| 118 | + }; | ||
| 119 | + } | ||
| 109 | if(this.data.multiIndex[0]>0){ | 120 | if(this.data.multiIndex[0]>0){ |
| 110 | this.param.cuisine=await DA.getCatesID(this.data.multiIndex[0]-1); | 121 | this.param.cuisine=await DA.getCatesID(this.data.multiIndex[0]-1); |
| 111 | } | 122 | } |
| @@ -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 | /** |
| @@ -18,13 +16,15 @@ Page({ | @@ -18,13 +16,15 @@ Page({ | ||
| 18 | data: { | 16 | data: { |
| 19 | history:[], | 17 | history:[], |
| 20 | suggestion:[], | 18 | suggestion:[], |
| 19 | + hasSellerMore:false, | ||
| 20 | + keyword:'', | ||
| 21 | + sellerSplit:-1, | ||
| 21 | }, | 22 | }, |
| 22 | 23 | ||
| 23 | /** | 24 | /** |
| 24 | * 生命周期函数--监听页面加载 | 25 | * 生命周期函数--监听页面加载 |
| 25 | */ | 26 | */ |
| 26 | onLoad: function (options) { | 27 | onLoad: function (options) { |
| 27 | - this.getHistory(); | ||
| 28 | this.getPos() | 28 | this.getPos() |
| 29 | }, | 29 | }, |
| 30 | 30 | ||
| @@ -39,7 +39,7 @@ Page({ | @@ -39,7 +39,7 @@ Page({ | ||
| 39 | * 生命周期函数--监听页面显示 | 39 | * 生命周期函数--监听页面显示 |
| 40 | */ | 40 | */ |
| 41 | onShow: function () { | 41 | onShow: function () { |
| 42 | - | 42 | + this.getHistory(); |
| 43 | }, | 43 | }, |
| 44 | 44 | ||
| 45 | /** | 45 | /** |
| @@ -56,26 +56,23 @@ Page({ | @@ -56,26 +56,23 @@ Page({ | ||
| 56 | 56 | ||
| 57 | }, | 57 | }, |
| 58 | getHistory(){ | 58 | getHistory(){ |
| 59 | - let ca=util.cache(search_history_cache_key); | ||
| 60 | - if(ca){ | 59 | + App.Customer.GetHistorySearch().then(res=>{ |
| 60 | + let mks=[] | ||
| 61 | + res.data.forEach(h=>{ | ||
| 62 | + mks.push({ // 获取返回结果,放到mks数组中 | ||
| 63 | + title: h.name, | ||
| 64 | + id: h.sid, | ||
| 65 | + addr: '', | ||
| 66 | + city: '', | ||
| 67 | + district: 0, | ||
| 68 | + latitude: h.latitude, | ||
| 69 | + longitude: h.longitude, | ||
| 70 | + type:h.type==1?-1:h.type, | ||
| 71 | + }) | ||
| 72 | + }) | ||
| 61 | this.setData({ | 73 | this.setData({ |
| 62 | - history:ca | 74 | + history:mks |
| 63 | }) | 75 | }) |
| 64 | - } | ||
| 65 | - }, | ||
| 66 | - setHistory(item){ | ||
| 67 | - let newca=[item]; | ||
| 68 | - let ca=this.data.history; | ||
| 69 | - let maxL=20; | ||
| 70 | - for(let i=0;i<ca.length;i++){ | ||
| 71 | - if(ca[i].id!=item.id){ | ||
| 72 | - newca.push(ca[i]); | ||
| 73 | - } | ||
| 74 | - if(newca.length>maxL) break; | ||
| 75 | - } | ||
| 76 | - util.cache(search_history_cache_key,newca); | ||
| 77 | - this.setData({ | ||
| 78 | - history:newca, | ||
| 79 | }) | 76 | }) |
| 80 | }, | 77 | }, |
| 81 | //在Page({})中使用下列代码 | 78 | //在Page({})中使用下列代码 |
| @@ -85,7 +82,6 @@ Page({ | @@ -85,7 +82,6 @@ Page({ | ||
| 85 | for (var i = 0; i < this.data.suggestion.length; i++) { | 82 | for (var i = 0; i < this.data.suggestion.length; i++) { |
| 86 | if (i == id) { | 83 | if (i == id) { |
| 87 | console.log('backfill,this.data.suggestion[i]:',this.data.suggestion[i]) | 84 | console.log('backfill,this.data.suggestion[i]:',this.data.suggestion[i]) |
| 88 | - this.setHistory(this.data.suggestion[i]) | ||
| 89 | let pages = getCurrentPages(); | 85 | let pages = getCurrentPages(); |
| 90 | let p = pages[pages.length - 2]; | 86 | let p = pages[pages.length - 2]; |
| 91 | p.setSuggestion(this.data.suggestion[i]) | 87 | p.setSuggestion(this.data.suggestion[i]) |
| @@ -97,24 +93,9 @@ Page({ | @@ -97,24 +93,9 @@ Page({ | ||
| 97 | } | 93 | } |
| 98 | } | 94 | } |
| 99 | }, | 95 | }, |
| 100 | - backHistoryFill: function (e) { | ||
| 101 | - var i = util.attr(e,'index'); | ||
| 102 | - let item=this.data.history[i]; | ||
| 103 | - console.log(item) | ||
| 104 | - this.setHistory(item) | ||
| 105 | - this.setData({ | ||
| 106 | - backfill: item.title | ||
| 107 | - }); | ||
| 108 | - | ||
| 109 | - let pages = getCurrentPages(); | ||
| 110 | - let p = pages[pages.length - 2]; | ||
| 111 | - p.setSuggestion(item) | ||
| 112 | - wx.navigateBack(); | ||
| 113 | - }, | ||
| 114 | inputVal:'', | 96 | inputVal:'', |
| 115 | //触发关键词输入提示事件 | 97 | //触发关键词输入提示事件 |
| 116 | getsuggest: function (e) { | 98 | getsuggest: function (e) { |
| 117 | - var _this = this; | ||
| 118 | //调用关键词提示接口 | 99 | //调用关键词提示接口 |
| 119 | this.inputVal=e.detail.value; | 100 | this.inputVal=e.detail.value; |
| 120 | if(e.detail.value.length<1){ | 101 | if(e.detail.value.length<1){ |
| @@ -132,21 +113,27 @@ Page({ | @@ -132,21 +113,27 @@ Page({ | ||
| 132 | key:map_key, | 113 | key:map_key, |
| 133 | }).then(res=>{ | 114 | }).then(res=>{ |
| 134 | res.data=res.data.data | 115 | res.data=res.data.data |
| 135 | - var sug = []; | 116 | + var sug = [],hasSellerMore=false,sellerSplit=-1 |
| 136 | for (var i = 0; i < res.data.length; i++) { | 117 | for (var i = 0; i < res.data.length; i++) { |
| 137 | - sug.push({ // 获取返回结果,放到sug数组中 | ||
| 138 | - title: res.data[i].title, | ||
| 139 | - id: res.data[i].id, | ||
| 140 | - addr: res.data[i].address, | ||
| 141 | - city: res.data[i].city, | ||
| 142 | - district: res.data[i].district, | ||
| 143 | - latitude: res.data[i].location.lat, | ||
| 144 | - longitude: res.data[i].location.lng, | ||
| 145 | - type:res.data[i].type, | ||
| 146 | - }); | 118 | + if(i==2 && res.data[i].type==-1){ |
| 119 | + hasSellerMore=true | ||
| 120 | + continue; | ||
| 121 | + } | ||
| 122 | + if((i==1 || i==2) && res.data[i-1].type==-1 && res.data[i].type!=-1){ | ||
| 123 | + sellerSplit=i-1 | ||
| 124 | + } | ||
| 125 | + let item=res.data[i] | ||
| 126 | + item.latitude=item.location.lat | ||
| 127 | + item.longitude=item.location.lng | ||
| 128 | + item.addr=item.address | ||
| 129 | + item.titles=item.title.match(new RegExp('(.*)('+this.inputVal+')(.*)')) | ||
| 130 | + sug.push(item); | ||
| 147 | } | 131 | } |
| 148 | - _this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示 | ||
| 149 | - suggestion: sug | 132 | + this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示 |
| 133 | + suggestion: sug, | ||
| 134 | + hasSellerMore:hasSellerMore, | ||
| 135 | + keyword:this.inputVal, | ||
| 136 | + sellerSplit:sellerSplit, | ||
| 150 | }); | 137 | }); |
| 151 | }) | 138 | }) |
| 152 | }, | 139 | }, |
| @@ -161,7 +148,6 @@ Page({ | @@ -161,7 +148,6 @@ Page({ | ||
| 161 | orderby:'_distance', | 148 | orderby:'_distance', |
| 162 | key:map_key, | 149 | key:map_key, |
| 163 | }).then(res=>{ | 150 | }).then(res=>{ |
| 164 | - res.data=res.data.data | ||
| 165 | var mks = [] | 151 | var mks = [] |
| 166 | for (var i = 0; i < res.data.length; i++) { | 152 | for (var i = 0; i < res.data.length; i++) { |
| 167 | mks.push({ // 获取返回结果,放到mks数组中 | 153 | mks.push({ // 获取返回结果,放到mks数组中 |
| @@ -173,6 +159,7 @@ Page({ | @@ -173,6 +159,7 @@ Page({ | ||
| 173 | latitude: res.data[i].location.lat, | 159 | latitude: res.data[i].location.lat, |
| 174 | longitude: res.data[i].location.lng, | 160 | longitude: res.data[i].location.lng, |
| 175 | type:res.data[i].type, | 161 | type:res.data[i].type, |
| 162 | + category:res.data[i].category, | ||
| 176 | }) | 163 | }) |
| 177 | } | 164 | } |
| 178 | this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示 | 165 | this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示 |
| @@ -227,5 +214,51 @@ Page({ | @@ -227,5 +214,51 @@ Page({ | ||
| 227 | } | 214 | } |
| 228 | }, | 215 | }, |
| 229 | }) | 216 | }) |
| 230 | - } | 217 | + }, |
| 218 | + gotoList(){ | ||
| 219 | + wx.navigateTo({ | ||
| 220 | + url:util.http_build_query({ | ||
| 221 | + lat:this.location.latitude, | ||
| 222 | + lng:this.location.longitude, | ||
| 223 | + keyword:this.inputVal, | ||
| 224 | + multiIndex:0, | ||
| 225 | + },'./indexList') | ||
| 226 | + }) | ||
| 227 | + }, | ||
| 228 | + searchItemClick(e){ | ||
| 229 | + //console.log('searchItemClick',e) | ||
| 230 | + let item=e.detail.data | ||
| 231 | + if(e.detail.act=='detail'){ | ||
| 232 | + if(item.type==-1){ | ||
| 233 | + wx.navigateTo({ | ||
| 234 | + url:util.http_build_query({ | ||
| 235 | + id:item.id, | ||
| 236 | + },'./detail') | ||
| 237 | + }) | ||
| 238 | + }else{ | ||
| 239 | + let pages = getCurrentPages(); | ||
| 240 | + let p = pages[pages.length - 2]; | ||
| 241 | + p.setSuggestion(item) | ||
| 242 | + this.setData({ | ||
| 243 | + backfill: item.title | ||
| 244 | + }); | ||
| 245 | + wx.navigateBack(); | ||
| 246 | + } | ||
| 247 | + }else{ | ||
| 248 | + wx.navigateTo({ | ||
| 249 | + url:util.http_build_query({ | ||
| 250 | + id:item.id, | ||
| 251 | + activeTab:'reserve', | ||
| 252 | + },'./detail') | ||
| 253 | + }) | ||
| 254 | + } | ||
| 255 | + }, | ||
| 256 | + historyEmpty(){ | ||
| 257 | + App.Customer.DelHistorySearch().then(()=>{ | ||
| 258 | + App.Customer.GetHistorySearch({},'clear') | ||
| 259 | + this.setData({ | ||
| 260 | + history:[] | ||
| 261 | + }) | ||
| 262 | + }) | ||
| 263 | + }, | ||
| 231 | }) | 264 | }) |
| @@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
| 4 | "navigationBarTitleText":"周到安排", | 4 | "navigationBarTitleText":"周到安排", |
| 5 | "usingComponents": { | 5 | "usingComponents": { |
| 6 | "formids":"/components/formids/formids", | 6 | "formids":"/components/formids/formids", |
| 7 | - "nav":"/components/nav/nav" | 7 | + "nav":"/components/nav/nav", |
| 8 | + "search-item":"/components/reserve/search/item" | ||
| 8 | } | 9 | } |
| 9 | } | 10 | } |
| @@ -4,40 +4,33 @@ | @@ -4,40 +4,33 @@ | ||
| 4 | <view class="searchAddrView"> | 4 | <view class="searchAddrView"> |
| 5 | <view class="searchAddr flex-ll"> | 5 | <view class="searchAddr flex-ll"> |
| 6 | <image class="icon" src="http://qn.colorcun.com/custom/lite-online/image/search26.png"></image> | 6 | <image class="icon" src="http://qn.colorcun.com/custom/lite-online/image/search26.png"></image> |
| 7 | - <input style="width: 100%;" placeholder="搜索店铺、地点或商圈" | 7 | + <input style="width: 100%;" placeholder="输入餐厅名或地名,快速订包间" |
| 8 | type="text" confirm-type="done" | 8 | type="text" confirm-type="done" |
| 9 | focus | 9 | focus |
| 10 | bindinput="getsuggest" value="{{backfill}}"/> | 10 | bindinput="getsuggest" value="{{backfill}}"/> |
| 11 | - <view class="search-but" bindtap="nearby_search">搜索</view> | ||
| 12 | </view> | 11 | </view> |
| 13 | </view> | 12 | </view> |
| 14 | <view class="res-view"> | 13 | <view class="res-view"> |
| 15 | <!--绑定回填事件--> | 14 | <!--绑定回填事件--> |
| 16 | - <view class="res-item" wx:for="{{suggestion}}" wx:key="index" | ||
| 17 | - bindtap="backfill" id="{{index}}"> | ||
| 18 | - <!--根据需求渲染相应数据--> | ||
| 19 | - <!--渲染地址title--> | ||
| 20 | - <view class="label">{{item.title}}</view> | ||
| 21 | - <!--渲染详细地址--> | ||
| 22 | - <view class="address">{{item.addr}}</view> | ||
| 23 | - </view> | 15 | + <block wx:for="{{suggestion}}" wx:key="index" |
| 16 | + bindtap="backfill" id="{{index}}"> | ||
| 17 | + <search-item item="{{item}}" keyword="{{keyword}}" bindclick="searchItemClick"></search-item> | ||
| 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> | ||
| 20 | + </block> | ||
| 21 | + <view class="see-more bottom" wx:if="{{suggestion.length>0}}"></view> | ||
| 24 | </view> | 22 | </view> |
| 25 | </view> | 23 | </view> |
| 26 | <view class="history" wx:if="{{history.length>0 && suggestion.length<1}}"> | 24 | <view class="history" wx:if="{{history.length>0 && suggestion.length<1}}"> |
| 27 | <view class="pages"> | 25 | <view class="pages"> |
| 28 | - <view class="history-title">历史记录</view> | ||
| 29 | - <view class="hr-one"></view> | 26 | + <view class="flex-lr"> |
| 27 | + <view class="history-title">最近搜索</view> | ||
| 28 | + <view class="history-empty" bindtap="historyEmpty"></view> | ||
| 29 | + </view> | ||
| 30 | <view class="history-list"> | 30 | <view class="history-list"> |
| 31 | - <view class="flex-ll item" wx:for="{{history}}" wx:key="history.key" | ||
| 32 | - bindtap="backHistoryFill" data-index="{{index}}"> | ||
| 33 | - <view class="icon-view"> | ||
| 34 | - <image class="icon" src="http://qn.colorcun.com/custom/lite-online/image/addr.png"></image> | ||
| 35 | - </view> | ||
| 36 | - <view class="info"> | ||
| 37 | - <view class="title">{{item.title}}</view> | ||
| 38 | - <view class="addr">{{item.addr}}</view> | ||
| 39 | - </view> | ||
| 40 | - </view> | 31 | + <block wx:for="{{history}}" wx:key="history.key"> |
| 32 | + <search-item item="{{item}}" hasHistory bindclick="searchItemClick"></search-item> | ||
| 33 | + </block> | ||
| 41 | </view> | 34 | </view> |
| 42 | </view> | 35 | </view> |
| 43 | </view> | 36 | </view> |
| @@ -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; |
| @@ -33,18 +36,7 @@ | @@ -33,18 +36,7 @@ | ||
| 33 | .res-view{ | 36 | .res-view{ |
| 34 | margin-top: 110rpx; | 37 | margin-top: 110rpx; |
| 35 | } | 38 | } |
| 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 | -} | 39 | + |
| 48 | .search-but{ | 40 | .search-but{ |
| 49 | min-width: 140rpx; | 41 | min-width: 140rpx; |
| 50 | color:#000000; | 42 | color:#000000; |
| @@ -62,32 +54,53 @@ | @@ -62,32 +54,53 @@ | ||
| 62 | color:#999999; | 54 | color:#999999; |
| 63 | height: 40rpx; | 55 | height: 40rpx; |
| 64 | line-height: 40rpx; | 56 | line-height: 40rpx; |
| 57 | + font-weight:600; | ||
| 58 | + margin-bottom: 20rpx; | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +.see-more{ | ||
| 62 | + width: 100%; | ||
| 63 | + height: 34rpx; | ||
| 64 | + position: relative; | ||
| 65 | + margin-bottom: 40rpx; | ||
| 66 | + margin-top: 40rpx; | ||
| 65 | } | 67 | } |
| 66 | -.hr-one{ | 68 | +.see-more:before{ |
| 69 | + content: ""; | ||
| 70 | + width: 100%; | ||
| 67 | height: 2rpx; | 71 | height: 2rpx; |
| 68 | background-color: #F5F5F5; | 72 | background-color: #F5F5F5; |
| 69 | - width: 110%; | ||
| 70 | - margin: 18rpx -5% 0; | 73 | + position: absolute; |
| 74 | + left: 0; | ||
| 75 | + top:17rpx; | ||
| 71 | } | 76 | } |
| 72 | -.history .item{ | ||
| 73 | - height: 120rpx; | ||
| 74 | - line-height: 120rpx; | 77 | +.see-more:after{ |
| 78 | + content: "查看更多"; | ||
| 79 | + width:136rpx; | ||
| 80 | + height:34rpx; | ||
| 81 | + font-size:24rpx; | ||
| 82 | + font-weight:500; | ||
| 83 | + color:rgba(153,153,153,1); | ||
| 84 | + line-height:34rpx; | ||
| 85 | + background-color: #fefefe; | ||
| 86 | + position: absolute; | ||
| 87 | + display: block; | ||
| 88 | + left:calc(50% - 68rpx); | ||
| 89 | + top:0; | ||
| 90 | + text-align: center; | ||
| 75 | } | 91 | } |
| 76 | -.history .icon{ | ||
| 77 | - width: 22rpx; | ||
| 78 | - height: 26rpx; | ||
| 79 | - min-width: 22rpx; | ||
| 80 | - margin-right: 20rpx; | 92 | +.see-more.bottom:after{ |
| 93 | + width:200rpx; | ||
| 94 | + content: "我是有底线的"; | ||
| 95 | + left:calc(50% - 100rpx); | ||
| 81 | } | 96 | } |
| 82 | -.history .title{ | ||
| 83 | - font-size: 28rpx; | ||
| 84 | - height: 40rpx; | ||
| 85 | - line-height: 40rpx; | ||
| 86 | - margin-bottom: 4rpx; | 97 | +.see-split{ |
| 98 | + width: 100%; | ||
| 99 | + height: 20rpx; | ||
| 87 | } | 100 | } |
| 88 | -.history .addr{ | ||
| 89 | - font-size: 24rpx; | ||
| 90 | - color:#999999; | ||
| 91 | - height: 34rpx; | ||
| 92 | - line-height: 34rpx; | 101 | +.history-empty{ |
| 102 | + width: 28rpx; | ||
| 103 | + height: 28rpx; | ||
| 104 | + background-image: url("http://qn.colorcun.com/reserve/images/empty.png"); | ||
| 105 | + background-size: 100% 100%; | ||
| 93 | } | 106 | } |
| @@ -352,7 +352,7 @@ | @@ -352,7 +352,7 @@ | ||
| 352 | "id": 39, | 352 | "id": 39, |
| 353 | "name": "pages/reserve/detail 在线订座 ", | 353 | "name": "pages/reserve/detail 在线订座 ", |
| 354 | "pathName": "pages/reserve/detail", | 354 | "pathName": "pages/reserve/detail", |
| 355 | - "query": "id=689&fromid=&activeTab=reserve", | 355 | + "query": "id=80&fromid=&activeTab=", |
| 356 | "scene": null | 356 | "scene": null |
| 357 | }, | 357 | }, |
| 358 | { | 358 | { |
| @@ -323,5 +323,19 @@ export default { | @@ -323,5 +323,19 @@ export default { | ||
| 323 | 'App.Seller.VerificationIsAdmin':{ | 323 | 'App.Seller.VerificationIsAdmin':{ |
| 324 | cachetime: 1800, | 324 | cachetime: 1800, |
| 325 | }, | 325 | }, |
| 326 | + | ||
| 327 | + //搜索相关 | ||
| 328 | + 'App.Customer.SetHistorySearch':{ | ||
| 329 | + openid:'openid' | ||
| 330 | + }, | ||
| 331 | + //搜索相关 | ||
| 332 | + 'App.Customer.DelHistorySearch':{ | ||
| 333 | + openid:'openid' | ||
| 334 | + }, | ||
| 335 | + //搜索相关 | ||
| 336 | + 'App.Customer.GetHistorySearch':{ | ||
| 337 | + openid:'openid', | ||
| 338 | + cachetime: -1, | ||
| 339 | + }, | ||
| 326 | 340 | ||
| 327 | } | 341 | } |
| @@ -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