const app = getApp() const {showSuccess} = require("../../../utils/util.js"); Page({ data: { tableData: [], userInfo:{}, from: 0, size: 10 }, onLoad: function(options) { app.checkLogin( userInfo =>{ this.setData({userInfo}) this.loadData() }) }, onPullDownRefresh() { this.setData({ from:0, tableData:[]}); this.loadData( true ) }, onReachBottom() { if(this.data.from > -1) { this.loadData() } }, gotoDetail( e ){ const {id} = e.currentTarget.dataset wx.navigateTo({ url: `/pages/detail/outList/index?logId=${id}`, }) }, confirmData: function(e){ const {id, index} = e.currentTarget.dataset let tableData = this.data.tableData||[] app.formPost('User.ConfirmImportOut', {logId:id} ).then(res => { if (res.code === 200) { tableData.splice( index, 1) showSuccess("审核通过") this.setData({tableData}); } }) }, loadData: function() { let {from, size, tableData} = this.data; let param = {from, size} app.formPost('User.WaitComfirmOutList', param ).then(res => { wx.stopPullDownRefresh() if (res.code === 200) { if( from == 0) tableData = []; this.setData({ from: res.data.from, tableData: tableData.concat(res.data.list) }); } }) } })