bankCard.vue
2.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<template>
<view class="bank_card">
<view class="head">
<view class="left">
<image class="bank_logo" :src="`https://apimg.alipay.com/combo.png?d=cashier&t=${bankCode}`" mode="widthFix"></image>
</view>
<view class="right">
<text class="name">{{ bankInfo.accountBank.split(' ')[0] }}</text>
<text class="type">{{ bankInfo.accountBank.split(' ')[1] }}</text>
</view>
</view>
<view class="bank_number">
{{ hideBankCard(bankInfo.account) }}
</view>
</view>
</template>
<script>
export default {
props: {
bankInfo: {
type: Object,
require: true
},
bankCode: {
type: String,
default: 'ABC'
}
},
computed: {
// 隐藏银行卡中间号码
hideBankCard() {
return (value) => {
if (value && value.length > 8) {
return `${value.substring(0, 4)} ${"*".repeat(value.length - 8).replace(/(.{4})/g, `$1 `)}${value.length % 4 ? " " : ""}${value.slice(-4)}`
}
return value
}
}
},
}
</script>
<style lang="scss" scoped>
.bank_card{
padding: 40rpx;
border-radius: 16rpx;
box-shadow: rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px, rgba(10, 37, 64, 0.35) 0px -2px 6px 0px inset;
.head{
display: flex;
height: 100rpx;
.left{
display: flex;
align-items: center;
justify-content: center;
width: 256rpx;
height: 72rpx;
border-radius: 50%;
background-color: #FFD9DB;
margin-right: 20rpx;
.bank_logo{
width: 100%;
height: 100%;
}
}
.right{
display: flex;
flex-direction: column;
gap: 10rpx;
flex: 1;
.name{
font-size: 32rpx;
line-height: 42rpx;
font-weight: 500;
}
.type {
line-height: 38rpx;
font-size: 28rpx;
}
}
}
.bank_number{
margin-top: 20rpx;
padding: 0 16rpx;
text-align: right;
font-size: 40rpx;
line-height: 64rpx;
font-weight: 600;
}
}
.redType{
background-color: #ca0000;
}
.greenType{
background-color: #54aa7e;
}
.grayType{
background-color: #4386c9;
}
.blueType{
background-color: #009300;
}
</style>