@@ -5,54 +5,71 @@
< view class = "propery-content" >
< view class = "currency" > 可提现额度 < / view >
< view class = "balance" > { { balance || '0.00' } } < / view >
< view class = "frozen" @click ="withdrawDetail " > 提现记录 < / view >
< view class = "frozen" @click ="$Router.push({name: ' withdrawList'}) " > 提现记录 < / view >
< / view >
< / view >
< view class = "item-name " >
提现至银行卡
< view class = "right" >
< view class = "cardName" v-if = "bank_accounts === 0" @click="addBanks" > 添加银行卡 < / view >
< view class = "cardName" v -if = ' bank_accounts > 0 ' @click="bankLists">{{bankInfo.name?bankInfo.name:' 选择银行卡 '}}
< ! - - 提现渠道 - - >
< view class = "extract-radio " >
< radio-group @change ="extractType = $event.detail.value" >
< view class = "extract-item" v-for = "(item, index) in types" :key="index" >
< label class = "radio" >
< radio :value = "item.type" color = "#8b64fd" : checked = "extractType === item.type" / > < text > 提现到 { { item . name } } < / text >
< / label >
< / view >
<uni-icons type="arrowright" size="12" color="#fff" />
</view>
< / radio-group >
< / view >
<!-- 提现金额 -- >
< view class = "withdrawing-content" >
< view class = "item" >
< view style = "flex: 1;" >
< view class = "inputTxt" > 提现金额 < / view >
< input class= "input_num" v-model= "withdraw_input" @input=' inputNum ' type="number"
placeholder-style="color:#999;font-weight:normal; font-size:34rpx;"
placeholder="请输入提现金额" :disabled="balance===0" />
< input class= "input_num" v-model= "withdraw_input" @input='inputNum' type="number" placeholder-style="color:#999;font-weight:normal; font-size:34rpx;" placeholder="请输入提现金额" :disabled="balance===0" / >
< / view >
< view class = "all" @click ="all" > 全部提现 < / view >
< / view >
< / view >
<view class="total" v-if="total">≈ ¥{{total.toFixed(2)}} </view>
<view class="btn" @click="actions">提现至银行卡</view>
< ! - - 银行卡 - - >
< block v-if = "extractType === '1'" >
< view class = "item-name" >
< view class = "cardName" v-if = "bank_accounts === 0" @click="$Router.push({name: 'addBank'})" > 添加银行卡 < / view >
< view class = "cardName" v -if = ' bank_accounts > 0 ' @click="$Router.push({name: ' bankList '})">{{bankInfo.name ? bankInfo.name:' 选择银行卡 '}}</view>
<uni-icons type="arrowright" size="16" color="#ddd" />
</view>
</block>
<!-- 支付宝 -->
<block v-if="extractType === ' 2 '">
<view class="alipay-form">
<view class="alipay-inputs">
<label>支付宝账号</label>
<input type="text" v-model="alipayUser" placeholder="输入支付宝账号" />
</view>
<view class="alipay-inputs">
<label>支付宝姓名</label>
<input type="text" v-model="alipayName" placeholder="输入支付宝姓名" />
</view>
</view>
</block>
<!-- -->
<view class="btn" @click="actions">申请提现</view>
<view class="des">预计5- 10个工作日到账 手续费: {{tax === ' 0 '?' 免手续费 ':tax+' % '}}</view>
</view>
</template>
<script>
import {
withdrawsIndexCreate,
withdrawsIndex
} from ' @ / apis / interfaces / withdraws ';
import { withdrawsIndexCreate, withdrawsIndex } from ' @ / apis / interfaces / withdraws ';
export default {
data() {
return {
balance: 0, // 钱包通证金额
tax: 0, // 当前手续费
cost: 1, // 每个通证的价格
total : 0, // 约合人民币
card: ' ', // 银行卡号
types : [],
alipayUser : ' ', // 支付宝账号
alipayName : ' ', // 支付宝姓名
balance : 0, // 钱包通证金额
tax : 0, // 当前手续费
withdraw_input: ' ', // 提现通证金额
bank_accounts: 0,
bankInfo: {} ,
certification:false,// 认证状态
extractType : ' 1 ', // 提现方式
bank_accounts : 0 ,
bankInfo : {},
certification : false,// 认证状态
};
},
onLoad() {
@@ -68,13 +85,19 @@
// 提现基本信息
getInfo() {
withdrawsIndexCreate().then(res => {
this.balance = res.balance
this.tax = res.tax
this.cost = res.cost
this.bank_accounts = res.bank_accounts.length
let typesArry = new Array
for(let key in res.types){
typesArry.push({
type: key,
name: res.types[key]
})
}
this.types = typesArry
this.balance = res.balance
this.tax = res.tax
this.bank_accounts = res.bank_accounts.length
this.withdraw_input = Number(res.balance)
this.total = Number(res.balance) * Number(res.cost)
this.certification = res.certification
this.certification = res.certification
uni.setStorageSync(' refresh ', false)
}).catch(err => {
uni.showToast({
@@ -97,7 +120,6 @@
duration: 2000
});
this.withdraw_input = 0
this.total = 0
} else {
uni.showToast({
title: ' 最大值能超过 ' + this.balance + ' ',
@@ -105,7 +127,6 @@
duration: 2000
});
this.withdraw_input = this.balance
this.total = this.balance * this.cost
}
}
},
@@ -125,24 +146,7 @@
},
// 提现
actions() {
let data = {
bank_account_id: this.bankInfo.bank_account_id,
amount: Number(this.withdraw_input)
}
if (data.bank_account_id === undefined || data.bank_account_id === null || data.bank_account_id === ' ') {
uni.showToast({
title: this.bank_accounts > 0 ? ' 请选择银行卡 ' : ' 请添加银行卡 ',
icon: ' none '
})
return;
}
if (data.amount === 0) {
uni.showToast({
title: ' 请输入通证金额 ',
icon: ' none '
})
return;
}
// 提现前置条件
if (!this.certification) {
uni.showModal({
title: ' 提示 ',
@@ -161,14 +165,62 @@
})
return
}
// 组织提现数据
let data = {
type : this.extractType,
amount : this.withdraw_input,
bank_account_id : this.bankInfo.bank_account_id,
name : this.alipayName,
identity : this.alipayUser
}
// 检查提现金额
if (Number(data.amount) <= 0) {
uni.showToast({
title: ' 提现金额不能为0或复数 ',
icon: ' none '
})
return;
}
// 检查银行卡信息
if(data.type === 1){
if (data.bank_account_id === undefined || data.bank_account_id === null || data.bank_account_id === ' ') {
uni.showToast({
title: this.bank_accounts > 0 ? ' 请选择银行卡 ' : ' 请添加银行卡 ',
icon: ' none '
})
return;
}
}
// 检查支付宝账号
if(data.type === 2){
if (data.name === ' ') {
uni.showToast({
title: ' 请输入支付宝账号 ',
icon: ' none '
})
return;
}
if (data.identity === ' ') {
uni.showToast({
title: ' 请输入支付宝姓名 ',
icon: ' none '
})
return;
}
}
uni.showModal({
title: ' 温馨提示 ',
content:this.tax === ' 0 '? ' 您是否确认提现 , 交易将免手续费 ': ' 您是否确认提现 , 将会扣除 ' + this.tax + ' % 手续费 ',
title : ' 温馨提示 ',
content :this.tax === ' 0 ' ? ' 您是否确认提现 , 交易将免手续费 ' : ' 您是否确认提现 , 将会扣除 ' + this.tax + ' % 手续费 ',
confirmColor: ' # 7 c52fc ',
cancelColor: ' # cacaca ',
cancelText: ' 我再想想 ',
confirmText: ' 确认提现 ',
success: ( res) => {
cancelColor : ' # cacaca ',
cancelText : ' 我再想想 ',
confirmText : ' 确认提现 ',
success : res => {
if (res.confirm) {
uni.showLoading({
title: ' 提交中 '
@@ -180,12 +232,11 @@
duration: 3000
})
this.withdraw_input = ' '
this.total = ' '
setTimeout(res => {
this.getInfo()
uni.hideLoading()
uni.setStorageSync(' refresh ',true )
}, 3000)
this.total = ' '
this.alipayUser = ' '
this.alipayName = ' '
this.getInfo( )
}).catch(err => {
uni.showToast({
title: err.message,
@@ -196,24 +247,6 @@
}
} )
},
// 添加银行卡
addBanks() {
this.$Router.push({
name: ' addBank '
})
},
// 选择银行卡
bankLists() {
this.$Router.push({
name: ' bankList '
})
},
// 提现记录
withdrawDetail() {
this.$Router.push({
name: ' withdrawList '
} )
}
}
}
@@ -296,40 +329,27 @@
}
. item - name {
text - align : center ;
color : # 303030 ;
font - weight : bold ;
margin - bottom : $margin ;
font - size : 30 rpx ;
margin - top : $margin ;
font - size : 32 rpx ;
display : flex ;
flex - direction : row ;
align - items : center ;
justify - content : space - between ;
box - sizing : border - box ;
background - image : linear - gradient ( to right , # aaaaff , # aaaaff ) ;
color : # fff ;
margin : 3 0rpx ;
padding : 30 rpx ;
. right {
background : white ;
padding : $padding / 2 $padding ;
line - height : 9 0rpx ;
justify - content : space - between ;
. cardName {
flex : 1 ;
display : flex ;
flex - direction : row ;
align - items : center ;
justify - content : space - between ;
font - size : 34 rpx ;
. cardName {
flex : 1 ;
& . gray {
color : $text - gray ;
}
}
}
. withdrawing - content {
background - color : # fff ;
padding : $padding $padding $padding $padding * 2 ;
padding : $padding / 2 $padding / 2 $padding / 2 $padding ;
font - size : $title - size - m ;
/* 绑定银行卡 */
. bank - card {
display : flex ;
@@ -339,8 +359,6 @@
box - sizing : border - box ;
padding : 0 45 rpx 0 35 rpx ;
}
. item {
display : flex ;
flex - direction : row ;
@@ -348,17 +366,14 @@
justify - content : flex - start ;
box - sizing : border - box ;
padding : 20 rpx 0 ;
span : nth - child ( 1 ) {
color : # 666 ;
margin - right : 20 rpx ;
}
. inputTxt {
color : # 999 ;
padding - bottom : 20 rpx ;
}
. input _num {
font - size : 60 rpx ;
color : # 3 a3a3a ;
@@ -400,7 +415,7 @@
border - radius : 10 rpx ;
text - align : center ;
padding : $padding * .9 ;
margin : $margin * 3 $margin * 2 $margin $margin * 2 ;
margin : $margin ;
font - size : $title - size ;
font - weight : bold ;
}
@@ -417,4 +432,62 @@
margin - left : 50 rpx ;
font - size : 36 rpx ;
}
// 选择类型
. extract - radio {
background : white ;
margin - bottom : $margin ;
. extract - item {
position : relative ;
padding : $padding / 2 $padding ;
line - height : 80 rpx ;
font - size : 32 rpx ;
label {
display : block ;
}
radio {
margin - right : $margin / 2 ;
}
& : : before {
position : absolute ;
bottom : 0 ;
left : $margin ;
right : 0 ;
content : " " ;
height : 1 rpx ;
background : $border - color ;
}
& : last - child : : before {
display : none ;
}
}
}
// 支付宝提现
. alipay - form {
background : white ;
margin - top : $margin ;
. alipay - inputs {
position : relative ;
padding - left : 240 rpx ;
position : relative ;
height : 90 rpx ;
label {
position : absolute ;
left : 0 ;
top : 0 ;
line - height : 90 rpx ;
width : 240 rpx ;
padding : 0 $padding ;
box - sizing : border - box ;
}
input {
height : 90 rpx ;
width : 100 % ;
}
label ,
input {
font - size : 32 rpx ;
}
}
}
< / style >