<template>
	<view>
		<view class="contract-title">
			<view class="contract-item" @click.stop="openDrawer">
				<view class="title-iocn">
					<text class="title-iocn-item"></text>
					<text class="title-iocn-item"></text>
					<text class="title-iocn-item"></text>
				</view>
				<!-- <image class="title-iocn" src="../../../static/logo.png" mode="aspectFit"></image> -->
				<text class="title-text">ETH/USDT</text>
			</view>
			<view class="contract-item">
				<text class="iconfont">&#xe625;</text>
			</view>
		</view>
		<view class="lable-title">
			<template v-for="(item , index) in lableList">
				<text @click.stop="lableIndex = index"
					:class="['lable-item', lableIndex === index ? 'active-lable-item' : '' ]">{{ item }}</text>
			</template>
		</view>
		<view class="shortcut">

			<view class="shortcut-type">
				<view class="type-box">
					<text class="type-item active-type-item">市价委托</text>
					<text class="type-item">计划委托</text>
				</view>
				<view class="type-times">
					{{leverName}}{{ multiple }}x
					<text class="iconfont">&#xeb6d;</text>
				</view>
			</view>

			<view class="shortcut-price">
				<view class="price-box">
					<text class="price-lable">价格</text>
					<view class="price-info">
						<text class="price-num">78.66</text>
						<text class="price-tag">USDT</text>
					</view>
				</view>
				<view class="price-box">
					<text class="price-lable">保证金</text>
					<input class="price-inp" type="number">
					<view class="price-info">
						USDT
					</view>
				</view>
			</view>

			<view class="shortcut-usable">
				<view class="usable-info">
					可用：2927.81 USDT
				</view>
				<view class="usable-btn">
					充值
				</view>
			</view>

			<view class="shortcut-btns">
				<view class="shortcut-btn" @click.stop="setSubmitLever()">
					买入/做多
				</view>
				<view class="shortcut-btn">
					卖出/做空
				</view>
			</view>


		</view>
		<lever :leverNum.sync="multiple" :leverName.sync="leverName" />
	</view>
</template>

<script>
	import {
		Api_setSubmitLever
	} from "@/api/index.js"

	import lever from "../sustainability/lever.vue"
	export default {
		name: 'shortcut',
		components: {
			lever
		},
		data() {
			return {
				lableList: [
					'开仓',
					'当前持仓'
				],
				lableIndex: 0,
				
				leverName: '逐仓',
				multiple: 100, // 逐仓倍数
			};
		},
		mounted() {

		},
		methods: {
			setSubmitLever(){}
		}
	}
</script>

<style lang="scss" scoped>
	.contract-title {
		padding: 5rpx $pages-padding 0;
		min-height: 90rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		border-bottom: 1rpx solid $border-color;

		.contract-item {
			display: flex;
			align-items: center;

			.title-iocn {
				width: 28rpx;
				height: 24rpx;
				display: flex;
				flex-direction: column;
				// align-items: center;
				justify-content: space-between;

				.title-iocn-item {
					width: 100%;
					height: 5rpx;
					border-radius: 3rpx;
					background: #111111;

					&:first-child {
						width: 50%;
					}
				}
			}

			.title-text {
				font-size: 34rpx;
				font-family: PingFang SC, PingFang SC-Bold;
				font-weight: 700;
				text-align: left;
				color: #141213;
				line-height: 1.2;
				letter-spacing: 0.74rpx;
				padding-left: 19rpx;
			}

			.title-ratio {
				font-size: 24rpx;
				font-family: PingFang SC, PingFang SC-Regular;
				font-weight: 400;
				color: #808080;
				line-height: 33rpx;
			}

			.ratio-icon {
				width: 31rpx;
				height: 33rpx;
				margin-left: 22rpx;
			}
		}
	}

	// <view class="lable-title">
	// 	<template v-for="(item , index) in lableList">
	// 		<text class="lable-item">{{ item }}</text>
	// 	</template>
	// </view>
	.lable-title {
		padding: 0 $pages-padding;
		width: 100%;
		height: 100rpx;
		border-bottom: 1rpx solid $border-color;
		display: flex;
		align-items: stretch;

		.lable-item {
			font-size: 28rpx;
			display: flex;
			align-items: center;

			&:nth-child(n + 2) {
				margin-left: 60rpx;
			}
		}

		.active-lable-item {
			font-size: 34rpx;
			color: $Theme-Color;
			position: relative;

			&::before {
				content: '';
				position: absolute;
				left: 50%;
				bottom: 0;
				width: 30rpx;
				height: 5rpx;
				background-color: $Theme-Color;
				border-radius: 3rpx;
				transform: translateX(-50%);
			}
		}
	}

	.shortcut {
		padding: 30rpx $pages-padding;

		.shortcut-type {
			width: 100%;
			display: flex;
			align-items: stretch;
			justify-content: space-between;

			.type-box {
				flex: 1;
				display: flex;
				align-items: stretch;
				border-radius: 6rpx;
				overflow: hidden;

				.type-item {
					font-size: 24rpx;
					flex-shrink: 0;
					flex: 1;
					text-align: center;
					display: flex;
					align-items: center;
					justify-content: center;
					border: 1rpx solid $border-color6;
					color: $SizeColor;
				}

				.active-type-item {
					color: #fff;
					background-color: $Theme-Color;
					border: 1rpx solid $Theme-Color;
				}
			}

			.type-times {
				margin-left: 20rpx;
				width: 230rpx;
				height: 50rpx;
				line-height: 50rpx;
				border: 1rpx solid red;
				text-align: center;
				font-size: 26rpx;
				position: relative;
				color: $SizeColor;
				border: 1rpx solid $border-color6;
				border-radius: 6rpx;

				.iconfont {
					position: absolute;
					right: 10rpx;
					top: 50%;
					transform: translateY(-50%);
					font-size: 20rpx;
					color: $Theme-Color;
				}
			}
		}
	}

	.shortcut-price {
		width: 100%;
		padding-top: 60rpx;

		.price-box {
			width: 100%;
			height: 80rpx;
			border-radius: 10rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 0 20rpx;
			background-color: $box-bg;
			font-size: 24rpx;
			color: $SizeColor2;

			.price-lable,
			.price-info {
				flex-shrink: 0;
			}

			.price-info {
				.price-num {
					color: #000;
					padding-right: 20rpx;
				}
			}

			.price-inp {
				flex: 1;
				height: 100%;
				padding: 0 10rpx;
				font-size: 24rpx;
				color: #000;
				text-align: right;
			}

			// <view class="price-box">
			// 	<text class="price-lable">价格</text>
			// 	<input class="price-inp" type="number">
			// 	<view class="price-info">
			// 		USDT
			// 	</view>
			// </view>
		}

		.price-box+.price-box {
			background-color: #fff;
			margin-top: 20rpx;
			border: 1rpx solid $box-bg;
		}
	}

	// <view class="shortcut-usable">
	// 	<view class="usable-info">
	// 		可用：2927.81 USDT
	// 	</view>
	// 	<view class="usable-btn">
	// 		充值
	// 	</view>
	// </view>
	.shortcut-usable {
		width: 100%;
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-size: 24rpx;
		color: $SizeColor2;
		padding: 20rpx 0 40rpx;

		.usable-btn {
			color: $Theme-Color;
		}
	}

	// <view class="shortcut-btns">
	// 	<view class="shortcut-btn">
	// 		买入/做多
	// 	</view>
	// 	<view class="shortcut-btn">
	// 		卖出做空
	// 	</view>
	// </view>
	.shortcut-btns {
		display: flex;
		align-items: center;

		.shortcut-btn {
			flex: 1;
			height: 70rpx;
			line-height: 70rpx;
			text-align: center;
			font-size: 28rpx;
			color: #fff;
			background-color: $Theme-Color;

			&:nth-child(n + 2) {
				margin-left: 30rpx;
				background-color: $Theme-Color2;
			}
		}
	}
</style>