Showing
12 changed files
with
87 additions
and
58 deletions
| @@ -27,10 +27,10 @@ Component({ | @@ -27,10 +27,10 @@ Component({ | ||
| 27 | const logger =wx.getLogManager() | 27 | const logger =wx.getLogManager() |
| 28 | let consoleLog=console.log | 28 | let consoleLog=console.log |
| 29 | console.hasRewrite=true | 29 | console.hasRewrite=true |
| 30 | - console.log=function () { | ||
| 31 | - consoleLog(...arguments) | 30 | + console.log.prototype=function(){ |
| 31 | + console.log(...arguments) | ||
| 32 | logger.debug(...arguments) | 32 | logger.debug(...arguments) |
| 33 | - } | 33 | + }; |
| 34 | } | 34 | } |
| 35 | let openid=wx.getStorageSync('customer_openid'); | 35 | let openid=wx.getStorageSync('customer_openid'); |
| 36 | if(!openid) return; | 36 | if(!openid) return; |
| @@ -14,11 +14,9 @@ Component({ | @@ -14,11 +14,9 @@ Component({ | ||
| 14 | items:items, | 14 | items:items, |
| 15 | }, | 15 | }, |
| 16 | lifetimes: { | 16 | lifetimes: { |
| 17 | - attached: function () { | 17 | + created: function () { |
| 18 | // 在组件实例进入页面节点树时执行 | 18 | // 在组件实例进入页面节点树时执行 |
| 19 | - this.setData({ | ||
| 20 | - spi:this.data.pi, | ||
| 21 | - }) | 19 | + this.type='date' |
| 22 | }, | 20 | }, |
| 23 | detached: function () { | 21 | detached: function () { |
| 24 | // 在组件实例被从页面节点树移除时执行 | 22 | // 在组件实例被从页面节点树移除时执行 |
| 1 | <!--components/reserve/search/how/hv/date.wxml--> | 1 | <!--components/reserve/search/how/hv/date.wxml--> |
| 2 | <wxs src="../../../../utils/util.wxs" module="util" /> | 2 | <wxs src="../../../../utils/util.wxs" module="util" /> |
| 3 | <swiper previous-margin="35rpx" next-margin="45rpx" | 3 | <swiper previous-margin="35rpx" next-margin="45rpx" |
| 4 | - class="tabs" | 4 | + class="tabs" current="{{current}}" |
| 5 | display-multiple-items="5"> | 5 | display-multiple-items="5"> |
| 6 | <swiper-item wx:for="{{items}}" wx:key="items"> | 6 | <swiper-item wx:for="{{items}}" wx:key="items"> |
| 7 | <view class="item {{spi==index?'active':''}} flex-vc" bindtap="checked" data-index="{{index}}" data-val="{{item}}" data-type="date"> | 7 | <view class="item {{spi==index?'active':''}} flex-vc" bindtap="checked" data-index="{{index}}" data-val="{{item}}" data-type="date"> |
| @@ -13,12 +13,9 @@ Component({ | @@ -13,12 +13,9 @@ Component({ | ||
| 13 | items:items, | 13 | items:items, |
| 14 | }, | 14 | }, |
| 15 | lifetimes: { | 15 | lifetimes: { |
| 16 | - attached: function () { | 16 | + created: function () { |
| 17 | // 在组件实例进入页面节点树时执行 | 17 | // 在组件实例进入页面节点树时执行 |
| 18 | - console.log(this.data.pi) | ||
| 19 | - this.setData({ | ||
| 20 | - spi:this.data.pi, | ||
| 21 | - }) | 18 | + this.type='dur' |
| 22 | }, | 19 | }, |
| 23 | detached: function () { | 20 | detached: function () { |
| 24 | // 在组件实例被从页面节点树移除时执行 | 21 | // 在组件实例被从页面节点树移除时执行 |
| @@ -2,29 +2,58 @@ | @@ -2,29 +2,58 @@ | ||
| 2 | import util from '../../../../utils/util' | 2 | import util from '../../../../utils/util' |
| 3 | module.exports = Behavior({ | 3 | module.exports = Behavior({ |
| 4 | properties: { | 4 | properties: { |
| 5 | - pi: { | ||
| 6 | - type: Number, | ||
| 7 | - value:0, | ||
| 8 | - } | 5 | + ckdata:{ |
| 6 | + type:Object, | ||
| 7 | + val:null, | ||
| 8 | + }, | ||
| 9 | }, | 9 | }, |
| 10 | data: { | 10 | data: { |
| 11 | - | 11 | + spi:0 |
| 12 | }, | 12 | }, |
| 13 | - attached: function(){ | ||
| 14 | - | 13 | + observers: { |
| 14 | + 'ckdata': function() { | ||
| 15 | + this.checkedDefEvent() | ||
| 16 | + } | ||
| 15 | }, | 17 | }, |
| 16 | methods: { | 18 | methods: { |
| 17 | - gotoHere(){ | ||
| 18 | - this.data.index; | ||
| 19 | - }, | ||
| 20 | - checked(e){ | 19 | + checked(e,hasCurrent=false){ |
| 21 | let index=util.attr(e,'index') | 20 | let index=util.attr(e,'index') |
| 22 | let val=util.attr(e,'val') | 21 | let val=util.attr(e,'val') |
| 23 | let type=util.attr(e,'type') | 22 | let type=util.attr(e,'type') |
| 24 | - this.setData({ | 23 | + let obj={ |
| 25 | spi:index, | 24 | spi:index, |
| 26 | - }) | 25 | + } |
| 26 | + if(hasCurrent){ | ||
| 27 | + let current=index-2 | ||
| 28 | + if(type=='date'){ | ||
| 29 | + current=current>10?10:current | ||
| 30 | + }else if(type=='pnum'){ | ||
| 31 | + current=current>26?26:current | ||
| 32 | + } | ||
| 33 | + obj.current=current>-1?current:0 | ||
| 34 | + } | ||
| 35 | + this.setData(obj) | ||
| 27 | this.triggerEvent('event',{index,val,type}) | 36 | this.triggerEvent('event',{index,val,type}) |
| 28 | - } | 37 | + }, |
| 38 | + checkedDefEvent(){ | ||
| 39 | + console.log('this.type',this.type) | ||
| 40 | + let type=this.type | ||
| 41 | + let ckdata = {} | ||
| 42 | + if (!this.data.ckdata) {//初始化值 | ||
| 43 | + if(type == 'dur') return; | ||
| 44 | + let index, val | ||
| 45 | + if (type == 'pnum') { | ||
| 46 | + index = 3 | ||
| 47 | + val = this.data.items[index] | ||
| 48 | + } else if (type == 'date') { | ||
| 49 | + index = 0 | ||
| 50 | + val = this.data.items[index] | ||
| 51 | + } | ||
| 52 | + ckdata = {index, val, type} | ||
| 53 | + }else{ | ||
| 54 | + ckdata = this.data.ckdata | ||
| 55 | + } | ||
| 56 | + this.checked({currentTarget:{dataset:ckdata}},true) | ||
| 57 | + }, | ||
| 29 | } | 58 | } |
| 30 | }) | 59 | }) |
| @@ -9,17 +9,9 @@ Component({ | @@ -9,17 +9,9 @@ Component({ | ||
| 9 | type:Boolean, | 9 | type:Boolean, |
| 10 | value:false, | 10 | value:false, |
| 11 | }, | 11 | }, |
| 12 | - date_pi:{ | ||
| 13 | - type:Number, | ||
| 14 | - value:0, | ||
| 15 | - }, | ||
| 16 | - pnum_pi:{ | ||
| 17 | - type:Number, | ||
| 18 | - value:0, | ||
| 19 | - }, | ||
| 20 | - dur_pi:{ | ||
| 21 | - type:Number, | ||
| 22 | - value:-1, | 12 | + findSellerData:{ |
| 13 | + type:Object, | ||
| 14 | + value:{}, | ||
| 23 | } | 15 | } |
| 24 | }, | 16 | }, |
| 25 | 17 | ||
| @@ -29,27 +21,37 @@ Component({ | @@ -29,27 +21,37 @@ Component({ | ||
| 29 | data: { | 21 | data: { |
| 30 | hidden:true, | 22 | hidden:true, |
| 31 | }, | 23 | }, |
| 32 | - attached(){ | 24 | + created(){ |
| 33 | this.params={} | 25 | this.params={} |
| 26 | + }, | ||
| 27 | + attached(){ | ||
| 34 | this.setData({ | 28 | this.setData({ |
| 35 | hidden:!this.data.hasPage | 29 | hidden:!this.data.hasPage |
| 36 | }) | 30 | }) |
| 37 | }, | 31 | }, |
| 32 | + observers: { | ||
| 33 | + 'findSellerData': function(findSellerData) { | ||
| 34 | + console.log('page=>findSellerData',findSellerData) | ||
| 35 | + } | ||
| 36 | + }, | ||
| 38 | /** | 37 | /** |
| 39 | * 组件的方法列表 | 38 | * 组件的方法列表 |
| 40 | */ | 39 | */ |
| 41 | methods: { | 40 | methods: { |
| 42 | paramEvent(e){ | 41 | paramEvent(e){ |
| 43 | - console.log('paramEvent',e.detail) | 42 | + console.log('paramEvent',e.detail.type,e.detail) |
| 44 | this.params[e.detail.type]=e.detail | 43 | this.params[e.detail.type]=e.detail |
| 45 | }, | 44 | }, |
| 46 | submit(){ | 45 | submit(){ |
| 47 | console.log(this.params) | 46 | console.log(this.params) |
| 48 | - let paramObj={ | ||
| 49 | - when_date:util.unixtoTime(this.params['date'].val,'YYYY-MM-DD'), | ||
| 50 | - several:this.params['pnum'].val, | 47 | + let paramObj={} |
| 48 | + if(this.params['date']){ | ||
| 49 | + paramObj.when_date=util.unixtoTime(this.params['date'].val,'YYYY-MM-DD') | ||
| 50 | + } | ||
| 51 | + if(this.params['pnum']){ | ||
| 52 | + paramObj.several=this.params['pnum'].val | ||
| 51 | } | 53 | } |
| 52 | - if(this.params['dur'].val>=0){ | 54 | + if(this.params['dur'] && this.params['dur'].val>=0){ |
| 53 | paramObj.daily=this.params['dur'].val | 55 | paramObj.daily=this.params['dur'].val |
| 54 | } | 56 | } |
| 55 | this.triggerEvent('event',{ | 57 | this.triggerEvent('event',{ |
| @@ -7,11 +7,12 @@ | @@ -7,11 +7,12 @@ | ||
| 7 | <view class="close" bindtap="hide"></view> | 7 | <view class="close" bindtap="hide"></view> |
| 8 | </view> | 8 | </view> |
| 9 | <view> | 9 | <view> |
| 10 | - <pnum bindevent="paramEvent" pi="{{pnum_pi}}"></pnum> | 10 | + <pnum bindevent="paramEvent" |
| 11 | + ckdata="{{findSellerData.params.pnum}}"></pnum> | ||
| 11 | <view style="margin: 60rpx 0"> | 12 | <view style="margin: 60rpx 0"> |
| 12 | - <date bindevent="paramEvent" pi="{{pnum_pi}}"></date> | 13 | + <date bindevent="paramEvent" ckdata="{{findSellerData.params.date}}"></date> |
| 13 | </view> | 14 | </view> |
| 14 | - <dur bindevent="paramEvent" pi="{{dur_pi}}"></dur> | 15 | + <dur bindevent="paramEvent" ckdata="{{findSellerData.params.dur}}"></dur> |
| 15 | </view> | 16 | </view> |
| 16 | <view class="submit" bindtap="submit">查找餐厅</view> | 17 | <view class="submit" bindtap="submit">查找餐厅</view> |
| 17 | </view> | 18 | </view> |
| @@ -12,13 +12,12 @@ Component({ | @@ -12,13 +12,12 @@ Component({ | ||
| 12 | behaviors: [myBehavior], | 12 | behaviors: [myBehavior], |
| 13 | data:{ | 13 | data:{ |
| 14 | items:items, | 14 | items:items, |
| 15 | + current:0, | ||
| 15 | }, | 16 | }, |
| 16 | lifetimes: { | 17 | lifetimes: { |
| 17 | - attached: function () { | 18 | + created: function () { |
| 18 | // 在组件实例进入页面节点树时执行 | 19 | // 在组件实例进入页面节点树时执行 |
| 19 | - this.setData({ | ||
| 20 | - spi:this.data.pi==0?3:this.data.pi, | ||
| 21 | - }) | 20 | + this.type='pnum' |
| 22 | }, | 21 | }, |
| 23 | detached: function () { | 22 | detached: function () { |
| 24 | // 在组件实例被从页面节点树移除时执行 | 23 | // 在组件实例被从页面节点树移除时执行 |
| 1 | <!--components/reserve/search/how/hv/pnum.wxml--> | 1 | <!--components/reserve/search/how/hv/pnum.wxml--> |
| 2 | <swiper previous-margin="35rpx" next-margin="45rpx" | 2 | <swiper previous-margin="35rpx" next-margin="45rpx" |
| 3 | - class="tabs" | 3 | + class="tabs" current="{{current}}" |
| 4 | display-multiple-items="5"> | 4 | display-multiple-items="5"> |
| 5 | <swiper-item wx:for="{{items}}" wx:key="items"> | 5 | <swiper-item wx:for="{{items}}" wx:key="items"> |
| 6 | - <view class="item {{spi==index?'active':''}} flex-vc" bindtap="checked" data-index="{{index}}" data-val="{{item}}" data-type="pnum"> | 6 | + <view class="item {{spi==index?'active':''}} flex-vc" |
| 7 | + bindtap="checked" data-index="{{index}}" | ||
| 8 | + data-val="{{item}}" data-type="pnum"> | ||
| 7 | <view class="name">{{item>30?'30位以上':item+' 位'}}</view> | 9 | <view class="name">{{item>30?'30位以上':item+' 位'}}</view> |
| 8 | </view> | 10 | </view> |
| 9 | </swiper-item> | 11 | </swiper-item> |
| @@ -5,7 +5,7 @@ Page({ | @@ -5,7 +5,7 @@ Page({ | ||
| 5 | * 页面的初始数据 | 5 | * 页面的初始数据 |
| 6 | */ | 6 | */ |
| 7 | data: { | 7 | data: { |
| 8 | - | 8 | + findSellerData:null, |
| 9 | }, | 9 | }, |
| 10 | 10 | ||
| 11 | /** | 11 | /** |
| @@ -17,6 +17,9 @@ Page({ | @@ -17,6 +17,9 @@ Page({ | ||
| 17 | // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据 | 17 | // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据 |
| 18 | this.eventChannel.on('acceptDataFromMapPage', findSellerData=> { | 18 | this.eventChannel.on('acceptDataFromMapPage', findSellerData=> { |
| 19 | console.log('findSellerData',findSellerData) | 19 | console.log('findSellerData',findSellerData) |
| 20 | + this.setData({ | ||
| 21 | + findSellerData:findSellerData, | ||
| 22 | + }) | ||
| 20 | }) | 23 | }) |
| 21 | }, | 24 | }, |
| 22 | 25 |
| @@ -29,9 +29,7 @@ | @@ -29,9 +29,7 @@ | ||
| 29 | "projectname": "c%E7%AB%AF%E9%A2%84%E5%AE%9A", | 29 | "projectname": "c%E7%AB%AF%E9%A2%84%E5%AE%9A", |
| 30 | "isGameTourist": false, | 30 | "isGameTourist": false, |
| 31 | "simulatorType": "wechat", | 31 | "simulatorType": "wechat", |
| 32 | - "simulatorPluginLibVersion": { | ||
| 33 | - "qywx_simulator_plugin": "1.2.0" | ||
| 34 | - }, | 32 | + "simulatorPluginLibVersion": {}, |
| 35 | "condition": { | 33 | "condition": { |
| 36 | "search": { | 34 | "search": { |
| 37 | "current": -1, | 35 | "current": -1, |
-
Please register or login to post a comment