deguodaigou/pages/deposit/deposit.js

118 lines
1.9 KiB
JavaScript
Raw Normal View History

2019-12-30 09:40:07 +08:00
// pages/deposit/deposit.js
import bin from "../../utils/bin"
Page({
/**
* 页面的初始数据
*/
data: {
user_money:"0.00"
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
bin.request({
url:"User/getusercenter"
}).then((res)=>{
this.setData({
user_money:res.data.result.user_money
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
tixian(e){
var money=e.detail.value.money;
var wechat=e.detail.value.wechat;
var zhifubao=e.detail.value.zhifubao;
2020-01-02 08:40:37 +08:00
2019-12-30 09:40:07 +08:00
// console.log(money,wechat,zhifubao)
if(wechat== "" && zhifubao == ""){
wx.showToast({
title: "请填写微信或支付宝帐号",
icon: 'none',
duration: 1500
});
return ;
}
2020-01-02 08:40:37 +08:00
let xx = {}
if(wechat == ""){
xx.zhifubao = zhifubao
}else{
xx.wechat = wechat
}
if(wechat && zhifubao){
xx.zhifubao = zhifubao
xx.wechat = wechat
}
2019-12-30 09:40:07 +08:00
bin.getuserid().then((id)=>{
bin.request({
url:"User/withdrawals",
urldata:{
user_id:id,
money,
2020-01-02 08:40:37 +08:00
...xx
2019-12-30 09:40:07 +08:00
}
}).then((res)=>{
// console.log( )
wx.showToast({
title: res.data.result.message,
icon: 'success',
duration: 1500
});
})
})
}
})