[添加转账,提现等新功能]

This commit is contained in:
zhangmanman
2021-07-20 09:01:00 +08:00
parent bc38362878
commit c661dd0e16
75 changed files with 1759 additions and 130 deletions

116
pages/favour/favour.js Normal file
View File

@@ -0,0 +1,116 @@
// 本市生活
Page({
/**
* 页面的初始数据
*/
data: {
account : '', //账户积分
typeArr : [], //转账类型
typeIndex: 0, //转账下标
userInfo : '', //转账用户信息
mobile : '', //转账手机号
disabled : false, //支付按钮状态
popShow : false //校验弹出层
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
// 获取账户下拉列表
this.accountList();
},
/**
* 账户下拉列表
*/
accountList() {
wx.$api.user.transfers().then(res=>{
this.setData({
account: res.data.account,
typeArr: res.data.accounts
})
})
},
/**
* 账户下拉选择
*/
typeBind(e) {
this.setData({
typeIndex: e.detail.value
})
},
/**
* 转入的手机号
*/
bindKeyInput(val){
this.setData({
mobile : val.detail.value
})
},
/**
* 校验手机号码
*/
checkTel() {
wx.$api.user.ajaxTel(this.data.mobile).then(res=>{
this.setData({
userInfo: res.data,
popShow : !this.data.popShow
})
}).catch(err=>{})
},
/**
* 关闭校验弹出
*/
popHide() {
this.setData({
popShow : !this.data.popShow
})
},
/**
* 提交表单
*/
formSubmit(e) {
// 检查用户登录状态
const Paypass = wx.getStorageSync("hasPaypass")
if(Paypass == false) {
wx.showModal({
title : '提示',
content : '抱歉,您还没有设置支付密码',
success : res=> {
if (res.confirm) {
wx.navigateTo({
url: '/pages/password/password?source=favourUrl'
})
} else if (res.cancel) {}
}
})
return
}
let newAmount = e.detail.value.amount,
newMobile = this.data.mobile,
newPaypass = e.detail.value.paypass,
newType = this.data.typeArr[this.data.typeIndex].key
wx.$api.user.transfersForm(newMobile, newType, newAmount, newPaypass).then(res=>{
this.setData({
disabled: true
})
wx.showToast({
title: '转入成功',
})
setTimeout(()=>{
wx.redirectTo({
url: "/pages/account/account?type=" + newType
})
},2000)
}) .catch(err=>{})
}
})