初次提交
This commit is contained in:
497
pages/mybankdata/index.js
Normal file
497
pages/mybankdata/index.js
Normal file
@@ -0,0 +1,497 @@
|
||||
var app = getApp()
|
||||
var that=null
|
||||
var sopenFrame=null
|
||||
var wait=120
|
||||
Page( {
|
||||
data: {
|
||||
loadingHidden:false,
|
||||
AccountName:"",
|
||||
BankName:"",
|
||||
BankCard:"",
|
||||
BankDepos:"",
|
||||
BankNames:[],
|
||||
AliAccount:"",
|
||||
AliName:"",
|
||||
aliimage:"../../images/add.png",
|
||||
weixinimage:"../../images/add.png",
|
||||
alipic:"",
|
||||
weixinpic:"",
|
||||
phone:"",
|
||||
getcode:"获取验证码",
|
||||
savebutton:"保存",
|
||||
nav:0,
|
||||
appbus:0,
|
||||
index:-1,
|
||||
umoney:0,
|
||||
umoney0:0
|
||||
},
|
||||
|
||||
onLoad: function(options) {
|
||||
that = this
|
||||
if(options.t){
|
||||
that.setData({
|
||||
nav:options.t
|
||||
});
|
||||
}
|
||||
if(options.appbus){
|
||||
that.setData({
|
||||
appbus:options.appbus
|
||||
});
|
||||
}
|
||||
that.rdata()
|
||||
}, // 下拉刷新
|
||||
onPullDownRefresh: function () {
|
||||
//在当前页面显示导航条加载动画
|
||||
wx.showNavigationBarLoading();
|
||||
//显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
|
||||
wx.showLoading({
|
||||
title: '刷新中...',
|
||||
})
|
||||
that.rdata();//第一次加载数据
|
||||
},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,
|
||||
umoney:userInfo.xjye,
|
||||
umoney0:userInfo.zzjfye
|
||||
})
|
||||
if(userInfo.xjye>0||userInfo.zzjfye>0){
|
||||
wx.setNavigationBarTitle({
|
||||
title: "绑定收款账号"
|
||||
})
|
||||
}
|
||||
wx.request({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx",
|
||||
data: {
|
||||
action:"getuserinfo",
|
||||
userId:(!userId?"":userId),
|
||||
LoginId:(!LoginId?"":LoginId)
|
||||
},
|
||||
method:"GET",
|
||||
dataType:"json",
|
||||
success (res) {
|
||||
if(res.data.status==1){
|
||||
var accountname=res.data.user.accountname
|
||||
var bankname=res.data.user.bankname
|
||||
var bankcard=res.data.user.bankcard
|
||||
var bankaddress=res.data.user.bankaddress
|
||||
var webbank=res.data.webbank
|
||||
|
||||
var webbanks=webbank.split('|')
|
||||
var banks=""
|
||||
var index=0
|
||||
|
||||
for(var i=0;i<webbanks.length;i++){
|
||||
if(banks!=""){
|
||||
banks+=",{\"key\":\""+webbanks[i]+"\"}"
|
||||
}else{
|
||||
banks+="{\"key\":\""+webbanks[i]+"\"}"
|
||||
}
|
||||
if(webbanks[i]==bankname){
|
||||
index=i;
|
||||
}
|
||||
}
|
||||
that.setData({
|
||||
index: index,
|
||||
AccountName:accountname,
|
||||
BankName:bankname,
|
||||
BankCard:bankcard,
|
||||
BankDepos:bankaddress,
|
||||
BankNames:JSON.parse("["+banks+"]"),
|
||||
AliAccount:res.data.user.AliAccount,
|
||||
AliName:res.data.user.AliName,
|
||||
aliimage:res.data.user.aliimage,
|
||||
weixinimage:res.data.user.weixinimage,
|
||||
loadingHidden:true
|
||||
})
|
||||
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: res.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
},onnav:function(e) {
|
||||
var index = e.currentTarget.dataset.id
|
||||
that.setData({
|
||||
nav:index
|
||||
})
|
||||
},onaliimage:function(e) {
|
||||
var yimage=that.data.aliimage
|
||||
if(that.data.aliimage=="../../images/ajaxLoader.gif"){
|
||||
wx.showToast({
|
||||
title: "正在上传中...",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}else{
|
||||
wx.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['original'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success (res) {
|
||||
const tempFilePaths = res.tempFilePaths;
|
||||
|
||||
that.setData({
|
||||
aliimage:"../../images/ajaxLoader.gif"
|
||||
})
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
wx.uploadFile({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx", //仅为示例,非真实的接口地址
|
||||
filePath: tempFilePaths[0],
|
||||
name: 'image',
|
||||
formData: {
|
||||
action:"uploadImage",
|
||||
userId:(!userId?"":userId),
|
||||
LoginId:(!LoginId?"":LoginId)
|
||||
},
|
||||
fail: function(err) {
|
||||
wx.showToast({
|
||||
title: "上传出错了",
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
})
|
||||
that.setData({
|
||||
aliimage:yimage
|
||||
})
|
||||
},
|
||||
success (res0){
|
||||
var data=JSON.parse(res0.data);
|
||||
|
||||
|
||||
if(data.status==1){
|
||||
wx.showToast({
|
||||
title: data.msg,
|
||||
icon: "success",
|
||||
duration: 1000
|
||||
})
|
||||
that.setData({
|
||||
aliimage:data.url,
|
||||
alipic:data.pic
|
||||
})
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: data.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
})
|
||||
that.setData({
|
||||
aliimage:yimage
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
},onweixinimage:function(e) {
|
||||
var yimage=that.data.weixinimage
|
||||
if(that.data.weixinimage=="../../images/ajaxLoader.gif"){
|
||||
wx.showToast({
|
||||
title: "正在上传中...",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}else{
|
||||
wx.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['original'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success (res) {
|
||||
const tempFilePaths = res.tempFilePaths;
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
that.setData({
|
||||
weixinimage:"../../images/ajaxLoader.gif"
|
||||
})
|
||||
wx.uploadFile({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx", //仅为示例,非真实的接口地址
|
||||
filePath: tempFilePaths[0],
|
||||
name: 'image',
|
||||
formData: {
|
||||
action:"uploadImage",
|
||||
userId:(!userId?"":userId),
|
||||
LoginId:(!LoginId?"":LoginId)
|
||||
},
|
||||
fail: function(err) {
|
||||
wx.showToast({
|
||||
title: "上传出错了",
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
})
|
||||
that.setData({
|
||||
weixinimage:yimage
|
||||
})
|
||||
},
|
||||
success (res0){
|
||||
var data=JSON.parse(res0.data);
|
||||
|
||||
|
||||
if(data.status==1){
|
||||
wx.showToast({
|
||||
title: data.msg,
|
||||
icon: "success",
|
||||
duration: 1000
|
||||
})
|
||||
that.setData({
|
||||
weixinimage:data.url,
|
||||
weixinpic:data.pic
|
||||
})
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: data.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
})
|
||||
that.setData({
|
||||
weixinimage:yimage
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
},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
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
gettime:function() {
|
||||
if (wait == 0) {
|
||||
that.setData({
|
||||
getcode:"获取验证码"
|
||||
})
|
||||
wait = 120;
|
||||
} else {
|
||||
that.setData({
|
||||
getcode: "重新发送(" + wait + ")"
|
||||
})
|
||||
wait--;
|
||||
setTimeout(function() {
|
||||
that.gettime()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
},BankChange:function(e) {
|
||||
var index=e.detail.value;
|
||||
var key=that.data.BankNames[index].key
|
||||
that.setData({
|
||||
index: index
|
||||
})
|
||||
|
||||
},saveaddress:function(e) {
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
var pwd = e.detail.value.txpwd
|
||||
var b=true
|
||||
|
||||
var AccountName = ""
|
||||
var BankName=""
|
||||
var BankCard=""
|
||||
var BankDepos=""
|
||||
var AliAccount=""
|
||||
var AliName=""
|
||||
var aliimage=""
|
||||
var weixinimage=""
|
||||
if(that.data.nav==0){
|
||||
AccountName = e.detail.value.AccountName
|
||||
BankName=(that.data.index==-1?"":that.data.BankNames[that.data.index].key)
|
||||
BankCard=e.detail.value.BankCard
|
||||
BankDepos=e.detail.value.BankDepos
|
||||
if(b){
|
||||
if(AccountName==null || AccountName==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "开户姓名不能为空!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
if(BankName==null || BankName==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "银行名称必须选择!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
if(BankCard==null || BankCard==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "开户姓名不能为空!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
}else if(that.data.nav==1){
|
||||
AliAccount = e.detail.value.AliAccount
|
||||
AliName = e.detail.value.AliName
|
||||
if((AliAccount=="" || AliName=="") && that.data.aliipic==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "支付宝账号姓名和收款码必选一!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}else if(that.data.aliimage=="../../images/ajaxLoader.gif"){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "支付宝收款码正在上传中!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}else{
|
||||
aliimage=that.data.alipic
|
||||
}
|
||||
}else if(that.data.nav==2){
|
||||
if(that.data.weixinpic==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "微信收款码未上传!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}else if(that.data.weixinimage=="../../images/ajaxLoader.gif"){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "微信收款码正在上传中!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}else{
|
||||
weixinimage=that.data.weixinpic
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
if(pwd==null || pwd==""){
|
||||
b=false
|
||||
wx.showToast({
|
||||
title: "安全密码不能为空!",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
that.setData({
|
||||
savebutton:"请稍候..."
|
||||
})
|
||||
var datas={}
|
||||
if(that.data.nav==0){
|
||||
datas={
|
||||
action:"updateBankInfo",
|
||||
userId:(!userId?"":userId),
|
||||
LoginId:(!LoginId?"":LoginId),
|
||||
AccountName:AccountName,
|
||||
BankName:BankName,
|
||||
BankCard:BankCard,
|
||||
BankDepos:BankDepos,
|
||||
pwd:pwd
|
||||
}
|
||||
}else if(that.data.nav==1){
|
||||
datas={
|
||||
action:"updatealipay",
|
||||
userId:(!userId?"":userId),
|
||||
LoginId:(!LoginId?"":LoginId),
|
||||
AliAccount:AliAccount,
|
||||
AliName:AliName,
|
||||
aliimage:aliimage,
|
||||
pwd:pwd
|
||||
}
|
||||
}else if(that.data.nav==2){
|
||||
datas={
|
||||
action:"updateweixinpay",
|
||||
userId:(!userId?"":userId),
|
||||
LoginId:(!LoginId?"":LoginId),
|
||||
weixinimage:weixinimage,
|
||||
pwd:pwd
|
||||
}
|
||||
}
|
||||
wx.request({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx",
|
||||
data: datas,
|
||||
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))
|
||||
wx.showModal({
|
||||
title: "操作提示",
|
||||
content: res.data.msg,
|
||||
showCancel:false,
|
||||
success (res0) {
|
||||
if (res0.confirm) {
|
||||
that.rdata();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: res.data.msg,
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
that.setData({
|
||||
savebutton:"保存"
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
3
pages/mybankdata/index.json
Normal file
3
pages/mybankdata/index.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
62
pages/mybankdata/index.wxml
Normal file
62
pages/mybankdata/index.wxml
Normal file
@@ -0,0 +1,62 @@
|
||||
<view class="container" wx:if="{{umoney>0||umoney0>0}}">
|
||||
|
||||
|
||||
<view class="myorder-menu">
|
||||
<view class='{{nav==0?"hover":""}}' bindtap="onnav" data-id="0">银行账号</view>
|
||||
<view class='{{nav==1?"hover":""}}' bindtap="onnav" data-id="1">支付宝</view>
|
||||
<view class='{{nav==2?"hover":""}}' bindtap="onnav" data-id="2">微信支付</view>
|
||||
</view>
|
||||
<view class="mydata-box">
|
||||
<view class="frombody">
|
||||
<form bindsubmit='saveaddress'>
|
||||
<view wx:if="{{nav==0}}">
|
||||
<text>开户姓名:</text><input name="AccountName" type="text" placeholder="请填写您的开户姓名" value="{{AccountName}}" />
|
||||
</view>
|
||||
<view wx:if="{{nav==0}}" class="area" bindtap="onarea">
|
||||
<text>银行名称:</text>
|
||||
<picker class="picker_hx" name="picker_hx" value="{{BankNames[index].key}}" data-selecthx="{{BankNames[index].key}}" range="{{BankNames}}" range-key="{{'key'}}" bindchange="BankChange"> <view class="picker">
|
||||
<text wx:if='{{BankNames[index]!=null}}'>{{BankNames[index].key}}</text>
|
||||
<text wx:if='{{BankNames[index]==null}}'>==请选择==</text>
|
||||
<image src="../../images/icon-arrowdown1.png"></image>
|
||||
</view></picker>
|
||||
|
||||
</view>
|
||||
<view wx:if="{{nav==0}}">
|
||||
<text>银行卡号:</text><input name="BankCard" type="text" placeholder="请填写银行卡号" value="{{BankCard}}" />
|
||||
</view>
|
||||
<view wx:if="{{nav==0}}">
|
||||
<text>开户行:</text><input name="BankDepos" type="text" placeholder="请填写开户行地址" value="{{BankDepos}}" />
|
||||
</view>
|
||||
<view wx:if="{{nav==1}}">
|
||||
<text>支付宝账号:</text><input name="AliAccount" type="text" placeholder="请填写支付宝账号" value="{{AliAccount}}" />
|
||||
</view>
|
||||
<view wx:if="{{nav==1}}">
|
||||
<text>支付宝姓名:</text><input name="AliName" type="text" placeholder="请填写支付宝账号" value="{{AliName}}" />
|
||||
</view>
|
||||
<view wx:if="{{nav==1}}">
|
||||
<text style="width: 7em;">支付宝收款码:</text>
|
||||
<view class="payimage" bindtap="onaliimage"><image src='{{aliimage}}'></image></view>
|
||||
</view>
|
||||
<view wx:if="{{nav==2}}">
|
||||
<text style="width: 7em;">微信收款码:</text>
|
||||
<view class="payimage" bindtap="onweixinimage"><image src='{{weixinimage}}'></image></view>
|
||||
</view>
|
||||
<view>
|
||||
<text>安全密码:</text><input name="txpwd" type="text" value="" placeholder="请填写您的安全密码" type="password" />
|
||||
</view>
|
||||
<view class="button">
|
||||
<button form-type="submit">{{savebutton}}</button>
|
||||
|
||||
</view>
|
||||
</form>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<loading hidden="{{loadingHidden}}">
|
||||
加载中...
|
||||
</loading>
|
||||
39
pages/mybankdata/index.wxss
Normal file
39
pages/mybankdata/index.wxss
Normal file
@@ -0,0 +1,39 @@
|
||||
page{
|
||||
background: #ccc;
|
||||
}
|
||||
.container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 14px;
|
||||
color: #000;
|
||||
}
|
||||
.myorder-menu{display: flex;flex-direction: row;align-items: center;justify-content: center;width:100%; background-color: #fff;}
|
||||
.myorder-menu view{display: flex;flex: 1; height:2.5em; line-height: 2.5em; text-align: center; border:1px solid #f1f1f1; border-left:0;border-top: 0; align-items: center;justify-content: center;}
|
||||
.myorder-menu view.hover{border-bottom:1px solid #00B050;color:#00B050;}
|
||||
.mydata-box{display: flex;flex-direction: column;align-items: center;justify-content: center;width:100%; padding: 0 0.8em; box-sizing: border-box;}
|
||||
|
||||
.mydata-box .frombody{margin-top: 1em; padding:0.5em 1em;width:100%; display: flex;border-radius:0.5em; flex-direction: column; align-items: center; background-color:#fff;box-sizing: border-box;}
|
||||
.mydata-box .frombody view{position: relative;float:left; width:100%;display: flex;flex-direction:row;border-bottom:1px solid #f1f1f1;padding:0.5em 0; box-sizing: border-box;}
|
||||
.mydata-box .frombody view view{display: block; width: auto;padding:0; border-bottom:0;line-height: 2.5em;}
|
||||
.mydata-box .frombody view text{float:left; display: block; padding:0; width:6em; height:2.5em; line-height: 2.5em;}
|
||||
.mydata-box .frombody view input{float:left; width:14em;height:2.5em; line-height: 2.5em;}
|
||||
.mydata-box .frombody view input.code{width:9em;}
|
||||
.mydata-box .frombody view.button{border: 0;}
|
||||
.mydata-box .frombody view.button button{width:100%;height:2.5em; line-height: 2.5em; background:linear-gradient(to right,#00B050,#00B050); color:#fff; border-radius:0.5em;}
|
||||
|
||||
.mydata-box .frombody view .picker_hx{color:#939393;line-height:2.5em;}
|
||||
.mydata-box .frombody view .picker_hx view{ float:left; position: relative; display: block; border:0;min-width:14em; padding:0 1em; box-sizing: border-box;border:1px solid #dfdfdf;border-radius:0.3em;height:2.5em;line-height:2.5em;}
|
||||
.mydata-box .frombody view .picker_hx image{position: absolute; top:0.6em;right:0.6em; width:1.2em;height:1.2em;}
|
||||
.mydata-box .frombody view .payimage{
|
||||
width: 4em;
|
||||
height: 4em;
|
||||
border:1px solid #f1f1f1;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.mydata-box .frombody view .payimage image{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user