// pages/upDownSubmit/index.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { str:' ', loginStatus: wx.getStorageSync('loginStatus') ? wx.getStorageSync('loginStatus') : false, roleCodeList: wx.getStorageSync('roleCodeList') ? wx.getStorageSync('roleCodeList') : '', searchVal: '', //分页 limit: 10, requestStatu: '加载中...', page: 1, totalPages: 1, more: false, nomore: '', resData:[], show: false, //弹窗 qxnumber:'', }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { const roleCodeList = wx.getStorageSync('roleCodeList') let loginStatus = wx.getStorageSync('loginStatus') this.setData({ searchVal: '', roleCodeList: roleCodeList ? roleCodeList : '', loginStatus: loginStatus ? loginStatus : false }) if(wx.getStorageSync('loginStatus')){ this.getListFun(); } }, //页面跳转 toLink: function (e) { let { url } = e.currentTarget.dataset wx.navigateTo({ url: url }) }, //搜索框请求S onChange(e) { this.setData({ searchVal: e.detail, }); }, onSearch: function (event) { this.setData({ searchVal: event.detail }) this.getListFun(); }, onCancel: function () { this.setData({}) }, toSearch: function (event) { this.getListFun(); }, //列表 getListFun: function () { this.setData({ page: 1 }) let params = { current: this.data.page, size: this.data.limit, licenseNumber:this.data.searchVal } app.request.pageFirst({ url: app.API.appointmentList, page: this, params: params, }) }, //执行 executeFun: function (e) { let _this = this let { id, tips } = e.currentTarget.dataset wx.showModal({ title: '提示!', content: `执行【${tips}】任务后不可恢复。确定要执行吗?`, confirmColor: '#FF5B5B', success: function (res) { if (res.confirm) { app.request.POST({ url: app.API.orderloadDelete, params: [{ id: id }], page: _this, isLoadingTxt: '执行中...', successFun: true }).then(res => { wx.showToast({ title: '执行成功', icon: 'success', duration: 1000, mask: true }) _this.getListFun(); //刷新列表 }) } else if (res.cancel) { } } }) }, //结束 finishFun: function (e) { let _this = this let { id, tips } = e.currentTarget.dataset wx.showModal({ title: '提示!', content: `结束【${tips}】任务后不可恢复。确定要结束吗?`, confirmColor: '#FF5B5B', success: function (res) { if (res.confirm) { app.request.POST({ url: app.API.orderloadDelete, params: [{ id: id }], page: _this, isLoadingTxt: '操作中...', successFun: true }).then(res => { wx.showToast({ title: '结束成功', icon: 'success', duration: 1000, mask: true }) _this.getListFun(); //刷新列表 }) } else if (res.cancel) { } } }) }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { this.setData({ searchVal: '' }) if (wx.getStorageSync('loginStatus')) { this.getListFun(); } else { wx.stopPullDownRefresh(); } }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { this.data.page++; let params = { current: this.data.page, size: this.data.limit, licenseNumber:this.data.searchVal, } app.request.pageOther({ url: app.API.appointmentList, page: this, params: params, loadType: true //加载类型,是否是下拉加载 }); }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })