diff --git a/pages/user/bindCard/index.js b/pages/user/bindCard/index.js index 68f1df8..4695607 100644 --- a/pages/user/bindCard/index.js +++ b/pages/user/bindCard/index.js @@ -57,6 +57,11 @@ Page({ wx.showToast({ title: '绑定成功!', }) + setTimeout(()=>{ + wx.navigateBack({ + delta: 1, + }) + }) }) }, /** diff --git a/pages/user/cashOut/index.js b/pages/user/cashOut/index.js index 4ff59c2..7519930 100644 --- a/pages/user/cashOut/index.js +++ b/pages/user/cashOut/index.js @@ -1,12 +1,12 @@ // pages/user/cashOut/index.js const app = getApp() -const user = '../../../api/user.js' +const user = require('../../../api/user.js') Page({ /** * 页面的初始数据 */ data: { - brokeragePrice: 0, + userInfo: {}, cashNum: '' }, @@ -14,9 +14,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - this.setData({ - brokeragePrice: options.brokeragePrice - }) + }, allCash(){ this.setData({ @@ -29,22 +27,29 @@ Page({ }) }, cashClick(){ - if(this.data.cashNum == '' || this.data.cashNum <= 100){ - return app.alertMessage('请输入正确的积分') - } - user.cash({ - extractType: 'bank', - money: this.data.cashNum - }).then((res)=>{ - wx.showToast({ - title: '申请提现成功', - }) - setTimeout(()=>{ - wx.navigateBack({ - delta: 1, + if(this.data.userInfo.userBank){ + if(this.data.cashNum == '' || this.data.cashNum <= 100){ + return app.alertMessage('请输入正确的积分') + } + user.cash({ + extractType: 'bank', + money: this.data.cashNum + }).then((res)=>{ + wx.showToast({ + title: '申请提现成功', }) - },1500) - }) + setTimeout(()=>{ + wx.navigateBack({ + delta: 1, + }) + },1500) + }) + } else{ + wx.navigateTo({ + url: '/pages/user/bindCard/index', + }) + } + }, /** * 生命周期函数--监听页面初次渲染完成 @@ -57,9 +62,15 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - + this.getUserInfo() + }, + getUserInfo(){ + user.getUserInfo().then((res)=> { + this.setData({ + userInfo: res.data.data + }) + }) }, - /** * 生命周期函数--监听页面隐藏 */ diff --git a/pages/user/cashOut/index.wxml b/pages/user/cashOut/index.wxml index 132ef8d..6ff945f 100644 --- a/pages/user/cashOut/index.wxml +++ b/pages/user/cashOut/index.wxml @@ -4,7 +4,7 @@ 当前可提现积分(积分比例为1:1) - {{brokeragePrice || 0}} + {{userInfo.brokeragePrice || 0}} 注:提现需在每月20-26日进行,其他时间不可提现