<template>
	<view class="container safe-area-inset-bottom">
		<MessageNotification />

		<view class="score">
			<u-rate :count="count" v-model="value" active-color="#FB8C00" inactive-color="#E2E8F0" size="40">
			</u-rate>
			<text>点击评分</text>
		</view>

		<view class="items">
			<u-field v-model="txt" :focus="true" label-width="0" placeholder="评价一下吧" placeholder-style="color:#94A3B8"
				type="textarea" @input="sumfontnum" :auto-height="false">
			</u-field>
			<view class="words">
				还可以描述
				<text id="txtnum">{{fontNum}}</text>个字(最少15个字)
			</view>
		</view>

		<view class="footer" @click="next">
			<text>确认</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				count: 5,
				value: 0,
				txt: "",
				fontNum: 140,
				su_id: "", // 医生id
				u_id: "", // 患者id
				id: "",

			}
		},
		onLoad(e) {
			// // console.log(e, 'id');
			// this.su_id = e.sid,
			// 	this.u_id = e.uid,
			// 	this.id = e.id
		},
		methods: {

			// 字数
			sumfontnum(e) {
				this.fontNum = 140 - e.length
			},

			next() {
				// getComment({
				// 	method: "post",
				// 	data: {
				// 		su_id: this.su_id,
				// 		u_id: this.u_id,
				// 		score: this.value,
				// 		comment: this.txt,
				// 		order_id: this.id
				// 	}
				// }).then((res) => {
				// 	// console.log(res, 'in');
				// 	if (res.data.errcode == 0) {

				// 		uni.showToast({
				// 			title: "评价成功",
				// 			duration: 1500,
				// 			mask: false,
				// 			icon: 'success'
				// 		})
				
				// this.$refs.uToast.show({
				// 	title: res.data.msg,
				// 	type: 'default',
				// 	icon: false
				// })

				// 		setTimeout(() => {
				// 			uni.navigateBack({
				// 				delta: 1
				// 			});
				// 		}, 1000)

				// 		this.value = 0
				// 		this.txt = ''
				// 	}
				// })
			}
		},
		mounted() {

		}
	}
</script>

<style lang="scss" scoped>
	.container {


		.score {
			width: 710rpx;
			margin: 20rpx auto;
			padding: 20rpx 30rpx;
			display: flex;
			align-items: center;

			text {
				height: 50rpx;
				font-size: 36rpx;
				font-family: PingFang SC-Semibold, PingFang SC;
				font-weight: 600;
				color: #aaa;
				line-height: 42rpx;
				margin-left: 66rpx;
			}
		}



		.items {
			width: 686rpx;
			height: 400rpx;
			background: #F8FAFC;
			border-radius: 8rpx;
			margin: 32rpx;
			position: relative;

			.words {
				position: absolute;
				right: 30rpx;
				bottom: 20rpx;
				font-size: 28rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				color: #A7ABB0;

				text {
					margin-left: 2rpx;
					color: #F44336;
				}
			}
		}

		.footer {
			width: 750rpx;
			height: 110rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			border: 2rpx solid #F2F3F5;
			position: fixed;
			left: 0;
			bottom: env(safe-area-inset-bottom);

			text {
				display: flex;
				align-items: center;
				justify-content: center;
				width: 686rpx;
				height: 86rpx;
				background: #536DFE;
				border-radius: 64rpx;
				font-size: 32rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
			}
		}

	}
</style>
