<template>
	<view>
		<u-form :model="form">
			<u-card padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false">
				<view slot="head">
					<view class="u-flex">
						<view style="width: 8rpx;height: 34rpx;background: #0292FD;margin-right:20rpx;"></view>
						选择合作品牌
					</view>
				</view>
				<view slot="body">

					<u-form-item prop="cooperation">
						<view style="margin-right: 10rpx;">
							<u-icon name="order" size="36"></u-icon>
						</view>
						<u-input placeholder="点击选择合作品牌" :disabled="true" @click="show = true;" v-model="form.cooperation"></u-input>
						<view class="" slot="right">
							<u-icon name="arrow-right" color="#666666" size="36"></u-icon>
						</view>
					</u-form-item>
				</view>
			</u-card>
			<u-popup mode="bottom" v-model="show">
				<view class="u-flex u-row-between u-padding-left-40 u-padding-right-40" style="height: 90rpx;" @click="show = false;">
					<view style="padding: 16rpx;font-size:30rpx">
						取消
					</view>
					<view style="padding: 16rpx;color:#0095FF;font-size:30rpx" @click="getCooperation">
						确认
					</view>
				</view>
				<u-line color="#e4e7ed"></u-line>
				<view class="content">
					<scroll-view scroll-y="true" style="height: 300rpx;">
						<view class="u-flex u-row-center">
							<u-checkbox-group :wrap="true" @change="checkboxGroupChange">
								<u-checkbox v-model="item.checked" v-for="(item, index) in list" :key="index" :name="item.name" shape="circle">{{item.name}}</u-checkbox>
							</u-checkbox-group>
						</view>
					</scroll-view>
				</view>
			</u-popup>
			<u-card padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false">
				<view slot="head">
					<view class="u-flex">
						<view style="width: 8rpx;height: 34rpx;background: #0292FD;margin-right:20rpx;"></view>
						已选合作品牌
					</view>
				</view>
				<view slot="body">
					<view class="u-flex u-flex-wrap u-row-around">
						<u-image width="40%" height="100rpx" src="../../static/sailun/upload_preview.png" style="margin:10rpx;"></u-image>
						<u-image width="40%" height="100rpx" src="../../static/sailun/upload_preview.png" style="margin:10rpx;"></u-image>
						<u-image width="40%" height="100rpx" src="../../static/sailun/upload_preview.png" style="margin:10rpx;"></u-image>
						<u-image width="40%" height="100rpx" src="../../static/sailun/upload_preview.png" style="margin:10rpx;"></u-image>
					</view>
				</view>
			</u-card>
			<u-card padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false">
				<view slot="head">
					<view class="u-flex">
						<view style="width: 8rpx;height: 34rpx;background: #0292FD;margin-right:20rpx;"></view>
						赛轮合作品牌签约任务
					</view>
				</view>
				<view slot="body">
					<u-form-item>
						<view style="margin-right: 10rpx;">
							<u-icon name="account" size="36"></u-icon>
						</view>
						<view class="">
							某某代理商
						</view>
					</u-form-item>
					<u-form-item prop="lists">
						<view style="margin-right: 10rpx;">
							<u-icon name="order" size="36"></u-icon>
						</view>
						<u-input placeholder="点击选择签约任务" :disabled="true" @click="show = true;"></u-input>
						<view class="" slot="right">
							<u-icon name="arrow-right" color="#666666" size="36"></u-icon>
						</view>
					</u-form-item>
				</view>
			</u-card>
			<u-form-item prop="protocol" :border-bottom="false">
				<view style="margin:0 30rpx;">
					<u-checkbox-group>
						<u-checkbox v-model="form.protocol">同意《用户协议》及《隐私政策》</u-checkbox>
					</u-checkbox-group>
				</view>
			</u-form-item>
		</u-form>
		<view style="margin:0 30rpx;">
			<u-button @click="nextStep" type="primary" @tap="$u.debounce(submit, 2000,immediate = true)" :loading="loading">确认注册</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				loading: false,
				form: {
					cooperation: '',
					protocol: false
				},
				form2: {},
				list: [{
						name: '第一个选项',
						checked: false,
						disabled: false
					},
					{
						name: '第二个选项',
						checked: false,
						disabled: false
					},
					{
						name: '第三个选项',
						checked: false,
						disabled: false
					},
					{
						name: '第四个选项',
						checked: false,
						disabled: false
					},
					{
						name: '第五个选项',
						checked: false,
						disabled: false
					}
				]
			}
		},
		methods: {
			checkboxGroupChange(e) {
				this.cooperations = e
			},
			getCooperation() {
				if (this.cooperations != null) {
					this.form.cooperation = this.cooperations.toString();
					this.show = false
				} else {
					console.log("至少选择一项")
				}

			},
			submit() {
				this.loading = true
				setTimeout(() => {
					this.$u.route({
						url: 'pages/login/index',
						type:"reLaunch"
					})
					this.loading = false
				}, 2000)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		padding: 24rpx;
		text-align: center;

		.u-checkbox[data-v-54acf820] {
			display: flex;
			justify-content: center;
		}
	}
</style>
