<template>
    <view style="width:50%">
        <u-button type="success" text="同意" size="small" @click="handleApprove" v-bind="$attrs" />

        <!-- 确认弹窗 -->
        <u-modal :show="showConfirmModal" title="确认" content="确认收到货了吗？" @confirm="confirmApprove" showCancelButton :content-style="{textAlign:'center'}"
            @cancel="showConfirmModal = false" />
    </view>
</template>

<script setup>
import { ref } from 'vue';
 
const emit = defineEmits(['approve']);
const showConfirmModal = ref(false);

const handleApprove = () => {
    showConfirmModal.value = true;
};

const confirmApprove = () => {
    emit('approve');
    showConfirmModal.value = false;
};
</script>