<template>
|
<view class="box" v-if="countData">
|
<view class="bg">
|
<view class="bg-a">可提现余额(元)</view>
|
<view class="bg-b">
|
<text>{{(countData.balance / 100 || 0).toFixed(2)}}</text>
|
<text></text>
|
</view>
|
<view class="form">
|
<view class="form-a">
|
<view class="form-a-label">提现至支付宝账号</view>
|
<view class="form-a-val">
|
<input type="text" placeholder="请输入提现账号" v-model="form.aliAccount" />
|
</view>
|
</view>
|
<view class="form-a">
|
<view class="form-a-label">账号姓名</view>
|
<view class="form-a-val">
|
<input type="text" placeholder="请输入账号姓名" v-model="form.aliName" />
|
</view>
|
</view>
|
<view class="form-title">提现金额</view>
|
<view class="form-input">
|
<view class="form-input-dw">¥</view>
|
<input type="digit" placeholder="0" v-model="form.amount" :focus='focus' @blur="focus = false" :style="{ color: isAmountExceeded ? '#FF0020' : '#111111' }"/>
|
<view class="form-input-tx" @click="inputAll">全部提现</view>
|
</view>
|
<view v-if="isAmountExceeded" class="form-error">输入的金额已经超过可提现金额</view>
|
<view class="form-btn" :class="{ 'form-btn--disabled': !isSubmitEnabled }" @click="isSubmitEnabled && confirm()">提交申请</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import { mapState } from 'vuex'
|
export default {
|
computed: {
|
...mapState(['userInfo']),
|
balance() {
|
return this.countData ? this.countData.balance / 100 : 0
|
},
|
amount() {
|
return parseFloat(this.form.amount) || 0
|
},
|
isAmountExceeded() {
|
return this.form.amount && this.amount > this.balance
|
},
|
isSubmitEnabled() {
|
return this.form.amount && this.amount > 0 && !this.isAmountExceeded
|
}
|
},
|
data() {
|
return {
|
tips:'',
|
focus:false,
|
valid:false,
|
bankList:[],
|
form: { amount: null, aliAccount: null, aliName: null },
|
shop:{},
|
info:{},
|
countData: null
|
}
|
},
|
onLoad(options) {
|
this.focus = false
|
this.form.aliAccount = this.userInfo.aliAccount
|
this.form.aliName = this.userInfo.aliName
|
this.getShopStatistics()
|
},
|
methods:{
|
// 获取司机钱包统计
|
getShopStatistics(){
|
this.$u.api.driverStatistics({}).then(res=>{
|
if(res.code == 200){
|
this.countData = res.data
|
}
|
})
|
},
|
confirm(){
|
if(!this.form.amount){
|
this.tips ='请输入提现金额'
|
this.focus = true
|
return
|
}
|
if(this.form.amount > (this.countData.balance / 100 || 0)){
|
this.tips ='输入的金额已经超过可提现金额'
|
this.focus = true
|
return
|
}
|
uni.showModal({
|
title: '操作提示',
|
content: '您确认发起此次提现申请吗?',
|
confirmColor: '#004096',
|
success: (res) => {
|
if (res.confirm) {
|
this.applyDo()
|
}
|
}
|
})
|
},
|
applyDo(){
|
var that =this
|
this.$u.api.driverApply(this.form)
|
.then(res => {
|
if (res.code === 200) {
|
uni.showToast({ title:'操作成功', icon:'success' })
|
uni.$emit('accountListReload')
|
uni.redirectTo({ url: "/pages/withdraw-success/withdraw-success?id=" + res.data })
|
}
|
})
|
},
|
inputAll(){
|
this.form.amount = this.countData.balance ? (this.countData.balance / 100 || 0) : 0
|
}
|
}
|
}
|
</script>
|
|
<style>
|
page {
|
background-color: #F9F9FB;
|
}
|
</style>
|
<style lang="scss" scoped>
|
.box {
|
width: 100%;
|
.bg {
|
width: 100%;
|
padding: 30rpx;
|
box-sizing: border-box;
|
height: 240rpx;
|
background: #004096;
|
.bg-a {
|
font-weight: 400;
|
font-size: 26rpx;
|
color: #FFFFFF;
|
}
|
.bg-b {
|
display: flex;
|
align-items: baseline;
|
margin-top: 14rpx;
|
text {
|
&:nth-child(1) {
|
font-weight: 600;
|
font-size: 48rpx;
|
color: #FFFFFF;
|
}
|
&:nth-child(2) {
|
font-weight: 600;
|
font-size: 26rpx;
|
color: #FFFFFF;
|
}
|
}
|
}
|
.form {
|
width: 100%;
|
background: #FFFFFF;
|
box-shadow: 0rpx 2rpx 20rpx 0rpx rgba(0,0,0,0.08);
|
border-radius: 20rpx;
|
margin-top: 30rpx;
|
padding: 48rpx 30rpx;
|
box-sizing: border-box;
|
.form-a {
|
width: 100%;
|
height: 102rpx;
|
border-bottom: 1rpx solid #E5E5E5;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
.form-a-label {
|
flex-shrink: 0;
|
margin-right: 30rpx;
|
font-weight: 400;
|
font-size: 30rpx;
|
color: #666666;
|
}
|
.form-a-val {
|
height: 100%;
|
input {
|
width: 300rpx;
|
height: 100%;
|
text-align: right;
|
font-weight: 500;
|
font-size: 28rpx;
|
color: #333333;
|
}
|
}
|
}
|
.form-xian {
|
width: 100%;
|
height: 1rpx;
|
margin: 30rpx 0;
|
background-color: #E5E5E5;
|
}
|
.form-title {
|
font-weight: 500;
|
font-size: 34rpx;
|
color: #111111;
|
margin-top: 40rpx;
|
}
|
.form-input {
|
width: 100%;
|
height: 116rpx;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
border-bottom: 1rpx solid #E5E5E5;
|
.form-input-dw {
|
flex-shrink: 0;
|
font-weight: bold;
|
font-size: 30rpx;
|
}
|
input {
|
flex: 1;
|
height: 100%;
|
font-weight: 500;
|
font-size: 40rpx;
|
color: #111111;
|
margin: 0 30rpx;
|
}
|
.form-input-tx {
|
flex-shrink: 0;
|
font-weight: 400;
|
font-size: 30rpx;
|
color: #004096;
|
}
|
}
|
.form-error {
|
font-weight: 400;
|
font-size: 26rpx;
|
color: #E4001D;
|
margin-top: 30rpx;
|
}
|
.disable {
|
color: #CCCCCC !important;
|
background: #EFEFEF !important;
|
}
|
.form-btn {
|
width: 100%;
|
height: 88rpx;
|
line-height: 88rpx;
|
text-align: center;
|
background: #004096;
|
border-radius: 44rpx;
|
font-weight: 500;
|
font-size: 32rpx;
|
color: #FFFFFF;
|
margin-top: 48rpx;
|
|
&--disabled {
|
background: #CCCCCC;
|
color: #FFFFFF;
|
}
|
}
|
}
|
}
|
}
|
</style>
|