<template>
	<view class="con-body">
		<view class="con-bg">
			<!-- 头部 -->
			<customHeader ref="customHeaderRef" :title="'驳回原因'" :leftFlag="true" :rightFlag="false"></customHeader>

			<!-- 高度来避免头部遮挡 -->
			<view class="top-height" :style="{ paddingTop: navBarPaddingTop + 'px' }"></view>

			<view class="inner-box">
				<view class="cu-form-group">
					<textarea v-model="rejectReason" placeholder="请输入驳回原因" name="input"></textarea>
				</view>
				<view class="btn-box">
					<button type="primary" @click="submitBack">确定驳回</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
import customHeader from '@/components/customHeader.vue'
import { onMounted, ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { getNavBarPaddingTop } from '@/utils/system.js'
import { getRejectReason } from '../../../../api/crm/activity/activity';

// 获取导航栏高度用于内容区域padding
const navBarPaddingTop = ref(0);
onMounted(() => {
	navBarPaddingTop.value = getNavBarPaddingTop() * 2;
})

let visistId = ref()
onLoad(option => {
	visistId.value = option.visistId
})

let rejectReason = ref();
//确定驳回
function submitBack() {
	if (rejectReason.value==null) {
		uni.showToast({
			title: "驳回原因不能为空！",
			icon: 'none',
		});
		return
	}
	let rejectForm = {
		visistId:visistId.value,
		rejectReason: rejectReason.value
	}
	getRejectReason(rejectForm).then(
		res => {
			if (res.code == 200) {
				uni.showToast({
					title: '提交成功',
					duration: 2000
				});
				uni.navigateBack({
					delta: 2
				})
			} else {
				uni.showToast({
					title: res.msg,
					icon: 'none',
				});
			}
		},
		rej => { }
	);
}

</script>

<style lang="scss" scoped>
.con-bg {
	background: white;
}

/* Container for the checkbox group */
.checkbox-group.block {
	width: 100%;
}

/* Each item row */
.itemClass {
	display: flex;
	align-items: center;
	padding: 10rpx 0;
	margin-left: 15rpx;
	border-bottom: 1px solid #eee;
	/* optional divider */
}

/* Checkbox styling */
.checkBoxClass {
	margin-right: 12rpx;
}

/* Content container */
.clientClass {
	flex: 1;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	font-size: 36rpx;
	color: #333;
	/* default text color */
}

/* Blue username text */
.blue-text {
	/* or any blue you prefer */
	margin-right: 5rpx;
}
</style>
