<template>
	<view class="layout">
		<view class="assessHead">
			<span style="padding-right: 10upx;">评价</span>
			<van-rate
			  :value="valueNumber"
			  :size="20"
			  void-color="#eee"
			  void-icon="star"
			  color="#ee0a24"
			  @change="changestar"
			/>
		</view>
		 <TextArea :tips="tips" @submitValue="submitValue"/>	
		<view>
			<view>添加图片(最多3张)</view>
			<uploadImage @getImg="getImg" />	
				
		</view>
		<view class="submitRemin" @click="submitRemin">提交</view>
	</view>
</template>

<script>
	import TextArea from '@/component/textarea.vue'
	import uploadImage from '@/component/uploadImage.vue'
	export default {
		components: {
			TextArea,
			uploadImage
		},
		data() {
			return{
				order_id:'',
				valueNumber: 0,
				imageList:'',
				size: 25,
				goodComment:'',
				tips: '五星好评超过20个字就有机会获得积分'
			}
		},
		onUnload() {
			   
		},
		onLoad(e) {
			this.order_id = e.order_id;
			
		},
		methods: {
			changestar(e) {
				this.valueNumber = e.detail;
			},
			getImg(e) {
				this.imageList = e.join(',');
			},
			submitValue(e) {
				this.goodComment = e.detail.value;
			},
			submitRemin() {
				if(this.valueNumber == 0) {
					this.$msg("请完成星级评价");
					return;
					
				}else if(this.goodComment == '') {
					this.$msg("请填写反馈内容");
					return;
				}else {
					this.request({
						url: '/v2/order/evaluate',
						method: 'post',
						data: {
							order_id: this.order_id,
							score:　this.valueNumber,
							content:　this.goodComment,
							img_list:　this.imageList
						},
							
						success: (res) => {
							uni.$emit('finshesitmate');
							setTimeout(()=> {
								uni.navigateBack()
							}, 2000)
						}
					})
				}
			}
			
		}
	}
</script>

<style lang="scss">
	.layout {
		padding: 0 32upx;
		.assessHead {
			padding: 20upx 0;
		}
		.deepHeight {
			height: 108upx;
			width: 108upx;
		}
	}
</style>
