|
@@ -9,22 +9,48 @@ Page({
|
|
|
phone: '17319450324',
|
|
|
isNum: '100',
|
|
|
},
|
|
|
- number: ''
|
|
|
+ number: '',
|
|
|
+ isDisabled: false,
|
|
|
},
|
|
|
//提交
|
|
|
formSubmit: function (e) {
|
|
|
+ this.setData({ isDisabled: true })
|
|
|
let data = this.data.form;
|
|
|
data.number = e.detail.value.number;
|
|
|
// 判断提现金额是否大于已拥有的金额
|
|
|
if (parseFloat(data.number) <= parseFloat(data.isNum)) {
|
|
|
if (parseFloat(data.isNum) >= 100 && parseFloat(data.number) >= 100) {
|
|
|
// 扣除6%手续费
|
|
|
- data.number = (data.number - data.number * 0.06).toFixed(2);
|
|
|
- wx.showToast({
|
|
|
- title: '提现成功',
|
|
|
- icon: 'success',
|
|
|
- duration: 2000
|
|
|
+ data.money = (data.number - data.number * 0.06).toFixed(2);
|
|
|
+ data.money = parseInt(data.money) * 100
|
|
|
+ // data.money
|
|
|
+ const query = `id=${data.id}&points=${data.number}&&money=${data.money}`
|
|
|
+ wx.request({
|
|
|
+ url: `${app.globalData.publicUrl}/api/htyd/wxpay/cash?${query}`,
|
|
|
+ success: res => {
|
|
|
+ if (res.data.errcode == '0') {
|
|
|
+ app.globalData.userInfo = res.data.data;
|
|
|
+ wx.showToast({
|
|
|
+ title: '提现成功',
|
|
|
+ icon: 'success',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.showToast({
|
|
|
+ title: '提现失败',
|
|
|
+ icon: 'error',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: err => {
|
|
|
+ wx.showToast({
|
|
|
+ title: err.data.errmsg,
|
|
|
+ icon: 'error'
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
+
|
|
|
} else {
|
|
|
wx.showToast({
|
|
|
title: '提现积分最低为100,请输入大于100的积分',
|
|
@@ -39,6 +65,7 @@ Page({
|
|
|
duration: 2000
|
|
|
})
|
|
|
}
|
|
|
+ this.setData({ isDisabled: false })
|
|
|
},
|
|
|
// 兑换记录
|
|
|
exchangeList: function () {
|
|
@@ -47,5 +74,9 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
onLoad: function () {
|
|
|
+ let data = app.globalData.userInfo;
|
|
|
+ const { points, name, mobile, id } = data
|
|
|
+ const form = { isNum: points, name, phone: mobile, id }
|
|
|
+ this.setData({ form })
|
|
|
},
|
|
|
})
|