index.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. const app = getApp()
  2. const {showSuccess} = require("../../../utils/util.js");
  3. Page({
  4. data: {
  5. tableData: [],
  6. userInfo:{},
  7. from: 0,
  8. size: 10
  9. },
  10. onLoad: function(options) {
  11. app.checkLogin( userInfo =>{
  12. this.setData({userInfo})
  13. this.loadData()
  14. })
  15. },
  16. onPullDownRefresh() {
  17. this.setData({ from:0, tableData:[]});
  18. this.loadData( true )
  19. },
  20. onReachBottom() {
  21. if(this.data.from > -1) {
  22. this.loadData()
  23. }
  24. },
  25. gotoDetail( e ){
  26. const {id} = e.currentTarget.dataset
  27. wx.navigateTo({
  28. url: `/pages/detail/outList/index?logId=${id}`,
  29. })
  30. },
  31. confirmData: function(e){
  32. const {id, index} = e.currentTarget.dataset
  33. let tableData = this.data.tableData||[]
  34. app.formPost('User.ConfirmImportOut', {logId:id} ).then(res => {
  35. if (res.code === 200) {
  36. tableData.splice( index, 1)
  37. showSuccess("审核通过")
  38. this.setData({tableData});
  39. }
  40. })
  41. },
  42. loadData: function() {
  43. let {from, size, tableData} = this.data;
  44. let param = {from, size}
  45. app.formPost('User.WaitComfirmOutList', param ).then(res => {
  46. wx.stopPullDownRefresh()
  47. if (res.code === 200) {
  48. if( from == 0) tableData = [];
  49. this.setData({
  50. from: res.data.from,
  51. tableData: tableData.concat(res.data.list)
  52. });
  53. }
  54. })
  55. }
  56. })