<template>
  <div class="bg-el-color" v-loading="loading">
    <ApplyDetail :apply="apply" />
    <van-sticky :offset-bottom="0" position="bottom">
      <div class="bg-el-color solid-top padding-sm flex justify-end">
        <el-button plain @click="handleEidt">修 改</el-button>
        <el-button plain @click="handelRevoke">撤 回</el-button>
        <el-button type="danger" @click="handelReject">驳 回</el-button>
        <el-button type="primary" @click="handelAgree">同 意</el-button>
        <!-- <van-button class="margin-left-xs">修 改</van-button>
        <van-button class="margin-left-xs">撤 回</van-button>
        <van-button class="margin-left-xs" type="danger">驳 回</van-button>
        <van-button class="margin-left-xs" type="primary">同 意</van-button> -->
      </div>
    </van-sticky>
  </div>
</template>

<script setup>
// 审批详情组件
import ApplyDetail from "@/components/ApplyDetail";
const { proxy } = getCurrentInstance();

const loading = ref(true);
const apply = ref({ a: "" });
const route = useRoute();

function getData(applyId) {
 // console.log(applyId);
  loading.value = true;
  setTimeout(() => {
    loading.value = false;
    apply.value = {
      a: "a",
      b: proxy.parseTime(new Date(), "{y}-{m}-{d} {h}:{i}:{s}"),
    };
  }, 1000);
  // getUser(userId).then((response) => {
  //   userInfo.value = response.data;
  //   loading.value = false;
  // });
}

let applyId = route.query.applyId;
getData(applyId);

// 修改
function handleEidt() {}

// 撤回
function handelRevoke() {
  proxy.$modal
    .confirm("是否撤回？")
    .then(() => {
      proxy.$modal.msg("已撤回");
    })
    .catch(() => {});
}

// 驳回
function handelReject() {
  proxy.$modal
    .confirm("是否驳回？")
    .then(() => {
      proxy.$modal.msgError("已驳回");
    })
    .catch(() => {});
}

// 同意
function handelAgree() {
  proxy.$modal
    .confirm("是否同意？")
    .then(() => {
      proxy.$modal.msgSuccess("已同意");
    })
    .catch(() => {});
}
</script>
