<template>
	<view class="cardList">
		<view class="container">
			<view class="content">
				<view class="left">
					<image :src="imgArr[0]"></image>
				</view>
				<view class="right">
					<view class="detailed">
						<view class="title">{{item.title}}</view>
						<view class="date">{{item.startTime}}</view>
						<view class="address">
							<view class="img-box">
								<image src="@/static/image/cart/addressIcon.png" mode=""></image>
							</view>
							<view>{{item.address}}</view>
						</view>
					</view>
					<view class="tips-box">
						<view class="tips-box-item" v-for="(val,i) in iconTextArr" :key="i">{{val}}</view>
					</view>
				</view>
			</view>
			<view class="bottom-box">
				<view class="bottom-box-l">
					<uv-avatar-group :urls="urls" keyName="headImage" size="45rpx" gap="0.1"></uv-avatar-group>
					<view class="num">{{item.num}}人参加</view>
				</view>
				<view class="bottom-box-r" @click="toZhaomu(item)">
					参与招募
				</view>
			</view>
			<view class="tabs-box" :class="item == 1? 'bzcx-item' : 'ycx-item'">{{item == 1? '保证成行' : '已成行'}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			item: {
				type: Object,
				default: ()=>{}
			},
		},
		data() {
			return {
				iconTextArr:[],
				imgArr:[],
				urls: [
					'https://cdn.uviewui.com/uview/album/1.jpg',
					'https://cdn.uviewui.com/uview/album/2.jpg',
					'https://cdn.uviewui.com/uview/album/3.jpg',
				]
			};
		},
		watch:{
			item:{
				handler(val){
					this.iconTextArr = val.iconText.split("，");
					this.imgArr = val.image.split(",")
					this.urls = val.popularizeRecruitLogList;
				},
				immediate:true
			}
		},
		mounted() {
		},
		methods: {
			skip(val) {
				uni.navigateTo({
					url: '/pages_order/orderDetails'
				})
			},
			toZhaomu(item) {
				let params = {
					recruitId:item.id,
				}
				this.$api('shopUserAuth',params,res=>{
					if(res.code == 200) {
						this.$Toast('参与成功')
					}
				})
			}
		}
	};
</script>

<style scoped lang="scss">
	.cardList {
		.container {
			margin-bottom: 30rpx;
			border-radius: 20rpx;
			background: #1B1713;
			position: relative;

			.content {
				display: flex;
				padding: 24rpx 35rpx;
				border-bottom: 1px solid #2A2A2A;

				.left {
					image {
						width: 228rpx;
						height: 228rpx;
						border-radius: 20rpx;
					}
				}

				.right {
					display: flex;
					flex-direction: column;
					justify-content: space-between;
					flex: 1;
					margin-left: 23rpx;
					color: $uni-text-color-grey;
					font-size: 24rpx;

					.detailed {
						.title {
							font-size: 32rpx;
							color: #fff;
							padding-top: 11rpx;
						}

						.date {
							padding: 25rpx 0 19rpx;
							display: flex;
							align-items: center;

							&::before {
								content: '';
								display: block;
								background: url('@/static/image/cart/timeIcon.png') no-repeat;
								background-size: 100% 100%;
								width: 24rpx;
								height: 24rpx;
								margin-right: 10rpx;
							}
						}

						.address {
							display: flex;
							margin-bottom: 10rpx;
							.img-box {
								width: 22rpx;
								height: 26rpx;
								margin-right: 10rpx;
								flex-shrink: 0;
								image {
									width: 100%;
									height: 100%;
								}
							}
							
						}
					}

					.tips-box {
						display: flex;
						align-items: center;
						flex-wrap: wrap;
						.tips-box-item {
							padding: 0 24rpx;
							height: 38rpx;
							line-height: 38rpx;
							background: #282421;
							border-radius: 7rpx;
							font-size: 20rpx;
							color: #999999;
							margin-right: 14rpx;
							margin-bottom: 5px;
							&:last-child {
								margin-right: 0;
							}
						}
						
						
					}
				}
			}

			.bottom-box {
				display: flex;
				align-items: center;
				justify-content: space-between;
				height: 104rpx;
				padding: 0 21rpx;
				&-l {
					display: flex;
					align-items: center;
					.num {
						font-weight: 500;
						font-size: 25rpx;
						color: #999999;
						margin-left: 20rpx;
					}
				}
				&-r {
					width: 180rpx;
					height: 53rpx;
					background: url('@/static/image/member/canyu-bg.png') no-repeat;
					background-size: 100% 100%;
					font-weight: 500;
					font-size: 23rpx;
					color: #FFFFFF;
					text-align: center;
					line-height: 53rpx;
				}
			}
		
			.tabs-box {
				position: absolute;
				top: 0;
				right: 0;
				width: 117rpx;
				height: 40rpx;
				font-weight: 500;
				font-size: 21rpx;
				text-align: center;
				line-height: 40rpx;
			}
			.bzcx-item {
				background: url('@/static/image/member/bzcx-bg.png') no-repeat;
				background-size: 100% 100%;
				color: #FF9000;
			}
			.ycx-item {
				background: url('@/static/image/member/ycx-bg.png') no-repeat;
				background-size: 100% 100%;
				color: #FF3B47;
			}
		}
	}

</style>