<template>
	<u-popup :show="show" @close="handleClose">
		<view class="popup-content">
			<view class="custom-pop-head">
				<view class="left" @click="handleClose">取消</view>
				<view class="title"></view>
				<view class="right" @click="handleSubmit">确认</view>
			</view>
			<view class="custom-pop-body">
				<view class="form-item">
					<u--textarea v-model="formModel.reason" placeholder="请输入自定义名称"></u--textarea>
				</view>
			</view>
		</view>
	</u-popup>
</template>

<script>
	export default {
		name: 'approve-popup',
		data() {
			return {
				show: false,
				formModel: {
					approvalStatus: 1,
					reason: ''
				},
				radioList: [{
						name: 1,
						label: '审批通过'
					},
					{
						name: 0,
						label: '审批驳回'
					},
				]
			}
		},
		methods: {
			open() {
				this.show = true
				this.formModel.reason = ''
			},
			handleChange(event) {
				if (event === 0) {
					this.formModel.reason = ''
				} else {
					this.formModel.reason = ''
				}
			},
			handleClose() {
				this.formModel.approvalStatus = 1
				this.formModel.reason = ''
				this.show = false
			},
			handleSubmit() {
				if (this.formModel.reason) {
					this.$emit('approive-submit', this.formModel)
					this.handleClose()
				} else {
					this.$.toast('请输入自定义名称')
				}
			}
		}
	}
</script>

<style lang="scss">
	.popup-content {
		.custom-pop-head {
			width: 100%;
			padding: 20rpx;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			justify-content: space-between;
			border-bottom: 1px solid #e6e6e6;
			margin-bottom: 20rpx;

			.left {
				color: #666666;
			}

			.title {
				font-size: 16px;
			}

			.right {
				color: #2663bf;
			}
		}

		.custom-pop-body {
			padding: 12px;
		}

		.form-item {
			margin-bottom: 12px;
		}

		.form-item-label {
			margin-bottom: 8px;
		}
	}
</style>