cancel.js
2.46 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
// components/book/reserveCancel/cancel.js
import util from '../../../../utils/util';
import App from '../../../../utils/api';
const {regeneratorRuntime} = global
const items=[{name:'顾客取消'},{name:'顾客行程有变'},{name:'信息填写有误'},{name:'操作失误'},{name:'其他原因'}];
Component({
/**
* 组件的属性列表
*/
properties: {
bookInfo:{
type:Object,
value:{},
}
},
/**
* 组件的初始数据
*/
data: {
hidden: true,
otherInputHidden:true,
items:JSON.parse(JSON.stringify(items)),
_cause:'',
cause:'',
},
/**
* 组件的方法列表
*/
methods: {
show(){
this.setData({
hidden:false,
})
},
hide(){
this.setData({
hidden:true,
})
},
radioChange(e){
let val=util.val(e);
if(val=='其他原因'){
this.setData({
otherInputHidden:false,
_cause:val
})
}else{
this.setData({
otherInputHidden:true,
_cause:val
})
}
},
otherInput(e){
let val=util.val(e);
this.setData({
cause:val
})
},
async submit(e){
console.log(e,);
let cause=this.data._cause;
let hasInput=false;
if(cause=='其他原因'){
cause=this.data.cause;
hasInput=true;
}
cause=cause.trim();
if(!cause){
return util.toast(hasInput?'请填写原因':'请选择原因','none')
}
let enter_params=util.cache('enter_params');
let sc=(await App.Reserve.SellerInfo(enter_params)).data
cause={desc:cause}
if(enter_params){
cause.uid=enter_params.manager_id;
}
if(sc.seller_user){
cause.uname=(sc.seller_user.nick_name||sc.seller_user.nickname)
}
if(1==this.data.bookInfo.type){
App.Customer.SetReserveStatus({
rid:this.data.bookInfo.id,
status:4,
cause:JSON.stringify(cause),
}).then(()=>{
this.hide()
this.triggerEvent('reserveCancel',{hasCancel:true});
//this.getDetail(this.data.bookInfo.id,true);
})
}else{
App.Reserve.SetReserveStatus({
rid:this.data.bookInfo.id,
status:4,
cause:JSON.stringify(cause),
}).then(()=>{
this.hide()
this.triggerEvent('reserveCancel',{hasCancel:true});
//this.getDetail(this.data.bookInfo.id,true);
})
}
}
}
})