<!-- 文件职责：拒单原因弹窗。 -->
<script setup lang="ts">
import { ref } from 'vue';

const { open = false } = defineProps<{
  open?: boolean;
}>();

const emit = defineEmits<{
  cancel: [];
  confirm: [reason: string];
}>();

const reason = ref('');

function handleOk() {
  if (!reason.value.trim()) return;
  emit('confirm', reason.value.trim());
  reason.value = '';
}

function handleCancel() {
  reason.value = '';
  emit('cancel');
}
</script>

<template>
  <a-modal :open="open" title="拒单原因" @ok="handleOk" @cancel="handleCancel">
    <a-textarea v-model:value="reason" :rows="3" placeholder="请输入拒单原因" />
  </a-modal>
</template>
