index.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // pages/promoter-order/index.js
  2. import { spreadOrder } from '../../api/user.js';
  3. const app = getApp();
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. parameter: {
  10. 'navbar': '1',
  11. 'return': '1',
  12. 'title': '推广人订单',
  13. 'color':true,
  14. 'class':'0'
  15. },
  16. page: 0,
  17. limit: 8,
  18. status: false,
  19. recordList: [],
  20. recordCount: 0,
  21. },
  22. /**
  23. * 生命周期函数--监听页面加载
  24. */
  25. onLoad: function (options) {
  26. },
  27. /**
  28. * 生命周期函数--监听页面初次渲染完成
  29. */
  30. onReady: function () {
  31. },
  32. /**
  33. * 生命周期函数--监听页面显示
  34. */
  35. onShow: function () {
  36. this.getRecordOrderList();
  37. },
  38. getRecordOrderList: function () {
  39. var that = this;
  40. var page = that.data.page;
  41. var limit = that.data.limit;
  42. var status = that.data.status;
  43. var recordList = that.data.recordList;
  44. var recordListNew = [];
  45. if (status == true) return;
  46. spreadOrder({ page: page, limit: limit }).then(res=>{
  47. var len = res.data.list ? res.data.list.length : 0;
  48. var recordListData = res.data.list;
  49. recordListNew = recordList.concat(recordListData);
  50. that.setData({ recordCount: res.data.count || 0, status: limit > len, page: limit + page, recordList: recordListNew });
  51. });
  52. },
  53. /**
  54. * 生命周期函数--监听页面隐藏
  55. */
  56. onHide: function () {
  57. },
  58. /**
  59. * 生命周期函数--监听页面卸载
  60. */
  61. onUnload: function () {
  62. },
  63. /**
  64. * 页面相关事件处理函数--监听用户下拉动作
  65. */
  66. onPullDownRefresh: function () {
  67. },
  68. /**
  69. * 页面上拉触底事件的处理函数
  70. */
  71. onReachBottom: function () {
  72. },
  73. /**
  74. * 用户点击右上角分享
  75. */
  76. onShareAppMessage: function () {
  77. }
  78. })