|
1
|
var util = require('../../../utils/util.js')
|
1
|
var util = require('../../../utils/util.js')
|
|
2
|
-var uri=require('../../../utils/uri.js')
|
2
|
+var uri = require('../../../utils/uri.js')
|
|
3
|
import App from '../../../utils/api';
|
3
|
import App from '../../../utils/api';
|
|
|
|
4
|
+
|
|
4
|
const {regeneratorRuntime} = global
|
5
|
const {regeneratorRuntime} = global
|
|
5
|
import TP from '../../../utils/tpls';
|
6
|
import TP from '../../../utils/tpls';
|
|
|
|
7
|
+import gl from '../../global';
|
|
|
|
8
|
+
|
|
6
|
Page({
|
9
|
Page({
|
|
7
|
- data:{
|
|
|
|
8
|
- actionSheetHidden:true,
|
|
|
|
9
|
- actionSheetItems:['客户取消','客户行程改变']
|
|
|
|
10
|
- },
|
|
|
|
11
|
- sc:{},
|
|
|
|
12
|
- tpls:TP.tpls(),
|
|
|
|
13
|
- enter_params:{},
|
|
|
|
14
|
- onLoad:async function (opt) {
|
|
|
|
15
|
- util.setBarTitle('预订详情');
|
|
|
|
16
|
- console.log(opt)
|
|
|
|
17
|
- this.getDetail(opt.id);
|
|
|
|
18
|
- wx.showShareMenu({
|
|
|
|
19
|
- withShareTicket: true,
|
|
|
|
20
|
- success:function(res){
|
|
|
|
21
|
- console.log(res)
|
|
|
|
22
|
- }
|
|
|
|
23
|
- })
|
|
|
|
24
|
- this.enter_params=util.cache('enter_params');
|
|
|
|
25
|
- this.sc=(await App.Reserve.SellerInfo(this.enter_params)).data;
|
|
|
|
26
|
- console.log('this.sc',this.sc);
|
|
|
|
27
|
- this.chooseManagerInit();
|
|
|
|
28
|
- },
|
|
|
|
29
|
- onShow:function(){
|
|
|
|
30
|
- this.notice=this.selectComponent('#notice');
|
|
|
|
31
|
- },
|
|
|
|
32
|
- noticeCall:function(){
|
|
|
|
33
|
- this.selectComponent('#notice').show();
|
|
|
|
34
|
- },
|
|
|
|
35
|
- onShareAppMessage: function () {
|
|
|
|
36
|
- this.selectComponent('#notice').close();
|
|
|
|
37
|
- var obj=this.data.bookInfo;
|
|
|
|
38
|
- let path=util.http_build_query({
|
|
|
|
39
|
- id:this.data.bookInfo.id,
|
|
|
|
40
|
- fromid:getApp().openid,
|
|
|
|
41
|
- hasSellerShare:1,
|
|
|
|
42
|
- hasInvitation:1,
|
|
|
|
43
|
- tplid:1
|
|
|
|
44
|
- },'/pages/customer/index')
|
|
|
|
45
|
- return {
|
|
|
|
46
|
- //title: (nickname||'')+'给你发送了一个订座信息,点击查看详情',
|
|
|
|
47
|
- title: this.tpls[0].shareFirstTitle,
|
|
|
|
48
|
- path: path,
|
|
|
|
49
|
- imageUrl:this.tpls[0].shareFirstImage,
|
|
|
|
50
|
- success: function (res) {
|
|
|
|
51
|
- console.log(res,666666)
|
|
|
|
52
|
- },
|
|
|
|
53
|
- fail:function(){
|
|
|
|
54
|
- console.log('ccccc')
|
|
|
|
55
|
- },
|
|
|
|
56
|
- complete:function(){
|
|
|
|
57
|
- console.log('ccccc')
|
|
|
|
58
|
- }
|
|
|
|
59
|
- };
|
|
|
|
60
|
- },
|
|
|
|
61
|
- getcall:function(){
|
|
|
|
62
|
- if(!this.detailData.hasOwner){
|
|
|
|
63
|
- return util.toast('只有记录人可以拨打','none');
|
10
|
+ data: {
|
|
|
|
11
|
+ actionSheetHidden: true,
|
|
|
|
12
|
+ actionSheetItems: ['客户取消', '客户行程改变'],
|
|
|
|
13
|
+ hasEditorFlag: false,
|
|
|
|
14
|
+ },
|
|
|
|
15
|
+ sc: {},
|
|
|
|
16
|
+ tpls: TP.tpls(),
|
|
|
|
17
|
+ enter_params: {},
|
|
|
|
18
|
+ onLoad: async function (opt) {
|
|
|
|
19
|
+ util.setBarTitle('预订详情');
|
|
|
|
20
|
+ console.log(opt)
|
|
|
|
21
|
+ this.getDetail(opt.id);
|
|
|
|
22
|
+ wx.showShareMenu({
|
|
|
|
23
|
+ withShareTicket: true,
|
|
|
|
24
|
+ success: function (res) {
|
|
|
|
25
|
+ console.log(res)
|
|
64
|
}
|
26
|
}
|
|
65
|
- if(this.data.bookInfo.phone.length<3){
|
|
|
|
66
|
- return util.toast('号码错误','none');
|
27
|
+ })
|
|
|
|
28
|
+ this.enter_params = util.cache('enter_params');
|
|
|
|
29
|
+ this.sc = (await App.Reserve.SellerInfo(this.enter_params)).data;
|
|
|
|
30
|
+ console.log('this.sc', this.sc);
|
|
|
|
31
|
+ this.chooseManagerInit();
|
|
|
|
32
|
+ },
|
|
|
|
33
|
+ onShow: function () {
|
|
|
|
34
|
+ this.notice = this.selectComponent('#notice');
|
|
|
|
35
|
+ gl.getHasEditorFlag().then(() => {
|
|
|
|
36
|
+ this.setData({
|
|
|
|
37
|
+ hasEditorFlag: true,
|
|
|
|
38
|
+ })
|
|
|
|
39
|
+ }).catch(()=>{})
|
|
|
|
40
|
+ },
|
|
|
|
41
|
+ noticeCall: function () {
|
|
|
|
42
|
+ this.selectComponent('#notice').show();
|
|
|
|
43
|
+ },
|
|
|
|
44
|
+ onShareAppMessage: function () {
|
|
|
|
45
|
+ this.selectComponent('#notice').close();
|
|
|
|
46
|
+ var obj = this.data.bookInfo;
|
|
|
|
47
|
+ let path = util.http_build_query({
|
|
|
|
48
|
+ id: this.data.bookInfo.id,
|
|
|
|
49
|
+ fromid: getApp().openid,
|
|
|
|
50
|
+ hasSellerShare: 1,
|
|
|
|
51
|
+ hasInvitation: 1,
|
|
|
|
52
|
+ tplid: 1
|
|
|
|
53
|
+ }, '/pages/customer/index')
|
|
|
|
54
|
+ return {
|
|
|
|
55
|
+ //title: (nickname||'')+'给你发送了一个订座信息,点击查看详情',
|
|
|
|
56
|
+ title: this.tpls[0].shareFirstTitle,
|
|
|
|
57
|
+ path: path,
|
|
|
|
58
|
+ imageUrl: this.tpls[0].shareFirstImage,
|
|
|
|
59
|
+ success: function (res) {
|
|
|
|
60
|
+ console.log(res, 666666)
|
|
|
|
61
|
+ },
|
|
|
|
62
|
+ fail: function () {
|
|
|
|
63
|
+ console.log('ccccc')
|
|
|
|
64
|
+ },
|
|
|
|
65
|
+ complete: function () {
|
|
|
|
66
|
+ console.log('ccccc')
|
|
67
|
}
|
67
|
}
|
|
68
|
- wx.makePhoneCall({
|
|
|
|
69
|
- phoneNumber: this.data.bookInfo.phone, //仅为示例,并非真实的电话号码
|
|
|
|
70
|
- complete:()=>{
|
|
|
|
71
|
- this.selectComponent('#notice').close();
|
|
|
|
72
|
- }
|
68
|
+ };
|
|
|
|
69
|
+ },
|
|
|
|
70
|
+ getcall: function () {
|
|
|
|
71
|
+ if (!this.detailData.hasOwner) {
|
|
|
|
72
|
+ return util.toast('只有记录人可以拨打', 'none');
|
|
|
|
73
|
+ }
|
|
|
|
74
|
+ if (this.data.bookInfo.phone.length < 3) {
|
|
|
|
75
|
+ return util.toast('号码错误', 'none');
|
|
|
|
76
|
+ }
|
|
|
|
77
|
+ wx.makePhoneCall({
|
|
|
|
78
|
+ phoneNumber: this.data.bookInfo.phone, //仅为示例,并非真实的电话号码
|
|
|
|
79
|
+ complete: () => {
|
|
|
|
80
|
+ this.selectComponent('#notice').close();
|
|
|
|
81
|
+ }
|
|
|
|
82
|
+ })
|
|
|
|
83
|
+ },
|
|
|
|
84
|
+ chooseManagerInit() {
|
|
|
|
85
|
+ try {
|
|
|
|
86
|
+ let managers = this.sc.manager;
|
|
|
|
87
|
+ let mans = [];
|
|
|
|
88
|
+ let mans_role = [];
|
|
|
|
89
|
+ // let space='';
|
|
|
|
90
|
+ // for(let i=0;i<50;i++){
|
|
|
|
91
|
+ // space+=' ';
|
|
|
|
92
|
+ // }
|
|
|
|
93
|
+ if (managers.length > 0) {
|
|
|
|
94
|
+ managers.forEach(man => {
|
|
|
|
95
|
+ let nickname = man.nick_name || man.user_name;
|
|
|
|
96
|
+ mans.push(nickname);
|
|
|
|
97
|
+ //mans_role.push(' ['+man.role_name+'] -- '+man.user_name+space);
|
|
|
|
98
|
+ mans_role.push('[' + man.role_name + '] -- ' + nickname);
|
|
73
|
})
|
99
|
})
|
|
74
|
- },
|
|
|
|
75
|
- chooseManagerInit(){
|
|
|
|
76
|
- try{
|
|
|
|
77
|
- let managers=this.sc.manager;
|
|
|
|
78
|
- let mans=[];
|
|
|
|
79
|
- let mans_role=[];
|
|
|
|
80
|
- // let space='';
|
|
|
|
81
|
- // for(let i=0;i<50;i++){
|
|
|
|
82
|
- // space+=' ';
|
|
|
|
83
|
- // }
|
|
|
|
84
|
- if(managers.length>0){
|
|
|
|
85
|
- managers.forEach(man=>{
|
|
|
|
86
|
- let nickname=man.nick_name||man.user_name;
|
|
|
|
87
|
- mans.push(nickname);
|
|
|
|
88
|
- //mans_role.push(' ['+man.role_name+'] -- '+man.user_name+space);
|
|
|
|
89
|
- mans_role.push('['+man.role_name+'] -- '+nickname);
|
|
|
|
90
|
- })
|
|
|
|
91
|
- }
|
|
|
|
92
|
- this.setData({mans:mans,mans_role:mans_role})
|
|
|
|
93
|
- }catch(e){
|
|
|
|
94
|
- wx.showToast({
|
|
|
|
95
|
- title:'无客户经理',
|
|
|
|
96
|
- icon:'none'
|
|
|
|
97
|
- });
|
|
|
|
98
|
- }
|
|
|
|
99
|
- },
|
|
|
|
100
|
- chooseManager(e){
|
|
|
|
101
|
- let mansIndex=util.val(e);
|
|
|
|
102
|
- this.setData({mansIndex:mansIndex});
|
|
|
|
103
|
- try{
|
|
|
|
104
|
- let managers=this.sc.manager;
|
|
|
|
105
|
- let man=managers[mansIndex];
|
|
|
|
106
|
- if(man){
|
|
|
|
107
|
- App.Reserve.SetReserveCusman({
|
|
|
|
108
|
- rid:this.data.bookInfo.id,
|
|
|
|
109
|
- cusman_id:man.id,
|
|
|
|
110
|
- cusman:man.nick_name||man.user_name,
|
|
|
|
111
|
- cusman_phone:man.user_phone?man.user_phone:'',
|
|
|
|
112
|
- cusman_account:man.user_wechat?man.user_wechat:'',
|
|
|
|
113
|
- cusman_openid:man.seat_openid?man.seat_openid:''
|
|
|
|
114
|
- }).then(()=>{
|
|
|
|
115
|
- this.getDetail(this.data.bookInfo.id,true);
|
|
|
|
116
|
- });
|
|
|
|
117
|
- }
|
|
|
|
118
|
- }catch(e){
|
|
|
|
119
|
- console.log(e);
|
|
|
|
120
|
- }
|
|
|
|
121
|
-
|
|
|
|
122
|
- },
|
|
|
|
123
|
- flushSellerInfo(){
|
|
|
|
124
|
- App.Reserve.SellerInfo(util.cache('enter_params'),true);
|
|
|
|
125
|
- },
|
|
|
|
126
|
- detailData:null,
|
|
|
|
127
|
- async getDetail(id,force=false){
|
|
|
|
128
|
- let res=await App.Reserve.Detail({rid:id,openid:''},force);
|
|
|
|
129
|
- res.data.rdateStr=util.unixtoTime(res.data.ddate,"MM月DD日 HH:II")
|
|
|
|
130
|
- res.data.phoneStr=res.data.phone||'';
|
|
|
|
131
|
- let enter_params=util.cache('enter_params');
|
|
|
|
132
|
- let sc=(await App.Reserve.SellerInfo(enter_params)).data
|
|
|
|
133
|
- let note_openid=enter_params.seller_openid;
|
|
|
|
134
|
- res.data.hasOwner=false;
|
|
|
|
135
|
- if(note_openid==res.data.note_openid || sc.seller_user.role_name=='管理员'){
|
|
|
|
136
|
- res.data.hasOwner=true;
|
|
|
|
137
|
- }
|
|
|
|
138
|
- if(!res.data.hasOwner){
|
|
|
|
139
|
- res.data.phoneStr=res.data.phoneStr.replace(/(\d{2})(.{5})(\d{3})/,function($0,$1,$2,$3){
|
|
|
|
140
|
- return $1+'**'+$3;
|
|
|
|
141
|
- })
|
|
|
|
142
|
- }
|
|
|
|
143
|
- if(res.data.status==4 && res.data.cancel){
|
|
|
|
144
|
- res.data.cancel.cdateStr=util.unixtoTime(res.data.cancel.cdate,"YYYY.MM.DD HH:II")
|
|
|
|
145
|
}
|
100
|
}
|
|
146
|
- this.detailData=res.data;
|
101
|
+ this.setData({mans: mans, mans_role: mans_role})
|
|
|
|
102
|
+ } catch (e) {
|
|
|
|
103
|
+ wx.showToast({
|
|
|
|
104
|
+ title: '无客户经理',
|
|
|
|
105
|
+ icon: 'none'
|
|
|
|
106
|
+ });
|
|
|
|
107
|
+ }
|
|
|
|
108
|
+ },
|
|
|
|
109
|
+ chooseManager(e) {
|
|
|
|
110
|
+ let mansIndex = util.val(e);
|
|
|
|
111
|
+ this.setData({mansIndex: mansIndex});
|
|
|
|
112
|
+ try {
|
|
|
|
113
|
+ let managers = this.sc.manager;
|
|
|
|
114
|
+ let man = managers[mansIndex];
|
|
|
|
115
|
+ if (man) {
|
|
|
|
116
|
+ App.Reserve.SetReserveCusman({
|
|
|
|
117
|
+ rid: this.data.bookInfo.id,
|
|
|
|
118
|
+ cusman_id: man.id,
|
|
|
|
119
|
+ cusman: man.nick_name || man.user_name,
|
|
|
|
120
|
+ cusman_phone: man.user_phone ? man.user_phone : '',
|
|
|
|
121
|
+ cusman_account: man.user_wechat ? man.user_wechat : '',
|
|
|
|
122
|
+ cusman_openid: man.seat_openid ? man.seat_openid : ''
|
|
|
|
123
|
+ }).then(() => {
|
|
|
|
124
|
+ this.getDetail(this.data.bookInfo.id, true);
|
|
|
|
125
|
+ });
|
|
|
|
126
|
+ }
|
|
|
|
127
|
+ } catch (e) {
|
|
|
|
128
|
+ console.log(e);
|
|
|
|
129
|
+ }
|
|
147
|
|
130
|
|
|
148
|
- this.setData({
|
|
|
|
149
|
- tables:res.data.tables,
|
|
|
|
150
|
- bookInfo:res.data,
|
|
|
|
151
|
- })
|
|
|
|
152
|
- },
|
|
|
|
153
|
- gotoModify(){
|
|
|
|
154
|
- wx.redirectTo({
|
|
|
|
155
|
- url:'./b_addnew?id='+this.data.bookInfo.id
|
|
|
|
156
|
- })
|
|
|
|
157
|
- },
|
|
|
|
158
|
- cancelReserve(){
|
131
|
+ },
|
|
|
|
132
|
+ flushSellerInfo() {
|
|
|
|
133
|
+ App.Reserve.SellerInfo(util.cache('enter_params'), true);
|
|
|
|
134
|
+ },
|
|
|
|
135
|
+ detailData: null,
|
|
|
|
136
|
+ async getDetail(id, force = false) {
|
|
|
|
137
|
+ let res = await App.Reserve.Detail({rid: id, openid: ''}, force);
|
|
|
|
138
|
+ res.data.rdateStr = util.unixtoTime(res.data.ddate, "MM月DD日 HH:II")
|
|
|
|
139
|
+ res.data.phoneStr = res.data.phone || '';
|
|
|
|
140
|
+ let enter_params = util.cache('enter_params');
|
|
|
|
141
|
+ let sc = (await App.Reserve.SellerInfo(enter_params)).data
|
|
|
|
142
|
+ let note_openid = enter_params.seller_openid;
|
|
|
|
143
|
+ res.data.hasOwner = false;
|
|
|
|
144
|
+ if (note_openid == res.data.note_openid || sc.seller_user.role_name == '管理员') {
|
|
|
|
145
|
+ res.data.hasOwner = true;
|
|
|
|
146
|
+ }
|
|
|
|
147
|
+ if (!res.data.hasOwner) {
|
|
|
|
148
|
+ res.data.phoneStr = res.data.phoneStr.replace(/(\d{2})(.{5})(\d{3})/, function ($0, $1, $2, $3) {
|
|
|
|
149
|
+ return $1 + '**' + $3;
|
|
|
|
150
|
+ })
|
|
|
|
151
|
+ }
|
|
|
|
152
|
+ if (res.data.status == 4 && res.data.cancel) {
|
|
|
|
153
|
+ res.data.cancel.cdateStr = util.unixtoTime(res.data.cancel.cdate, "YYYY.MM.DD HH:II")
|
|
|
|
154
|
+ }
|
|
|
|
155
|
+ this.detailData = res.data;
|
|
|
|
156
|
+
|
|
|
|
157
|
+ this.setData({
|
|
|
|
158
|
+ tables: res.data.tables,
|
|
|
|
159
|
+ bookInfo: res.data,
|
|
|
|
160
|
+ })
|
|
|
|
161
|
+ },
|
|
|
|
162
|
+ gotoModify() {
|
|
|
|
163
|
+ wx.redirectTo({
|
|
|
|
164
|
+ url: './b_addnew?id=' + this.data.bookInfo.id
|
|
|
|
165
|
+ })
|
|
|
|
166
|
+ },
|
|
|
|
167
|
+ cancelReserve() {
|
|
159
|
this.selectComponent('#cancel').show();
|
168
|
this.selectComponent('#cancel').show();
|
|
160
|
},
|
169
|
},
|
|
161
|
- reserveCancel(e){
|
|
|
|
162
|
- console.log('reserveCancel',e.detail);
|
|
|
|
163
|
- this.getDetail(this.data.bookInfo.id,true);
|
170
|
+ reserveCancel(e) {
|
|
|
|
171
|
+ console.log('reserveCancel', e.detail);
|
|
|
|
172
|
+ this.getDetail(this.data.bookInfo.id, true);
|
|
164
|
},
|
173
|
},
|
|
165
|
- actionSheetChange(e){
|
174
|
+ actionSheetChange(e) {
|
|
166
|
this.setData({
|
175
|
this.setData({
|
|
167
|
- actionSheetHidden:true
|
176
|
+ actionSheetHidden: true
|
|
168
|
})
|
177
|
})
|
|
169
|
},
|
178
|
},
|
|
170
|
- async startDinner(e){
|
|
|
|
171
|
- let cause={};
|
|
|
|
172
|
- let enter_params=util.cache('enter_params');
|
|
|
|
173
|
- let sc=(await App.Reserve.SellerInfo(enter_params)).data
|
|
|
|
174
|
- cause={desc:""}
|
|
|
|
175
|
- if(enter_params){
|
|
|
|
176
|
- cause.uid=enter_params.manager_id;
|
179
|
+ async startDinner(e) {
|
|
|
|
180
|
+ let cause = {};
|
|
|
|
181
|
+ let enter_params = util.cache('enter_params');
|
|
|
|
182
|
+ let sc = (await App.Reserve.SellerInfo(enter_params)).data
|
|
|
|
183
|
+ cause = {desc: ""}
|
|
|
|
184
|
+ if (enter_params) {
|
|
|
|
185
|
+ cause.uid = enter_params.manager_id;
|
|
177
|
}
|
186
|
}
|
|
178
|
- if(sc.seller_user){
|
|
|
|
179
|
- cause.uname=(sc.seller_user.nick_name||sc.seller_user.nickname)
|
187
|
+ if (sc.seller_user) {
|
|
|
|
188
|
+ cause.uname = (sc.seller_user.nick_name || sc.seller_user.nickname)
|
|
180
|
}
|
189
|
}
|
|
181
|
App.Reserve.SetReserveStatus({
|
190
|
App.Reserve.SetReserveStatus({
|
|
182
|
- rid:this.data.bookInfo.id,
|
|
|
|
183
|
- status:util.attr(e,'status'),
|
|
|
|
184
|
- cause:JSON.stringify(cause),
|
|
|
|
185
|
- }).then(()=>{
|
|
|
|
186
|
- this.getDetail(this.data.bookInfo.id,true);
|
191
|
+ rid: this.data.bookInfo.id,
|
|
|
|
192
|
+ status: util.attr(e, 'status'),
|
|
|
|
193
|
+ cause: JSON.stringify(cause),
|
|
|
|
194
|
+ }).then(() => {
|
|
|
|
195
|
+ this.getDetail(this.data.bookInfo.id, true);
|
|
187
|
});
|
196
|
});
|
|
188
|
},
|
197
|
},
|
|
189
|
- showOrder(){
|
198
|
+ showOrder() {
|
|
190
|
wx.navigateTo({
|
199
|
wx.navigateTo({
|
|
191
|
- url:util.http_build_query({rid:this.data.bookInfo.id,oid:this.data.bookInfo.orderid,identity:2},'/pack-cookbook/pages/success')
|
200
|
+ url: util.http_build_query({
|
|
|
|
201
|
+ rid: this.data.bookInfo.id,
|
|
|
|
202
|
+ oid: this.data.bookInfo.orderid,
|
|
|
|
203
|
+ identity: 2
|
|
|
|
204
|
+ }, '/pack-cookbook/pages/success')
|
|
192
|
});
|
205
|
});
|
|
193
|
},
|
206
|
},
|
|
194
|
}) |
207
|
}) |