DialogExamineGoods.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div>
  3. <el-dialog title="设置" v-model="dialogVisible">
  4. <div>
  5. <el-form label-width="auto">
  6. <el-form-item label="审核状态">
  7. <el-radio-group
  8. v-model="state.form.status"
  9. class="ml-4"
  10. name="status"
  11. >
  12. <el-radio :label="1" size="large">通过</el-radio>
  13. <el-radio :label="2" size="large">不通过</el-radio>
  14. </el-radio-group>
  15. </el-form-item>
  16. <el-form-item label="备注信息" v-if="state.form.status == 2">
  17. <el-input
  18. v-model="state.form.comment"
  19. type="textarea"
  20. :rows="5"
  21. placeholder="选填请输入不通过的理由"
  22. clearable
  23. />
  24. </el-form-item>
  25. </el-form>
  26. </div>
  27. <template #footer>
  28. <div>
  29. <el-button @click="dialogVisible = false">取 消</el-button>
  30. <el-button type="primary" @click="handleSubmit">确 定</el-button>
  31. </div>
  32. </template>
  33. </el-dialog>
  34. </div>
  35. </template>
  36. <script lang="ts" setup>
  37. import { request } from "@/utils";
  38. import { ElMessage } from "element-plus";
  39. import { ref, computed, defineProps, defineEmits, watch, reactive } from "vue";
  40. const props = defineProps({
  41. show: {
  42. type: Boolean,
  43. default: false
  44. },
  45. id: {
  46. type: Number
  47. }
  48. });
  49. const emits = defineEmits(["update:show", "success"]);
  50. const dialogVisible = computed({
  51. get() {
  52. return props.show;
  53. },
  54. set(n) {
  55. emits("update:show", n);
  56. }
  57. });
  58. watch(
  59. () => dialogVisible.value,
  60. n => {
  61. if (n) {
  62. getDetail();
  63. } else {
  64. }
  65. }
  66. );
  67. const status = ref(0);
  68. const radio1 = ref(3);
  69. const state = reactive({
  70. detail: {},
  71. form: {
  72. status: 0,
  73. comment: ""
  74. }
  75. });
  76. const getDetail = () => {
  77. if (!props.id) {
  78. return;
  79. }
  80. request.get(`/mallService/mechanism/goods/${props.id}`).then(resp => {
  81. state.detail = resp.data;
  82. state.form.status = resp.data.goods.verifyStatus;
  83. });
  84. };
  85. const handleSubmit = () => {
  86. request
  87. .put(`/mallService/mechanism/goods/verifyStatus/${state.form.status}`, {
  88. ids: [props.id],
  89. comment: state.form.comment
  90. })
  91. .then(resp => {
  92. ElMessage.success(resp.message);
  93. dialogVisible.value = false;
  94. emits("success");
  95. });
  96. };
  97. </script>