<template>
	<view>
		<view class="mart15 marb10 font14 fontwig6 fcor333 fontwig6 fotct addCardBtn" @click="goBingCard()">添加工会卡</view>
		<view class="height70 cardListcs width90 mart15" v-for="cards in userCardList" :key="cards" @click="getHuiLianTongCardBalance(cards.cardNo)">
			<!-- <view class="cardBtn">已选择</view> -->
			<view class="fcor666 fontwig6 font15 paddtop10 paddleft10">工会卡类型:<text class="fcor333" v-if="cards.type == 1">汇联通工会卡</text>
			</view>
			<view class="fcor666 fontwig6 font15 paddtop10 paddleft10">工会卡卡号:<text
					class="fcor333">{{cards.cardNo}}</text></view>
		</view>
		
	</view>
</template>

<script>
	import {
		getUserCardList,
		getHuiLianTongCardBalance
	} from '../../../Utils/Api.js';
	let app = getApp();
	export default {
		data() {
			return {
				userCardList:''
			}
		},
		onLoad() {
			this.getUserCardList();
		},
		methods: {
			//跳转绑定工会卡
			goBingCard() {
				uni.navigateTo({
					url: '../bindingCard/bindingCard'
				})
			},
			//查询我的卡号列表
			getUserCardList() {
				uni.showLoading();
				getUserCardList().then(res => {
					uni.hideLoading();
					if (res.return_code == '000000') {
						this.userCardList = res.return_data;
						return;
					}
					this.UserCard = '';
				});
			},
			//查询详情
			getHuiLianTongCardBalance(item) {
				app.globalData.balanceCardNo = item;
				let params = {
					cardNo: item
				}
				getHuiLianTongCardBalance(params).then(res => {
					if (res.return_code == '000000') {
							app.globalData.balancePrice = res.return_data.balance;
					}
				
				});
			},
		}
	}
</script>

<style lang="scss">
	.addCardBtn{
		width: 60%;
		margin-left: 20%;
		height: 75rpx;
		line-height: 75rpx;
		background-color: #0083f5;
		color: #FFFFFF;
		font-size: 25rpx;
		margin-top: 40rpx;
		margin-bottom: 40px;
		border-radius: 25px;
	}
	.cardBtn {
		position: absolute;
		right: 5%;
		height: 50rpx;
		line-height: 50rpx;
		text-align: center;
		width: 120rpx;
		font-size: 14px;
		background-color: #0083f5;
		color: #FFFFFF;
		border-radius: 0px 16rpx 0 0;
	}

	.cardListcs {
		box-shadow: 0px 1px 7px 1px rgba(0, 0, 0, 0.14);
		border-radius: 16rpx;
		border: 1px solid #f6f6f6;
	}
</style>
