mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-22 00:49:37 +08:00
68 lines
1.6 KiB
JavaScript
68 lines
1.6 KiB
JavaScript
![]() |
let app = getApp()
|
||
|
Page({
|
||
|
|
||
|
/**
|
||
|
* 页面的初始数据
|
||
|
*/
|
||
|
data: {
|
||
|
form: {},
|
||
|
IMG_NAME: app.IMG_NAME
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面加载
|
||
|
*/
|
||
|
onLoad(e) {
|
||
|
let that = this
|
||
|
app.AjaxRequest('get', {
|
||
|
'content-type': 'application/json',
|
||
|
'Authorization': 'Bearer ' + app.Getopenid()
|
||
|
}, '/room/detail', {
|
||
|
roomId: e.id
|
||
|
}, function (res) {
|
||
|
wx.setNavigationBarTitle({
|
||
|
title: '申请预约 ' + res.data.name,
|
||
|
})
|
||
|
that.setData({
|
||
|
roomDetail: res.data,
|
||
|
'form.userName': wx.getStorageSync('MemberInfo').userName,
|
||
|
'form.mobile': wx.getStorageSync('MemberInfo').mobile,
|
||
|
'form.userId': wx.getStorageSync('userId')
|
||
|
})
|
||
|
})
|
||
|
},
|
||
|
nameInput(e) {
|
||
|
this.setData({
|
||
|
'form.userName': e.detail.value,
|
||
|
})
|
||
|
},
|
||
|
mobileInput(e) {
|
||
|
this.setData({
|
||
|
'form.mobile': e.detail.value,
|
||
|
})
|
||
|
},
|
||
|
apply() {
|
||
|
let that = this
|
||
|
let form = that.data.form
|
||
|
app.AjaxRequest('post', {
|
||
|
'content-type': 'application/json',
|
||
|
'Authorization': 'Bearer ' + app.Getopenid()
|
||
|
}, '/room/submit?roomId=' + that.data.roomDetail.id + '&contacts=' + form.userName + '&phone=' + form.mobile, {},
|
||
|
function (res) {
|
||
|
if (res.code === 0) {
|
||
|
wx.showModal({
|
||
|
content: '已成功提交预约,请静候客服与您联系。',
|
||
|
showCancel: false,
|
||
|
confirmText: '回到首页',
|
||
|
success(res) {
|
||
|
if (res.confirm) {
|
||
|
wx.reLaunch({
|
||
|
url: '/pages/index/office/office',
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
})
|