Commit f9fbd27e52dd0347879da12641510a92a147626b

Authored by vking
1 parent 2f666428

search

... ... @@ -5,7 +5,7 @@ Component({
* 组件的属性列表
*/
properties: {
cla:String,
},
/**
... ...
<!--components/reserve/search/filter.wxml-->
<view class="filter {{hasDisplay?'animation-slide-top':''}}" catchtap="catchtap" wx:if="{{hasDisplay}}">
<view class="filter {{cla}} {{(hasDisplay && !cla)?'animation-slide-top':''}}" catchtap="catchtap" wx:if="{{hasDisplay}}">
<view class="part flex-ll">
人均消费
<view class="txt" wx:if="{{consumeStr}}">{{consumeStr}}</view>
... ...
... ... @@ -10,7 +10,9 @@
box-sizing: border-box;
border-radius: 0px 0px 40rpx 40rpx;
}
.bottom-search{
border-radius: 40rpx 40rpx 0px 0px ;
}
.part{
height: 48rpx;
font-size: 34rpx;
... ...
// components/reserve/search/how/hv/pnum.js
/**
早餐:7:00 —10:00
午餐:11:00 — 14:30
晚餐:16:00—22:00
取最近未到的时段
当天最后一个时段过了,那就第二天第一个时段
*/
import util from '../../../../utils/util'
var myBehavior = require('hv_behavior')
const items=[
{id:1,label:'早餐'},
{id:2,label:'午餐'},
{id:3,label:'晚餐'},
{id:1,label:'早餐',stime:'07:00',etime:'10:00'},
{id:2,label:'午餐',stime:'11:00',etime:'14:30'},
{id:3,label:'晚餐',stime:'16:00',etime:'22:00'},
{},
{},
]
... ... @@ -12,20 +20,36 @@ Component({
data:{
items:items,
},
lifetimes: {
created: function () {
// 在组件实例进入页面节点树时执行
this.type='dur'
},
detached: function () {
// 在组件实例被从页面节点树移除时执行
},
created: function () {
// 在组件实例进入页面节点树时执行
this.type='dur'
this.autoChecked()//自动选中
},
/**
* 组件的方法列表
*/
methods: {
autoChecked(){
let now=parseInt(new Date()/1000);
let nowHHII=util.unixtoTime(now,'HH:II')
let activeIndex=0
if(nowHHII>items[0].etime && nowHHII<=items[2].etime){//有效时间内计算
activeIndex=1
if(nowHHII>items[1].etime){
activeIndex=2
}
}
let dataset={
index:activeIndex,
val:items[activeIndex].id,
type:'dur',
}
//console.log('dur-dataset',dataset)
setTimeout(()=>{
this.checked({currentTarget:{dataset:dataset}})
},0)
}
}
})
... ...
... ... @@ -28,6 +28,9 @@ Component({
this.setData({
hidden:!this.data.hasPage
})
setTimeout(()=>{
this.submit()
},0)
},
observers: {
'findSellerData': function(findSellerData) {
... ... @@ -57,6 +60,9 @@ Component({
this.triggerEvent('event',{
params:this.params,
paramObj:paramObj,
paramStr:util.unixtoTime(this.params['date'].val,'MM月DD日(`DAY/周WW`)')
+' '+{1:'早餐',2:'午餐',3:'晚餐'}[this.params['dur'].val]
+' '+this.params['pnum'].val+'位',
})
},
show(){
... ...
... ... @@ -3,7 +3,7 @@
<view class="mask" wx:if="{{!hasPage}}" bindtap="hide"></view>
<view class="{{hasPage?'pages':'pages-window'}}">
<view class="title flex-lr">
<view class="title-name">您好,几位,什么时候</view>
<view class="title-name">您几位?什么时间用餐?</view>
<view class="close33" bindtap="hide"></view>
</view>
<view>
... ...
... ... @@ -34,12 +34,18 @@ Component({
this.position={}
this.isAddr=false
this.citys=await DA.getCitys()
this.cacheCity=null
this.setData({
citys: this.citys
})
let cache=util.cache(CACHE_LOCALTION_KEY)
if(cache && cache.city){
this.cacheCity=cache.city
}
this.selectComponent('#getpos').getPos();
},
rePos(e){
this.cacheCity=null
this.isAddr=util.attr(e,'isAddr')
this.selectComponent('#getpos').getPos();
},
... ... @@ -63,6 +69,7 @@ Component({
activeCity:activeCity,
})
this.event({city:activeCity,address:this.position.address,isAddr:false})
this.hide()
},
onpos(e) {
let res = e.detail;
... ... @@ -80,7 +87,9 @@ Component({
this.position.address_component= res.result.address_component
this.position.address=res.result.address
let activeCity={}
if(!this.data.code){
if(this.cacheCity){
activeCity=this.cacheCity
}else if(!this.data.code){
this.citys.some(ci=>{
if(ci.name==this.position.address_component.city){
activeCity=ci
... ... @@ -95,6 +104,7 @@ Component({
}
})
}
this.setData({
activeCity:activeCity,
address:this.position.address
... ...
... ... @@ -4,7 +4,9 @@
<view class="nav" style="margin-top: {{statusBarHeight}}px;">
<view class="flex-lr part" style="height: {{titleBarHeight}}px; line-height: {{titleBarHeight}}px">
<view class="opt flex-ll">
<view class="back flex-vc" bindtap="back" wx:if="{{disBack}}">
<view class="back flex-vc"
style="height: {{titleBarHeight}}px; line-height: {{titleBarHeight}}px"
bindtap="back" wx:if="{{disBack}}">
<image class="back-image"
src="http://nosqn.colorcun.com/custom/lite-yd/image/back{{backgroundColor!='#ffffff'?'-light':''}}.png"></image>
</view>
... ...
... ... @@ -42,6 +42,11 @@ Page({
* &keyword=
* &filterParams={"consumeStr":"¥200-300","min":"200","max":"300","active":"200,300"}
*/
/**
hasSuggestion=1&keyword=橡树湾&lat=39.662877&lng=118.130962&centre_pos=39.662877,118.130962&multiIndex=0&filter={"consumeStr":"¥200-300","min":"200","max":"300","active":"200,300"}&city={"code":"610100","pid":"610000","name":"西安市","status":"1","last_date":"1598949575"}&hows={"params":{"pnum":{"index":3,"val":4,"type":"pnum"},"date":{"index":0,"val":1606983211,"type":"date"},"dur":{"index":2,"val":3,"type":"dur"}},"paramObj":{"when_date":"2020-12-03","several":4,"daily":3},"paramStr":"12月03日(今天) 晚餐 4位"}
city={"code":"130200","pid":"130000","name":"唐山市","status":"1","last_date":"1598949575"}&hows={"params":{"pnum":{"index":3,"val":4,"type":"pnum"},"date":{"index":0,"val":1606984766,"type":"date"},"dur":{"index":2,"val":3,"type":"dur"}},"paramObj":{"when_date":"2020-12-03","several":4,"daily":3},"paramStr":"12月03日(今天) 晚餐 4位"}
*/
wx.getSystemInfo({
success:res=>{
console.log('wx.getSystemInfo',res)
... ... @@ -51,12 +56,25 @@ Page({
},
})
this.filterParams=null
if(options.filterParams){
this.filterParams=JSON.parse(options.filterParams)
if(options.filter){
this.filterParams=JSON.parse(options.filter)
this.setData({
filterParams:this.filterParams,
})
}
if(options.city){
this.city=JSON.parse(options.city)
}
if(options.hows){
this.hows=JSON.parse(options.hows)
let paramStr=this.hows.paramStr.split(" ");
this.setData({
headerHows:[
paramStr[0].substr(0,6),
paramStr[1]+' '+paramStr[2],
],
})
}
this.options=options;
if(options.hasSuggestion){
let pos=options.centre_pos.split(',')
... ... @@ -102,7 +120,7 @@ Page({
}
})
}catch(e){}
setTimeout(()=>{this.getList()},300)
//setTimeout(()=>{this.getList()},300)
},
... ... @@ -127,6 +145,13 @@ Page({
}
}
)
if(wx.getMenuButtonBoundingClientRect){
let rect=wx.getMenuButtonBoundingClientRect()
console.log(rect,getApp().system)
this.setData({
right:getApp().system.windowWidth - rect.right + rect.width + 10,
})
}
},
/**
... ... @@ -182,64 +207,21 @@ Page({
this.setData({
hasLoading:true,
})
let mapParam=this.options
this.offset=1 //page
this.size=20 //page size
this.setData({
keyword:mapParam.keyword||'',
})
if(mapParam.keyword){
this.param={
lat_extend:mapParam.lat,
lng_extend:mapParam.lng,
keyword:mapParam.keyword.trim(),
offset:this.offset,
size:this.size,
distance:500000,
};
if(mapParam.lat){
this.param.centre_pos=`${mapParam.lat},${mapParam.lng}`
}
if(mapParam.isopen_md){
this.param.isopen_md=1
}
}else{
//计算视窗中心
let lat,lng
if(this.suggestion){
lat=this.suggestion.latitude
lng=this.suggestion.longitude
this.setData({
keyword:this.suggestion.title,
})
}else if(this.hasCleanSuggestion){//清理地标使用人的位置
lat=this.location.latitude
lng=this.location.longitude
}
if(!lat || !lng){//不完整时,使用地图中心点
let map=JSON.parse(mapParam.map);
lat=map.northeast.latitude-(map.northeast.latitude-map.southwest.latitude)/2;
lng=map.northeast.longitude-(map.northeast.longitude-map.southwest.longitude)/2;
}
this.param={
lat:lat,
lng:lng,
lat_extend:mapParam.lat,
lng_extend:mapParam.lng,
offset:this.offset,
size:this.size,
distance:50,
};
if(this.suggestion || this.hasCleanSuggestion){
this.param.centre_pos=`${lat},${lng}`
}else{
if(mapParam.centre_pos){
this.param.centre_pos=mapParam.centre_pos
}
}
this.param={
offset:this.offset,
size:this.size,
code:this.city.code,
pid:this.city.pid,
keyword:this.options.keyword||'',
...this.hows.paramObj,
}
console.log('this.location',this.location)
if(this.location){
this.param.lat_extend=this.location.latitude
this.param.lng_extend=this.location.longitude
}
this.hasFilterData=false
if(this.filterGroupData.tags){
this.param.tags = this.filterGroupData.tags;
... ... @@ -254,7 +236,7 @@ Page({
this.hasFilterData=true
}
App.Customer.SellerLists(this.param).then(res=>{
App.Customer.GetSellerListByFoods(this.param).then(res=>{
this.setData({
rsl:[],
hasMore:res.data.length==this.size,
... ... @@ -283,7 +265,7 @@ Page({
getListMore(){
this.param.offset+=1;
let sellers=this.data.sellers;
App.Customer.SellerLists(this.param).then(res=>{
App.Customer.GetSellerListByFoods(this.param).then(res=>{
this.setData({
hasMore:res.data.length==this.size,
sellers:sellers.concat(this.sellerFormat(res.data)),
... ... @@ -384,11 +366,7 @@ Page({
onpos(e){
console.log('onpos',this.hasGetSellerEnd,e);
this.location=e.detail
if(!this.hasGetSellerEnd){
return setTimeout(()=>{
this.onpos(e)
},500)
}
this.getList()
// if(this.data.sellers.length<1){
// this.GetRecommendSellerList()
// }
... ... @@ -513,4 +491,20 @@ Page({
this.selectComponent('#as').show(e.detail.seller);
}
},
searchKeyword(){
let pages = getCurrentPages();
if(pages.length>=2){
let p = pages[pages.length - 2];
if(p.route=='pages/reserve/searchKeyword') {
return wx.navigateBack();
}
}
wx.navigateTo({
url:util.http_build_query({
filter:this.filterParams?JSON.stringify(this.filterParams):null,
city:JSON.stringify(this.city),
hows:JSON.stringify(this.hows),
},'/pages/reserve/searchKeyword')
})
},
})
\ No newline at end of file
... ...
<!--pages/reserve/indexList.wxml-->
<nav>周到安排</nav>
<view class="view content" style="height: calc(100vh - 65px);">
<nav>
<view class="view header flex align-center justify-center text-blue" style="right:{{right}}px;" wx:if="{{right>0}}">
<view class="view flex flex-direction" style="width: 174rpx;">
<view class="view txt-26-h">{{headerHows[0]}}</view>
<view class="view txt-26-h">{{headerHows[1]}}</view>
</view>
<view class="line margin-lr"></view>
<view class="flex justify-around align-center" style="width: 292rpx;">
<image class="margin-right-sm" wx:if="{{!keyword}}"
style="width: 32rpx; height: 32rpx;" src="http://nosqn.colorcun.com/search/s%20%2811%29.png"></image>
<view class="view text-cut txt-34-h" catchtap="searchKeyword">{{keyword||'搜索餐厅…'}}</view>
<view class="clean margin-left-sm" catchtap="moveToLocation" wx:if="{{keyword}}"></view>
</view>
</view>
</nav>
<!--
<view class="searchAddrView searchKeyword bg-white" bindtap="gotoSearch">
<view class="searchAddr flex-ll">
<image class="icon" src="http://nosqn.colorcun.com/custom/lite-online/image/search26.png"></image>
... ... @@ -10,6 +24,8 @@
<view class="clean" catchtap="moveToLocation" wx:if="{{keyword && hasSuggestion}}"></view>
</view>
</view>
-->
<view class="view content" style="height: calc(100vh - 65px);">
<filter-group height="{{height}}"
id="filter-group"
bindevent="filterGroupEvent"
... ... @@ -33,7 +49,7 @@
scroll-into-view="seller-{{scrollSellerID}}"
scroll-with-animation
bindscrolltolower="getListMore"
style="width:100%;height: calc(100vh - 150px);">
style="width:100%;height: calc(100vh - 65px);">
<block wx:for="{{sellers}}" wx:key="sellers" >
<navigator url="/pages/reserve/detail?id={{item.id}}" hover-class="navigator-hover">
<seller-card class="seller-card" id="seller-{{item.id}}"
... ... @@ -41,7 +57,7 @@
seller="{{item}}" bindevent="sellerCardEvent" ></seller-card>
</navigator>
</block>
<view class="view" style="height: 50rpx;"></view>
<view class="view" style="height: 160rpx;"></view>
</scroll-view>
</block>
</view>
... ...
... ... @@ -227,4 +227,38 @@
position: absolute;
top:16rpx;
left:32rpx;
}
.header{
width: 468rpx;
height: 80rpx;
background: #F4FAFF;
border-radius: 48rpx;
border: 2rpx solid #4C91F8;
position: fixed;
font-weight: 500;
}
.header .line{
width: 2rpx;
height: 32rpx;
background: #42A5FF;
}
.header .clean{
position: relative;
width: 100rpx;
height: 60rpx;
min-width: 100rpx;
}
.header .clean:after{
background-image: url("http://nosqn.colorcun.com/clean.png");
background-size: 100% 100%;
display: block;
content: "";
width:28rpx;
height:28rpx;
position: absolute;
top:16rpx;
left:32rpx;
}
\ No newline at end of file
... ...
// pages/reserve/home.js
import util from '../../utils/util'
Page({
/**
* 页面的初始数据
*/
data: {
location:'获取中...'
location:'获取中...',
hasFilter:false,//
},
/**
... ... @@ -81,11 +83,47 @@ Page({
dispalyLocation(){
this.selectComponent('#location').show();
},
meLocation(){
this.selectComponent('#location').rePos({currentTarget:{dataset:{isAddr:true}}});
},
locationEvent(e){
console.log('locationEvent',e.detail)
this.city=e.detail.city
this.setData({
location:e.detail.isAddr?e.detail.address:e.detail.city.name
})
}
},
filterParams:null,
displayFilter(){
this.selectComponent('#filter').show(this.filterParams);
this.setData({
hasFilter:true,
})
},
filterEvent(e){
console.log('filterEvent',e.detail)
if(e.detail.type=='set'){
this.filterParams=e.detail.data
this.setData({
hasFilter:false,
consumeStr:e.detail.data.consumeStr,
})
}else{
this.filterParams=null;
this.setData({
hasFilter:false,
consumeStr:'',
})
}
},
goPath(e){
let path=util.attr(e,'path');
wx.navigateTo({
url:util.http_build_query({
filter:this.filterParams?JSON.stringify(this.filterParams):null,
city:JSON.stringify(this.city),
hows:JSON.stringify(this.findSellerData),
},path)
})
},
})
\ No newline at end of file
... ...
... ... @@ -4,6 +4,7 @@
"navigationBarTitleText":"周到安排",
"usingComponents": {
"search-how":"/components/2.0/filter/how/index",
"location":"/components/2.0/filter/location"
"location":"/components/2.0/filter/location",
"filter":"/components/2.0/filter/filter"
}
}
\ No newline at end of file
... ...
... ... @@ -10,26 +10,35 @@
class="view flex-treble text-bold text-xl text-cut margin-right-lg">
{{location}}
</view>
<view class="view flex flex-direction align-center justify-center">
<view class="view flex flex-direction align-center justify-center" bindtap="meLocation">
<view class="view posicon"></view>
<view class="view text-blue txt-24-h" style="margin-top: 4rpx;">我的位置</view>
</view>
</view>
<view class="view solid-bottom flex justify-around align-center" style="height: 110rpx;" bindtap="dispalySearchHow">
<view class="flex-treble">sss</view>
<view class="flex-treble txt-36-h text-bold">{{findSellerData.paramStr}}</view>
<view class="more"></view>
</view>
<view class="view solid-bottom flex justify-around align-center" style="height: 110rpx;">
<view class="flex-treble">sss</view>
<view class="view solid-bottom flex justify-around align-center"
bindtap="goPath" data-path="/pages/reserve/searchKeyword"
style="height: 110rpx;">
<view class="flex-treble txt-32-h text-gray">搜索餐厅/位置/关键词</view>
<view class="more"></view>
</view>
<view class="view flex justify-around align-center" style="height: 110rpx;">
<view class="flex-treble">sss</view>
<view class="view flex justify-around align-center" style="height: 110rpx;" bindtap="displayFilter">
<view class="flex-treble txt-32-h {{consumeStr?'':'text-gray'}}">{{consumeStr||'人均消费'}}</view>
<view class="more"></view>
</view>
<view class="view flex justify-around align-center round bg-blue-blue text-bold" style="height: 84rpx;">
<view class="view flex justify-around align-center round bg-blue-blue text-bold"
bindtap="goPath" data-path="/pages/reserve/indexList"
style="height: 84rpx;">
查找包间
</view>
</view>
<search-how id="search-how" findSellerData="{{findSellerData}}" bindevent="howEvent"></search-how>
<location id="location" bindevent="locationEvent"></location>
\ No newline at end of file
<location id="location" bindevent="locationEvent"></location>
<view class="view filter-mask" hidden="{{!hasFilter}}">
<view class="view filter">
<filter id="filter" bindevent="filterEvent" cla="bottom-search"></filter>
</view>
</view>
\ No newline at end of file
... ...
... ... @@ -45,4 +45,17 @@
background-image: url("http://nosqn.colorcun.com/search/s%20%283%29.png");
width: 36rpx;
height: 36rpx;
}
.filter-mask{
background-color: rgba(0,0,0,0.5);
width: 100%;
height: 100%;
position: fixed;
z-index: 99999;
bottom:0;
left:0;
}
.filter{
position: relative;
margin-top: calc(100% + 30rpx);
}
\ No newline at end of file
... ...
... ... @@ -27,6 +27,10 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
//filter=null&city={"code":"610100","pid":"610000","name":"西安市","status":"1","last_date":"1598949575"}&hows={"params":{"pnum":{"index":3,"val":4,"type":"pnum"},"date":{"index":0,"val":1606979898,"type":"date"},"dur":{"index":2,"val":3,"type":"dur"}},"paramObj":{"when_date":"2020-12-03","several":4,"daily":3},"paramStr":"12月03日(今天)晚餐 4位"}
console.log('searchKeyword',options)
this.options=options
this.city=JSON.parse(options.city)
this.selectComponent('#getpos').getPos();
},
... ... @@ -116,11 +120,16 @@ Page({
let prarms={
keyword:this.inputVal,
region:this.location.city||'',
region_fix:0,
region_fix:1,
page_size:20,
page_index:1,
key:map_key,
}
if(this.city){
prarms.name=this.city.name
prarms.code=this.city.code
prarms.pid=this.city.pid
}
if(this.location.latitude){
prarms.location=this.location.latitude+','+this.location.longitude
}
... ... @@ -235,7 +244,7 @@ Page({
this.setData({
backfill: item.title
});
wx.navigateBack();
//wx.navigateBack();
}
}else{
wx.navigateTo({
... ... @@ -321,6 +330,7 @@ Page({
lng:suggestion.longitude,
centre_pos:`${suggestion.latitude},${suggestion.longitude}`,
multiIndex:0,
...this.options,
},'/pages/reserve/indexList')
})
},
... ...
... ... @@ -468,7 +468,7 @@
{
"name": "pages/reserve/indexList",
"pathName": "pages/reserve/indexList",
"query": "lat=39.65157&lng=118.15044&keyword=西安&multiIndex=0",
"query": "city={\"code\":\"130200\",\"pid\":\"130000\",\"name\":\"唐山市\",\"status\":\"1\",\"last_date\":\"1598949575\"}&hows={\"params\":{\"pnum\":{\"index\":3,\"val\":4,\"type\":\"pnum\"},\"date\":{\"index\":0,\"val\":1606984766,\"type\":\"date\"},\"dur\":{\"index\":2,\"val\":3,\"type\":\"dur\"}},\"paramObj\":{\"when_date\":\"2020-12-03\",\"several\":4,\"daily\":3},\"paramStr\":\"12月03日(今天) 晚餐 4位\"}",
"scene": null
},
{
... ...
... ... @@ -294,7 +294,9 @@ export default {
'App.Customer.SearchMap':null,
//根据腾讯地点搜索api整合现有商家
'App.Customer.KeywordTips':null,
'App.Customer.KeywordTips':{
alias:'App.App.KeywordTips'//限制城市
},
//设置C端用户常用信息
'App.Customer.SetCustomerInfo':{
... ... @@ -512,6 +514,9 @@ export default {
openid:'openid',
},
//根据区域查询指定条件下的商家列表
'App.Customer.GetSellerListByFoods':null,
//根据账单ID获取账单详情
'App.Foodset.GetFoodOrdersDetail':null,
... ...