Files
sphc/pages/my/my_cash/my_cash.js
2024-05-06 15:34:15 +08:00

224 lines
4.6 KiB
JavaScript

const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
cardNum: "",//银行卡号
customerName: "",//姓名
customerPhone: "",//手机号
bankName: '',//开户行
money: "",//提现金额
moneyCan: "",//最大提现
disabled: false,
sys: [],
roles:[],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.showLoading({
title: '加载中..',
})
wx.request({
url: app.globalData.ip + '/wisdommining/api/user/getWithdrawalRole',
method: 'GET',
data: {},
success: res => {
console.log(res)
wx.hideLoading()
if (res.data.code == 1) {
this.setData({
roles:res.data.value
})
} else {
wx.showModal({
title: '提示!',
content: res.data.message,
showCancel: false,
})
_this.setData({
disabled: false,
})
}
},fail:f=>{
wx.hideLoading()
wx.showToast({
title: '请求异常',
icon:"none",
})
}
})
this.setData({
moneyCan: options.moneyCan,
})
},
cash1: function () {
wx.showModal({
title: '提示',
content: '你当前的账户小于300不足以提现~',
showCancel: false,
success: s => {
},
})
},
//申请提现
cash: function () {
var _this = this;
var cardNum = _this.data.cardNum;
var customerPhone = _this.data.customerPhone;
var customerName = _this.data.customerName;
var bankName = _this.data.bankName;
var money = _this.data.money;
if (cardNum == "" || customerName == "" || bankName == "" || money == "") {
wx.showToast({
title: '请完善信息~',
icon: 'none',
})
return
}
if (customerPhone.length != 11) {
wx.showToast({
title: '请填写正确手机号~',
icon: 'none',
})
return
}
if (money > 100000 || money<this.data.roles.withdrawalMinimum) {
wx.showToast({
title: '提现金额需为'+this.data.roles.withdrawalMinimum+'~10万以内',
icon: 'none',
})
return
}
_this.setData({
disabled: true,
})
wx.showLoading({
title: '申请中',
mask: true,
})
wx.request({
url: app.globalData.ip + '/wisdommining/api/user/addWisdWithdrawal',
method: 'POST',
data: {
userId: app.globalData.userId,
withdrawalUserPhone:customerPhone,
withdrawalUserName: customerName,
withdrawalCard: bankName,
withdrawalCardNumber: cardNum,//银行卡号
withdrawalMoney: money,
},
success: res => {
console.log(res)
wx.hideLoading()
if (res.data.code == 1) {
wx.showModal({
title: '提现申请成功!',
content: "稍后工作人员就会处理您的申请信息,请耐心等待",
showCancel: false,
success(res) {
if (res.confirm) {
wx.navigateBack()
}
}
})
_this.setData({
disabled: false,
})
} else {
wx.showModal({
title: '申请失败!',
content: res.data.message,
showCancel: false,
})
_this.setData({
disabled: false,
})
}
},fail:f=>{
wx.hideLoading()
wx.showToast({
title: '请求异常',
icon:"none",
})
}
})
},
//卡号
cardNum: function (e) {
this.setData({
cardNum: e.detail.value
})
},
//姓名
customerName: function (e) {
this.setData({
customerName: e.detail.value
})
},
//开户行
bankName: function (e) {
this.setData({
bankName: e.detail.value
})
},
//手机号
customerPhone: function (e) {
this.setData({
customerPhone: e.detail.value
})
},
//提现金额
money: function (e) {
this.setData({
money: e.detail.value
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
})