<template>
	<view class="bank-card">
		
		<view class="card" v-for="(item,index) in list" :key="index">
			<image class="icon" src="https://img0.baidu.com/it/u=3079143123,3184684096&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500" mode=""></image>
			<view class="info">
				<view class="title">
					{{item.bankName}}
				</view>
				<view class="type">
					{{item.type || '储蓄卡'}}
				</view>
				<view class="num">
					{{item.bankCardNo}}
				</view>
			</view>
		</view>
		
		<button class="add-btn" type="default" @click="addCard">+ 添加银行卡</button>
	</view>
</template>

<script>
	import {addBankCard,bankList} from '@/api/common.js'
	export default {
		data() {
			return {
				list: []
			}
		},
		methods: {
			addCard() {
				uni.navigateTo({
					url:'../../pages/income/addCard'
				})
			},
			bankList(){
				bankList().then(res=>{
					this.list = res.content
				})
			}
		},
		created() {
			this.bankList()
		}
	}
</script>

<style lang="scss" scoped>
.bank-card{
	padding: 0 30rpx 60rpx;
	.card{
		border-radius: 12px;
		background: linear-gradient(90deg,rgb(116,142,251),rgb(32,181,255));
		display: flex;
		padding: 30rpx 30rpx 60rpx ;
		margin: 30rpx 0;
		color: #fff;
		.icon{
			width: 100rpx;
			height: 100rpx;
			border-radius: 50%;
		}
		.info{
			margin-left: 30rpx;
			.title{
				font-size: 34rpx;
			}
			.type{
				font-size: 28rpx;
				margin: 20rpx 0;
			}
			.num{
				font-size: 28rpx;
			}
		}
	}
	
	.add-btn{
		background: #fff;
		font-size: $btn-size;
	}
}
</style>