index.vue 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <div class="body">
  3. <div class="bottombox">
  4. <van-button
  5. round
  6. :style="{ width: '40vw', margin: 'auto' }"
  7. :disabled="!invoiceId"
  8. type="primary"
  9. @click="goForm"
  10. >
  11. 立即填写
  12. </van-button>
  13. <van-button
  14. round
  15. class="mybutton"
  16. :style="{ width: '40vw', margin: 'auto' }"
  17. :disabled="!invoiceId"
  18. type="primary"
  19. @click="goPromulgate"
  20. >
  21. 信息公示
  22. </van-button>
  23. <van-button
  24. round
  25. :style="{ width: '40vw', margin: 'auto' }"
  26. type="primary"
  27. @click="goRecord"
  28. >
  29. 填写记录
  30. </van-button>
  31. </div>
  32. <div>
  33. {{tipText}}
  34. </div>
  35. </div>
  36. </template>
  37. <script setup>
  38. import { computed, onMounted, reactive, ref } from 'vue';
  39. import { useRouter, useRoute } from 'vue-router'
  40. import dayjs from 'dayjs'
  41. import { getInvoiceFill } from '@/services/invoice'
  42. const router = useRouter();
  43. const route = useRoute();
  44. const { invoiceId } = route.query
  45. const formData = reactive({})
  46. const tipText = computed(() => {
  47. if (!invoiceId) return '请扫码访问此页面';
  48. const finished = formData.status === 2 || (formData.endDate ? dayjs().isAfter(dayjs(formData.endDate)) : false)
  49. return finished ? '该班次已截止如有问题请联系报销助理' : `该班次将于 ${dayjs(formData.endDate).format('YYYY年MM月DD日')} 截止`
  50. })
  51. const goForm = () => {
  52. router.push({ name: 'invoice.fill', query: route.query })
  53. }
  54. const goRecord = () => {
  55. router.push({ name: 'invoice.history', query: route.query })
  56. }
  57. const goPromulgate = () => {
  58. router.push({ name: 'publicity.list', query: route.query })
  59. }
  60. onMounted(() => {
  61. getInvoiceFill(invoiceId).then(res => {
  62. Object.assign(formData, res)
  63. }).catch(err => {
  64. console.log(err)
  65. })
  66. })
  67. </script>
  68. <style lang="less" scoped>
  69. .body {
  70. display: flex;
  71. flex-direction: column;
  72. align-items: center;
  73. justify-content: space-between;
  74. height: 80vh;
  75. padding-top: 10vh;
  76. .bottombox {
  77. display: flex;
  78. flex-direction: column;
  79. align-items: center;
  80. height: 50vh;
  81. }
  82. }
  83. </style>