<template>
    <uni-popup
        ref="popupRef"
        type="center"
        borderRadius="10px 15px 15px 15px"
        background-color="#FFFFFF"
        :mask-click="false"
    >
        <view class="remind-popup-content">
            <view class="remind-title">提醒</view>
            <view class="remind-message">请先完善您的个人信息:</view>
            <view class="remind-list">
                <view 
                    class="remind-item" 
                    v-for="(item, index) in remindList" 
                    :key="index"
                >
                    {{ index + 1 }}、{{ item }}
                </view>
            </view>
            <view class="remind-btns">
                <button class="remind-btn cancel-btn" @click="handleCancel">取消</button>
                <button class="remind-btn confirm-btn" @click="handleConfirm">确认</button>
            </view>
        </view>
    </uni-popup>
</template>

<script setup>
import { ref, defineExpose } from 'vue';

const props = defineProps({
    remindList: {
        type: Array,
        default: () => []
    }
});

const emit = defineEmits(['cancel', 'confirm']);

const popupRef = ref(null);

// 打开弹窗
function open() {
    if (popupRef.value) {
        try {
            popupRef.value.open();
        } catch (error) {
            // 静默处理错误
        }
    }
}

// 关闭弹窗
function close() {
    popupRef.value?.close();
}

// 取消按钮
function handleCancel() {
    emit('cancel');
}

// 确认按钮
function handleConfirm() {
    emit('confirm');
}

defineExpose({
    open,
    close
});
</script>

<style lang="scss" scoped>
.remind-popup-content {
    padding: 60rpx;
    width: 945rpx;
    background-color: #FFFFFF;
    border-radius: 30rpx;
    box-sizing: border-box;
}

.remind-title {
    font-weight: 600;
    font-size: 48rpx;
    color: #000000;
    margin-bottom: 36rpx;
}

.remind-message {
    font-size: 42rpx;
    color: #000000;
    margin-bottom: 30rpx;
    line-height: 60rpx;
}

.remind-list {
    margin-bottom: 48rpx;
    min-height: 60rpx;
}

.remind-item {
    font-size: 42rpx;
    color: #000000;
    line-height: 60rpx;
    margin-bottom: 12rpx;
}

.remind-btns {
    display: flex;
    justify-content: space-between;
    gap: 30rpx;
}

.remind-btn {
    flex: 1;
    height: 132rpx;
    line-height: 132rpx;
    text-align: center;
    border-radius: 12rpx;
    font-size: 42rpx;
    padding: 0;
    box-sizing: border-box;
    font-weight: 400;
}

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

.confirm-btn {
    background-color: #256BFA;
    color: #FFFFFF;
    border: none;
}

button::after {
    border: none;
}
</style>

