Commit e8e69857c73d91a3ef6172d289b577c2e1205f0b

Authored by vking
1 parent e9f2251b

search page

... ... @@ -27,10 +27,10 @@ Component({
const logger =wx.getLogManager()
let consoleLog=console.log
console.hasRewrite=true
console.log=function () {
consoleLog(...arguments)
console.log.prototype=function(){
console.log(...arguments)
logger.debug(...arguments)
}
};
}
let openid=wx.getStorageSync('customer_openid');
if(!openid) return;
... ...
... ... @@ -14,11 +14,9 @@ Component({
items:items,
},
lifetimes: {
attached: function () {
created: function () {
// 在组件实例进入页面节点树时执行
this.setData({
spi:this.data.pi,
})
this.type='date'
},
detached: function () {
// 在组件实例被从页面节点树移除时执行
... ...
<!--components/reserve/search/how/hv/date.wxml-->
<wxs src="../../../../utils/util.wxs" module="util" />
<swiper previous-margin="35rpx" next-margin="45rpx"
class="tabs"
class="tabs" current="{{current}}"
display-multiple-items="5">
<swiper-item wx:for="{{items}}" wx:key="items">
<view class="item {{spi==index?'active':''}} flex-vc" bindtap="checked" data-index="{{index}}" data-val="{{item}}" data-type="date">
... ...
... ... @@ -13,12 +13,9 @@ Component({
items:items,
},
lifetimes: {
attached: function () {
created: function () {
// 在组件实例进入页面节点树时执行
console.log(this.data.pi)
this.setData({
spi:this.data.pi,
})
this.type='dur'
},
detached: function () {
// 在组件实例被从页面节点树移除时执行
... ...
... ... @@ -2,29 +2,58 @@
import util from '../../../../utils/util'
module.exports = Behavior({
properties: {
pi: {
type: Number,
value:0,
}
ckdata:{
type:Object,
val:null,
},
},
data: {
spi:0
},
attached: function(){
observers: {
'ckdata': function() {
this.checkedDefEvent()
}
},
methods: {
gotoHere(){
this.data.index;
},
checked(e){
checked(e,hasCurrent=false){
let index=util.attr(e,'index')
let val=util.attr(e,'val')
let type=util.attr(e,'type')
this.setData({
let obj={
spi:index,
})
}
if(hasCurrent){
let current=index-2
if(type=='date'){
current=current>10?10:current
}else if(type=='pnum'){
current=current>26?26:current
}
obj.current=current>-1?current:0
}
this.setData(obj)
this.triggerEvent('event',{index,val,type})
}
},
checkedDefEvent(){
console.log('this.type',this.type)
let type=this.type
let ckdata = {}
if (!this.data.ckdata) {//初始化值
if(type == 'dur') return;
let index, val
if (type == 'pnum') {
index = 3
val = this.data.items[index]
} else if (type == 'date') {
index = 0
val = this.data.items[index]
}
ckdata = {index, val, type}
}else{
ckdata = this.data.ckdata
}
this.checked({currentTarget:{dataset:ckdata}},true)
},
}
})
\ No newline at end of file
... ...
... ... @@ -9,17 +9,9 @@ Component({
type:Boolean,
value:false,
},
date_pi:{
type:Number,
value:0,
},
pnum_pi:{
type:Number,
value:0,
},
dur_pi:{
type:Number,
value:-1,
findSellerData:{
type:Object,
value:{},
}
},
... ... @@ -29,27 +21,37 @@ Component({
data: {
hidden:true,
},
attached(){
created(){
this.params={}
},
attached(){
this.setData({
hidden:!this.data.hasPage
})
},
observers: {
'findSellerData': function(findSellerData) {
console.log('page=>findSellerData',findSellerData)
}
},
/**
* 组件的方法列表
*/
methods: {
paramEvent(e){
console.log('paramEvent',e.detail)
console.log('paramEvent',e.detail.type,e.detail)
this.params[e.detail.type]=e.detail
},
submit(){
console.log(this.params)
let paramObj={
when_date:util.unixtoTime(this.params['date'].val,'YYYY-MM-DD'),
several:this.params['pnum'].val,
let paramObj={}
if(this.params['date']){
paramObj.when_date=util.unixtoTime(this.params['date'].val,'YYYY-MM-DD')
}
if(this.params['pnum']){
paramObj.several=this.params['pnum'].val
}
if(this.params['dur'].val>=0){
if(this.params['dur'] && this.params['dur'].val>=0){
paramObj.daily=this.params['dur'].val
}
this.triggerEvent('event',{
... ...
... ... @@ -7,11 +7,12 @@
<view class="close" bindtap="hide"></view>
</view>
<view>
<pnum bindevent="paramEvent" pi="{{pnum_pi}}"></pnum>
<pnum bindevent="paramEvent"
ckdata="{{findSellerData.params.pnum}}"></pnum>
<view style="margin: 60rpx 0">
<date bindevent="paramEvent" pi="{{pnum_pi}}"></date>
<date bindevent="paramEvent" ckdata="{{findSellerData.params.date}}"></date>
</view>
<dur bindevent="paramEvent" pi="{{dur_pi}}"></dur>
<dur bindevent="paramEvent" ckdata="{{findSellerData.params.dur}}"></dur>
</view>
<view class="submit" bindtap="submit">查找餐厅</view>
</view>
... ...
... ... @@ -12,13 +12,12 @@ Component({
behaviors: [myBehavior],
data:{
items:items,
current:0,
},
lifetimes: {
attached: function () {
created: function () {
// 在组件实例进入页面节点树时执行
this.setData({
spi:this.data.pi==0?3:this.data.pi,
})
this.type='pnum'
},
detached: function () {
// 在组件实例被从页面节点树移除时执行
... ...
<!--components/reserve/search/how/hv/pnum.wxml-->
<swiper previous-margin="35rpx" next-margin="45rpx"
class="tabs"
class="tabs" current="{{current}}"
display-multiple-items="5">
<swiper-item wx:for="{{items}}" wx:key="items">
<view class="item {{spi==index?'active':''}} flex-vc" bindtap="checked" data-index="{{index}}" data-val="{{item}}" data-type="pnum">
<view class="item {{spi==index?'active':''}} flex-vc"
bindtap="checked" data-index="{{index}}"
data-val="{{item}}" data-type="pnum">
<view class="name">{{item>30?'30位以上':item+' 位'}}</view>
</view>
</swiper-item>
... ...
... ... @@ -5,7 +5,7 @@ Page({
* 页面的初始数据
*/
data: {
findSellerData:null,
},
/**
... ... @@ -17,6 +17,9 @@ Page({
// 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
this.eventChannel.on('acceptDataFromMapPage', findSellerData=> {
console.log('findSellerData',findSellerData)
this.setData({
findSellerData:findSellerData,
})
})
},
... ...
<!--pages/reserve/findSeller.wxml-->
<nav id="nav">周到安排</nav>
<how bindevent="howEvent" hasPage></how>
<how bindevent="howEvent" hasPage findSellerData="{{findSellerData}}"></how>
... ...
... ... @@ -29,9 +29,7 @@
"projectname": "c%E7%AB%AF%E9%A2%84%E5%AE%9A",
"isGameTourist": false,
"simulatorType": "wechat",
"simulatorPluginLibVersion": {
"qywx_simulator_plugin": "1.2.0"
},
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"current": -1,
... ...