<template>

	<view style="background: #F1F2F5;">
		<RefreshView id="mescrollRef" ref="mescrollRef" :pageBg="F1F2F5" text="招募队员的队伍列表" :useDownScroll="false"
			:useUpScroll="false">

			<view class="top">

			<view style="flex: 1;">
				<sl-filter id="header" ref="slLilter" v-if="menuList.length!=0" :color="fd6d2a" themeColor="#000000"
					:menuList.sync="menuList" @result="result"></sl-filter>
					
			</view>
				<text class="top_text">共10个队伍</text>
			</view>
			<view style="margin-top: 20rpx;">
				<view v-for="(item,index) in list " :key="index">
					<view class="itemLay">
						<view class="itemLay_top">
							<text class="itemLay_top_name">{{item.teamName}}</text>
							<view class="itemLay_top_label">
								<text class="itemLay_top_label_item">{{item.city}}</text>
								<text class="itemLay_top_label_item">{{item.table}}</text>
								<text class="itemLay_top_label_item">{{item.number}}</text>
							</view>

						</view>
						<view class="line"></view>
						<view class="itemLay_list">

							<scroll-view class="itemLay_list_scroll_view" scroll-x="true">
								<view v-for="(memberItem,pos) in item.member" :key="pos"
									class="itemLay_list_scroll_view_for">
									<view class="itemLay_list_scroll_view_item">
										<image :src="memberItem.headImage" class="itemLay_list_scroll_view_item_image"
											mode="scaleToFill">
										</image>
										<text class="itemLay_list_scroll_view_item_text">{{memberItem.name}}</text>

									</view>

								</view>
							</scroll-view>
						</view>

						<view class="itemLay_bom">

							<view class="itemLay_bom_right">

								<text class="itemLay_bom_right3" @click="join(item.sid)">申请加入</text>

							</view>

							<view class="itemLay_bom_notice" v-if="isShow(item.noticeSid)">
								<view class="line"></view>
								<view class="itemLay_bom_notice_content">
									<text class="itemLay_bom_notice_content_text">本队报名了</text>
									<text class="itemLay_bom_notice_content_text2"
										@click="detail(item.noticeSid)">{{item.notice}}</text>
									<text class="itemLay_bom_notice_content_text">，组队成功后即可报名</text>
								</view>

							</view>

						</view>

					</view>
				</view>
			</view>

		</RefreshView>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page: {
					'city': this.ReadPreference("find_city"),
					'adCode': this.ReadPreference("find_city_code").slice(0, -2),
					state: "",
					type: "",
				},
				menuList: [{
						'title': '当前定位城市',
						'key': 'type',
						'reflexTitle': true,
						'defaultSelectedIndex': 0,
						detailList: [{
								'title': this.ReadPreference("find_city"),
								'value': this.ReadPreference("find_city_code").slice(0, -2)
							},
							{
								'title': '选择其他城市',
								'value': '0'
							}
						]
					}, {
						'title': '默认活动类型',
						'key': 'state',
						'reflexTitle': true,
						'defaultSelectedIndex': 0,
						detailList: [{
							'title': '全部活动',
							'value': ""
						}]
					}

				],
				list: [{
						teamName: "我的队伍名称1",
						city: "石家庄1",
						table: "乒乓球1",
						number: "2/5",
						sid: "1516589",
						member: [{
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "阿萨苏打水就激动四季豆i阿萨按时递交四栋i阿萨大四的1",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三2",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三3",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三4",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三5",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三6",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三7",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三8",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三9",
						}],
						applyNumber: "5",
						notice: "梧桐居周赛",
						noticeSid: "",
					}, {
						teamName: "asdsdfg士大夫是非得失的阿大撒大撒的地方dads发的阿风飒飒大大发生的1",
						city: "石家庄1",
						table: "乒乓球1",
						number: "2/5",
						sid: "1516589",
						member: [{
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三1",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三2",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三3",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三4",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三5",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三6",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三7",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三8",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三9",
						}],
						applyNumber: "5",
						notice: "梧桐居周赛",
						noticeSid: "12561651651",
					}, {
						teamName: "我的队伍名称1",
						city: "石家庄1",
						table: "乒乓球1",
						sid: "1516589",
						number: "2/5",
						member: [{
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三1",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三2",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三3",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三4",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三5",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三6",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三7",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三8",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三9",
						}],
						applyNumber: "5",
						notice: "梧桐居周赛",
						noticeSid: "12561651651",
					}, {
						teamName: "我的队伍名称1",
						city: "石家庄1",
						table: "乒乓球1",
						number: "2/5",
						sid: "1516589",
						member: [{
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三1",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三2",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三3",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三4",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三5",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三6",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三7",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三8",
						}, {
							headImage: "https://tse1-mm.cn.bing.net/th/id/OIP-C.n0_p3rYRuofABd3XudbZnAHaEo?w=298&h=186&c=7&r=0&o=5&pid=1.7",
							name: "张三9",
						}],
						applyNumber: "5",
						notice: "梧桐居周赛",
						noticeSid: "12561651651",
					}

				]
			}
		},
		onLoad() {
			let that = this
			that.HTTP({
				url: 'aos/v1/activityManagement/getActivityCreatePageParameter',
				method: 'GET',
				data: {
					"adcode": that.page.adCode
				},
				paramsType: "FORM",
				loading: true
			}).then((res) => {
				console.log("that.menuList[1].detailList", that.menuList[1].detailList);

				let list = [];

				for (var i = 0; i < res.data.listSportCategoryArea.length; i++) {
					list.push({
						title: res.data.listSportCategoryArea[i].sportCategoryName,
						value: res.data.listSportCategoryArea[i].sid
					})
				}
				// 必须用变量去接受
				that.menuList[1].detailList = that.menuList[1].detailList.concat(list)

				console.log("qqq", that.menuList[1].detailList);
			});
		},

		onShow() {

			let backResult = this.OnActivityResult();
			if (backResult != undefined) {
				console.log("结果>" + JSON.stringify(backResult))
				if (!this.IsEmpty(backResult.code)) {
					console.log("结果2>" + backResult.code)
					this.page.adCode = backResult.code
					this.page.city = backResult.city
					this.menuList[0].detailList[0].title = backResult.city
					this.menuList[0].detailList[0].value = backResult.code
					console.log("qqq", this.menuList[0].detailList);
					this.$refs.slLilter.setTitle(this.menuList)
				}
			}
		},
		methods: {
			result(val) {
					console.log("aaa", val);
				
				if (!this.IsEmpty(val.type)) {
					console.log("===>1" + JSON.stringify(this.page))
					if (val.type != "0") {
						this.page.type = val.type;
						this.list = []
					} else {
						console.log("===>2" + JSON.stringify(this.page))
						uni.navigateTo({
							url: "../../pages/city/CitySelectActivity?city=" + this.page.city +
								"&code=" + this.page.adCode
						})
					}
				}

				if (!this.IsEmpty(val.state)) {
					this.page.state = val.state;
					this.list = []
					console.log("this.page.state", this.page.state);
				} else {
					this.page.state = val.state;
					this.list = []
				}


			},
			isShow(sid) {
				if (!this.IsEmpty(sid)) {
					return true
				} else {
					return false
				}
			},
			join(sid) {
				// 申请加入
				
			},
			detail(sid) {
				// 活动详情
				uni.navigateTo({
					url: '../index/DetailActivity?raceSid=' + sid
				})
			},

		}
	}
</script>

<style lang="scss">
	.top {
		display: flex;
		width: 100%;
		flex-direction: row;
		background-color: #fff;
		align-items: center;

		.top_text {
			text-align: end;
			margin-right: 30rpx;
		}
	}

	.line {
		height: 5rpx;
		margin-top: 20rpx;
		background: #eee;
		width: 100%;
	}

	.itemLay {
		background-color: #fff;
		margin-bottom: 24rpx;
		display: flex;
		flex-direction: column;
		padding: 32rpx;

		.itemLay_top {
			display: flex;
			flex-direction: row;

			.itemLay_top_name {
				max-width: 350rpx;
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;
				font-size: 36rpx;
				color: #101010;
			}

			.itemLay_top_label {
				flex: 1;
				display: flex;
				flex-direction: row;

				.itemLay_top_label_item {
					background-color: #F4CE98;
					color: #fff;
					font-size: 24rpx;
					padding: 5rpx 10rpx;
					text-align: center;
					align-items: center;
					margin-left: 24rpx;
				}
			}
		}

		.itemLay_list {

			.itemLay_list_scroll_view {
				width: 100%;
				white-space: nowrap;

				.itemLay_list_scroll_view_for {
					display: inline-block;
					padding-top: 32rpx;
					padding-bottom: 32rpx;

					.itemLay_list_scroll_view_item {
						margin-left: 20rpx;
						margin-right: 20rpx;
						display: flex;
						flex-direction: column;

						.itemLay_list_scroll_view_item_image {
							width: 110rpx;
							height: 110rpx;
							border-radius: 12rpx;
						}

						.itemLay_list_scroll_view_item_text {
							white-space: nowrap;
							overflow: hidden;
							text-overflow: ellipsis;
							max-width: 100rpx;
							margin-top: 15rpx;
							font-size: 24rpx;
							text-align: center;
							color: #4D4A4A;
						}
					}
				}
			}

		}

		.itemLay_bom {
			display: flex;
			flex-direction: column;

			.itemLay_bom_right {
				align-items: center;
				text-align: right;

				.itemLay_bom_right3 {
					font-size: 32rpx;
					color: #E99D42;
					text-decoration-line: underline;
				}
			}

			.itemLay_bom_notice {
				display: flex;
				flex-direction: column;

				.itemLay_bom_notice_content {
					display: flex;
					margin-top: 20rpx;
					align-items: baseline;

					.itemLay_bom_notice_content_text {
						font-size: 28rpx;
						color: #898989;
					}

					.itemLay_bom_notice_content_text2 {
						font-size: 40rpx;
						margin-left: 10rpx;
						margin-right: 10rpx;
						text-decoration-line: underline;
						color: #E99D42;
					}
				}
			}
		}


	}
</style>
