<template>
    <view v-if="show" class="confirm-dialog-overlay" @click="handleCancel">
        <view class="confirm-dialog-container" @click.stop>
			<view class="confirm-dialog-content">
				<image class="apply_success_icon" src="/static/images/comm/apply_success_icon.png" />
			</view>
            
            <!-- 标题 -->
            <view class="dialog-title">{{ title }}</view>
            
            <!-- 内容 -->
            <view class="dialog-content">{{ content }}</view>
            
            <!-- 按钮组 -->
            <view class="dialog-buttons">
                <!-- <view class="cancel-btn" @click="handleCancel">
                    <text class="cancel-text">{{ cancelText }}</text>
                </view> -->
                <view class="confirm-btn" @click="handleConfirm">
                    <text class="confirm-text">{{ confirmText }}</text>
                </view>
            </view>
        </view>
    </view>
</template>

<script setup lang="ts">
interface Props {
    show?: boolean
    title?: string
    content?: string
    cancelText?: string
    confirmText?: string
}

const props = withDefaults(defineProps<Props>(), {
    show: false,
    title: '提示',
    content: '',
    cancelText: '取消',
    confirmText: '确认',
})

const emit = defineEmits<{
    (e: 'update:show', value: boolean): void
    (e: 'cancel'): void
    (e: 'confirm'): void
}>()

function handleCancel() {
    emit('update:show', false)
    emit('cancel')
}

function handleConfirm() {
    emit('confirm')
}
</script>

<style lang="scss" scoped>
.confirm-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.confirm-dialog-container {
    position: relative;
    width: 600rpx;
    background: #FFFFFF;
    border-radius: 32rpx;
	box-sizing: border-box;
    box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);
	padding-bottom: 28rpx;
}
.confirm-dialog-content{
	width: 600rpx;
	height: 240rpx;
	border-radius: 32rpx;
	opacity: 1;
	background: linear-gradient(0deg, rgba(93, 182, 111, 0) 0%, rgba(93, 182, 111, 0.25) 100%);
	position: relative;
	display: flex;
	justify-content: center;
	.apply_success_icon{
		width: 240rpx;
		height: 162rpx;
		margin-top: 54rpx;
	}
}

.close-btn {
    position: absolute;
    top: 24rpx;
    right: 24rpx;
    width: 48rpx;
    height: 48rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.close-icon {
    font-size: 36rpx;
    color: #999999;
    font-weight: 300;
}

.dialog-title {
	margin-top: -32rpx;
    font-size: 36rpx;
    font-weight: 600;
    color: #333333;
    text-align: center;
    margin-bottom: 32rpx;
}

.dialog-content {
    font-size: 28rpx;
    color: #666666;
    text-align: center;
    line-height: 40rpx;
    margin-bottom: 48rpx;
}

.dialog-buttons {
    display: flex;
    gap: 24rpx;
	padding-left: 30rpx;
	padding-right: 30rpx;
}

.cancel-btn,
.confirm-btn {
    flex: 1;
    height: 80rpx;
    border-radius: 40rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.cancel-btn {
    background-color: #FFFFFF;
    border: 2rpx solid #5DB66F;
}

.cancel-text {
    font-size: 28rpx;
    color: #5DB66F;
    font-weight: 500;
}

.confirm-btn {
    background: linear-gradient(135deg, #5DB66F 0%, #4CAF50 100%);
    box-shadow: 0 4rpx 12rpx rgba(93, 182, 111, 0.3);
}

.confirm-text {
    font-size: 28rpx;
    color: #FFFFFF;
    font-weight: 500;
}

.cancel-btn:active {
    opacity: 0.8;
}

.confirm-btn:active {
    opacity: 0.9;
    transform: scale(0.98);
}
</style>
