258 lines
5.0 KiB
JavaScript
258 lines
5.0 KiB
JavaScript
// pages/member/memberBank/memberBank.js
|
|
var app = getApp();
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
bank_name: "",
|
|
bank_id: "",
|
|
bank_user: "",
|
|
bank_province: "",
|
|
bank_city: "",
|
|
bank_branch: "",
|
|
status:false
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function(options) {
|
|
this._getData();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function() {
|
|
|
|
},
|
|
//绑定开户行的值
|
|
banknameinp(e) {
|
|
let val = e.detail.value;
|
|
this.setData({
|
|
"bank_name": val.trim()
|
|
});
|
|
},
|
|
//绑定开户行省份的值
|
|
bankprovinceinp(e) {
|
|
let val = e.detail.value;
|
|
this.setData({
|
|
"bank_province": val.trim()
|
|
});
|
|
},
|
|
//绑定开户行城市的值
|
|
bankcityinp(e) {
|
|
let val = e.detail.value;
|
|
this.setData({
|
|
"bank_city": val.trim()
|
|
});
|
|
},
|
|
//绑定开户行支行的值
|
|
bankbranchinp(e) {
|
|
let val = e.detail.value;
|
|
this.setData({
|
|
"bank_branch": val.trim()
|
|
});
|
|
},
|
|
//绑定账号的值
|
|
bankidinp(e) {
|
|
let val = e.detail.value;
|
|
this.setData({
|
|
"bank_id": val.trim()
|
|
});
|
|
},
|
|
//绑定姓名的值
|
|
bankuserinp(e) {
|
|
let val = e.detail.value;
|
|
this.setData({
|
|
"bank_user": val.trim()
|
|
});
|
|
},
|
|
//获取信息
|
|
_getData() {
|
|
// let json = {};
|
|
let that = this;
|
|
let urlStr = app.getNetAddresss("member.bank-card.show");
|
|
app._postNetWork({
|
|
url: urlStr,
|
|
showToastIn: false,
|
|
data: this.data.form,
|
|
success: function(resdata) {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
that.setData({
|
|
bank_name: res.data.bank_name,
|
|
bank_id: res.data.bank_card,
|
|
bank_user: res.data.member_name,
|
|
bank_province: res.data.bank_province,
|
|
bank_city: res.data.bank_city,
|
|
bank_branch: res.data.bank_branch
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: res.msg,
|
|
duration: 1500
|
|
});
|
|
}
|
|
|
|
},
|
|
fail: function(res) {
|
|
console.log(res.msg);
|
|
}
|
|
});
|
|
},
|
|
change(){
|
|
this.setData({
|
|
// this.status = true;
|
|
// this.bank_id = "";
|
|
status:true,
|
|
bank_id:''
|
|
});
|
|
},
|
|
//注册
|
|
bind() {
|
|
// let that = this;
|
|
if (app._isTextEmpty(this.data.bank_name)) {
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: '请输入开户行',
|
|
duration: 1500
|
|
});
|
|
return;
|
|
}
|
|
|
|
if (app._isTextEmpty(this.data.bank_province)) {
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: '请输入开户行省份',
|
|
duration: 1500
|
|
});
|
|
return;
|
|
}
|
|
|
|
if (app._isTextEmpty(this.data.bank_city)) {
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: '请输入开户行城市',
|
|
duration: 1500
|
|
});
|
|
return;
|
|
}
|
|
|
|
|
|
if (app._isTextEmpty(this.data.bank_branch)) {
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: '请输入开户行支行',
|
|
duration: 1500
|
|
});
|
|
return;
|
|
}
|
|
|
|
if (app._isTextEmpty(this.data.bank_id)) {
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: '请输入账号',
|
|
duration: 1500
|
|
});
|
|
return;
|
|
}
|
|
|
|
if (app._isTextEmpty(this.data.bank_user)) {
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: '请输入姓名',
|
|
duration: 1500
|
|
});
|
|
return;
|
|
}
|
|
let json = {
|
|
'bank_card': this.data.bank_id,
|
|
'member_name': this.data.bank_user,
|
|
'bank_name': this.data.bank_name,
|
|
"bank_province": this.data.bank_province,
|
|
"bank_city": this.data.bank_city,
|
|
"bank_branch": this.data.bank_branch
|
|
};
|
|
let urlStr = app.getNetAddresss("member.bank-card.edit");
|
|
app._postNetWork({
|
|
url: urlStr,
|
|
showToastIn: false,
|
|
data: json,
|
|
success: function(resdata) {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
wx.showToast({
|
|
title: res.msg,
|
|
icon: 'none',
|
|
duration: 1500,
|
|
success: function() {
|
|
setTimeout(function() {
|
|
//要延时执行的代码
|
|
wx.navigateBack({
|
|
delta: 1
|
|
});
|
|
}, 1500); //延迟时间
|
|
},
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: res.msg,
|
|
duration: 1500
|
|
});
|
|
}
|
|
|
|
},
|
|
fail: function(res) {
|
|
console.log(res.msg);
|
|
}
|
|
});
|
|
},
|
|
});
|