team.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. var util = require('../../../utils/util.js');
  2. var api = require('../../../config/api.js');
  3. var app = getApp();
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. info:{},
  10. teamList:[],
  11. // teamList:[
  12. // {
  13. // refereeAvatar:'https://jzmall.lifejingzhi.com/file/jzmall/weixin/distribution/icon-order.png',
  14. // refereeName:'鲸致生活',
  15. // refereeTypeName:'副团长',
  16. // refereeMobile:'123433344444',
  17. // orders:"12",
  18. // actualPrice:'12311',
  19. // commissionEstimate:'100'
  20. // },
  21. // {
  22. // refereeAvatar:'https://jzmall.lifejingzhi.com/file/jzmall/weixin/distribution/icon-order.png',
  23. // refereeName:'鲸致生活',
  24. // refereeTypeName:'副团长',
  25. // refereeMobile:'123433344444',
  26. // orders:"12",
  27. // actualPrice:'12311',
  28. // commissionEstimate:'100'
  29. // },
  30. // ],
  31. showType: 0,
  32. orderType:0,//0推广 1自购
  33. page: 1,
  34. limit: 10,
  35. totalPages: 1,
  36. tipsShow:false,
  37. teamText:true,
  38. },
  39. /**
  40. * 生命周期函数--监听页面加载
  41. */
  42. onLoad: function (options) {
  43. util.request(api.RefereeMyTeamInfo, { }).then(res=> {
  44. if (res.errno === 0) {
  45. this.setData({
  46. info: res.data
  47. });
  48. }
  49. });
  50. this.getTeamList();
  51. },
  52. /**
  53. * 生命周期函数--监听页面初次渲染完成
  54. */
  55. onReady: function () {
  56. },
  57. getTeamList() {
  58. let that = this;
  59. util.request(api.RefereeMyTeamList, {
  60. showType: that.data.showType,
  61. page: that.data.page,
  62. limit: that.data.limit
  63. }).then(function(res) {
  64. if (res.errno === 0) {
  65. res.data.list.forEach(item=>{
  66. if(item.refereeType==0) item.refereeTypeName="员工"
  67. if(item.refereeType==1) item.refereeTypeName="BD"
  68. if(item.refereeType==2) item.refereeTypeName="团长"
  69. if(item.refereeType==3) item.refereeTypeName="副团长"
  70. if(item.refereeType==4) item.refereeTypeName="团员"
  71. })
  72. that.setData({
  73. teamList: that.data.teamList.concat(res.data.list),
  74. totalPages: res.data.pages
  75. });
  76. }
  77. });
  78. },
  79. /**
  80. * 生命周期函数--监听页面显示
  81. */
  82. onShow: function () {
  83. },
  84. showTeamTip(){
  85. this.setData({
  86. tipsShow:true,
  87. teamText:true,
  88. })
  89. },
  90. showSaleTip(){
  91. this.setData({
  92. tipsShow:true,
  93. teamText:false,
  94. })
  95. },
  96. onReachBottom() {
  97. if (this.data.totalPages > this.data.page) {
  98. this.setData({
  99. page: this.data.page + 1
  100. });
  101. this.getTeamList();
  102. } else {
  103. wx.showToast({
  104. title: '没有更多订单了',
  105. icon: 'none',
  106. duration: 2000
  107. });
  108. return false;
  109. }
  110. },
  111. onClickHide(){
  112. this.setData({
  113. tipsShow:false
  114. })
  115. },
  116. onTabChange(e){
  117. let showType = e.detail.name;
  118. this.setData({
  119. teamList: [],
  120. showType: showType,
  121. page: 1,
  122. limit: 10,
  123. totalPages: 1
  124. });
  125. this.getTeamList();
  126. },
  127. /**
  128. * 生命周期函数--监听页面隐藏
  129. */
  130. onHide: function () {
  131. },
  132. /**
  133. * 生命周期函数--监听页面卸载
  134. */
  135. onUnload: function () {
  136. },
  137. /**
  138. * 页面相关事件处理函数--监听用户下拉动作
  139. */
  140. onPullDownRefresh: function () {
  141. },
  142. /**
  143. * 用户点击右上角分享
  144. */
  145. onShareAppMessage: function () {
  146. }
  147. })