<template>
	<view class="search">
		<u-sticky>
			<view class="search-wrapper">
				<u-search color="#333333" border-color="#E8E8E8" :showAction="true" actionText="搜索" :animation="false"
					v-model="where.keywords" @search="onSearch" @custom="onSearch"
					:actionStyle="actionStyle"></u-search>
			</view>
		</u-sticky>
		<view class="order-total">
			<view class="pay-btn">
				<view class="btn">
					<u-button text="上架" plain size="small" @click="onPay(item.logId)"></u-button>
				</view>
				<view class="btn">
					<u-button text="下架" plain size="small" @click="onPay(item.logId)"></u-button>
				</view>
				<view class="btn">
					<u-button text="删除" plain size="small" @click="onPay(item.logId)"></u-button>
				</view>
				<view class="btn">
					<u-button text="分享" plain size="small" @click="onPay(item.logId)"></u-button>
				</view>
				<!-- <view class="btn" v-if="item.payStatus == 10">
					<u-button text="取消订单" size="small" @click="onRemove(item.logId)"></u-button>
				</view> -->
			</view>
		</view>
		<view class="house">
			<view class="btn">
				<u-radio-group v-model="select">
					<u-radio activeColor="red" label="全选"></u-radio>
				</u-radio-group>
			</view>
			<view class="list">
				<view class="item" @click="$push('sub_pages/house/detail?id=')">
					<view class="badge" @click="onBadge(1)"><u-badge :isDot="true" type="info" :bgColor="bgColor"></u-badge></view>
					<image class="image" src="https://oss-aishangjia.oss-cn-shenzhen.aliyuncs.com/v2_rwr9ba.jpg"></image>
					<view class="info">
						<view class="title">整租·万科云城 2室1厅1卫</view>
						<view class="desc"><text>50.8m²|南</text></view>
						<view class="price">6600元/月</view>
					</view>
				</view>
				<view class="item" @click="$push('sub_pages/house/detail?id=')">
					<image class="image" src="https://oss-aishangjia.oss-cn-shenzhen.aliyuncs.com/v2_rwr9ba.jpg"></image>
					<view class="info">
						<view class="title">整租·万科云城 2室1厅1卫</view>
						<view class="desc"><text>50.8m²|南</text></view>
						<view class="price">6600元/月</view>
					</view>
				</view>
				<view class="item" @click="$push('sub_pages/house/detail?id=')">
					<image class="image" src="https://oss-aishangjia.oss-cn-shenzhen.aliyuncs.com/v2_rwr9ba.jpg"></image>
					<view class="info">
						<view class="title">整租·万科云城 2室1厅1卫</view>
						<view class="desc"><text>50.8m²|南</text></view>
						<view class="price">6600元/月</view>
					</view>
				</view>
				<view class="item" @click="$push('sub_pages/house/detail?id=')">
					<image class="image" src="https://oss-aishangjia.oss-cn-shenzhen.aliyuncs.com/v2_rwr9ba.jpg"></image>
					<view class="info">
						<view class="title">整租·万科云城 2室1厅1卫</view>
						<view class="desc"><text>50.8m²|南</text></view>
						<view class="price">6600元/月</view>
					</view>
				</view>
			</view>
		</view>
		<u-gap></u-gap>
		<view class="float">
			<view class="release">
				<u-button text="添加房源" type="primary" shape="circle" @click="$push('sub_pages/house/add')"></u-button>
			</view>
		</view>
	</view>
</template>

<script>
	import store from '@/store'
	import {
		fileUrl
	} from '@/config.js'
	import {
		dateFormat
	} from '@/utils/util.js'
	import * as UserApi from '@/api/user'
	import * as UserProfileApi from '@/api/love-user-profile.js'
	import * as UploadApi from '@/api/upload'
	import * as DictApi from '@/api/dict.js'

	export default {
		data() {
			return {
				select: [],
				bgColor: '#ffffff'
			}
		},

		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad() {
			// this.getDict()
		},

		// 必须要在onReady生命周期，因为onLoad生命周期组件可能尚未创建完毕
		onReady() {
			// this.$refs.uForm.setRules(this.rules)
			// 微信小程序需要用此写法
			// this.$refs.datetimePicker.setFormatter(this.formatter)
		},

		methods: {

			onSearch() {
				this.$push('/sub_pages/member/member', this.where)
			},
			onBadge(id){
				this.bgColor = '#ff0000'
			}
		}
	}
</script>

<style>
	page {
		background: #f7f8fa;
	}
</style>
<style lang="scss" scoped>
	.container {}


	.search-wrapper {
		display: flex;
		height: 64rpx;
		padding: 20rpx;
		background-color: #FFFFFF;
	}

	// 搜索输入框
	.search-input {
		width: 80%;
		background: #fff;
		height: 72rpx;
		line-height: 72rpx;
		border-radius: 10rpx 0 0 10rpx;
		box-sizing: border-box;
		overflow: hidden;

		.search-input-wrapper {
			display: flex;

			.left {
				display: flex;
				width: 60rpx;
				justify-content: center;
				align-items: center;

				.search-icon {
					display: block;
					color: #b4b4b4;
					font-size: 28rpx;
				}

			}

			.right {
				flex: 1;

				input {
					font-size: 28rpx;
					height: 72rpx;
					line-height: 72rpx;
					display: flex;
					align-items: center;

					.input-placeholder {
						color: #aba9a9;
					}
				}

			}
		}
	}

	// 搜索按钮
	.search-button {
		width: 20%;
		box-sizing: border-box;

		.button {
			height: 64rpx;
			font-size: 28rpx;
			border-radius: 0 10rpx 10rpx 0;
			background: $main-bg;
			color: $main-text;
			display: flex;
			justify-content: center;
			align-items: center;
		}
	}
	
	// 订单合计
	.order-total {
		margin: 10rpx auto;
		font-size: 26rpx;
		vertical-align: bottom;
		text-align: right;
		height: 50rpx;
		padding-top: 10rpx;
		display: flex;
		justify-content: center;
		
		.pay-btn{
			display: flex;
			.btn{
				margin-right: 16rpx;
			}
		}
		.total-price{
			display: flex;
			align-items: center;
		}
	
		.unit {
			margin-left: 8rpx;
			margin-right: -2rpx;
			font-size: 26rpx;
		}
	
		.money {
			font-size: 28rpx;
			color: #ff0000;
		}
	}
	.house{
		margin: 30rpx auto;
		width: 680rpx;
		.btn{
			width: 150rpx;
			margin: 40rpx 0;
		}
		.list{
			width: 680rpx;
			margin: auto;
			.item{
				border-radius: 30rpx 30rpx 0 0;
				box-shadow: 0 3rpx 10rpx 0px #999999;
				background-color: #FFFFFF;
				margin: 50rpx auto;
				position: relative;
				.badge{
					position: absolute;
					left: 30rpx;
					top: 30rpx;
				}
				.image{
					width: 680rpx;
					height: 360rpx;
					border-radius: 30rpx 30rpx 0 0;
				}
				.info{
					padding: 20rpx 20rpx;
					display: flex;
					flex-direction: column;
					.title{
						font-size: 40rpx;
					}
					.desc{
						color: #999999;
						font-size: 28rpx;
					}
					.price{
						color: #ff0000;
						font-size: 30rpx;
					}
				}
			}
		}
	}
	.float{
		width: 750rpx;
		display: flex;
		justify-content: center;
		position: fixed;
		bottom: 100rpx;
		.release{
			width: 500rpx;
			opacity: 0.9;
		}
	}
</style>