能量碎片接口页面处理

This commit is contained in:
2021-09-27 16:21:08 +08:00
parent d6af7dca6c
commit bb0e42104a
7 changed files with 120 additions and 80 deletions

View File

@@ -15,7 +15,8 @@
提现至银行卡
<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>
<view class="cardName" v-if='bank_accounts>0' @click="bankLists">{{bankInfo.name?bankInfo.name:'选择银行卡'}}
</view>
<uni-icons type="arrowright" size="12" color="#fff" />
</view>
</view>
@@ -29,9 +30,9 @@
<view class="all" @click="all">全部提现</view>
</view>
</view>
<view class="total" v-if="total">≈ ¥{{total}} </view>
<view class="total" v-if="total">≈ ¥{{total.toFixed(2)}} </view>
<view class="btn" @click="actions">提现至银行卡</view>
<view class="des">预计5- 10个工作日到账 手续费: {{tax}}%</view>
<view class="des">预计5- 10个工作日到账 手续费: {{tax}}%</view>
</view>
</template>
@@ -45,19 +46,22 @@
return {
balance: 0, // 钱包能量球数量
tax: 0, // 当前手续费
cost:1,// 每个能量球的价格
total:0,// 约合人民币
cost: 1, // 每个能量球的价格
total: 0, // 约合人民币
card: '', // 银行卡号
withdraw_input: '', // 提现能量球数量
bank_accounts: 0,
bankInfo:{}
bankInfo: {}
};
},
onLoad() {
this.getInfo()
},
onReachBottom() {
onShow() {
if (uni.getStorageSync('refresh')) {
this.bankInfo = {}
this.getInfo()
}
},
methods: {
// 提现基本信息
@@ -67,6 +71,7 @@
this.tax = res.tax
this.cost = res.cost
this.bank_accounts = res.bank_accounts.length
uni.setStorageSync('refresh', false)
}).catch(err => {
uni.showToast({
title: err.message,
@@ -104,35 +109,49 @@
}
},
// 提现
actions(){
actions() {
let data = {
bank_account_id:this.bankInfo.bank_account_id,
amount:Number(this.withdraw_input)
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 === ''){
if (data.bank_account_id === undefined || data.bank_account_id === null || data.bank_account_id === '') {
uni.showToast({
title:this.bank_accounts>0?'请选择银行卡':'请添加银行卡',
icon:'none'
title: this.bank_accounts > 0 ? '请选择银行卡' : '请添加银行卡',
icon: 'none'
})
return;
}
if (data.amount === 0) {
uni.showToast({
title: '请输入能量球数量',
icon: 'none'
})
return;
}
uni.showModal({
title:'温馨提示',
content:'您是否确认提现将会扣除' +this.tax+'%手续费' ,
confirmColor:'#7c52fc',
cancelColor:'#cacaca',
cancelText:'我再想想',
confirmText:'确认提现',
title: '温馨提示',
content: '您是否确认提现将会扣除' + this.tax + '%手续费',
confirmColor: '#7c52fc',
cancelColor: '#cacaca',
cancelText: '我再想想',
confirmText: '确认提现',
success: (res) => {
if(res.confirm){
withdrawsIndex(data).then(res=>{
if (res.confirm) {
uni.showLoading({
title:'提交中'
})
withdrawsIndex(data).then(res => {
uni.showToast({
title:res.message,
icon:'none'
title: res,
icon: 'none',
duration:3000
})
this.withdraw_input = ''
this.total = ''
this.getInfo()
setTimeout(res => {
this.getInfo()
uni.hideLoading()
}, 3000)
}).catch(err => {
uni.showToast({
title: err.message,
@@ -142,7 +161,7 @@
}
}
})
},
// 添加银行卡
addBanks() {
@@ -353,7 +372,7 @@
color: #cacaca;
font-size: 26rpx;
}
.total {
color: $mian-color;
margin-top: 20rpx;