231 lines
5.7 KiB
JavaScript
231 lines
5.7 KiB
JavaScript
|
|
// pages/departmentMsg/departmentMsg.js
|
||
|
|
// pages/articleDetails/articleDetails.js
|
||
|
|
Page({
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 页面的初始数据
|
||
|
|
*/
|
||
|
|
data: {
|
||
|
|
minDate: '',
|
||
|
|
maxDate: '',
|
||
|
|
defaultDate: '',
|
||
|
|
|
||
|
|
selectDate: '',
|
||
|
|
selectDept: '',
|
||
|
|
|
||
|
|
doctorList: [],
|
||
|
|
|
||
|
|
},
|
||
|
|
// getWeek(date) {
|
||
|
|
// let myDate = new Date(date);
|
||
|
|
// let wk = myDate.getDay();
|
||
|
|
// let yy = String(myDate.getFullYear());
|
||
|
|
// let mm = myDate.getMonth() + 1;
|
||
|
|
// let dd = String(
|
||
|
|
// myDate.getDate() < 10 ? "0" + myDate.getDate() : myDate.getDate()
|
||
|
|
// );
|
||
|
|
// let hou = String(
|
||
|
|
// myDate.getHours() < 10 ? "0" + myDate.getHours() : myDate.getHours()
|
||
|
|
// );
|
||
|
|
// let min = String(
|
||
|
|
// myDate.getMinutes() < 10 ?
|
||
|
|
// "0" + myDate.getMinutes() :
|
||
|
|
// myDate.getMinutes()
|
||
|
|
// );
|
||
|
|
// let sec = String(
|
||
|
|
// myDate.getSeconds() < 10 ?
|
||
|
|
// "0" + myDate.getSeconds() :
|
||
|
|
// myDate.getSeconds()
|
||
|
|
// );
|
||
|
|
// let weeks = [
|
||
|
|
// "周日",
|
||
|
|
// "周一",
|
||
|
|
// "周二",
|
||
|
|
// "周三",
|
||
|
|
// "周四",
|
||
|
|
// "周五",
|
||
|
|
// "周六"
|
||
|
|
// ];
|
||
|
|
// let week = weeks[wk];
|
||
|
|
// let nowDate;
|
||
|
|
// let nowTime;
|
||
|
|
// let nowWeek;
|
||
|
|
// nowDate = yy + "-" + mm + "-" + dd;
|
||
|
|
// nowTime = hou + ":" + min + ":" + sec;
|
||
|
|
// nowWeek = week;
|
||
|
|
// return week;
|
||
|
|
// },
|
||
|
|
formatDate(date) {
|
||
|
|
date = new Date(date);
|
||
|
|
let year = date.getFullYear(); //年
|
||
|
|
let month = date.getMonth() + 1; //月
|
||
|
|
let day = date.getDate(); //天数
|
||
|
|
if (month >= 1 && month <= 9) {
|
||
|
|
month = `0${month}`;
|
||
|
|
}
|
||
|
|
if (day >= 1 && day <= 9) {
|
||
|
|
day = `0${day}`;
|
||
|
|
}
|
||
|
|
return `${year}${month}${day}`;
|
||
|
|
},
|
||
|
|
onConfirm(e) {
|
||
|
|
this.setData({
|
||
|
|
doctorList:[]
|
||
|
|
})
|
||
|
|
let str = this.formatDate(e.detail)
|
||
|
|
this.setData({
|
||
|
|
selectDate:str
|
||
|
|
})
|
||
|
|
wx.request({
|
||
|
|
url: 'https://fy.btlsoln.com:8443/booking/getDoctorList?selectDate&selectKsdm',
|
||
|
|
method: "GET",
|
||
|
|
data: {
|
||
|
|
selectDate: str,
|
||
|
|
selectKsdm: this.data.selectDept
|
||
|
|
},
|
||
|
|
header: {
|
||
|
|
'content-type': 'application/json'
|
||
|
|
},
|
||
|
|
success: (res) => {
|
||
|
|
// console.log(res, "获取医生信息")
|
||
|
|
this.setData({
|
||
|
|
doctorList: res.data.list
|
||
|
|
})
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
initData() {
|
||
|
|
this.setData({
|
||
|
|
doctorList:[]
|
||
|
|
})
|
||
|
|
var today= new Date()
|
||
|
|
let str = this.formatDate(today)
|
||
|
|
this.setData({
|
||
|
|
selectDate:str
|
||
|
|
})
|
||
|
|
wx.request({
|
||
|
|
url: 'https://fy.btlsoln.com:8443/booking/getDoctorList?selectDate&selectKsdm',
|
||
|
|
method: "GET",
|
||
|
|
data: {
|
||
|
|
selectDate: str,
|
||
|
|
selectKsdm: this.data.selectDept
|
||
|
|
},
|
||
|
|
header: {
|
||
|
|
'content-type': 'application/json'
|
||
|
|
},
|
||
|
|
success: (res) => {
|
||
|
|
console.log(res)
|
||
|
|
this.setData({
|
||
|
|
doctorList: res.data.list
|
||
|
|
})
|
||
|
|
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
navigateToBooking(e){
|
||
|
|
console.log(e)
|
||
|
|
let a = e.currentTarget.dataset.item
|
||
|
|
a.selectDate = this.data.selectDate
|
||
|
|
wx.navigateTo({
|
||
|
|
url: `/pages/bookingDetails/bookingDetails?item=${JSON.stringify(a)}`,
|
||
|
|
})
|
||
|
|
},
|
||
|
|
// naviToyy(e) {
|
||
|
|
// let pbmxid = e.currentTarget.dataset.item.pbmxid
|
||
|
|
// let day = e.currentTarget.dataset.item.zxrq
|
||
|
|
// let week = e.currentTarget.dataset.item.weekday
|
||
|
|
// let date = e.currentTarget.dataset.item.kssj
|
||
|
|
// let date2 = e.currentTarget.dataset.item.jssj
|
||
|
|
// let zxrq = e.currentTarget.dataset.item.zxrq
|
||
|
|
// let ksmc = this.data.ksmc
|
||
|
|
// let ksdm = this.data.ksdm
|
||
|
|
// let num = e.currentTarget.dataset.item.ghf + e.currentTarget.dataset.item.zlf
|
||
|
|
// let today = this.data.today
|
||
|
|
// var t1 = this.data.t1
|
||
|
|
// var t2 = this.data.t2
|
||
|
|
// if ((t2 - t1) / (24 * 3600 * 1000) > 30) {
|
||
|
|
// wx.showToast({
|
||
|
|
// title: '暂未开放预约',
|
||
|
|
// icon: "error"
|
||
|
|
// })
|
||
|
|
// } else {
|
||
|
|
// wx.navigateTo({
|
||
|
|
// url: '/pages/confirmation/confirmation?pbmxid=' + pbmxid + '&day=' + day + '&week=' + week + '&date=' + date + '&ksmc=' + ksmc + '&num=' + num + '&ksdm=' + ksdm + '&today=' + today + '&date2=' + date2 + '&zxrq=' + zxrq,
|
||
|
|
// })
|
||
|
|
// }
|
||
|
|
// },
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面加载
|
||
|
|
*/
|
||
|
|
onLoad: function (options) {
|
||
|
|
this.setData({
|
||
|
|
selectDept: options.deptId
|
||
|
|
})
|
||
|
|
this.initData()
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面初次渲染完成
|
||
|
|
*/
|
||
|
|
onReady: function () {
|
||
|
|
var today = new Date(new Date().setHours(0, 0, 0, 0))
|
||
|
|
var todayTime = new Date(new Date().setHours(0, 0, 0, 0))
|
||
|
|
var weekend = today.setDate(today.getDate() + 6)
|
||
|
|
this.setData({
|
||
|
|
minDate: todayTime.valueOf(),
|
||
|
|
maxDate: weekend,
|
||
|
|
defaultDate: todayTime.valueOf()
|
||
|
|
})
|
||
|
|
// this.setData({
|
||
|
|
// days:[this.getDays(0).substr(8,2), this.getDays(1).substr(8,2), this.getDays(2).substr(8,2), this.getDays(3).substr(8,2), this.getDays(4).substr(8,2), this.getDays(5).substr(8,2), this.getDays(6).substr(8,2)],
|
||
|
|
// weeks:[this.getWeek(this.getDays(0)), this.getWeek(this.getDays(1)), this.getWeek(this.getDays(2)),
|
||
|
|
// this.getWeek(this.getDays(3)), this.getWeek(this.getDays(4)), this.getWeek(this.getDays(5)), this.getWeek(this.getDays(6))
|
||
|
|
// ],
|
||
|
|
// today:this.getDays(0)
|
||
|
|
// })
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面显示
|
||
|
|
*/
|
||
|
|
onShow: function () {
|
||
|
|
// console.log(this.data.ksdm,"ksdm")
|
||
|
|
// let ksdm = this.data.ksdm
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面隐藏
|
||
|
|
*/
|
||
|
|
onHide: function () {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面卸载
|
||
|
|
*/
|
||
|
|
onUnload: function () {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
||
|
|
*/
|
||
|
|
onPullDownRefresh: function () {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 页面上拉触底事件的处理函数
|
||
|
|
*/
|
||
|
|
onReachBottom: function () {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 用户点击右上角分享
|
||
|
|
*/
|
||
|
|
onShareAppMessage: function () {
|
||
|
|
|
||
|
|
}
|
||
|
|
})
|