const app = getApp() const util = require("../../../utils/util"); const api = require('../../../api/api.js'); const user = require('../../../utils/user.js'); // const update = require('../../../api/update.js'); Page({ data: { firstDate:'请选择', serviceTimes:'请选择', serviceFrequency:'请选择', currentDate:new Date().getTime(), showPicker:false, datePicker:false, columns:[], serviceTimesCol:['4','24'], serviceFrequencyCol:['一周一次','两周一次'], scheduleData:{ mastUseCount:'', otherUseCount:'', unUseCount:'', monthData:[], }, scheduleList:[ { month:'2022年10月', amount:'2', list:[ { date:'14日', tips:'我有档期' }, { date:'21日', tips:'我有档期' } ] }, { month:'2022年11月', amount:'4', list:[ { date:'1日', tips:'我有档期' }, { date:'7日', tips:'我有档期' }, { date:'14日', tips:'其他姐妹' }, { date:'21日', tips:'无档期' } ] }, { month:'2022年12月', amount:'4', list:[ { date:'1日', tips:'我有档期' }, { date:'7日', tips:'我有档期' }, { date:'14日', tips:'其他姐妹' }, { date:'21日', tips:'无档期' } ] } ] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, selectTimes(){ }, onDateInput(e){ console.log(e); this.setData({ currentDate:e.detail }); }, dateSelect(){ this.setData({ showPicker:true, datePicker:true }) } , dateCancel(){ this.setData({ showPicker:false }) }, dateConfirm(){ this.setData({ firstDate:util.formetdate(new Date(this.data.currentDate)), showPicker:false }) }, serviceTimesTap(){ this.setData({ showPicker:true, datePicker:false, columns:this.data.serviceTimesCol }); }, frequencySelect(){ this.setData({ showPicker:true, datePicker:false, columns:this.data.serviceFrequencyCol }) }, pickerCancel(){ this.setData({ showPicker:false, }) }, pickerConfirm(e){ console.log(e); if(this.data.columns==this.data.serviceTimesCol){ this.setData({ serviceTimes:e.detail.value, showPicker:false, }); }else{ this.setData({ serviceFrequency:e.detail.value, showPicker:false }) } }, caclSchedule(){ if(this.data.serviceTimes=='请选择'){ wx.showToast({ title: '请选择服务次数', icon: 'none' }); return false; }else if(this.data.firstDate=='请选择'){ wx.showToast({ title: '请选择首次时间', icon: 'none' }); return false; }else if(this.data.serviceFrequency=='请选择'){ wx.showToast({ title: '请选择服务频率', icon: 'none' }); return false; }else{ wx.showLoading({ title: '加载中...', }); util.request(api.computerWorkerSchedule, { firstDate: this.data.firstDate, serviceTimes:this.data.serviceTimes, pinlv:this.data.serviceFrequency=='一周一次'?'7':'14' }, 'GET').then(res=> { wx.hideLoading(); if (res.errno === 0) { console.log(res); this.setData({ scheduleData:res.data }); } }).catch(err=>{ wx.hideLoading(); }); } }, onReachBottom() { // if (this.data.totalPages > this.data.page) { // this.setData({ // page: this.data.page + 1 // }); // this.getGoodsList(); // } else { // wx.showToast({ // title: '没有更多商品了', // icon: 'none', // duration: 2000 // }); // return false; // } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, onHide: function () { }, onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, })