<template>
		<u-popup :show="showTag" @close="showTag=false"  mode="center" round="20" style="width: 80%;z-index: 888;" closeable>
			<view class="bg-white ui-border-radius-20 ui-p" style="width: 650rpx;box-sizing: border-box;">
				<h4 class="ui-mt30">{{ tagInfo.parentTab.tab_name }} - {{ tagInfo.studentTab.tab_name }}</h4>
				<view class="ui-mt30 ui-flex ui-flex-align-center" >
					<span class="ui-flex ui-flex-align-center">
						<span class="f32 ui-mr20">分数</span>
						<u-number-box :disabledInput="true" @change="changeScore" :value="score" :min="tagInfo.type==1 ? 1 : '-5'" :max="tagInfo.type==1 ? 5 : '-1'"></u-number-box>
					</span>
				</view>
				<view class="ui-mt30">
					<u-radio-group 
					    v-model="tagInfo.type"
					    placement="row">
						<u-radio activeColor="#05cca1" disabled label="好评" :name="1"></u-radio>
						<u-radio activeColor="#05cca1" disabled label="差评" :name="2" style="margin-left: 40rpx;"></u-radio>
					</u-radio-group>
				</view>
				<view class="ui-mt30 ui-flex ui-flex-column ui-flex-center ui-flex-align-center">
					<u-button @click="queding()" style="width: 35%;" type="primary" color="#05cca1" size="small" :plain="true" text="确定修改"></u-button>
					<view class="text-center ui-mt20" @click="querenshanchu">
						<u--text text="删除" style="text-decoration: underline;" type="info"></u--text>
					</view>
				</view>
			</view>
		</u-popup>
</template>

<script>
	import { shanchubiaoqianByTeacherId,laoshixiugaibiaoqian,laoshiXiugaiXueshengBiaoqianFenshu,laoshiShanchuXueshengBiaoqian } from "@/common/api/tab.js"
	export default {
		data() {
			return {
				showTag : false,
				tagInfo : {
					parentTab : {},
					studentTab : {}
				},
				score : '',
			}
		},
		methods: {
			changeScore(val){
				this.score=val.value
			},
			open(){
				this.showTag=true
			},
			change(val){
			
			},
			queding(){
				this.$api.sendRequest({
					url: laoshiXiugaiXueshengBiaoqianFenshu,
					data : {
						tab_log_id : this.tagInfo.id,
						teacher_id : this.$store.state.teacher_id,
						score : this.score
					},
					method : 'post',
					success: res => {
						uni.showToast({
							title: '修改成功',
							icon: "none"
						})
						this.showTag=false
						this.tagInfo.score=this.score
					},
				})
			},
			querenshanchu(){
				uni.showModal({
					title: '提示',
					content: '确定删除吗',
					confirmColor : '#05cca1',
					success:  (res)=> {
						if (res.confirm) {
							this.$api.sendRequest({
								url: laoshiShanchuXueshengBiaoqian,
								data : {
									tab_log_id : this.tagInfo.id,
									teacher_id : this.$store.state.teacher_id
								},
								method : 'post',
								success: res => {
									uni.showToast({
										title: '删除成功',
										icon: "none"
									})
									this.showTag=false
									this.$emit("del",)
								},
							})
						}
					}
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	
	/deep/.uni-data-tree-input {
		display: none;
	}

	.edit-tag {
	}

	.edit-tag-item-btn {
		background: rgba(5, 204, 161, 0.10);
		border-radius: 14.33px;
		padding: 4rpx 20rpx;
		width: fit-content;
	}
	.edit-tag-item {
		background: rgba(5, 204, 161, 0.10);
		border-radius: 14.33px;
		padding: 4rpx 20rpx;
		margin-right: 32rpx;
		margin-bottom: 32rpx;
		position: relative;
		.edit-tag-item-icon {
			position: absolute;
			width: 40rpx;
			border-radius: 50%;
			height: 40rpx;
			text-align: center;
			line-height: 40rpx;
			background-color: rgba(66, 185, 131, 1);
			right: -20rpx;
			top: -20rpx;
		}
	}

	.edit-tag-item-add {}
</style>