<template>
	<view class="center">
		<view class="row1">
			<u--image class="flex-end" :showLoading="true" src="../../static/images/mine/saoma.png" width="30px"
				height="30px" @click="addFleet"></u--image>
		</view>
		<view>
			<u-search placeholder="日照香炉生紫烟" v-model="keyword"></u-search>
		</view>
		<view class="" @click="inTeam">
			入队申请
		</view>
		<view class="" @click="fleetInvitation">
			车队邀请
		</view>
		<view v-for="(item,index) in formData" class="flex fleet" @click="fleetInfo(item)">
			<view class="fleet_img">
				<u--image class="flex-end" :showLoading="true" :src="item.coverUrl" width="60px" height="60px" shape='circle'>
			</u--image>
			</view>
			
			<view class="fleet_right">
				<view class="flex">
					<view class="fleet_name">
						{{item.fleetName}}({{item.fleetMemberNum}})
					</view>
					<view class="fleet_invite" v-if="item.captainFlag == 1">{{item.fleetStatus}}</view>
				</view>
				<view>
					{{item.province}}{{item.city}}{{item.area}}
				</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				formData:[]
			}
		},
		onShow() {

		},
		onLoad() {
			this.commonId = uni.getStorageSync("firstAuthentication").commonId
			this.getList()
		},
		methods: {
			getList() {
				this.$request.baseRequest('get', '/fleetMemberInfo/selectMyFleetInfo', {
						commonId: this.commonId,
						pageSize: 10,
						currentPage: 1
					}).then(res => {
						// if (res.code == 200) {
						// 	this.$refs.uToast.show({
						// 		type: 'success',
						// 		message: "车队添加成功！",
						// 		complete() {
						// 			uni.$u.route("pages/riders/myTeam")
						// 		}
						// 	})
						// }
						this.formData = res.data.records
					})
					.catch(res => {
						uni.$u.toast(res.message);
					});
			},
			fleetInfo(item){
				this.$u.route("/pages/riders/fleetSee",{
					id:item.fleetId
				})
			},
			inTeam() {
				this.$u.route("/pages/riders/inTeam")
			},
			fleetInvitation() {
				this.$u.route("/pages/riders/fleetInvitation")
			},
			addFleet() {
				this.$u.route("/pages/riders/addFleet")
			}

		}
	}
</script>

<style lang="scss" scoped>
	.center {
		padding: 30rpx;

		.row1 {
			display: flex;
			justify-content: flex-end;
			margin-top: 46rpx;
			margin: 40rpx 30rpx 0 0;
		}
	}
	.fleet{
		margin: 30rpx 0;
		.fleet_img{
			width: 20%;
		}
		.fleet_right{
			width: 80%;
			.fleet_name{
				width: 80%;
			}
			.fleet_invite{
				background-color: #5878e8;
				color: #fff;
			}
		}
	}
</style>
