// pages/signFor/record.js const app = getApp() Page({ /** * 页面的初始数据 */ data: { typeid: 0, typelist: ['未取', '已取'], selectitem: '', selectInfo: [], date: '', content: [] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.getinfo() this.getdata() }, bindDateChange: function (e) { let that = this that.setData({ date: e.detail.value,pageindex: 1,content: [] }) that.getdata() }, changeisselect() { this.setData({ isselect: !this.data.isselect }) }, chooseselect(e) { this.setData({ selectitem: e.currentTarget.dataset.item,pageindex: 1,content: []}) this.changeisselect() this.getdata() }, getinfo() { let that = this app.api.useApi(app.globalData.baseAppUrl + "api/admin/shop_list", {}, "get").then(function (res) { wx.hideLoading(); if (res.code == 200) { that.setData({ selectInfo: res.message.data }) } else { } }).catch(function (err) { console.log(222); }) }, getdata() { var that = this wx.showLoading() app.api.useApi(app.globalData.baseAppUrl + "api/admin/temporary_list", { status: that.data.typeid, network_id: that.data.selectitem.id || 0, created_at: that.data.date || '' }, "get").then(function (res) { console.log(res); if (res.code != 200) { wx.showLoading({ title: '数据获取失败', }) setTimeout(function () { wx.hideLoading(); }, 1000); } else { wx.hideLoading() if (that.data.pageindex == 1) { that.setData({ content: [] }) } if (res.message.data.list.data.length > 0) { that.setData({ content: that.data.content.concat(res.message.data.list.data) }) } else { that.setData({ pageindex: that.data.pageindex -= 1 }) } } }).catch(function (err) { console.log(222); }) }, changetype() { let that = this wx.showActionSheet({ itemList: that.data.typelist, success(res) { that.setData({typeid: res.tapIndex,pageindex: 1,content: []}) that.getdata() } }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { this.setData({ pageindex: this.data.pageindex += 1 }) this.getdata() }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })