list.js
1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
var util = require('../../../../utils/util.js')
var uri=require('../../../../utils/uri.js');
const reserveStatus=['待确认','已预订','就餐中','已完成','已取消','已预订','已拒绝'];
Component({
properties:{
item:{
type:Object,
observer:function (v1,v2) {
this.changeitem()
}
}
},
data:{
vitem:null
},
attached(){
this.changeitem();
},
methods:{
detail:function(e){
var obj=this.data.vitem;
wx.navigateTo({
url:util.http_build_query({id:obj.id},'b_detail')
})
},
invitation:function(e){
var obj=this.data.vitem;
wx.navigateTo({
url:util.http_build_query({id:obj.id},'b_invitation')
})
},
changeitem:function () {
let item=this.data.item;
if(item.tid){
item.table_ids=item.tid.split(',');
}
item.phone_mask='';
if(item.phone){
item.phone_mask=item.phone.replace(/(\d{2})(.{5})(\d{3})/,function($0,$1,$2,$3){
return $1+'**'+$3;
})
}
if(item.rname){
if(item.sex==3){
item.rname_mask=item.rname.substr(0,10)
}else{
item.rname_mask=item.rname.substr(0,3)+(item.sex==1?'先生':item.sex==2?'女士':item.sex==4?'贵宾':'')
}
}else{
item.rname_mask=''
}
item.order_time=util.unixtoTime(item.ddate,'HH:II')
item.status_str=reserveStatus[item.status]||'';
this.setData({vitem:item})
},
callPhone(e){
if(util.attr(e,'phone').length<3){
return util.toast('号码错误','none');
}
wx.makePhoneCall({
phoneNumber: util.attr(e,'phone'), //仅为示例,并非真实的电话号码
})
},
}
})