榆钱落尽槿花稀 5c3b736c51 1.搭+页面新增:银行卡页面
2.搭+钱包接口对接:新增,编辑银行卡,提现,提现列表
搭+提现功能完成度(100%)
3.搭+身份认证功能页面制作接口对接
搭+身份认证功能完成度(100%)
2025-06-06 18:30:30 +08:00

176 lines
5.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="bank-container">
<view style="background-color: #ffffff;border-radius: 0rpx 0rpx 44rpx 44rpx;padding:40rpx 30rpx;">
<view @click="addBank()"
style="display: flex;justify-content: space-between;align-items: center;background: #323232;height: 220rpx;width: 100%;border-radius: 18rpx;">
<view v-if="bankInfo == ''" style="display: flex;align-items: center;padding-left: 30rpx;">
<image src="/static/add.png" style="width: 40rpx;height: 40rpx;"></image>
<view style="color: #ffffff;font-size: 32rpx;margin-left: 20rpx;">添加银行卡</view>
</view>
<view v-if="bankInfo != ''" style="padding-left: 30rpx;">
<view style="color: #ffffff;font-size: 32rpx;">{{ bankInfo.bank_name }}</view>
<view
style="color: #ffffff;font-size: 32rpx;margin-top: 20rpx;font-family: PingFang SC, PingFang SC;">
{{ formatBankCard(bankInfo.bank_user_name) }}</view>
</view>
<view style="padding-right: 20rpx;">
<u-icon color="#BBFC5B" name="arrow-right"></u-icon>
</view>
</view>
</view>
<view style="background-color: #ffffff;border-radius:44rpx;padding:40rpx 30rpx;margin-top: 20rpx;">
<view style="font-size: 28rpx;color: #3D3D3D;font-weight: 400;">
提现金额
</view>
<view style="margin-top: 20rpx;font-family: D-DIN-PRO, D-DIN-PRO;">
<text style="font-size: 28rpx;color: #3D3D3D;font-weight: 700;"></text>
<text style="font-size: 70rpx;color: #3D3D3D;font-weight: 700;margin-left: 20rpx;">{{
settleInfo.settled_amount }}</text>
</view>
<view style="background-color: #F0F0F0;height: 1px;width: 100%;margin-top: 20rpx;"></view>
<view style="font-size: 24rpx;color: #9C9C9C;font-weight: 400;margin-top: 30rpx;">
默认全部提现具体到账时间以银行为准
</view>
<view style="color: #FF4810;font-size: 24rpx;font-weight: 400;margin-top: 30rpx;">
若您的提现账户为跨行或跨区域的对公账户银行会收取额外 手续费具体金额以实际到账为准
</view>
<view class="btn_1" @click="withdraw()">确认提现</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
bankInfo: '',
settleInfo: {},
}
},
onShow() {
this.getBankList();
this.getUserInfo();
},
methods: {
getBankList() {
uni.$u.http
.get("/api/school.newactivity.settle_log/detail")
.then((res) => {
console.log(res);
this.bankInfo = res.data.withdrawal==''||res.data.withdrawal==null?'':res.data.withdrawal;
});
},
//格式化银行卡格式为4252 **** **** **** 2563
formatBankCard(cardNumber) {
// 转换为字符串并移除非数字字符
const cleaned = cardNumber.toString().replace(/\D/g, '');
// 验证长度至少8位才能保留首尾各4位
if (cleaned.length < 8) return cardNumber;
// 提取前4位和后4位
const firstPart = cleaned.substring(0, 4);
const lastPart = cleaned.substring(cleaned.length - 4);
// 组合成目标格式
return `${firstPart}${'*'.repeat(12)}${lastPart}`;
},
withdraw() {
if(this.bankInfo==''||this.bankInfo==null){
uni.showToast({
title: '请先添加银行卡',
icon: 'none',
duration: 2000
})
return;
}
//确认是否提现
uni.showModal({
title: '提示',
content: '确认提现?',
success: (res) => {
if (res.confirm) {
this.withdrawDo();
}
}
});
},
withdrawDo() {
//提现
uni.$u.http
.post("/api/school.newactivity.settle_log/withdrawal")
.then((res) => {
console.log(res);
if(res.code==1){
uni.showToast({
title: '提现成功',
icon: 'success',
duration: 2000,
complete: function () {
setTimeout(function () {
uni.navigateBack();
}, 1500);
}
})
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
});
},// 获取个人信息
getUserInfo() {
uni.$u.http.get('/api/user/index', {}).then(res => {
if (res.code == 1) {
uni.setStorageSync('userInfo', res.data.user_info)
uni.setStorageSync('settleInfo', res.data.settle_info)
uni.setStorageSync('activityInfo', res.data.activity_info)
this.settleInfo = res.data.settle_info;
} else {
uni.showToast({
title: '登陆失败',
icon: 'error',
duration: 2000
})
}
}).catch(error => {
console.log('error', error);
this.showPopup = false
uni.showToast({
title: '登陆失败',
icon: 'error',
duration: 2000
})
})
},
addBank(){
uni.navigateTo({
url: '/packageB/wallet/add_bank'
})
},
}
}
</script>
<style scoped lang="scss">
.bank-container {
font-family: PingFang SC, PingFang SC;
background: #F7F7F7;
min-height: 100vh;
}
.btn_1 {
width: 100%;
height: 90rpx;
background: #323232;
border-radius: 198rpx 198rpx 198rpx 198rpx;
font-family: YouSheBiaoTiHei, YouSheBiaoTiHei;
font-weight: 400;
font-size: 32rpx;
color: #BBFC5B;
line-height: 90rpx;
text-align: center;
margin-top: 70rpx;
}
</style>