<template>
	<view class="content">
		<view class="content1 flex">
			<span class='default active'>邀请</span>
			<span class='default'>黑名单</span>
		</view>
		<view class="content2 ">
			<view v-for='(item,index) in cardList' class="item">
				<!-- <view class="card-list-item" style="background:red"> -->
				
				<view class="card-list-item"
					:style="item.cardManagementInfo.currentBackground?'background:url('+item.cardManagementInfo.currentBackground+');background-size:100% 100%':''">
				<view class="card-content style1" v-if="item.cardManagementInfo.cuttentTemplate==1">
							<view class="left">
							<u--image :showLoading="true" :src="item.cardManagementInfo.headSculpture" width="66px" height="66px"
								shape="circle"></u--image>
						</view>
						 <view class="right">
							<view class="row1">
								<text class="name">{{item.cardManagementInfo.name}}</text>
								<text class="post">{{item.cardManagementInfo.post}}</text>
							</view>
							<view class="row2">
								{{item.cardManagementInfo.companyName}}
							</view>
							<view class="row3 flex" @click="">
								<u--image :showLoading="true" src="/static/imgs/card/address1.png"  width="13px" height="16px"
									 ></u--image>
									 <view class='icon-text'>{{ item.cardManagementInfo.province }}{{ item.cardManagementInfo.city }}{{ item.cardManagementInfo.area }}</view>
							</view>
							<view class="row4 flex">
								<u--image :showLoading="true" src="/static/imgs/card/phone1.png" width="12px" height="13px"
									></u--image><view class='icon-text'>{{ item.cardManagementInfo.phone }}</view>
							</view>
						</view>
					</view> 
					
					<view class="card-content style1 flex-between" v-if="item.cardManagementInfo.cuttentTemplate==2">
						<view class="right">
							<view class="row1">
								<text class="name">{{item.cardManagementInfo.name}}</text>
								<text class="post">{{item.cardManagementInfo.post}}</text>
							</view>
							<view class="row2">
								{{item.cardManagementInfo.companyName}}
							</view>
							<view class="row3 flex">
								<u--image :showLoading="true" src="/static/imgs/card/address3.png"  width="13px" height="16px"
									></u--image>
									<view class='icon-text'>{{ item.cardManagementInfo.province }}{{ item.cardManagementInfo.city }}{{ item.cardManagementInfo.area }}</view>
							</view>
							<view class="row4 flex">
								<u--image :showLoading="true" src="/static/imgs/card/phone3.png" width="12px" height="13px"
								></u--image><view class='icon-text'>{{ item.cardManagementInfo.phone }}</view>
							</view>
						</view>
						<view class="left">
							<u--image :showLoading="true" :src="item.cardManagementInfo.headSculpture" width="66px" height="66px"
								shape="circle" v-if="item.cardManagementInfo.headSculpture"></u--image>
							<u--image :showLoading="true" src="/./../static/imgs/card/defaulthead.png" width="66px"
								height="66px" shape="circle" v-else></u--image>
						</view>

					</view>
					<view class="card-content style2" v-if="item.cardManagementInfo.cuttentTemplate==3">
						<view class="top">
							<u--image :showLoading="true" :src="item.cardManagementInfo.headSculpture" width="66px" height="66px"
								shape="circle" v-if="item.cardManagementInfo.headSculpture"></u--image>
							<u--image :showLoading="true" src="/./../static/imgs/card/defaulthead.png" width="66px"
								height="66px" shape="circle" v-else></u--image>
						</view>
						<view class="bottom flex">
							<view class="left">
								<view class="row1">
									<text class="name">{{item.cardManagementInfo.name}}</text>
									<text class="post">{{item.cardManagementInfo.post}}</text>
								</view>
								<view class="row2">
									{{item.cardManagementInfo.companyName}}
								</view>
							</view>
							<view class="right">
								<view class="row1 flex">
									<u--image :showLoading="true" src="/static/imgs/card/address1.png"  width="13px" height="16px"
									></u--image><view class='icon-text'>{{ item.cardManagementInfo.province }}{{ item.cardManagementInfo.city }}{{ item.cardManagementInfo.area }}</view>
								</view>
								<view class="row2 flex">
									<u--image :showLoading="true" src="/static/imgs/card/phone1.png" width="12px" height="13px"
										></u--image><view class='icon-text'>{{ item.cardManagementInfo.phone }}</view>
								</view>
							</view>
						</view>
					</view>
					<view class="card-content style2" v-if="item.cardManagementInfo.cuttentTemplate==4">
						<view class="top">
							<view class="row1">
								<text class="name">{{item.cardManagementInfo.name}}</text>
								<text class="post">{{item.cardManagementInfo.post}}</text>
							</view>
							<view class="row2">
								{{item.cardManagementInfo.companyName}}
							</view>
			
						</view>
						<view class="bottom flex">
							<view class="left">
								<u--image :showLoading="true" :src="item.cardManagementInfo.headSculpture" width="66px" height="66px"
									shape="circle" v-if="item.cardManagementInfo.headSculpture"></u--image>
								<u--image :showLoading="true" src="/./../static/imgs/card/defaulthead.png"
									width="66px" height="66px" shape="circle" v-else></u--image>
							</view>
							<view class="right">
								<view class="row1 flex">
									<u--image :showLoading="true" src="/static/imgs/card/address2.png" width="13px" height="16px"
										 ></u--image><view class='icon-text'>{{ item.cardManagementInfo.province }}{{ item.cardManagementInfo.city }}{{ item.cardManagementInfo.area }}</view>
								</view>
								<view class="row2 flex">
									<u--image :showLoading="true" src="/static/imgs/card/phone2.png" width="12px" height="13px"
										 ></u--image><view  class='icon-text'>{{ item.cardManagementInfo.phone }}</view>
								</view>

							</view>
						</view>
					</view>
					<view class="status-btns" v-if="item.status==0">
						<span class='status-btn' @click='cardExchangeInfoEdit(1,item)'> 拉黑</span>
						<span class='status-btn error' @click='cardExchangeInfoEdit(2,item)'>拒绝</span>
						<span class='status-btn success' @click='cardExchangeInfoEdit(3,item)'>接受</span>
						<span class='status-btn' @click='cardExchangeInfoEdit(4,item)'>移除</span>
					</view>
					<view class="status-btns" v-else>
						<span class='status' v-if="item.status==1">已接受</span>
						<span class='status' v-if="item.status==3">已拒绝</span>
						<span class='status' v-if="item.status==5">已过期</span>
						<span class='status' v-if="item.status==7">已拉黑</span>
					</view>
				</view>
				<view style='margin:0 20rpx;' class="flex flex-between">
					<span>来至 {{item.circleName}}</span>
					<span> {{parseTime(item.gmtCreate)}}</span>
				</view>
				<!-- <view class="left">
					<view class="top flex-row-center">
						<image :src="item.headSculpture" mode="widthFix" class="img"></image>
					</view>
					<view class="bottom flex flex-evenly">
						<uni-icons @click="toHome(item)" type="home" size="20"></uni-icons>
						<text @click='switchType(item)'>{{item.classify?item.classifyName:'默'}}</text>
						<uni-icons @click='share(item)' type="redo" size="20" color=''></uni-icons>
					</view>
				</view>
				<view class="right">
					<view class="row1 flex">
						<text>{{item.name}}</text>
						<text class="line"></text>
						<text>{{item.post}}</text>
						<u-checkbox-group v-if='islongPress' placement="column"
							@change="checkboxChange($event,index)">
							<u-checkbox :name='index+1' :checked='item.checked'
								:customStyle="{marginBottom: '8px'}">
							</u-checkbox>
						</u-checkbox-group>
					</view>
					<view class="row2">
						{{item.companyName}}
					</view>
					<view class="row3" @click="toMap(item)">
						<uni-icons type="redo" size="20"></uni-icons>
						<text>{{item.province}}{{item.city}}{{item.area}}{{item.detailedAddress}}</text>
					</view>
					<view class="row3">
						<uni-icons type="redo" size="20"></uni-icons>
						<text>{{item.phone}}</text>
					</view>
					<view @click='remarkEdit(item)' class="row3">
						<uni-icons type="redo" size="20"></uni-icons>
						<text>{{item.remark?item.remark:'单击添加备注'}}</text>
					</view>
				</view> -->
			</view>
			<!--< view class="row" v-for="(item,index) in cardList" :key="index">
				<view class="flex">
					<view class="left">
						<view class="top flex-row-center">
							<image :src="item.cardManagementInfo.headSculpture" mode="widthFix" class="img"></image>
						</view>
					</view>
					<view class="right">
						<view class="row1 flex">
							<text>{{item.cardManagementInfo.name}}</text>
							<text class="line"></text>
							<text>{{item.cardManagementInfo.post}}</text>
						</view>
						<view class="row2">
							{{item.cardManagementInfo.companyName}}
						</view>
						<view class="row3" @click="toMap">
							<uni-icons type="redo" size="20"></uni-icons>
							<text>{{item.cardManagementInfo.detailedAddress}}</text>
						</view>
						<view class="row3">
							<uni-icons type="redo" size="20"></uni-icons>
							<text>{{item.cardManagementInfo.phone}}</text>
						</view>
					</view>
				</view>
				<view class="" v-if="item.status==0">
					<span @click='cardExchangeInfoEdit(1,item)'> 拉黑</span>
					<span @click='cardExchangeInfoEdit(2,item)'>拒绝</span>
					<span @click='cardExchangeInfoEdit(3,item)'>接受</span>
					<span @click='cardExchangeInfoEdit(4,item)'>移除</span>
				</view>
				<view class="" v-else>
					<span v-if="item.status==1">已接受</span>
					<span v-if="item.status==3">已拒绝</span>
					<span v-if="item.status==5">已过期</span>
					<span v-if="item.status==7">已拉黑</span>
				</view>
				<view class="flex flex-between">
					<span>来至 {{item.circleName}}</span>
					<span> {{parseTime(item.gmtCreate)}}</span>
				</view>
			</view> -->
		</view>
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo:{},
				status:1,
				cardList:[{cardManagementInfo:{}}],
			};
		},
		onLoad() {
			this.userInfo = uni.getStorageSync("userInfo")
			this.getList()
		},
		methods:{
			getList(){
				uni.showLoading({
					title: '数据加载中'
				})
				this.$request.baseRequest('admin.unimall.cardExchangeInfo', 'list', {
					receiveId:this.userInfo.id,
					status:this.status
				}, failres => {
					console.log('res+++++', failres.errmsg)
					this.$refs.uToast.show({
						type: 'error',
						message: failres.errmsg,
					})
					uni.hideLoading()
				}).then(res => {
					uni.hideLoading()
					this.cardList = res.data.items
				})
			},
			cardExchangeInfoEdit(type,val){
				uni.showLoading({
					title: '数据加载中'
				})
				this.$request.baseRequest('admin.unimall.cardExchangeInfo', 'update', {
					cardExchangeInfo:JSON.stringify(val),
					updateFlag:type
				}, failres => {
					console.log('res+++++', failres.errmsg)
					this.$refs.uToast.show({
						type: 'error',
						message: failres.errmsg,
					})
					uni.hideLoading()
				}).then(res => {
					uni.hideLoading()
					this.$refs.uToast.show({
						type: 'success',
						message: "操作成功！",
					})
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content1 {
		background: #112253;
		padding: 0rpx 20rpx 160rpx 20rpx;
		box-sizing: border-box;
		border-radius: 0px 0px 20rpx 20rpx;
	}
	// .content2 {
	// 	margin-top:-112rpx;
	// 	border: 1px solid #ccc;
	// 	border-radius: 30rpx;
	// 	padding: 40rpx;
	// 	box-sizing: border-box;

	// 	.left {
	// 		width: 30%;

	// 		.top {
				
	// 			margin-bottom: 20rpx;
	// 		}
	// 		.img {
	// 			width: 80%;
	// 		}

	// 		.bottom {
	// 		}
	// 	}

	// 	.right {
	// 		.row1 {
	// 			.line {
	// 				width: 1px;
	// 				height: 20px;
	// 				margin: 0 20rpx;
	// 				background: black;
	// 			}
	// 		}
	// 	}
	// }
	.default{
		color:rgba(255, 255, 255, 0.5);
		font-size:26rpx;
		padding:20rpx;
		position:relative;
	}
	.active{
		color:#fff;
		font-size:32rpx;
	}
	.active:after{
		content:'';
		display:block;
		width:10px;
		height:2px;
		background:#fff;
		position: absolute;
		left: 50%;
		transform: translateX(-50%);
		bottom: 0;
	}
	.content2 {
		// padding:0 20rpx;
		position: relative;
		top: -144rpx;
	
		.style1 {
			display: flex;
			padding: 20rpx 30rpx;
			width: 85%;
			margin-bottom: 90rpx;
	
			.left {
				width: 132rpx;
				height: 132rpx;
				border-radius: 50%;
			}
	
			.right {
				margin-left: 40rpx;
	
				.row1 {
					.name {
						font-size: 38rpx;
						font-weight: bold;
						color: #040000;
						margin-right: 20rpx;
					}
	
					.post {
						font-size: 26rpx;
						font-weight: 500;
						color: #666666;
					}
				}
	
				.row2 {
					font-size: 24rpx;
					font-weight: bold;
					color: #323333;
				}
	
				.row3 {
					margin-top: 30rpx;
					font-size: 24rpx;
					font-weight: 500;
					color: #323333;
	
				}
				.row2,.row4 {
					margin-top: 10rpx;
				}
			}
		}
	
		.style2 {
			padding: 30rpx;
			margin-bottom: 100rpx;
	
			.top {
				.row1 {
					.name {
						font-size: 38rpx;
						font-weight: bold;
						color: #040000;
						margin-right: 20rpx;
					}
	
					.post {
						font-size: 26rpx;
						font-weight: 500;
						color: #666666;
					}
				}
	
				.row2 {
					margin-top: 10rpx;
					font-size: 24rpx;
					font-weight: bold;
					color: #323333;
				}
			}
	
			.bottom {
				margin-top: 48rpx;
	
				.left {
					margin-right: 40rpx;
	
					.row1 {
						.name {
							font-size: 38rpx;
							font-weight: bold;
							color: #040000;
							margin-right: 20rpx;
						}
	
						.post {
							font-size: 26rpx;
							font-weight: 500;
							color: #666666;
						}
					}
	
					.row2 {
						margin-top: 10rpx;
						font-size: 24rpx;
						font-weight: bold;
						color: #323333;
					}
					
				}
	
				.right {
	
					.row1,
					.row2 {
						font-size: 24rpx;
						font-weight: 500;
						color: #323333;
					}
	
					.row2,.row4 {
						margin-top: 10rpx;
					}
				}
			}
	
		}
	
		.card-list-item {
			width: calc(100%);
			// left:-20rpx;
			position: relative;
			border-radius: 30rpx;
			padding: 40rpx;
			box-sizing: border-box;
	
			.car-bottom {
				position: absolute;
				bottom: 63rpx;
				left: 20rpx;
				bottom:24rpx;
				width:94.9%;
				background: url("../../static/imgs/card/bg5.png") no-repeat center;
				background-size: 100% 100%;
				height: 80rpx;
				// width: calc(100% - 40rpx);
				.left {
					// top: -40rpx;
					position: absolute;
					padding: 20rpx 0;
					width: 70vw;
					height: 80rpx;
					box-sizing: border-box;
					display: flex;
					align-items: center;
					justify-content: space-evenly;
					z-index:100;
					left: 0px;
					
					// background-size: 100% 100%;
					overflow-y: hidden;
				}
			}
	
			.left {
				width: 30%;
	
				.top {
	
					margin-bottom: 20rpx;
				}
	
				.img {
					width: 80%;
				}
	
				.bottom {}
			}
	
			.right {
				.row1 {
					.line {
						width: 1px;
						height: 20px;
						margin: 0 20rpx;
						background: black;
					}
				}
			}
		}
	
	}
	.icon-text{
		margin-left: 10px;
		font-size: 24rpx;
		font-weight: 500;
		color: #323333;
	}
	.status-btns{
		margin:10rpx 0 25rpx;
		text-align:right;
	}
	.status-btns span{
		background:#fff;
		border:1px solid rgba(0, 0, 0, 0.20);
		padding:10rpx 30rpx;
		font-size:26rpx;
	}
	.status{
		color:#666;
	}
	.error{
		color:#FF4E4E;
	}
	.success{
		color:#279D2A;
	}
</style>
