// pages/tabber/news/index.js const app=getApp(); Page({ /** * 页面的初始数据 */ data: { selectInfo: {}, inputValue:"", show:false, vtype:"订单号", ktype:0, columns: ['订单号', '物流单号', '水洗码', '封签号', '手机号','用户姓名'], pageindex: 1 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { class Select { in = 1 getSelet(){ console.log(2); return 10 } } var b = new Select(); console.log(b.getSelet()); this.serch(); }, onPullDownRefresh:function(){ this.setData({pageindex: 1}) this.serch(); }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { this.setData({pageindex:this.data.pageindex+=1}) this.serch() }, click(){ this.setData({ show:!this.data.show }) }, onChange(event) { const { picker, value, index } = event.detail; this.setData({ vtype:value, show:!this.data.show, ktype:index }) console.log(`当前值:${value}, 当前索引:${index}`); }, onCancel() { Toast('取消'); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, goto:function(e){ wx.navigateTo({ url: "/pages/serah/detal?id="+e.currentTarget.dataset.id }) }, bindinput(e){ this.setData({ inputValue: e.detail.value }) }, serch(){ var that=this; app.api.useApi(app.globalData.baseAppUrl + "api/admin/SearchOrder", { key: that.data.inputValue, logistics_status:0, network_id:"", created_at:"", page: that.data.pageindex }, "post").then(function (res) { console.log(res); if (res.code != 200) { wx.showLoading({ title: res.message.msg, }) that.setData({pageindex: that.data.pageindex -= 1}) setTimeout(function () { wx.hideLoading(); }, 1000); } else { wx.hideLoading(); if (that.data.pageindex == 1) { that.setData({selectInfo: []}) } if (res.message.data.length > 0) { that.setData({selectInfo: that.data.selectInfo.concat(res.message.data)}) } else { that.setData({pageindex: that.data.pageindex -= 1}) } } }).catch(function (err) { console.log(222); }) } })