<template>
	<u-popup :show="showTask" @close="handleClose" @open="handleOpen" round="32rpx" bgColor="#ffffff" zIndex="10077"
		mode="right">
		<view class="content">
			<view class="option">
				<view class="title-box">服务/折扣</view>
				<view class="list">
					<view v-for="(item,index) in serviceList" :key="index" @click="onSelect(item)"
						:class="activeIndex == item.value?'item active':'item'">{{item.txt}}</view>
				</view>
			</view>
			<view class="option">
				<view class="title-box">
					<text>价格</text>
				</view>
				<view class="list">
					<input class="input" placeholder="最低价" />
					<view class="symbol"></view><input class="input" placeholder="最高价" />
				</view>
			</view>
			<view class="option">
				<view class="title-box">
					<text>品牌</text>
					<view class="expand">
						<text class="txt">展开</text>
						<image class="icon" src="https://cdn.his.cdwjyyh.com/images/arrow_down.png"></image>
					</view>
				</view>
				<view class="list">
					<view v-for="(item,index) in serviceList" :key="index" @click="onSelect(item)"
						:class="activeIndex == item.value?'item active':'item'">{{item.txt}}</view>
				</view>
			</view>
			<view class="btn-group">
				<view class="btn clear">清空选择</view>
				<view class="btn confirm">确定</view>
			</view>

		</view>
	</u-popup>
</template>

<script>
	export default {
		data() {
			return {
				showTask: true,
				activeIndex: 0,
				serviceList: [{
						txt: '顺丰物流',
						value: 0
					}, {
						txt: '顺丰物流',
						value: 1
					}, {
						txt: '顺丰物流',
						value: 2
					}, {
						txt: '顺丰物流',
						value: 3
					}

				]
			}
		},
		mounted() {},
		methods: {
			onSelect(item) {
				console.log("item", item)
				this.activeIndex = item.value
			},
			handleClose() {
				console.log("关闭")
				// 关闭弹窗
			},

			handleOpen() {
				// 打开弹窗
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		height: 100%;
		width: 660rpx;
		background: #FFFFFF;
		display: flex;
		flex-direction: column;
		padding: 192rpx 24rpx 16rpx;
		position: relative;
		box-sizing: border-box;

		.option {
			.title-box {
				height: 80rpx;
				font-weight: 500;
				font-size: 32rpx;
				color: #000000;
				margin-bottom: 16rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;

				.expand {
					display: flex;
					align-items: center;

					.txt {
						font-weight: 400;
						font-size: 24rpx;
						color: #333333;
					}

					.icon {
						width: 24rpx;
						height: 24rpx;
						margin-left: 16rpx;
					}
				}

			}

			.list {
				display: flex;
				flex-wrap: wrap;
				align-items: center;
				margin-bottom: 48rpx;

				.input {
					width: 280rpx;
					height: 72rpx;
					background: #F5F7FA;
					border-radius: 12rpx 12rpx 12rpx 12rpx;
					text-align: center;
				}

				.symbol {
					margin: 0 20rpx;
					width: 12rpx;
					height: 2rpx;
					background: #333333;
					border-radius: 0rpx 0rpx 0rpx 0rpx;
				}

				.item {
					width: 192rpx;
					height: 72rpx;
					background: #F5F7FA;
					border-radius: 12rpx 12rpx 12rpx 12rpx;
					text-align: center;
					line-height: 72rpx;
					font-size: 28rpx;
					color: #333333;
					box-sizing: border-box;
					border: 2rpx solid transparent;
					margin: 0 18rpx 18rpx 0;

					&:nth-child(3n) {
						margin-right: 0;
					}

					&.active {
						background: #E6FFF4;
						border-radius: 12rpx 12rpx 12rpx 12rpx;
						border: 2rpx solid #02B176;
						font-weight: 500;
						color: #02B176;
					}
				}
			}
		}

		.btn-group {
			display: flex;
			justify-content: space-between;
			position: absolute;
			bottom: 16rpx;


			.btn {
				width: 297rpx;
				height: 88rpx;
				border-radius: 16rpx 16rpx 16rpx 16rpx;
				text-align: center;
				font-weight: 500;
				font-size: 32rpx;
				line-height: 88rpx;
			}

			.clear {
				background: #E6FFF4;
				color: #02B176;
				margin-right: 18rpx;
			}

			.confirm {
				background: #02B176;
				color: #FFFFFF;
			}
		}

	}
</style>