银花优选微信小程序修改后的最新版本代码
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"
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
3
pages/mybalance/index.json
Normal file
3
pages/mybalance/index.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "明细"
|
||||
}
|
||||
43
pages/mybalance/index.wxml
Normal file
43
pages/mybalance/index.wxml
Normal file
@@ -0,0 +1,43 @@
|
||||
<view class="container">
|
||||
|
||||
<view class="button_box" wx:if="{{nav==1&&TXEnable==0}}">
|
||||
<view class="button_box_item" style="width:100%" wx:if="{{nav==11&&mybalance.length>0}}">
|
||||
<view class="mybtn" bindtap="onzz">互转</view>
|
||||
</view>
|
||||
<view class="button_box_item" wx:if="{{nav==11&&mybalance.length>0}}">
|
||||
<view class="mybtn" bindtap="onzz">互转</view>
|
||||
</view>
|
||||
<view class="button_box_item" wx:if="{{nav==1&&mybalance.length>0}}">
|
||||
<view class="mybtn" bindtap="ontx">提现</view>
|
||||
</view>
|
||||
<view class="button_box_item" style="width:100%" wx:if="{{nav==2&&mybalance.length>0}}">
|
||||
<view class="mybtn" bindtap="onzh">划转流量积分</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mybalance-box" hidden="{{balanceHidden}}">
|
||||
<view class="mybalance-item" wx:for="{{mybalance}}" wx:for-index="index" >
|
||||
<view class="Total">
|
||||
<view><text>增减:</text>{{item.Addmoney}}</view>
|
||||
<view class="right"><text>余额:</text>{{item.Totalmoney}}</view>
|
||||
</view>
|
||||
<view>
|
||||
<text>时间:</text>{{item.addtime}}
|
||||
</view>
|
||||
<view>
|
||||
<text>备注:</text>{{item.BZContent}}
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="nodata" hidden="{{nobalanceHidden}}">
|
||||
<image src="../../images/order-null.png"/>
|
||||
<view>暂无数据</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<loading hidden="{{loadingHidden}}">
|
||||
加载中...
|
||||
</loading>
|
||||
67
pages/mybalance/index.wxss
Normal file
67
pages/mybalance/index.wxss
Normal file
@@ -0,0 +1,67 @@
|
||||
page{
|
||||
background: #ccc;
|
||||
}
|
||||
.container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 14px;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.container .balance-image {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
.button_box{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
margin: 0;
|
||||
padding:0;
|
||||
padding-right: 0.8em;
|
||||
box-sizing: border-box;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #fff;
|
||||
}
|
||||
.button_box .button_box_item{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-grow: 1;
|
||||
width:50%;
|
||||
height:2.5em;
|
||||
margin: 0;
|
||||
padding: 0.8em;
|
||||
padding-right: 0;
|
||||
}
|
||||
.button_box .button_box_item .mybtn{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 0.4em;
|
||||
background-color: #00B050;
|
||||
color:#fff;
|
||||
line-height: 2.5em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mybalance-menu{display: flex;flex-direction: row;align-items: center;justify-content: center;width:100%; background-color: #fff;}
|
||||
.mybalance-menu view{width:25%; height:2.5em; line-height: 2.5em; text-align: center; border:1px solid #f1f1f1; border-left:0;border-top: 0;}
|
||||
.mybalance-menu view.hover{border-bottom:1px solid #ff4d00;}
|
||||
.mybalance-box{display: flex;flex-direction: column;align-items: center;justify-content: center;width:100%;padding:0.8em; box-sizing: border-box;}
|
||||
.mybalance-item{width:100%;display: flex;flex-direction: column; align-items: center;justify-content: center;box-sizing: border-box; padding:0.5em 0.8em; margin:0.8em 0; margin-top: 0; line-height: 2em; background-color:#fff;border-radius:0.5em;}
|
||||
.mybalance-item view{width:100%;display: flex;flex-direction: row; align-items: center;justify-content:left;color: #939393;}
|
||||
.mybalance-item view text{color: #000;}
|
||||
.mybalance-item view text.Totalprice{ margin-left: 1em;}
|
||||
.mybalance-item view.Total{float: left; display: block;}
|
||||
.mybalance-item view.Total view{float: left; display: block;width:auto; margin:0; padding:0;color:#ff4d00; box-sizing: border-box; overflow: hidden;}
|
||||
.mybalance-item view.Total view.right{float:right;}
|
||||
.mybalance-item view.Total view text{float: left; display: block;width:auto;color: #000;}
|
||||
.nodata{padding-top:1em; text-align: center; line-height: 1.5em; color:#939393;}
|
||||
.nodata image {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user