<template>
	<view>
		<view class="cu-form-group solid-top">
			<textarea maxlength="120" v-model="comment"  placeholder="请输入您的评价"/>
			<text class="text-gray font-num-view">{{comment.length}} / 120字</text>
		</view>
		<view @click="save" class="cu-btn lg radius flex  bg-red footer-fixed">
			确认保存
		</view>
	</view>
</template>
<script>
	var app=getApp()
	export default {
		data() {
			return {
				comment:'',
				dataDetail:{}
			}
		},
		onShow() {
			this.dataDetail=app.globalData.dataDetail
		},
		methods: {
			save(){
				let that=this
				if (this.$isEmpty(this.dataDetail)) {
					app.globalData.oneFailHint("系统异常");
					return
				}
				if (this.comment.length<2) {
					this.$u.toast('评价内容过短')
					return
				}
				this.dataDetail.comment=this.comment
				this.dataDetail.estimateStatus=1
				let operation='estateRepair/addEstateRepair'
				app.globalData.postRequest(this.dataDetail, operation, function (res) {
					if (res.data.add_result==true) {
						app.globalData.oneFailHint("评价成功",function(){
							uni.navigateBack({
								delta:1
							})
						});
					}else{
						app.globalData.oneFailHint(res.data.add_result);
					}
				});
			}
		}
	}
</script>

<style lang="scss">
	.cu-form-group {
		textarea {
			height: 8.6em;
		}
		.font-num-view {
		    position: absolute;
		    bottom: 9.09rpx;
		    right: 27.27rpx;	
		}
	}
</style>
