订单,提现功能调整
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
<view class="total" :style="'background-image: url(' + require('@/static/imgs/bonus_back.png') + ');'">
|
||||
<view class="total-left">
|
||||
<view class="total-value nowrap">{{total}}</view>
|
||||
<view class="total-text nowrap">账户余额</view>
|
||||
<view class="total-text nowrap">{{ type === 'balance' ? '账户余额': '已提现总金额'}}</view>
|
||||
</view>
|
||||
<view class="total-btn">提现</view>
|
||||
<view class="total-btn" @click="$Router.push({name: 'Withdraws'})">提现</view>
|
||||
</view>
|
||||
<!-- 账户记录 -->
|
||||
<view class="tabs">
|
||||
@@ -21,11 +21,21 @@
|
||||
<view class="logs">
|
||||
<block v-if="list.length > 0">
|
||||
<view class="log-flex" v-for="(item, index) in list" :key="index">
|
||||
<view class="text">
|
||||
<view class="type nowrap">{{item.remark || '-'}}</view>
|
||||
<view class="time nowrap">{{item.created_at}}</view>
|
||||
</view>
|
||||
<view class="price nowrap">{{item.amount}}</view>
|
||||
<block v-if="type === 'balance'">
|
||||
<view class="text">
|
||||
<view class="type nowrap">{{item.remark || '-'}}</view>
|
||||
<view class="time nowrap">{{item.created_at}}</view>
|
||||
</view>
|
||||
<view class="price nowrap">{{item.amount}}</view>
|
||||
</block>
|
||||
<block v-if="type === 'withdraws'">
|
||||
<view class="text">
|
||||
<view class="type nowrap"><text>[{{item.status.status_text}}]</text>{{item.title || '-'}}</view>
|
||||
<view class="remark nowrap" v-if="item.remark != null">{{item.remark || '-'}}</view>
|
||||
<view class="time nowrap">{{item.created_at}}</view>
|
||||
</view>
|
||||
<view class="price nowrap">{{item.amount}}</view>
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
@@ -44,13 +54,14 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { balance } from '@/apis/interfaces/account.js'
|
||||
import { balance, withdrawsLog } from '@/apis/interfaces/account.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
type: 'balance',
|
||||
tabs: [
|
||||
{ name: '奖金收益明细', value: '' },
|
||||
{ name: '提现记录', value: '' },
|
||||
{ name: '奖金收益明细', value: 'balance' },
|
||||
{ name: '提现记录', value: 'withdraws' },
|
||||
],
|
||||
total : '0.00',
|
||||
list : [],
|
||||
@@ -62,24 +73,71 @@
|
||||
status : ''
|
||||
};
|
||||
},
|
||||
created() {
|
||||
onShow() {
|
||||
this.page = {
|
||||
current : 1,
|
||||
has_more: false,
|
||||
}
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
onTabs(e){
|
||||
console.log(e)
|
||||
console.log('这里需要之后处理提现记录')
|
||||
if(e.value === this.type) return
|
||||
this.type = e.value
|
||||
this.page = {
|
||||
current : 1,
|
||||
has_more: false,
|
||||
}
|
||||
this.list = []
|
||||
this.total = '0.00'
|
||||
this.getList()
|
||||
},
|
||||
// 获取账户余额
|
||||
getList(){
|
||||
uni.showLoading({
|
||||
title:'加载中...',
|
||||
mask : true
|
||||
})
|
||||
if(this.type === 'balance') this.getBalance()
|
||||
if(this.type === 'withdraws')this.getWithdraws()
|
||||
},
|
||||
// 获取账户余额
|
||||
getBalance(){
|
||||
balance({
|
||||
page: this.page.current
|
||||
}).then(res => {
|
||||
let { balance, logs } = res;
|
||||
let atList = logs.page.current == 1 ? [] : this.list
|
||||
let atList = logs.page.current == 1 ? [] : this.list
|
||||
this.total = balance
|
||||
this.list = atList.concat(logs.data)
|
||||
this.page = logs.page
|
||||
this.pagesShow = false
|
||||
uni.hideLoading()
|
||||
}).catch(err => {
|
||||
this.errMsg(err)
|
||||
})
|
||||
},
|
||||
// 获取提现记录
|
||||
getWithdraws(){
|
||||
withdrawsLog({
|
||||
page: this.page.current
|
||||
}).then(res => {
|
||||
let { all, lists } = res;
|
||||
let atList = lists.page.current == 1 ? [] : this.list
|
||||
this.total = all;
|
||||
this.list = atList.concat(lists.data)
|
||||
this.page = lists.page
|
||||
this.pagesShow = false
|
||||
uni.hideLoading()
|
||||
}).catch(err => {
|
||||
this.errMsg(err)
|
||||
})
|
||||
},
|
||||
// 错误提示
|
||||
errMsg(err){
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -178,6 +236,14 @@
|
||||
font-weight: bold;
|
||||
font-size: 30rpx;
|
||||
color: #666666;
|
||||
text{
|
||||
font-weight: normal;
|
||||
padding-right: 10rpx;
|
||||
color: $main-color;
|
||||
}
|
||||
}
|
||||
.remark{
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.time{
|
||||
font-size: 28rpx;
|
||||
|
||||
244
pages/account/withdraws.vue
Normal file
244
pages/account/withdraws.vue
Normal file
@@ -0,0 +1,244 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<view class="block" v-if="banks.length > 0">
|
||||
<view class="bank">
|
||||
<view class="block-title">到账银行卡</view>
|
||||
<view class="bank-input">
|
||||
<label>开户银行</label>
|
||||
<picker class="banks-picker" :range="banks" range-key="name" :value="bankVal" @change="bankVal = $event.detail.value">
|
||||
<view class="banks-text" :class="{'gray': bankVal === 0}">{{banks[bankVal].name}}<uni-icons class="banks-icon" type="bottom" size="18" color="gray"></uni-icons></view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="bank-input">
|
||||
<label>银行卡号</label>
|
||||
<input type="number" placeholder="输入银行卡号" maxlength="20" v-model="bankNo">
|
||||
</view>
|
||||
<view class="bank-input">
|
||||
<label>预留手机号</label>
|
||||
<input type="number" placeholder="输入银行开户预留手机号" maxlength="11" v-model="mobile">
|
||||
</view>
|
||||
<view class="bank-input">
|
||||
<label>持卡人姓名</label>
|
||||
<input type="text" placeholder="输入开户人真实姓名" maxlength="15" v-model="name">
|
||||
</view>
|
||||
</view>
|
||||
<view class="cny">
|
||||
<view class="bank-from">
|
||||
<view class="block-title">提现金额</view>
|
||||
<view class="title"><text v-if="min >= 1">最小提现金额:{{min}}元,</text><text>提现手续费{{rate}}%</text></view>
|
||||
<view class="input">
|
||||
<label>¥</label>
|
||||
<input placeholder="0.00" type="number" v-model="amount" />
|
||||
</view>
|
||||
<view class="balance" v-if="!greater">当前账户余额{{balance}}<text @click="amount = balance">全部提现</text></view>
|
||||
<view class="balance red" v-else>输入金额超过账户余额</view>
|
||||
</view>
|
||||
<button class="cny-btn" :disabled="greater" @click="onSubmit">申请提现</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { withdrawsCreate, withdraws } from '@/apis/interfaces/account.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
banks : [],
|
||||
bankVal : 0,
|
||||
bankNo : '',
|
||||
mobile : '',
|
||||
name : '',
|
||||
amount : '',
|
||||
min : 0,
|
||||
rate : 0,
|
||||
balance : '0.00'
|
||||
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
greater(){
|
||||
return parseFloat(this.amount) > parseFloat(this.balance)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
mask : true
|
||||
})
|
||||
withdrawsCreate().then(res => {
|
||||
let { bank, tax, min, balance, banks} = res;
|
||||
let bankIndex
|
||||
this.rate = tax
|
||||
this.min = min
|
||||
this.balance = balance
|
||||
this.banks = [ { id: '', name: '请选择开户银行'}, ...banks ]
|
||||
if(bank.bank_no){
|
||||
bankIndex = this.banks.findIndex(val => val.name === bank.bank_name)
|
||||
this.bankNo = bank.bank_no
|
||||
this.mobile = bank.mobile
|
||||
this.name = bank.name
|
||||
this.bankVal = bankIndex >= 0 ? bankIndex : 0
|
||||
}
|
||||
uni.hideLoading()
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
onSubmit(){
|
||||
if(this.bankVal === 0){
|
||||
uni.showToast({
|
||||
title: '请选择开户银行',
|
||||
icon : 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '提交中...',
|
||||
mask : true
|
||||
})
|
||||
withdraws({
|
||||
bank_name : this.banks[this.bankVal].name,
|
||||
amount : this.amount,
|
||||
name : this.name,
|
||||
mobileNo : this.mobile,
|
||||
bank_no : this.bankNo,
|
||||
}).then(res => {
|
||||
uni.showModal({
|
||||
title : '提示',
|
||||
content : res,
|
||||
showCancel : false,
|
||||
success : ModalRes => {
|
||||
if(ModalRes.confirm){
|
||||
this.$Router.back()
|
||||
}
|
||||
}
|
||||
})
|
||||
uni.hideLoading()
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.content{
|
||||
padding: 30rpx;
|
||||
}
|
||||
.block{
|
||||
background: white;
|
||||
.block-title{
|
||||
font-size: 30rpx;
|
||||
color: gray;
|
||||
line-height: 50rpx;
|
||||
}
|
||||
.bank{
|
||||
background: #fdfdfd;
|
||||
padding: 50rpx;
|
||||
.bank-input{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
font-size: 30rpx;
|
||||
@extend .border-solid;
|
||||
label{
|
||||
width: 200rpx;
|
||||
color: #333;
|
||||
}
|
||||
input{
|
||||
font-size: 30rpx;
|
||||
width: calc(100% - 200rpx);
|
||||
height: 100rpx;
|
||||
vertical-align: top;
|
||||
text-align: right;
|
||||
}
|
||||
.banks-picker{
|
||||
font-size: 30rpx;
|
||||
width: calc(100% - 200rpx);
|
||||
text-align: right;
|
||||
.banks-text{
|
||||
&.gray{
|
||||
color: gray;
|
||||
}
|
||||
.banks-icon{
|
||||
vertical-align: middle;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.cny{
|
||||
padding: 50rpx;
|
||||
.cny-btn{
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
border-radius: 10rpx;
|
||||
background: $main-color;
|
||||
color: white;
|
||||
font-size: 34rpx;
|
||||
margin-top: 50rpx;
|
||||
&::after{
|
||||
display: none;
|
||||
}
|
||||
&[disabled]{
|
||||
opacity: .7;
|
||||
}
|
||||
}
|
||||
// 提现
|
||||
.bank-from{
|
||||
background: white;
|
||||
border-radius: 10rpx;
|
||||
.title{
|
||||
padding-bottom: 20rpx;
|
||||
line-height: 40rpx;
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
text{
|
||||
font-size: 90%;
|
||||
color: gray;
|
||||
}
|
||||
}
|
||||
.input{
|
||||
display: flex;
|
||||
@extend .border-solid;
|
||||
font-size: 60rpx;
|
||||
height: 120rpx;
|
||||
line-height: 120rpx;
|
||||
font-weight: 500;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
input{
|
||||
flex: 1;
|
||||
height: 120rpx;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-size: 70rpx;
|
||||
}
|
||||
}
|
||||
.balance{
|
||||
font-size: 28rpx;
|
||||
line-height: 60rpx;
|
||||
padding-top: 20rpx;
|
||||
text{
|
||||
color: $main-color;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
&.red{
|
||||
color: $text-price;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user