159 lines
4.6 KiB
JavaScript
159 lines
4.6 KiB
JavaScript
|
|
var WxParse = null;
|
||
|
|
var app = getApp()
|
||
|
|
var that=null
|
||
|
|
var sopenFrame=null
|
||
|
|
Page( {
|
||
|
|
data: {
|
||
|
|
zsymoney:"0.00",
|
||
|
|
yxfmoney:"0.00",
|
||
|
|
wxfmoney:"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,
|
||
|
|
datas: [],
|
||
|
|
bonuscategorys: [],
|
||
|
|
},
|
||
|
|
onLoad: function() {
|
||
|
|
|
||
|
|
that = this
|
||
|
|
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),
|
||
|
|
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,
|
||
|
|
yxfmoney:res.data.yxfmoney,
|
||
|
|
wxfmoney:res.data.wxfmoney,
|
||
|
|
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();
|
||
|
|
}
|
||
|
|
},ondetails: function(e) {
|
||
|
|
|
||
|
|
var addtime=e.currentTarget.dataset.time
|
||
|
|
wx.navigateTo({
|
||
|
|
url: "../myincome0/index?addtime=" + addtime
|
||
|
|
})
|
||
|
|
|
||
|
|
},onbonus:function(e) {
|
||
|
|
var userId = wx.getStorageSync("userId")
|
||
|
|
var LoginId = wx.getStorageSync("LoginId")
|
||
|
|
var userInfodata = wx.getStorageSync("userInfo")
|
||
|
|
var ifdl=true;
|
||
|
|
if(!userId||!LoginId){
|
||
|
|
ifdl=false;
|
||
|
|
wx.navigateTo({
|
||
|
|
url: "../login/index"
|
||
|
|
})
|
||
|
|
}else{
|
||
|
|
var userInfo = JSON.parse(userInfodata);
|
||
|
|
if(userInfo.Phone==""){
|
||
|
|
ifdl=false;
|
||
|
|
wx.showToast({
|
||
|
|
title: "您还没有绑定手机号",
|
||
|
|
icon: "none",
|
||
|
|
duration: 2000
|
||
|
|
})
|
||
|
|
wx.navigateTo({
|
||
|
|
url: "../myphone/index"
|
||
|
|
})
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if(ifdl){
|
||
|
|
var t = e.currentTarget.dataset.id
|
||
|
|
|
||
|
|
wx.navigateTo({
|
||
|
|
url: "../mybonus/index?t=" + t
|
||
|
|
})
|
||
|
|
}
|
||
|
|
}
|
||
|
|
})
|