219 lines
5.5 KiB
JavaScript
219 lines
5.5 KiB
JavaScript
|
|
var app = getApp()
|
||
|
|
var that=null
|
||
|
|
var sopenFrame=null
|
||
|
|
var wait=120
|
||
|
|
Page( {
|
||
|
|
data: {
|
||
|
|
loadingHidden:false,
|
||
|
|
nodataHidden:true,
|
||
|
|
mybalance:[],
|
||
|
|
Start: 0,
|
||
|
|
nav:0,
|
||
|
|
mcHidden:true,
|
||
|
|
mcsl:0,
|
||
|
|
mcjg:0,
|
||
|
|
yjdz:0,
|
||
|
|
zzid:0,
|
||
|
|
ifrdata:0,
|
||
|
|
qytitle:"确认",
|
||
|
|
a_pwd:""
|
||
|
|
},
|
||
|
|
|
||
|
|
onLoad: function(options) {
|
||
|
|
that = this
|
||
|
|
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({
|
||
|
|
loadingHidden:false,
|
||
|
|
Start: 0,
|
||
|
|
mybalance:[]
|
||
|
|
});
|
||
|
|
},onnav:function(e) {
|
||
|
|
var index = e.currentTarget.dataset.id
|
||
|
|
that.setData({
|
||
|
|
nav:index
|
||
|
|
})
|
||
|
|
that.clearCache();
|
||
|
|
that.getlist(0);
|
||
|
|
},getlist: function(gp) {
|
||
|
|
var userId = wx.getStorageSync("userId")
|
||
|
|
var LoginId = wx.getStorageSync("LoginId")
|
||
|
|
wx.request({
|
||
|
|
url: app.globalData.apiurl + "/xapiajax.ashx?timestamp=" + (new Date().getTime() / 1000),
|
||
|
|
data: {
|
||
|
|
action:"getzzjf_log",
|
||
|
|
Start:that.data.Start,
|
||
|
|
t:that.data.nav,
|
||
|
|
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;
|
||
|
|
if(res.data.data.length>0){
|
||
|
|
tmpArr.push.apply(tmpArr,res.data.data);
|
||
|
|
}
|
||
|
|
that.setData({
|
||
|
|
mybalance: tmpArr,
|
||
|
|
Start: that.data.Start+res.data.data.length,
|
||
|
|
loadingHidden:true,
|
||
|
|
mcjg:res.data.jrjg
|
||
|
|
})
|
||
|
|
|
||
|
|
if(gp==0||gp==1){
|
||
|
|
if(res.data.data.length==0){
|
||
|
|
that.setData({
|
||
|
|
nodataHidden:false
|
||
|
|
})
|
||
|
|
}else{
|
||
|
|
that.setData({
|
||
|
|
nodataHidden:true
|
||
|
|
})
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}else{
|
||
|
|
wx.showToast({
|
||
|
|
title: res.data.msg,
|
||
|
|
icon: "none",
|
||
|
|
duration: 3000
|
||
|
|
})
|
||
|
|
}
|
||
|
|
if(gp==1){
|
||
|
|
//隐藏loading 提示框
|
||
|
|
wx.hideLoading();
|
||
|
|
//隐藏导航条加载动画
|
||
|
|
wx.hideNavigationBarLoading();
|
||
|
|
//停止下拉刷新
|
||
|
|
wx.stopPullDownRefresh();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},showmc:function(e) {
|
||
|
|
var id = e.currentTarget.dataset.id
|
||
|
|
var index = e.currentTarget.dataset.index
|
||
|
|
that.setData({
|
||
|
|
mcHidden:false,
|
||
|
|
zzid:id,
|
||
|
|
mcsl:index,
|
||
|
|
yjdz: (parseFloat(that.data.mcjg) * parseFloat(index)).toFixed(2)
|
||
|
|
})
|
||
|
|
},closemc:function(e) {
|
||
|
|
that.setData({
|
||
|
|
mcHidden:true
|
||
|
|
})
|
||
|
|
},inorderpay:function(e) {
|
||
|
|
|
||
|
|
},getpwdValue:function(e) {
|
||
|
|
that.setData({
|
||
|
|
a_pwd:e.detail.value.replace(/\s+/g, "")
|
||
|
|
})
|
||
|
|
},onqymc:function() {
|
||
|
|
var userId = wx.getStorageSync("userId")
|
||
|
|
var LoginId = wx.getStorageSync("LoginId")
|
||
|
|
if(userId&&LoginId){
|
||
|
|
var b=true
|
||
|
|
if(that.data.a_pwd==""){
|
||
|
|
b=false
|
||
|
|
wx.showToast({
|
||
|
|
title: "安全密码不能为空!",
|
||
|
|
icon: "none",
|
||
|
|
duration: 3000
|
||
|
|
})
|
||
|
|
}
|
||
|
|
if(b){
|
||
|
|
if(that.data.qytitle=="请稍候..."){
|
||
|
|
b=false
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if(b){
|
||
|
|
that.setData({
|
||
|
|
qytitle:"请稍候..."
|
||
|
|
})
|
||
|
|
wx.request({
|
||
|
|
url: app.globalData.apiurl + "/xapiajax.ashx",
|
||
|
|
data: {
|
||
|
|
action:"qymczzjf",
|
||
|
|
userId:(userId==null?"":userId),
|
||
|
|
LoginId:(LoginId==null?"":LoginId),
|
||
|
|
id:that.data.zzid,
|
||
|
|
pwd:that.data.a_pwd
|
||
|
|
},
|
||
|
|
method:"POST",
|
||
|
|
dataType:"json",
|
||
|
|
header: {
|
||
|
|
"content-type": "application/x-www-form-urlencoded" // 默认值
|
||
|
|
},
|
||
|
|
success (res0) {
|
||
|
|
that.setData({
|
||
|
|
qytitle:"确认"
|
||
|
|
})
|
||
|
|
if(res0.data.status==1){
|
||
|
|
wx.showToast({
|
||
|
|
title: res0.data.msg,
|
||
|
|
icon: "none",
|
||
|
|
duration: 3000
|
||
|
|
})
|
||
|
|
app.globalData.IFRefreshmy=1;
|
||
|
|
app.globalData.IFRefreshzzjf=1;
|
||
|
|
that.clearCache();
|
||
|
|
that.getlist(0);
|
||
|
|
that.setData({
|
||
|
|
mcHidden:true
|
||
|
|
})
|
||
|
|
|
||
|
|
|
||
|
|
}else{
|
||
|
|
wx.showToast({
|
||
|
|
title: res0.data.msg,
|
||
|
|
icon: "none",
|
||
|
|
duration: 3000
|
||
|
|
})
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
})
|
||
|
|
}
|
||
|
|
}else{
|
||
|
|
wx.navigateTo({
|
||
|
|
url: "../login/index"
|
||
|
|
})
|
||
|
|
}
|
||
|
|
}
|
||
|
|
})
|