银花优选微信小程序修改后的最新版本代码
This commit is contained in:
238
pages/mybalance/index.js
Normal file
238
pages/mybalance/index.js
Normal file
@@ -0,0 +1,238 @@
|
||||
|
||||
var app = getApp()
|
||||
var that=null
|
||||
var sopenFrame=null
|
||||
Page( {
|
||||
data: {
|
||||
balanceImg: '../../images/order-null.png',
|
||||
tipWords: '亲,暂时没有数据哦!',
|
||||
balanceHidden:false,
|
||||
nobalanceHidden:true,
|
||||
loadingHidden:false,
|
||||
mybalance:[],
|
||||
Start: 0,
|
||||
ZZEnable:1,
|
||||
TXEnable:0,
|
||||
nav:0,
|
||||
},
|
||||
|
||||
onLoad: function(options) {
|
||||
that = this
|
||||
if(options.t){
|
||||
that.setData({
|
||||
nav:options.t
|
||||
});
|
||||
}
|
||||
if(that.data.nav==1){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "余额明细"
|
||||
})
|
||||
}else if(that.data.nav==2){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "兑换积分明细"
|
||||
})
|
||||
}else if(that.data.nav==3){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "贡献值明细"
|
||||
})
|
||||
}
|
||||
else if(that.data.nav==4){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "佣金明细"
|
||||
})
|
||||
}else if(that.data.nav==5){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "活力值明细"
|
||||
})
|
||||
}else if(that.data.nav==9){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "增值额度明细"
|
||||
})
|
||||
}else if(that.data.nav==15){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "货款扣税明细"
|
||||
})
|
||||
}else if(that.data.nav==16){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "冻结货款明细"
|
||||
})
|
||||
}else if(that.data.nav==17){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "解冻货款明细"
|
||||
})
|
||||
}else if(that.data.nav==18){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "广告值明细"
|
||||
})
|
||||
}else if(that.data.nav==19){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "增值积分明细"
|
||||
})
|
||||
}else if(that.data.nav==21){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "激活码明细"
|
||||
})
|
||||
}else if(that.data.nav==22){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "推广名额明细"
|
||||
})
|
||||
}else if(that.data.nav==26){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "补贴券明细"
|
||||
})
|
||||
}else{
|
||||
wx.setNavigationBarTitle({
|
||||
title: "重复消费明细"
|
||||
})
|
||||
}
|
||||
sopenFrame=setInterval(function (){
|
||||
if(app.globalData.IFRefreshmybalance==1){
|
||||
app.globalData.IFRefreshmybalance=0
|
||||
that.clearCache();//清本页缓存
|
||||
that.getlist(0)
|
||||
}
|
||||
}, 1000);
|
||||
that.clearCache();//清本页缓存
|
||||
that.getlist(0)
|
||||
}, // 下拉刷新
|
||||
onPullDownRefresh: function () {
|
||||
//在当前页面显示导航条加载动画
|
||||
wx.showNavigationBarLoading();
|
||||
//显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
|
||||
wx.showLoading({
|
||||
title: '刷新中...',
|
||||
})
|
||||
that.clearCache();
|
||||
that.getlist(1);//第一次加载数据
|
||||
},
|
||||
|
||||
// 页面上拉触底事件(上拉加载更多)
|
||||
onReachBottom: function () {
|
||||
if(that.data.loadingHidden){
|
||||
that.setData({
|
||||
loadingHidden:false
|
||||
});
|
||||
that.getlist(2);//后台获取新数据并追加渲染
|
||||
}else{
|
||||
wx.hideLoading();
|
||||
}
|
||||
},
|
||||
|
||||
// 清缓存
|
||||
clearCache:function(){
|
||||
that.setData({
|
||||
balanceHidden:false,
|
||||
nobalanceHidden:true,
|
||||
loadingHidden:false,
|
||||
Start: 0,
|
||||
mybalance:[]
|
||||
});
|
||||
},getlist: function(gp) {
|
||||
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({
|
||||
ZZEnable:userInfo.ZZEnable,
|
||||
TXEnable:userInfo.TXEnable,
|
||||
})
|
||||
}
|
||||
wx.request({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx?timestamp=" + (new Date().getTime() / 1000),
|
||||
data: {
|
||||
action:"getbilllist",
|
||||
t:that.data.nav,
|
||||
Start:that.data.Start,
|
||||
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.mybalance;
|
||||
tmpArr.push.apply(tmpArr,res.data.data);
|
||||
that.setData({
|
||||
mybalance: tmpArr,
|
||||
Start: that.data.Start+res.data.data.length,
|
||||
loadingHidden:true
|
||||
})
|
||||
if(gp==0||gp==1){
|
||||
|
||||
if(res.data.data.length>0){
|
||||
that.setData({
|
||||
balanceHidden:false,
|
||||
nobalanceHidden:true
|
||||
|
||||
})
|
||||
}else{
|
||||
that.setData({
|
||||
balanceHidden:true,
|
||||
nobalanceHidden:false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
if(gp==1){
|
||||
//隐藏loading 提示框
|
||||
wx.hideLoading();
|
||||
//隐藏导航条加载动画
|
||||
wx.hideNavigationBarLoading();
|
||||
//停止下拉刷新
|
||||
wx.stopPullDownRefresh();
|
||||
}
|
||||
}
|
||||
})
|
||||
},onnav:function(e) {
|
||||
var index = e.currentTarget.dataset.id
|
||||
that.setData({
|
||||
nav:index
|
||||
})
|
||||
that.clearCache();
|
||||
that.getlist(0);
|
||||
},onzz:function() {
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
if(!userId||!LoginId){
|
||||
wx.navigateTo({
|
||||
url: "../login/index"
|
||||
})
|
||||
}else{
|
||||
wx.navigateTo({
|
||||
url: "../zhuanzhang/index?t=" + that.data.nav
|
||||
})
|
||||
}
|
||||
|
||||
},ontx:function() {
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
if(!userId||!LoginId){
|
||||
wx.navigateTo({
|
||||
url: "../login/index"
|
||||
})
|
||||
}else{
|
||||
wx.navigateTo({
|
||||
url: "../withdrawal/index?t=0"
|
||||
})
|
||||
}
|
||||
|
||||
},onzh:function() {
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
if(!userId||!LoginId){
|
||||
wx.navigateTo({
|
||||
url: "../login/index"
|
||||
})
|
||||
}else{
|
||||
wx.navigateTo({
|
||||
url: "../zhuanhuan/index?t=1"
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user