|
|
|
// pages/customer/cancel.js
|
|
|
|
import util from '../../utils/util';
|
|
|
|
import App from '../../utils/api';
|
|
|
|
import PubSub from '../../utils/PubSub'
|
|
|
|
const reasons=[
|
|
|
|
'不想去了',
|
|
|
|
'预订信息有误,重新预订',
|
|
|
|
'已通过其他方式预订',
|
|
|
|
'商家处理太慢,等不及了',
|
|
|
|
'其他',
|
|
|
|
]
|
|
|
|
Page({
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
reasons:reasons,
|
|
|
|
radioIndex:-1,
|
|
|
|
inputFouce:false,
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad: function (options) {
|
|
|
|
this.options=options
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
*/
|
|
|
|
onReady: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
*/
|
|
|
|
onShow: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
*/
|
|
|
|
onHide: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
*/
|
|
|
|
onUnload: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
*/
|
|
|
|
onPullDownRefresh: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
*/
|
|
|
|
onReachBottom: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
keyboardheight:0,
|
|
|
|
keyboardheightchange(e){
|
|
|
|
console.log(e);
|
|
|
|
if(e.detail.height==0 || e.detail.height>this.keyboardheight){
|
|
|
|
this.keyboardheight=e.detail.height
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
//paddingBottom:e.detail.height?(parseInt(e.detail.height)+100):0
|
|
|
|
paddingBottom:this.keyboardheight>0?(parseInt(this.keyboardheight)+20):0
|
|
|
|
})
|
|
|
|
setTimeout(()=>{
|
|
|
|
this.pageScrollToBottom()
|
|
|
|
},0)
|
|
|
|
},
|
|
|
|
pageScrollToBottom: function () {
|
|
|
|
wx.createSelectorQuery().select('.pages').boundingClientRect(function (rect) {
|
|
|
|
// 使页面滚动到底部
|
|
|
|
wx.pageScrollTo({
|
|
|
|
scrollTop: rect.bottom
|
|
|
|
})
|
|
|
|
}).exec()
|
|
|
|
},
|
|
|
|
hideKeyboard(){
|
|
|
|
this.setData({
|
|
|
|
paddingBottom:0
|
|
|
|
})
|
|
|
|
},
|
|
|
|
cancelSubmit(){
|
|
|
|
let desc=''
|
|
|
|
if(this.radioIndex==reasons.length-1){
|
|
|
|
desc=this.desc
|
|
|
|
}else{
|
|
|
|
desc=reasons[this.radioIndex]
|
|
|
|
}
|
|
|
|
if(!desc){
|
|
|
|
return util.toast('请选择取消原因','none')
|
|
|
|
}
|
|
|
|
App.Reserve.Detail({
|
|
|
|
openid: getApp().openid,
|
|
|
|
rid: this.options.id
|
|
|
|
},'clear')
|
|
|
|
App.Customer.SetReserveStatusByUser({
|
|
|
|
rid:this.options.id,
|
|
|
|
desc:desc,
|
|
|
|
}).then(res=>{
|
|
|
|
if(res.ret!=200){
|
|
|
|
return util.toast(res.msg,'none')
|
|
|
|
}
|
|
|
|
PubSub.emit('detailPub',{type:'cancel'})
|
|
|
|
wx.navigateBack()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
radioIndex:-1,
|
|
|
|
radioChange(e){
|
|
|
|
this.radioIndex=e.detail.value
|
|
|
|
if(this.radioIndex==reasons.length-1){
|
|
|
|
if(!this.data.inputFouce){
|
|
|
|
this.setData({
|
|
|
|
inputFouce:true,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if(this.data.inputFouce){
|
|
|
|
this.setData({
|
|
|
|
inputFouce:false,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
textareaFocus(e){
|
|
|
|
if(this.radioIndex!=reasons.length-1){
|
|
|
|
this.radioIndex=reasons.length-1
|
|
|
|
this.setData({
|
|
|
|
radioIndex:this.radioIndex,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
desc:'',
|
|
|
|
textareaInput(e){
|
|
|
|
this.desc=e.detail.value
|
|
|
|
}
|
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|