123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- // pages/tabber/news/index.js
- const app=getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- inpscreenind: 0,
- inpscreenlist: ['水洗码', '封签号', '订单号', '物流单号', '手机号'],
- stateind: 0,
- statelist: ['全部'],
- shopsind: 0,
- shopslist: [{
- id:0,title:'全部'
- }],
- date: '',
- keyword: '',
- selectInfo: {},
- data:{},
- pageindex: 1
- },
- onPullDownRefresh:function(){
- this.setData({pageindex: 1})
- this.getdata()
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- class Select {
- in = 1
- getSelet(){
- console.log(2);
- return 10
- }
- }
- var b = new Select();
- console.log(b.getSelet());
- this.getdata()
- this.getshopslist()
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- // this.setData({pageindex:this.data.pageindex+=1})
- // this.getdata()
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- const query = wx.createSelectorQuery()
- query.select('#nav').boundingClientRect((res) => {
- console.log(res);
- this.setData({
- selectInfo: res
- })
- })
- query.exec()
- },
- getshopslist(){
- let that = this
- wx.showLoading()
- app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry/ReportList", {}, "get").then(function (res) {
- wx.hideLoading()
- if(res.code==200){
- that.setData({
- shopslist:that.data.shopslist.concat(res.message.shop)
- })
- }
- }).catch(function (err) {
- console.log(222);
- })
- },
- getdata() {
- var that = this;
- app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry/ReportList", {
- network_id: that.data.shopsind!=0?that.data.shopslist[that.data.shopsind].id:'',
- status: that.data.stateind!=0?that.data.stateind:'',
- key: that.data.keyword,
- created_at: that.data.date,
- page: that.data.pageindex
- }, "get").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({data: []})
- }
- if (res.message.data.length > 0) {
- that.setData({data: that.data.data.concat(res.message.data)})
- } else {
- that.setData({pageindex: that.data.pageindex -= 1})
- }
-
- }
- }).catch(function (err) {
-
- console.log(222);
- })
- },
- changkeyword(e){
- this.setData({keyword: e.detail.value})
- },
- closedate(){
- this.setData({date: ''})
- this.setData({pageindex: 1})
- this.getdata()
- },
- datechange(e){
- this.setData({date:e.detail.value})
- this.setData({pageindex: 1})
- this.getdata()
- },
- shopschange(e){
- this.setData({shopsind: e.detail.value})
- this.setData({pageindex: 1})
- this.getdata()
- },
- changeinpscreen() {
- let that = this
- wx.showActionSheet({
- itemList: that.data.inpscreenlist,
- success(res) {
- that.setData({inpscreenind: res.tapIndex})
- }
- })
- },
- changestate() {
- let that = this
- wx.showActionSheet({
- itemList: that.data.statelist,
- success(res) {
- that.setData({stateind: res.tapIndex})
- this.setData({pageindex: 1})
- that.getdata()
- }
- })
- },
- })
|