visitorcheck.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. const util = require('../../../utils/util.js');
  2. const api = require('../../../utils/api.js');
  3. const app = getApp()
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. isregiste: true,
  10. approvalNum: 0,
  11. approvedNum: 0,
  12. list: []
  13. },
  14. checkTab: function(e) {
  15. const that = this;
  16. that.setData({
  17. isregiste: !that.data.isregiste
  18. })
  19. if (that.data.isregiste) {
  20. that.getVisitorCheckInfo(2);
  21. } else {
  22. that.getVisitorCheckInfo(3);
  23. }
  24. },
  25. todetail: function(e) {
  26. let id = e.currentTarget.dataset.id;
  27. wx.navigateTo({
  28. url: '../visitorcheckdetail/visitorcheckdetail?id=' + id,
  29. })
  30. },
  31. getVisitorCheckInfo: function(status) {
  32. const that = this;
  33. util.httpRequest(api.getVisitorCheckInfo, {
  34. status: status,
  35. rows: 20,
  36. page: 1
  37. }, 'post').then(res => {
  38. that.setData({
  39. list: res.data.data.data,
  40. approvalNum: res.data.data.approval,
  41. approvedNum: res.data.data.approved
  42. })
  43. })
  44. },
  45. /**
  46. * 生命周期函数--监听页面加载
  47. */
  48. onLoad: function(options) {
  49. const that = this;
  50. that.getVisitorCheckInfo(2);
  51. },
  52. /**
  53. * 生命周期函数--监听页面初次渲染完成
  54. */
  55. onReady: function() {
  56. },
  57. /**
  58. * 生命周期函数--监听页面显示
  59. */
  60. onShow: function() {
  61. },
  62. /**
  63. * 生命周期函数--监听页面隐藏
  64. */
  65. onHide: function() {
  66. },
  67. /**
  68. * 生命周期函数--监听页面卸载
  69. */
  70. onUnload: function() {
  71. },
  72. /**
  73. * 页面相关事件处理函数--监听用户下拉动作
  74. */
  75. onPullDownRefresh: function() {
  76. },
  77. /**
  78. * 页面上拉触底事件的处理函数
  79. */
  80. onReachBottom: function() {
  81. }
  82. })