init project

This commit is contained in:
limqhz
2020-06-21 16:27:58 +08:00
commit e8fe10b5fb
178 changed files with 9964 additions and 0 deletions

178
pages/withdrawal/index.js Normal file
View File

@@ -0,0 +1,178 @@
// pages/withdrawal/index.js
const app = getApp();
let money = 0;
Page({
/**
* 页面的初始数据
*/
data: {
cardholder: '',
bank: '',
bankCard: '',
money: '',
isUnClick: false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.setData({
money:options.money
})
money = options.money
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
this.data.isUnClick = false;
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
return {
title: '智慧云馆'
}
},
// 修改持卡人
cardholderInput(e) {
this.data.cardholder = e.detail.value;
},
// 修改银行
bankInput(e) {
this.data.bank = e.detail.value;
},
// 修改银行卡号
bankCardInput(e) {
this.data.bankCard = e.detail.value;
},
// 提现金额
moneyInput(e) {
this.data.money = e.detail.value;
},
// 确认提现
withdrawalClick(e) {
if (!this.data.cardholder) {
wx.showToast({
title: '请输入持卡人',
icon: 'none',
})
return;
}
if (!this.data.bank) {
wx.showToast({
title: '请输入开户银行',
icon: 'none',
})
return;
}
if (this.data.bankCard.length != 16) {
wx.showToast({
title: '请输入16位银行卡号',
icon: 'none',
})
return;
}
if (!this.data.money) {
wx.showToast({
title: '请输入提现金额',
icon: 'none',
})
return;
}
if (this.data.money > money) {
wx.showToast({
title: '提现金额不得大于余额',
icon: 'none',
})
return;
}
console.log(/^([1-9][\d]{0,7}|0)(\.[\d]{1,2})?$/.test(this.data.money));
if (!/^([1-9][\d]{0,7}|0)(\.[\d]{1,2})?$/.test(this.data.money)) {
wx.showToast({
title: '请输入正确的金额',
icon: 'none',
})
return;
}
if (this.data.isUnClick) {
return
}
wx.showLoading({
title: '加载中...',
mask: true,
})
this.data.isUnClick = true;
app.$api.memberBankBind({
bankName: this.data.bank,
bankNo: this.data.bankCard,
name: this.data.cardholder
}).then(res => {
app.$api.memberWithdrawApply({
bankId: res.bankId,
money: this.data.money
}).then(res => {
wx.showToast({
title: '已受理提现申请',
duration: 2000
}),
setTimeout(function() {
wx.navigateBack({
delta: 1,
})
}, 2000)
}, err => {
this.data.isUnClick = false;
})
}, err => {
this.data.isUnClick = false;
})
}
})

View File

@@ -0,0 +1,5 @@
{
"usingComponents": {
"header": "/component/header/header"
}
}

View File

@@ -0,0 +1,27 @@
<!--pages/withdrawal/index.wxml-->
<header></header>
<view class='container'>
<view class='box'>
<view class='cell'>
<text>持卡人</text>
<input value="{{cardholder}}" placeholder='请输入持卡人' bindinput='cardholderInput'></input>
</view>
<view class='cell'>
<text>银行</text>
<input value="{{bank}}" placeholder='请输入开户银行' bindinput='bankInput'></input>
</view>
<view class='cell unLine'>
<text>银行卡卡号</text>
<input placeholder='请输入银行卡卡号' type='number' bindinput='bankCardInput'></input>
</view>
</view>
<view class='box bottom'>
<view class='label'>提现金额</view>
<view class='input-box'>
<text style='margin-top: 10rpx'>¥</text>
<input bindinput='moneyInput' type='digit'></input>
</view>
<text class='message'>可提现余额为 {{money}}</text>
<view class='btn-box' bindtap='withdrawalClick'>确认提现</view>
</view>
</view>

View File

@@ -0,0 +1,79 @@
/* pages/withdrawal/index.wxss */
.container {
min-height: calc(100vh - 190rpx);
padding: 30rpx;
padding-top: 190rpx;
}
.box {
background: #1a191e;
border-radius: 20rpx;
}
.box .cell {
display: flex;
justify-content: space-between;
align-items: center;
height: 90rpx;
padding: 0 20rpx;
border-bottom: 2rpx solid #212025;
font-size: 24rpx;
color: rgba(255, 255, 255, 0.6);
}
.box .cell.unLine {
border: none;
}
.box .cell>input {
flex: 1;
margin-left: 20rpx;
color: #FFF;
text-align: right;
}
.box.bottom {
padding: 50rpx;
margin-top: 30rpx;
}
.box .label {
font-size: 24rpx;
color: #FFF;
margin-top: 10rpx;
}
.box .input-box {
display: flex;
/* align-items: center; */
margin-top: 60rpx;
margin-bottom: 10rpx;
border-bottom: 2rpx solid #212025;
color: #FFF;
font-size: 30rpx;
font-weight: bold;
}
.box .input-box>input {
height: 70rpx;
font-size: 52rpx;
font-weight: bold;
margin-bottom: 20rpx;
margin-left: 20rpx;
}
.box .btn-box {
height: 80rpx;
margin: 60rpx 20rpx 20rpx 20rpx;
background: #ffda2e;
color: #1a191e;
border-radius: 40rpx;
line-height: 80rpx;
text-align: center;
font-size: 28rpx;
}
.message {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.6);
}