feedbackDialog.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <el-dialog
  3. title="反馈信息"
  4. v-model="formOpen"
  5. width="500px"
  6. append-to-body
  7. draggable
  8. @close="cancel"
  9. >
  10. <el-form ref="dictRef" :model="form" label-width="100">
  11. <el-form-item label="失败类型:">
  12. <el-select
  13. v-model.trim="form.failureType"
  14. size="small"
  15. type="text"
  16. placeholder="失败类型"
  17. :clearable="true"
  18. style="width: 130px"
  19. >
  20. <el-option
  21. v-for="item in types"
  22. :key="item.value"
  23. :label="item.label"
  24. :value="item.value"
  25. />
  26. </el-select>
  27. </el-form-item>
  28. <el-form-item v-if="form.failureType !== 0" label="失败说明:">
  29. <el-input
  30. v-model.trim="form.failureResult"
  31. size="small"
  32. type="text"
  33. placeholder="失败原因"
  34. :clearable="true"
  35. style="width: 220px"
  36. />
  37. </el-form-item>
  38. </el-form>
  39. <template #footer>
  40. <div class="dialog-footer">
  41. <el-button
  42. type="primary"
  43. size="small"
  44. icon="Finished"
  45. @click="submitForm"
  46. >确 定</el-button
  47. >
  48. <el-button @click="cancel" icon="close" size="small">取 消</el-button>
  49. </div>
  50. </template>
  51. </el-dialog>
  52. </template>
  53. <script setup>
  54. import { ref } from "vue";
  55. const { proxy } = getCurrentInstance();
  56. const props = defineProps({
  57. verify: {
  58. type: Function,
  59. default: () => {},
  60. },
  61. });
  62. const types = ref([
  63. {
  64. value: 0,
  65. label: "余额不足",
  66. },
  67. {
  68. value: 1,
  69. label: "其他",
  70. },
  71. ]);
  72. const { verify } = toRefs(props);
  73. const currentMonth = ref(proxy.moment().format("YYYY-MM-01"));
  74. const formOpen = ref(false);
  75. const form = ref({});
  76. function submitForm() {
  77. if (form.value.failureType !== 0 && !form.value.failureResult) {
  78. proxy.$modal.msgError("请输入扣款失败说明");
  79. return;
  80. }
  81. proxy.$modal
  82. .confirm("确认驳回么?")
  83. .then((_) => {
  84. verify.value(form.value);
  85. cancel();
  86. })
  87. .catch((_) => {
  88. proxy.$modal.msg("取消驳回");
  89. });
  90. }
  91. function cancel() {
  92. formOpen.value = false;
  93. reset();
  94. }
  95. function open(options) {
  96. formOpen.value = true;
  97. form.value = options;
  98. }
  99. function reset() {
  100. form.value = {};
  101. }
  102. // 暴露给父组件的方法
  103. defineExpose({
  104. open,
  105. });
  106. </script>