var util = require('../../../utils/util.js'); var api = require('../../../config/api.js'); var app = getApp(); Page({ /** * 页面的初始数据 */ data: { info:{}, teamList:[], // teamList:[ // { // refereeAvatar:'https://jzmall.lifejingzhi.com/file/jzmall/weixin/distribution/icon-order.png', // refereeName:'鲸致生活', // refereeTypeName:'副团长', // refereeMobile:'123433344444', // orders:"12", // actualPrice:'12311', // commissionEstimate:'100' // }, // { // refereeAvatar:'https://jzmall.lifejingzhi.com/file/jzmall/weixin/distribution/icon-order.png', // refereeName:'鲸致生活', // refereeTypeName:'副团长', // refereeMobile:'123433344444', // orders:"12", // actualPrice:'12311', // commissionEstimate:'100' // }, // ], showType: 0, orderType:0,//0推广 1自购 page: 1, limit: 10, totalPages: 1, tipsShow:false, teamText:true, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { util.request(api.RefereeMyTeamInfo, { }).then(res=> { if (res.errno === 0) { this.setData({ info: res.data }); } }); this.getTeamList(); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, getTeamList() { let that = this; util.request(api.RefereeMyTeamList, { showType: that.data.showType, page: that.data.page, limit: that.data.limit }).then(function(res) { if (res.errno === 0) { res.data.list.forEach(item=>{ if(item.refereeType==0) item.refereeTypeName="员工" if(item.refereeType==1) item.refereeTypeName="BD" if(item.refereeType==2) item.refereeTypeName="团长" if(item.refereeType==3) item.refereeTypeName="副团长" if(item.refereeType==4) item.refereeTypeName="团员" }) that.setData({ teamList: that.data.teamList.concat(res.data.list), totalPages: res.data.pages }); } }); }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, showTeamTip(){ this.setData({ tipsShow:true, teamText:true, }) }, showSaleTip(){ this.setData({ tipsShow:true, teamText:false, }) }, onReachBottom() { if (this.data.totalPages > this.data.page) { this.setData({ page: this.data.page + 1 }); this.getTeamList(); } else { wx.showToast({ title: '没有更多订单了', icon: 'none', duration: 2000 }); return false; } }, onClickHide(){ this.setData({ tipsShow:false }) }, onTabChange(e){ let showType = e.detail.name; this.setData({ teamList: [], showType: showType, page: 1, limit: 10, totalPages: 1 }); this.getTeamList(); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })