Showing
3 changed files
with
27 additions
and
15 deletions
| @@ -2,21 +2,19 @@ var util = require('../../../utils/util.js') | @@ -2,21 +2,19 @@ var util = require('../../../utils/util.js') | ||
| 2 | var uri=require('../../../utils/uri.js'); | 2 | var uri=require('../../../utils/uri.js'); |
| 3 | Component({ | 3 | Component({ |
| 4 | properties:{ | 4 | properties:{ |
| 5 | - item:Object | 5 | + item:{ |
| 6 | + type:Object, | ||
| 7 | + observer:function (v1,v2) { | ||
| 8 | + console.log(v2); | ||
| 9 | + console.log(this) | ||
| 10 | + } | ||
| 11 | + } | ||
| 6 | }, | 12 | }, |
| 7 | data:{ | 13 | data:{ |
| 8 | vitem:null | 14 | vitem:null |
| 9 | }, | 15 | }, |
| 10 | attached(){ | 16 | attached(){ |
| 11 | - let item=this.data.item; | ||
| 12 | - item.table_ids=item.tid.split(','); | ||
| 13 | - item.phone_mask=''; | ||
| 14 | - if(item.phone){ | ||
| 15 | - item.phone_mask=item.phone.replace(/(\d{2})(.{5})(\d{3})/,function($0,$1,$2,$3){ | ||
| 16 | - return $1+'**'+$3; | ||
| 17 | - }) | ||
| 18 | - } | ||
| 19 | - this.setData({vitem:item}) | 17 | + this.changeitem(); |
| 20 | }, | 18 | }, |
| 21 | methods:{ | 19 | methods:{ |
| 22 | detail:function(e){ | 20 | detail:function(e){ |
| @@ -25,6 +23,17 @@ Component({ | @@ -25,6 +23,17 @@ Component({ | ||
| 25 | url:util.http_build_query(obj,'b_detail') | 23 | url:util.http_build_query(obj,'b_detail') |
| 26 | }) | 24 | }) |
| 27 | }, | 25 | }, |
| 26 | + changeitem:function () { | ||
| 27 | + let item=this.data.item; | ||
| 28 | + item.table_ids=item.tid.split(','); | ||
| 29 | + item.phone_mask=''; | ||
| 30 | + if(item.phone){ | ||
| 31 | + item.phone_mask=item.phone.replace(/(\d{2})(.{5})(\d{3})/,function($0,$1,$2,$3){ | ||
| 32 | + return $1+'**'+$3; | ||
| 33 | + }) | ||
| 34 | + } | ||
| 35 | + this.setData({vitem:item}) | ||
| 36 | + } | ||
| 28 | 37 | ||
| 29 | } | 38 | } |
| 30 | }) | 39 | }) |
| @@ -56,8 +56,6 @@ Page({ | @@ -56,8 +56,6 @@ Page({ | ||
| 56 | 56 | ||
| 57 | }, | 57 | }, |
| 58 | onShow:function(){ | 58 | onShow:function(){ |
| 59 | - this.book=this.selectComponent('#bookorder'); | ||
| 60 | - console.log(this.book) | ||
| 61 | setTimeout(()=>{ | 59 | setTimeout(()=>{ |
| 62 | this.setData({ | 60 | this.setData({ |
| 63 | calendarMaskLoad:true, | 61 | calendarMaskLoad:true, |
| @@ -94,7 +92,12 @@ Page({ | @@ -94,7 +92,12 @@ Page({ | ||
| 94 | isloading:true, | 92 | isloading:true, |
| 95 | bookList:json.data.length==0 ? null : json.data | 93 | bookList:json.data.length==0 ? null : json.data |
| 96 | }) | 94 | }) |
| 97 | - console.log(that.data.bookList) | 95 | + if(json.data.length>0){ |
| 96 | + that.boolists=that.selectAllComponents('.orderbook'); | ||
| 97 | + that.boolists.forEach(function(v,i){ | ||
| 98 | + v.changeitem(); | ||
| 99 | + }) | ||
| 100 | + } | ||
| 98 | } | 101 | } |
| 99 | }) | 102 | }) |
| 100 | }, | 103 | }, |
| @@ -166,5 +169,5 @@ Page({ | @@ -166,5 +169,5 @@ Page({ | ||
| 166 | searchbook:function(e){ | 169 | searchbook:function(e){ |
| 167 | console.log(this.data.form) | 170 | console.log(this.data.form) |
| 168 | this.getbooklist(); | 171 | this.getbooklist(); |
| 169 | - } | 172 | + }, |
| 170 | }) | 173 | }) |
| @@ -45,7 +45,7 @@ | @@ -45,7 +45,7 @@ | ||
| 45 | <view class="book-list" style="padding-bottom:118rpx;"> | 45 | <view class="book-list" style="padding-bottom:118rpx;"> |
| 46 | <view class="book-list-body"> | 46 | <view class="book-list-body"> |
| 47 | <block wx:for="{{bookList}}"> | 47 | <block wx:for="{{bookList}}"> |
| 48 | - <bookList item="{{item}}" bind:changeitem="changeitem" id="bookorder"></bookList> | 48 | + <bookList item="{{item}}" class="orderbook"></bookList> |
| 49 | </block> | 49 | </block> |
| 50 | </view> | 50 | </view> |
| 51 | </view> | 51 | </view> |
-
Please register or login to post a comment