|
|
|
@ -112,9 +112,16 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<u-modal title="确认提现金额" :show="isWithdrawForm" :showCancelButton="true" @confirm="confirmWithdraw" @cancel="isWithdrawForm=false"> |
|
|
|
<view class="slot-content"> |
|
|
|
<u--input prefixIcon="¥" placeholder="提现金额" border="surround" v-model="withdrawAmount"></u--input> |
|
|
|
<u-modal title="确认提现金额" :show="isWithdrawForm" :showCancelButton="true" @confirm="confirmWithdraw" |
|
|
|
@cancel="isWithdrawForm=false"> |
|
|
|
<view class="withdraw-form"> |
|
|
|
<u--input prefixIcon="¥" placeholder="提现金额" border="surround" v-model="inputAmount"></u--input> |
|
|
|
<view class="fee-desc"> |
|
|
|
扣手续费{{calcFee}}元,实际到账{{calcReceiveAmount}}元 |
|
|
|
</view> |
|
|
|
<view class="tips"> |
|
|
|
<view class="tips-item" v-for="line in sysConfig.withdraw_tips.split('\n')">{{line}}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</u-modal> |
|
|
|
|
|
|
|
@ -125,7 +132,8 @@ |
|
|
|
import { |
|
|
|
userAccountInfo, |
|
|
|
userFillAlipayAccount, |
|
|
|
userWithdraw |
|
|
|
userWithdraw, |
|
|
|
publicSysConfig |
|
|
|
} from '../../common/api.js' |
|
|
|
|
|
|
|
export default { |
|
|
|
@ -136,11 +144,36 @@ |
|
|
|
inputAlipayAccount: '', |
|
|
|
inputAlipayName: '', |
|
|
|
isWithdrawForm: false, |
|
|
|
withdrawAmount: '' |
|
|
|
inputAmount: '', |
|
|
|
sysConfig: {} |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
calcFee() { |
|
|
|
if (!this.inputAmount || isNaN(this.inputAmount)) { |
|
|
|
return '--'; |
|
|
|
} |
|
|
|
if (!this.sysConfig.withdraw_fee_rate) { |
|
|
|
return '--'; |
|
|
|
} |
|
|
|
let fee = (this.inputAmount * this.sysConfig.withdraw_fee_rate / 100).toFixed(2); |
|
|
|
return fee; |
|
|
|
}, |
|
|
|
calcReceiveAmount() { |
|
|
|
if (!this.inputAmount || isNaN(this.inputAmount)) { |
|
|
|
return '--'; |
|
|
|
} |
|
|
|
if (!this.sysConfig.withdraw_fee_rate) { |
|
|
|
return '--'; |
|
|
|
} |
|
|
|
let fee = this.calcFee; |
|
|
|
let receiveAmount = (this.inputAmount - parseFloat(fee)).toFixed(2); |
|
|
|
return receiveAmount; |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
this.getAccountInfo(); |
|
|
|
this.getSysConfig(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
getAccountInfo() { |
|
|
|
@ -167,12 +200,13 @@ |
|
|
|
}, |
|
|
|
showWithdrawForm() { |
|
|
|
this.isWithdrawForm = true |
|
|
|
this.withdrawAmount = this.accountInfo.wallet_balance |
|
|
|
this.inputAmount = this.accountInfo.wallet_balance |
|
|
|
}, |
|
|
|
confirmWithdraw() { |
|
|
|
userWithdraw({ |
|
|
|
amount: this.accountInfo.wallet_balance |
|
|
|
amount: this.inputAmount |
|
|
|
}).then(() => { |
|
|
|
this.getAccountInfo() |
|
|
|
this.isWithdrawForm = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
@ -180,7 +214,10 @@ |
|
|
|
uni.navigateTo({ |
|
|
|
url: '/pages/withdrawal-history/withdrawal-history' |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
getSysConfig() { |
|
|
|
publicSysConfig().then(data => this.sysConfig = data) |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
@ -400,4 +437,15 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.withdraw-form { |
|
|
|
font-size: 28rpx; |
|
|
|
.tips { |
|
|
|
margin-top: 20rpx; |
|
|
|
|
|
|
|
.tips-item { |
|
|
|
margin-top: 6rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |