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, //是否通过筛选来选择历史服务 is_reset: 0, //是否重复点击 is_nav: 1, //是否显示导航栏 }, 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, is_nav: 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 false; if (th.data.ismore) return false; wx.showLoading({ title: '加载中...', }) th.query_hist(); }, //重置历史服务数据 his_reset: function() { var th = this; var is_reset = th.data.is_reset; if (is_reset == 0) { th.setData({ hist_List: [], curpage: 1, is_service_read: 0, is_screen: 1, is_reset: 1, startTime: "", endTime: "", is_nav: 1 }) th.query_hist(); } }, 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/history/reservation/page"; getApp().request.promiseGet(url, { data: { storeId: a.stoid, userId: d.user_id, beginDate: startTime, endDate: endTime, page: th.data.curpage, pageSize: th.data.pageSize } }).then(res => { wx.hideLoading(); th.setData({ is_reset: 0 }) if (res.data.code == 0) { 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 { th.setData({ is_service_read: 1, is_screen: 0, ismore: 1 }) if (startTime!="") { th.setData({ total:0 }) } } }) } })