<template>
	<view class="container">
		<view class="form-box">
			<view class="item">
				<view class="label">价格</view>
				<view class="input">
					<u-input :clearable="false" type="text" input-align="right" v-model="form.price" placeholder="请输价格"></u-input>
				</view>
			</view>
			<view class="last-item">
				<view class="label">申请理由</view>
					<u-input style="flex:1" input-align="right"  :custom-style="customStyle" v-model="form.mark" :height="60" :auto-height="true" type="textarea" :clearable="false"  placeholder="请输入申请理由"></u-input>
			</view>
		</view>
		<view class="submit-btn" @click="submit">提交</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				form: {
					price: '',
					mark: ''//备注
				},
				customStyle:{
					maxHeight:'200rpx',
					padding: '20rpx',
					fontSize: '30rpx',
					borderBottom:'1px solid #e0e0e0'
				},
				roomId: ''
			};
		},
		onLoad(options) {
			this.roomId = options.id;
		},
		onShow() {
		
		},
		methods: {
			submit() {
				if(this.flag) return;
				this.flag = true;
				if(this.form.price==''){
					uni.showToast({
						title: '请输入价格',
						icon: 'none'
					})
					return ;
				}
					if(this.form.mark==''){
					uni.showToast({
						title: '请输入申请理由',
						icon: 'none'
					})
					return ;
				}
				let body={
					"price": +this.form.price,
					"roomId": +this.roomId,
					"remark": this.form.mark
				}
				this.$u.api.appChangePriceapply({body:body}).then((res)=>{
					// console.log(res)
					this.flag = false;
					if(res.ErrNo=='0000'){
						uni.showToast({
							title: res.ErrMsg,
							icon: 'none'
						})
						setTimeout(function() {
							wx.navigateBack()
						}, 1000);
					}
				})
			}
		},
	};
</script>

<style lang="scss" scoped>
.container {
	width: 750rpx;
	min-height: 100vh;
	background: #F8F8F8;
	padding-top: 20rpx;
	.form-box{
		background: #fff;
		padding: 0 30rpx;
		.item{
			height: 102rpx;
			font-size: 30rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			line-height: 102rpx;
			color: #333333;
			border-bottom: 1px solid #e0e0e0;
			display: flex;
			align-items: center;
			justify-content: space-between;
			.label{
				width: 120rpx;
				margin-right: 20rpx;
			}
			.input{
				width: 380rpx;
				display: flex;
				align-items: center;
				justify-content: flex-end;
				.path{
					width: 14rpx;
					height: 30rpx;
					margin-left: 20rpx;
				}
				.calendar{
					width: 40rpx;
					height: 40rpx;
					margin-left: 20rpx;
				}

			}
		}
		.last-item{
			display: flex;
			.label{
				line-height: 102rpx;
				font-size: 30rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #333333;
				margin-right: 150rpx;
			}

		}
	}
	.submit-btn{
		width: 690rpx;
		height: 88rpx;
		line-height: 88rpx;
		text-align: center;
		background: #FF6D25;
		border-radius: 12rpx;
		margin-left: 30rpx;
		font-size: 32rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		position: fixed;
		bottom: 90rpx;
	}
}
</style>
