139 lines
2.8 KiB
JavaScript
139 lines
2.8 KiB
JavaScript
// packageE/appointment/showAppointment/showAppointment.js
|
|
var app = getApp();
|
|
Page({
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
events: [],
|
|
activeNames: [],
|
|
value: 3,
|
|
calendarEvents: [],
|
|
result: "",
|
|
today: "",
|
|
timeList: [],
|
|
showCalendar: true,
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.setData({
|
|
worker_id: options.worker_id,
|
|
});
|
|
this.getTime();
|
|
this.setData({
|
|
today:
|
|
new Date().getFullYear() +
|
|
"-" +
|
|
(new Date().getMonth() + 1) +
|
|
"-" +
|
|
new Date().getDate(),
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {},
|
|
// 日历组件点击事件
|
|
select(e) {
|
|
console.log(e);
|
|
let touchDay = e.detail.work_date;
|
|
this.setData({
|
|
today: touchDay,
|
|
});
|
|
this.getAppointment();
|
|
},
|
|
getTime() {
|
|
var that = this;
|
|
let urlStr = app.getNetAddresss(
|
|
"plugin.appointment.frontend.work-time.get-period-list"
|
|
);
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
data: {
|
|
worker_id: this.data.worker_id,
|
|
},
|
|
success: (resdata) => {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
console.log(res.data);
|
|
let list = res.data;
|
|
let lis = [];
|
|
list.forEach((item, index, arr) => {
|
|
lis.push(item.work_date_format);
|
|
});
|
|
that.setData({
|
|
events: lis,
|
|
});
|
|
this.getAppointment(this.data.today);
|
|
} else {
|
|
wx.showToast({
|
|
title: res.msg,
|
|
icon: "none",
|
|
});
|
|
console.log(res.msg);
|
|
}
|
|
},
|
|
});
|
|
},
|
|
getAppointment(date) {
|
|
let urlStr = app.getNetAddresss(
|
|
"plugin.appointment.frontend.work-time.get-order-service-time-list"
|
|
);
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
data: {
|
|
worker_id: this.data.worker_id,
|
|
work_date: this.data.today,
|
|
},
|
|
success: (resdata) => {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
this.setData({
|
|
timeList: res.data,
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: res.msg,
|
|
icon: "none",
|
|
});
|
|
console.log(res.msg);
|
|
}
|
|
},
|
|
});
|
|
},
|
|
});
|