<template>
	<view class="page">
		<view class="evalContent">
			<view class="item">
				<view class="main-left cross-center title">
					整体评价
				</view>
				<textarea class="evalClass" v-model="content" auto-height placeholder-class="evalphlVal"  maxlength="200" placeholder="请写下您想咨询的问题或投诉建议，以便更好的为您解决。" />
			</view>
		</view>
		<view class="evalContent">
			<view class="item">
				<view class="main-left cross-center title">
					上传图片(选填)
				</view>
			</view>
		</view>

		<view class='uploddimg'>
			<app-upload-image  @imageEvent='imageEvent' :count="3" :maxNum='3'></app-upload-image>
		</view>
		
		<button class="tij" @click="submit">提交</button>
	</view>
</template>

<script>
	import AppUploadImage from "@/components/basic-component/app-upload-image/app-upload-image.vue";
	export default {
		components: {
			'app-upload-image': AppUploadImage,
		},
		data() {
			return {
				content:'',
				imgs:[],
				setTimer:'',
			};
		},
		methods:{
			submit(){
				if(this.content===''){
					uni.showToast({
						title:'请填写评价内容',
						icon:'none'
					})
					return
				}
				this.$request({
					url:this.$api.user.suggestion,
					data:{
						content:this.content,
						imgs:this.imgs
					},
					method:'post'
				}).then(res=>{
					if(res.code===0){
						uni.showToast({
							title:'提交成功',
							success: () => {
								this.setTimer=setTimeout(()=>{
									uni.navigateBack()
								},2000)	
							}
						})
					}
				})
			},
			// 上传图片
			imageEvent(e) {
				this.imgs = e.imageList;
			},
		},
		onHide() {
			clearTimeout(this.setTimer)
		}
	}
</script>

<style lang="scss" scoped>
	.page{
		min-height: 100vh;
		background-color: #fff;
	}
	.tij{
		width: 678rpx;
		height: 90rpx;
		background: #A18353;
		border-radius: 6rpx;
		font-size: 32rpx;
		font-weight: bold;
		color: #FFFFFF;
	}
	.uploddimg{
		// width: 187rpx;
		// height: 126rpx;
		// background: #F4F4F4;
		opacity: 0.8;
		border-radius: 8rpx;
		margin: 56rpx 36rpx;
		padding-top: 31rpx;
		// image{
		// 	width: 48rpx;
		// 	height: 38rpx;
		// 	display: block;
		// 	margin: 0 auto 14rpx;
		// }
		// .text{
		// 	text-align: center;
		// 	font-size: 20rpx;
		// 	font-weight: 500;
		// 	color: #666666;
		// }
	}
	.evalContent{
		background-color: #fff;
		margin-top: 16rpx;
		.evalClass{
			width: 678rpx;
			min-height: 171rpx;
			background: #F8F8F8;
			border-radius: 6rpx;
			margin: 24rpx auto 0;
			padding: 10rpx;
		}
		/deep/.evalphlVal{
			font-size: 28rpx;
			font-weight: 500;
			color: #999999;
			padding: 33rpx 31rpx;
		}
		.item{
			padding: 40rpx 36rpx 0;
		.title{
			font-size: 30rpx;
			font-weight: bold;
			color: #222222;
		}
		.icon{
			width: 32rpx;
			height: 32rpx;
			margin-right: 11rpx;
		}}
	}
	.evaObj{
		padding: 37rpx 37rpx 0;
		background-color: #fff;
		image{
			width: 111rpx;height: 110rpx;
			margin-right: 24rpx;
		}
		.title{
			font-size: 26rpx;
			
			font-weight: 500;
			color: #666666;
		}
		.price{
			font-size: 24rpx;
			font-weight: 500;
			color: #222222;
		}
		.num{
			font-size: 22rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #222222;
		}
	}
</style>
