<script setup lang="ts">
import { ref, reactive } from "vue";
import { useRouter } from "vue-router";
import { httpApplyred } from "/@/api/InvoiceSales/redInk";
import { useAsync } from "/@/hooks";

const visible = ref(false);
const { push } = useRouter();
const { run, loading } = useAsync({
  success: () => push("/InvoiceSales/redInk")
});

const params = reactive({
  invNo: ""
});

const requesetOpenInvoice = () => {
  run(httpApplyred(params));
};

defineExpose({
  onDisplay(invNo) {
    visible.value = true;
    params.invNo = invNo;
  }
});
</script>

<template>
  <el-dialog
    title="红冲发票"
    v-model="visible"
    center
    :close-on-click-modal="false"
    :close-on-press-escape="false"
  >
    <div w-full flex justify-end>
      <el-button type="primary" :loading="loading" @click="requesetOpenInvoice"
        >确认</el-button
      >
    </div>
  </el-dialog>
</template>
