b_detail.js
5.13 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
var util = require('../../utils/util.js')
var uri=require('../../utils/uri.js')
import App from '../../utils/api';
const {regeneratorRuntime} = global
Page({
onLoad:function (opt) {
util.setBarTitle('预定详情');
console.log(opt)
opt.name=opt.name.length>3 ? opt.name.slice(0,3)+'...' : opt.name
opt.rdateStr=util.unixtoTime(opt.rdate,"MM月DD日 HH:II")
this.setData({
sellerid:util.cache('sellerid'),
phoneNumber:opt.phone,
bookInfo:opt
})
wx.showShareMenu({
withShareTicket: true,
success:function(res){
console.log(res)
}
})
this.chooseManagerInit();
},
onShow:function(){
this.getsellerInfo();
this.getdesklist();
var that=this;
this.notice=this.selectComponent('#notice');
util.postSuccessFun=function(json,uri_code){
switch (uri_code) {
case uri.CGI__USER_GETSELLERBYID__CODE:
console.log(json)
if(json.ret==200){
that.setData({
storeInfo:json.data.data
})
}
break;
case uri.CGI_USER_GETTABLELIST__CODE:
var list=json.data;
var templist=[];
for(var key in list){
if(key!='typex' && key!='typey'){
list[key].list.forEach(function(v,i){
templist.push(v)
})
}
}
var tables=that.data.bookInfo.tid.split(',');
var selecttable=[];
templist.forEach(function (v,i) {
tables.forEach(function(r,n){
if(r==v.id){
v.name=v.name.length>4 ? v.name.slice(0,3)+'...' : v.name;
selecttable.push(v)
}
})
})
console.log(selecttable)
that.setData({
selecttable:selecttable
})
break;
}
}
},
noticeCall:function(){
this.notice.show();
},
getsellerInfo:function(){
util.post(uri.CGI__USER_GETSELLERBYID,{sellerid:this.data.sellerid},uri.CGI__USER_GETSELLERBYID__CODE);
},
getdesklist:function(){
util.post(uri.CGI_USER_GETTABLELIST,{sid:this.data.sellerid,pnum:parseInt(this.data.bookInfo.pnum),rdate:this.data.bookInfo.rdate},uri.CGI_USER_GETTABLELIST__CODE)
},
lookLocation:function(){
wx.openLocation({
latitude:Number(this.data.storeInfo.lat),
longitude:Number(this.data.storeInfo.long),
scale:17,
address:this.data.storeInfo.map_address,
success:function (res) {
console.log(res)
}
})
},
onShareAppMessage: function () {
this.notice.close();
var obj=this.data.bookInfo;
var path='/pages/customer/index?id='+this.data.bookInfo.id;
let nickname="";
try{
nickname='"'+util.cache('sellerInfo').seller_user.nickname+'"';
}catch(e){}
console.log(path);
return {
title: nickname+'给你发送了一个订座信息,点击查看详情',
path: path,
success: function (res) {
console.log(res,666666)
},
fail:function(){
console.log('ccccc')
},
complete:function(){
console.log('ccccc')
}
};
},
getcall:function(){
var that=this;
wx.makePhoneCall({
phoneNumber: this.data.phoneNumber, //仅为示例,并非真实的电话号码
complete:function(){
this.notice.close();
}
})
},
chooseManagerInit(){
try{
let managers=util.cache('sellerInfo').manager;
let mans=[];
if(managers.length>0){
managers.forEach(man=>{
mans.push(man.user_name);
})
}
this.setData({mans:mans})
}catch(e){
wx.showToast({
title:'无客户经理',
icon:'none'
});
}
},
chooseManager(e){
let mansIndex=util.val(e);
this.setData({mansIndex:mansIndex});
try{
let managers=util.cache('sellerInfo').manager;
let man=managers[mansIndex];
if(man){
App.Reserve.SetReserveCusman({
rid:this.data.bookInfo.id,
cusman_id:man.id,
cusman:man.user_name,
cusman_phone:man.user_phone?man.user_phone:'',
cusman_account:man.user_wechat?man.user_wechat:'',
});
}
}catch(e){
console.log(e);
}
},
})