index.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. var util = require('../../../../utils/util.js');
  2. var api = require('../../../../config/api.js');
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. childList: [],
  9. page: 1,
  10. limit: 10,
  11. totalPages: 1
  12. },
  13. getChildList() {
  14. let that = this;
  15. util.request(api.DisCommissionChildUser, {
  16. page: that.data.page,
  17. limit: that.data.limit
  18. }).then(function(res) {
  19. if (res.errno === 0) {
  20. console.log(res.data);
  21. that.setData({
  22. childList: that.data.childList.concat(res.data.list),
  23. totalPages: res.data.pages
  24. });
  25. }
  26. });
  27. },
  28. makeCall(e){
  29. wx.makePhoneCall({
  30. phoneNumber: e.currentTarget.dataset.mobile
  31. })
  32. },
  33. /**
  34. * 生命周期函数--监听页面加载
  35. */
  36. onLoad: function (options) {
  37. },
  38. /**
  39. * 生命周期函数--监听页面初次渲染完成
  40. */
  41. onReady: function () {
  42. },
  43. /**
  44. * 生命周期函数--监听页面显示
  45. */
  46. onShow: function () {
  47. this.getChildList();
  48. },
  49. /**
  50. * 生命周期函数--监听页面隐藏
  51. */
  52. onHide: function () {
  53. },
  54. /**
  55. * 生命周期函数--监听页面卸载
  56. */
  57. onUnload: function () {
  58. },
  59. /**
  60. * 页面相关事件处理函数--监听用户下拉动作
  61. */
  62. onPullDownRefresh: function () {
  63. },
  64. /**
  65. * 页面上拉触底事件的处理函数
  66. */
  67. onReachBottom: function () {
  68. if (this.data.totalPages > this.data.page) {
  69. this.setData({
  70. page: this.data.page + 1
  71. });
  72. this.getChildList();
  73. } else {
  74. wx.showToast({
  75. title: '没有更多了',
  76. icon: 'none',
  77. duration: 2000
  78. });
  79. return false;
  80. }
  81. },
  82. /**
  83. * 用户点击右上角分享
  84. */
  85. onShareAppMessage: function () {
  86. }
  87. })