<template>
	<view class="share">
		<view class="share-top">
			<image src="../../static/image/machine.png" mode="widthFix"></image>
			<view class="right">
				<view class="no">
					设备编号：41010010001
				</view>
				<view class="no">
					绑定日期：2021-12-12
				</view>
				<view class="no">
					设备状态：正常
				</view>
				<view class="no">
					水位：正常
				</view>
			</view>
		</view>
		<view class="select-time">
			<view class="title">
				时间选择
			</view>
			<view class="time-list">
				<view class="time-item" :class="currentTime==index?'timeActive':''" @click="changeTime(index)" v-for="(item,index) in timeList"
				 :key='index'>
					{{item.time}}分钟
				</view>
				<view class="time-item" :class="currentTime==-1?'timeActive':''" @click="changeTime(-1)">
					自定义
				</view>
			</view>
			<view class="customTime" v-show="isShow">
				<input type="number" value="" placeholder="请输入时间(/分钟)" v-model="customTime" @input="inputCustom()" />
			</view>
		</view>
		<view class="buttom-list">
			<view class="list-item">
				开始
			</view>
			<view class="list-item" style="background-color: #e76953;">
				暂停
			</view>
			<view class="list-item" style="background-color: #01356e;">
				结束
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				timeList: [{
						id: 0,
						time: 30
					},
					{
						id: 1,
						time: 50
					},
					{
						id: 2,
						time: 60
					},
				],
				currentTime: 0,
				isShow: false
			}
		},
		methods: {

			changeTime: function(e) {
				console.log(e)
				if (e == -1) {
					console.log(this.customTime)
					this.currentTime = e
					this.isShow = true
				} else {
					console.log(this.customTime)
					this.isShow = false
					this.currentTime = e

				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.share {
		.share-top {
			display: flex;
			padding: 50upx 30upx;
			background-color: $mine-background-color;

			image {
				flex: 0 0 200upx;
				width: 200upx;
				margin-right: 30upx;
			}

			.right {
				flex: 1;
				font-size: 28upx;
				color: #FFFFFF;

				.no {
					line-height: 40upx;
				}
			}
		}

		.select-time {
			padding: 30upx 0;
			margin-top: 50upx;

			.title {
				padding: 0 30upx;
				font-size: 34upx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #000000;
			}

			.time-list {
				display: flex;

				padding: 0 10upx;
				margin-top: 25upx;

				.time-item {
					flex: 1;
					margin: 0 10upx;
					height: 80upx;
					line-height: 80upx;
					text-align: center;
					font-size: 30upx;
					font-family: PingFang SC;
					font-weight: 500;
					background-color: #FFFFFF;
					border-radius: 37upx;
				}

				.timeActive {
					font-weight: bold;
					background: $mine-background-color;
					font-size: 33upx;
					box-shadow: 0upx 2upx 13upx 0upx rgba(150, 150, 150, 0.35);
					border-radius: 37upx;
					color: #FFFFFF;
				}
			}

			.customTime {
				height: 70upx;
				background-color: #FFFFFF;
				margin: 30upx;

				input {
					height: 70upx;
					padding: 0 30upx;
					line-height: 70upx;
					font-size: 26upx;
				}
			}
		}

		.buttom-list {
			margin-top: 100upx;
			.list-item {
				height: 90upx;
				line-height: 90upx;
				margin: 0 auto;
				border-radius: 50upx;
				text-align: center;
				width: 70%;
				margin-top: 50upx;
				color: #FFFFFF;
				font-size: 30upx;
				background-color: $mine-background-color;
				font-weight: 500;
			}
		}
	}
</style>
