Files
HnyhuaXCX/pages/myusers/index.js

153 lines
4.1 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var app = getApp()
var that=null
var sopenFrame=null
Page( {
data: {
orderImg: '../../images/iconfont-dingdan.png',
tipWords: '亲,您还没有推荐会员哦!',
dataHidden:false,
nodataHidden:true,
loadingHidden:false,
tjcount:0,
temcount:0,
zyj:0,
maxzcount:0.00,
minzcount:0.00,
zcount:0.00,
datas:[],
Start: 0,
t:1
},
onLoad: function() {
that = this
that.clearCache();//清本页缓存
that.getlist(0)
}, // 下拉刷新
onPullDownRefresh: function () {
//在当前页面显示导航条加载动画
wx.showNavigationBarLoading();
//显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
wx.showLoading({
title: '刷新中...',
})
that.clearCache();
that.getlist(1);//第一次加载数据
},
// 页面上拉触底事件(上拉加载更多)
onReachBottom: function () {
that.setData({
loadingHidden:false
});
that.getlist(2);//后台获取新数据并追加渲染
},
// 清缓存
clearCache:function(){
that.setData({
dataHidden:false,
nodataHidden:true,
loadingHidden:false,
Start: 0,
datas:[]
});
},getlist: function(gp) {
var userId = wx.getStorageSync("userId")
var LoginId = wx.getStorageSync("LoginId")
wx.request({
url: app.globalData.apiurl + "/xapiajax.ashx",
data: {
action:"getmyfriendlist",
Start:that.data.Start,
t:that.data.t,
userId:(userId==null?"":userId),
LoginId:(LoginId==null?"":LoginId)
},
method:"GET",
dataType:"json",
header: {
"content-type": "application/json" // 默认值
},
success (res) {
if(res.data.status==1){
var tmpArr = null;
tmpArr = that.data.datas;
tmpArr.push.apply(tmpArr,res.data.data);
that.setData({
datas: tmpArr,
Start: that.data.Start+res.data.data.length,
loadingHidden:true
})
if(gp==0||gp==1){
that.setData({
tjcount:res.data.tjcount,
temcount:res.data.temcount,
zyj:res.data.zyj,
maxzcount:res.data.maxzcount,
minzcount:res.data.minzcount,
zcount:res.data.zcount
})
if(res.data.data.length>0){
that.setData({
dataHidden:false,
nodataHidden:true
})
}else{
that.setData({
dataHidden:true,
nodataHidden:false
})
}
that.setData({
tipWords: '亲,您还没有推荐会员哦!'
})
}else{
that.setData({
tipWords: '亲,找不到会员哦!'
})
}
}
if(gp==1){
//隐藏loading 提示框
wx.hideLoading();
//隐藏导航条加载动画
wx.hideNavigationBarLoading();
//停止下拉刷新
wx.stopPullDownRefresh();
}
}
})
},getkeyword:function(e) {
that.setData({
keyword:e.detail.value
})
},onskusers:function() {
wx.navigateTo({
url: "../myskusers/index"
})
},onsearch:function() {
that.clearCache();
that.getlist(1);//第一次加载数据
},onyj:function(e) {
var tjcount = e.currentTarget.dataset.tjcount
var temcount = e.currentTarget.dataset.temcount
var zyj = e.currentTarget.dataset.zyj
wx.showModal({
title: "会员情况",
content: "推荐人数:"+tjcount+"\r\n团队人数"+temcount+"\r\n总业绩"+zyj+"",
showCancel:false,
success (res0) {
if (res0.confirm) {
}
}
});
}
})