// pages/tabber/news/index.js const app=getApp(); Page({ /** * 页面的初始数据 */ data: { selectInfo: {}, inputValue:"", show:false, vtype:"订单号", ktype:0, columns: ['订单号', '物流单号', '水洗码', '封签号', '手机号','用户姓名'], pageindex: 1, order_count: 0, shopsind: 0, shopslist: [{ id:0,title:'全部' }], }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { class Select { in = 1 getSelet(){ console.log(2); return 10 } } var b = new Select(); console.log(b.getSelet()); this.serch(); this.getshopslist() }, onPullDownRefresh:function(){ this.setData({pageindex: 1}) this.serch(); }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { this.setData({pageindex:this.data.pageindex+=1}) this.serch() }, getshopslist(){ let that = this wx.showLoading() app.api.useApi(app.globalData.baseAppUrl + "api/admin/SearchOrder", { key: '', logistics_status:0, network_id:"", created_at:"", page: 1 }, "post").then(function (res) { wx.hideLoading() if(res.code==200){ that.setData({ shopslist:that.data.shopslist.concat(res.message.data.networker) }) } }).catch(function (err) { console.log(222); }) }, 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 }) }, shopschange(e){ this.setData({shopsind: e.detail.value}) this.serch() }, serch(){ var that=this; app.api.useApi(app.globalData.baseAppUrl + "api/admin/SearchOrder", { key: that.data.inputValue, logistics_status:0, network_id:that.data.shopsind!=0?that.data.shopslist[that.data.shopsind].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(); that.setData({order_count:res.message.data.order_count}) if (that.data.pageindex == 1) { that.setData({selectInfo: []}) } if (res.message.data.list.length > 0) { that.setData({selectInfo: that.data.selectInfo.concat(res.message.data.list)}) } else { that.setData({pageindex: that.data.pageindex -= 1}) } } }).catch(function (err) { console.log(222); }) } })