var e = getApp(), a = e.globalData.setting, os = a, t = e.request, d = e.globalData; Page({ /** * 页面的初始数据 */ data: { iurl: a.imghost, isPickerShow: false, isPickerRender: false, startTime: "", endTime: "", pickerConfig: { endDate: true, column: "", dateLimit: true, initStartTime: "2019-01-01 12:32:44", initEndTime: "2019-12-01 12:32:44", limitStartTime: "1917-05-06 12:32:44", limitEndTime: "2055-05-06 12:32:44" }, hist_List: [], //服务项目列表 is_service_read: 0, curpage: 1, //当前分页数 pageSize: 15, //页大小 total: 0, ismore: 0, //是否加载完毕 is_screen: 0, //是否通过筛选来选择历史服务 }, pickerShow: function() { this.setData({ isPickerShow: true, isPickerRender: true, chartHide: true }); }, pickerHide: function() { var th = this; th.setData({ isPickerShow: false, chartHide: false }); }, //--选择时间-- setPickerTime: function(val) { let data = val.detail, gl_data = getApp().globalData, th = this; th.setData({ startTime: data.startTime, endTime: data.endTime, val: 0, distance: 0, hist_List: [], curpage: 1, is_screen: 1 }); th.query_hist(); }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { var th = this; th.query_hist(); }, /** * 生命周期函数--监听页面显示 */ onShow: function() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function() { var th = this; if (th.data.total <= th.data.pageSize) return; if (th.data.ismore) return; wx.showLoading({ title: '加载中...', }) th.query_service(); }, query_hist: function() { var th = this; var startTime = th.data.startTime.substring(0, 10); //开始 var endTime = th.data.endTime.substring(0, 10); //结束 var url = "/api/weshop/marketing/reservation/reservation/page"; getApp().request.promiseGet(url, { data: { storeId: a.stoid, userId: 5682130, //5682130 d.user_id beginDate: startTime, endDate: endTime, page: th.data.curpage, pageSize: th.data.pageSize } }).then(res => { if (res.data.code == 0) { wx.hideLoading(); th.data.curpage++; var arr1 = th.data.hist_List; var arr2 = res.data.data.pageData; var arr3 = [...arr1, ...arr2]; var ismore = 0; if (arr3.length == res.data.total) ismore = 1 th.setData({ hist_List: arr3, total: res.data.data.total, ismore: ismore, is_service_read: 1, }), wx.stopPullDownRefresh(); //停止下拉刷新 } else { getApp().my_warnning(res.data.msg, 0, this); // else { // th.setData({ // is_service_read: 1 // }) } }) }, /** * 用户点击右上角分享 */ onShareAppMessage: function() { } })