Files
CompanyProject/衣莎项目/源码/YiShaXiYi/user/cashWithdrawal/cashWithdrawal.js
2024-09-27 01:32:49 +08:00

124 lines
2.6 KiB
JavaScript

// user/cashWithdrawal/cashWithdrawal.js
const app = getApp();
const util = app.loadUtils("util")
const regeneratorRuntime = app.loadAsync()
const model = app.loadModel("index")
const http = app.loadHttp()
Page({
/**
* 页面的初始数据
*/
data: {
system: app.globalData.system, //设备相关信息
pageTitle: "合伙人收益提现", //头部标题
isBack: true,//显示返回
distribution_money: 0,//可提现金额
},
async withDraw(e) {
let money = parseFloat(e.detail.value.money) || 0
if (money <= 0) {
wx.showToast({
title: '请输入正确的金额',
icon: 'none',
duration: 2000
})
return;
}
if (money < 100) {
wx.showToast({
title: '小于100元不能提现哦!!!',
icon: 'none',
duration: 2000
})
return;
}
wx.showModal({
title: '提现',
content: '提现后不能取消,是否提现?',
success(res) {
if (res.confirm) {
wx.showLoading({
title: '提现中,请稍等!!!',
})
http.http.request2({ url: `${http.api.withDraw}`, method: "POST", data: { total_money: money } })
.then(res => {
wx.hideLoading()
wx.showToast({
title: res.data.msg,
icon: 'none',
duration: 2000
})
setTimeout(() => {
wx.navigateBack({
delta: 2
})
}, 2000)
})
}
}
})
},
// 获取当前可提现金额接口
async getDistributionMoney() {
let res = await http.http.request2({ url: `${http.api.getDistributionMoney}`, method: "POST" })
this.setData({
distribution_money: res.data.data.distribution_money
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getDistributionMoney()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})