Files
HnyhuaXCX/pages/myincome0/index.js

123 lines
3.4 KiB
JavaScript

var WxParse = null;
var app = getApp()
var that=null
var sopenFrame=null
Page( {
data: {
zsymoney:"0.00",
jrsymoney:"0.00",
zrsymoney:"0.00",
bysymoney:"0.00",
sysymoney:"0.00",
symoney0:"0.00",
symoney1:"0.00",
symoney2:"0.00",
symoney3:"0.00",
symoney4:"0.00",
symoney5:"0.00",
symoney6:"0.00",
Start:0,
addtime:"",
datas: [],
bonuscategorys: [],
},
onLoad: function(options) {
that = this
that.setData({
addtime: options.addtime
})
var userId = wx.getStorageSync("userId")
var LoginId = wx.getStorageSync("LoginId")
var userInfodata = wx.getStorageSync("userInfo")
if(userId&&LoginId&&userInfodata){
var userInfo = JSON.parse(userInfodata)
that.setData({
bonuscategorys:userInfo.bonuscategorys
})
}
that.rdata(0)
},onPullDownRefresh: function () {
//在当前页面显示导航条加载动画
wx.showNavigationBarLoading();
//显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
wx.showLoading({
title: '刷新中...',
})
that.clearCache();
that.rdata(1);
}, // 页面上拉触底事件(上拉加载更多)
onReachBottom: function () {
that.setData({
loadingHidden:false
});
that.rdata(2);//后台获取新数据并追加渲染
},// 清缓存
clearCache:function(){
that.setData({
datas: [],
Start: 0,
loadingHidden:false
});
},rdata: function(t) {
var userId = wx.getStorageSync("userId")
var LoginId = wx.getStorageSync("LoginId")
if(userId&&LoginId){
wx.request({
url: app.globalData.apiurl + "/xapiajax.ashx",
data: {
action:"getmyincome",
userId:(!userId?"":userId),
LoginId:(!LoginId?"":LoginId),
t:1,
addtime:that.data.addtime,
Start:that.data.Start
},
method:"GET",
dataType:"json",
header: {
"content-type": "application/json" // 默认值
},
success (res) {
if(that.data.Start==0){
that.setData({
zsymoney:res.data.zsymoney,
jrsymoney:res.data.jrsymoney,
zrsymoney:res.data.zrsymoney,
bysymoney:res.data.bysymoney,
sysymoney:res.data.sysymoney,
symoney0:res.data.SYCount1,
symoney1:res.data.SYCount2,
symoney2:res.data.SYCount3,
symoney3:res.data.SYCount4,
symoney4:res.data.SYCount5,
symoney5:res.data.SYCount6,
symoney6:res.data.SYCount7
})
}
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(t==1){
//隐藏loading 提示框
wx.hideLoading();
//隐藏导航条加载动画
wx.hideNavigationBarLoading();
//停止下拉刷新
wx.stopPullDownRefresh();
}
}
})