银花优选微信小程序修改后的最新版本代码
This commit is contained in:
430
pages/withdrawal/index.js
Normal file
430
pages/withdrawal/index.js
Normal file
@@ -0,0 +1,430 @@
|
||||
var app = getApp()
|
||||
var that=null
|
||||
var WxParse = null;
|
||||
var sopenFrame=null
|
||||
var wait=120
|
||||
Page( {
|
||||
data: {
|
||||
loadingHidden:false,
|
||||
umoney:0.00,
|
||||
getumoney:"",
|
||||
sjdzmoney:0.00,
|
||||
sxfmoney:0,
|
||||
sxfmoney0:0,
|
||||
sjsxfmoney:0,
|
||||
title:"余额",
|
||||
txzh:"",
|
||||
txmsg:"",
|
||||
phone:"",
|
||||
savedisable:"",
|
||||
savebutton:"确认",
|
||||
getcode:"获取验证码",
|
||||
paytype:0,
|
||||
txtype:0,
|
||||
KHName:"",
|
||||
BankName:"",
|
||||
BankCard:"",
|
||||
BankKHH:"",
|
||||
AliAccount:"",
|
||||
AliName:"",
|
||||
aliimage:"",
|
||||
weixinimage:"",
|
||||
mybalance:[],
|
||||
Start: 0,
|
||||
t:0
|
||||
},
|
||||
|
||||
onLoad: function(options) {
|
||||
that = this
|
||||
WxParse = require('../../wxParse/wxParse.js')
|
||||
if(options.t){
|
||||
that.setData({
|
||||
t:options.t
|
||||
});
|
||||
}
|
||||
if(that.data.t==4){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "增值积分提现"
|
||||
})
|
||||
that.setData({
|
||||
title:"增值积分"
|
||||
});
|
||||
}else{
|
||||
wx.setNavigationBarTitle({
|
||||
title: "余额提现"
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
that.rdata()
|
||||
that.clearCache();//清本页缓存
|
||||
that.getlist(0);
|
||||
},rdata: function() {
|
||||
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({
|
||||
phone:userInfo.Phone
|
||||
})
|
||||
var umoney = userInfo.xjjye
|
||||
var TXEnable = userInfo.TXEnable
|
||||
if(that.data.t==4){
|
||||
umoney = userInfo.zzjfye
|
||||
}
|
||||
|
||||
if(TXEnable=="1"){
|
||||
that.setData({
|
||||
savebutton:"暂时不能提现",
|
||||
savedisable:"disabled"
|
||||
})
|
||||
}
|
||||
var txmsg=userInfo.txmsg
|
||||
txmsg=txmsg.replace(/<br>/g,"\n").replace(/ /g,"")
|
||||
that.setData({
|
||||
umoney:umoney,
|
||||
txtype:userInfo.txtype,
|
||||
sxfmoney:userInfo.txsxf,
|
||||
sxfmoney0:userInfo.txsxf0,
|
||||
KHName:userInfo.KHName,
|
||||
BankName:userInfo.KHName,
|
||||
BankCard:userInfo.BankCard,
|
||||
BankKHH:userInfo.BankKHH,
|
||||
AliAccount:userInfo.AliAccount,
|
||||
AliName:userInfo.AliName,
|
||||
aliimage:userInfo.aliimage,
|
||||
weixinimage:userInfo.weixinimage,
|
||||
txmsg:txmsg,
|
||||
loadingHidden:true
|
||||
})
|
||||
}
|
||||
}, // 下拉刷新
|
||||
onPullDownRefresh: function () {
|
||||
//在当前页面显示导航条加载动画
|
||||
wx.showNavigationBarLoading();
|
||||
//显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
|
||||
wx.showLoading({
|
||||
title: '刷新中...',
|
||||
})
|
||||
that.clearCache();
|
||||
that.getlist(1);//第一次加载数据
|
||||
},
|
||||
|
||||
// 页面上拉触底事件(上拉加载更多)
|
||||
onReachBottom: function () {
|
||||
that.setData({
|
||||
loadingHidden:false
|
||||
});
|
||||
that.getlist(2);//后台获取新数据并追加渲染
|
||||
},
|
||||
|
||||
// 清缓存
|
||||
clearCache:function(){
|
||||
that.setData({
|
||||
loadingHidden:false,
|
||||
Start: 0,
|
||||
mybalance:[]
|
||||
});
|
||||
},getlist: function(gp) {
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
wx.request({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx",
|
||||
data: {
|
||||
action:"gettixianlist",
|
||||
Start:that.data.Start,
|
||||
t:that.data.t,
|
||||
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==1){
|
||||
//隐藏loading 提示框
|
||||
wx.hideLoading();
|
||||
//隐藏导航条加载动画
|
||||
wx.hideNavigationBarLoading();
|
||||
//停止下拉刷新
|
||||
wx.stopPullDownRefresh();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
,getcode:function(e) {
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
var b=true
|
||||
|
||||
if(b){
|
||||
wx.request({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx",
|
||||
data: {
|
||||
action:"sendphonecode1",
|
||||
userId:(!userId?"":userId),
|
||||
LoginId:(!LoginId?"":LoginId)
|
||||
},
|
||||
method:"POST",
|
||||
dataType:"json",
|
||||
header: {
|
||||
"content-type": "application/x-www-form-urlencoded" // 默认值
|
||||
},
|
||||
success (res) {
|
||||
if(res.data.status==1){
|
||||
wx.showToast({
|
||||
title: res.data.msg,
|
||||
icon: "success",
|
||||
duration: 3000
|
||||
})
|
||||
that.gettime()
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: res.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
ontixiantype:function(e) {
|
||||
that.setData({
|
||||
paytype: e.currentTarget.dataset.id
|
||||
})
|
||||
},goeditpay:function(e) {
|
||||
wx.navigateTo({
|
||||
url: "../mybankdata/index?t="+that.data.paytype
|
||||
})
|
||||
},
|
||||
getfull:function(e) {
|
||||
that.setData({
|
||||
getumoney:that.data.umoney
|
||||
})
|
||||
that.getsjdzmoney0();
|
||||
},
|
||||
getsjdzmoney:function(e) {
|
||||
var txumoney=e.detail.value.replace(/\s+/g, "");
|
||||
if(txumoney!=""){
|
||||
that.setData({
|
||||
getumoney:txumoney
|
||||
})
|
||||
}
|
||||
that.getsjdzmoney0();
|
||||
},
|
||||
getsjdzmoney0:function() {
|
||||
|
||||
var txumoney=that.data.getumoney;
|
||||
var sxfmoney=that.data.sxfmoney;
|
||||
var sxfmoney0=that.data.sxfmoney0;
|
||||
var sjsxfmoney=0.00;
|
||||
|
||||
if(txumoney!=""){
|
||||
if(that.data.txtype==0){
|
||||
sjsxfmoney=(parseFloat(sxfmoney) + parseFloat(txumoney)*(parseFloat(sxfmoney0)/100))
|
||||
}else if(that.data.txtype==1){
|
||||
sjsxfmoney=parseFloat(sxfmoney)
|
||||
}else{
|
||||
sjsxfmoney=(parseFloat(txumoney)*(parseFloat(sxfmoney0)/100))
|
||||
}
|
||||
that.setData({
|
||||
sjsxfmoney:sjsxfmoney.toFixed(2),
|
||||
sjdzmoney:(parseFloat(txumoney)-sjsxfmoney).toFixed(2)
|
||||
})
|
||||
}else{
|
||||
that.setData({
|
||||
sjsxfmoney:0.00,
|
||||
sjdzmoney:0.00
|
||||
})
|
||||
}
|
||||
},
|
||||
gettime:function() {
|
||||
if (wait == 0) {
|
||||
that.setData({
|
||||
getcode:"获取验证码"
|
||||
})
|
||||
wait = 120;
|
||||
} else {
|
||||
that.setData({
|
||||
getcode: "重新发送(" + wait + ")"
|
||||
})
|
||||
wait--;
|
||||
setTimeout(function() {
|
||||
that.gettime()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
},onpaytype:function(e) {
|
||||
var paytype = e.currentTarget.dataset.id
|
||||
var sjsxfmoney=0;
|
||||
if(paytype==1){
|
||||
sjsxfmoney=that.data.sxfmoney;
|
||||
}
|
||||
that.setData({
|
||||
paytype:paytype,
|
||||
sjsxfmoney:sjsxfmoney
|
||||
})
|
||||
that.getsjdzmoney0();
|
||||
},withdrawal:function(e) {
|
||||
var txje = e.detail.value.txje.replace(/\s+/g, "");
|
||||
var pwd = e.detail.value.txpwd;
|
||||
var code = e.detail.value.txcode
|
||||
if(that.data.paytype==1){
|
||||
wx.login({
|
||||
success: function (res) {
|
||||
if (res.code) {
|
||||
that.withdrawalto(res.code,txje,pwd,code);
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
that.withdrawalto("",txje,pwd,code);
|
||||
}
|
||||
|
||||
},withdrawalto:function(logincode,txje,pwd,code) {
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
var userInfodata = wx.getStorageSync("userInfo")
|
||||
if(userId&&LoginId&&userInfodata){
|
||||
var userInfo = JSON.parse(userInfodata)
|
||||
var TXEnable = userInfo.TXEnable
|
||||
if(TXEnable=="0"){
|
||||
|
||||
var b=true
|
||||
if(b){
|
||||
if(txje==null || txje==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "提现金额不能为空!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(b){
|
||||
if(pwd==null || pwd==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "安全密码不能为空!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
/*if(b){
|
||||
if(code==null || code==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "验证码不能为空!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}*/
|
||||
if(b){
|
||||
if(that.data.savebutton=="请稍候..."){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "请稍候...",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(b){
|
||||
that.setData({
|
||||
savebutton:"请稍候..."
|
||||
})
|
||||
|
||||
wx.request({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx",
|
||||
data: {
|
||||
action:"tixian",
|
||||
userId:(!userId?"":userId),
|
||||
LoginId:(!LoginId?"":LoginId),
|
||||
t:that.data.t,
|
||||
paytype:that.data.paytype,
|
||||
logincode:logincode,
|
||||
code:code,
|
||||
pwd:pwd,
|
||||
je:txje
|
||||
},
|
||||
method:"POST",
|
||||
dataType:"json",
|
||||
header: {
|
||||
"content-type": "application/x-www-form-urlencoded" // 默认值
|
||||
},
|
||||
success (res) {
|
||||
if(res.data.status==1){
|
||||
wx.setStorageSync('userInfo', JSON.stringify(res.data.userInfo))
|
||||
app.globalData.IFRefreshindex=1;
|
||||
app.globalData.IFRefreshmy=1;
|
||||
app.globalData.IFRefreshmybalance=1;
|
||||
wx.showModal({
|
||||
title: "操作提示",
|
||||
content: res.data.msg,
|
||||
showCancel:false,
|
||||
success (res0) {
|
||||
if (res0.confirm) {
|
||||
|
||||
wx.navigateBack({})
|
||||
}
|
||||
}
|
||||
})
|
||||
}else{
|
||||
if(res.data.msg=="请先完善银行资料!"){
|
||||
wx.showModal({
|
||||
title: "操作提示",
|
||||
content: res.data.msg,
|
||||
showCancel:false,
|
||||
success (res0) {
|
||||
if (res0.confirm) {
|
||||
|
||||
wx.navigateTo({
|
||||
url: "../mybankdata/index"
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: res.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
that.setData({
|
||||
savebutton:"确认"
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},getbank:function(e){
|
||||
wx.navigateTo({
|
||||
url: "../mybankdata/index"
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user