RegistrationReview.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <el-dialog
  3. :visible.sync="visible"
  4. v-bind="modalOptions"
  5. append-to-body
  6. >
  7. <el-form
  8. ref="formData"
  9. :model="formData"
  10. :rules="formRules"
  11. size="mini"
  12. label-suffix=":"
  13. label-width="150px"
  14. >
  15. <el-form-item label="审核状态" prop="state">
  16. <el-radio-group v-model="formData.state">
  17. <el-radio label="1">报名成功</el-radio>
  18. <el-radio label="2">报名失败</el-radio>
  19. </el-radio-group>
  20. </el-form-item>
  21. <el-form-item label="备注" prop="remark">
  22. <el-input v-model="formData.remark" type="textarea" placeholder="请输入备注" maxlength="520" :rows="3" show-word-limit />
  23. </el-form-item>
  24. </el-form>
  25. <template #footer>
  26. <span class="dialog-footer">
  27. <el-button size="mini" @click="handleClose">取 消</el-button>
  28. <el-button type="primary" size="mini" @click="handleSubmit">确 定</el-button>
  29. </span>
  30. </template>
  31. </el-dialog>
  32. </template>
  33. <script>
  34. import { activExamine } from '@/api/active'
  35. export default {
  36. name: 'RegistrationReview',
  37. components: {
  38. },
  39. data() {
  40. return {
  41. modalOptions: {
  42. closeOnClickModal: false,
  43. width: '620px',
  44. title: ''
  45. },
  46. visible: false,
  47. formData: {
  48. signId: '', // 报名id
  49. state: '1', // 审核状态 1-报名成功 2-报名失败
  50. remark: '' // 备注
  51. },
  52. formRules: {
  53. signId: [
  54. { required: true, message: '缺少报名信息' }
  55. ],
  56. state: [
  57. { required: true, message: '请选择状态' }
  58. ],
  59. remark: [
  60. { required: false, message: '请输入备注' }
  61. ]
  62. }
  63. }
  64. },
  65. methods: {
  66. handleClose() {
  67. this.visible = false
  68. },
  69. initList() {
  70. },
  71. handleOpen(params = {}) {
  72. this.modalOptions.title = params.signId ? '店铺的报名审核' : '--'
  73. this.visible = true
  74. this.initList()
  75. if (params.signId) {
  76. // this.getInfo(params.signId)
  77. } else {
  78. this.$refs.formData && this.$refs.formData.resetFields()
  79. }
  80. },
  81. async getInfo(id) {
  82. const loading = this.$loading({ text: '加载中' })
  83. try {
  84. const res = await xxx({ id })
  85. this.formData = Object.assign(this.$options.data().formData, res.data, {
  86. signId: res.data.signId || ''
  87. })
  88. this.$nextTick(() => {
  89. this.$refs.formData && this.$refs.formData.validate()
  90. })
  91. } finally {
  92. loading.close()
  93. }
  94. },
  95. handleSubmit() {
  96. this.$refs.formData.validate(async (valid) => {
  97. if (valid) {
  98. const loading = this.$loading({ text: '加载中' })
  99. try {
  100. const { ...otps } = this.formData
  101. const params = {
  102. ...otps
  103. }
  104. await activExamine(params)
  105. loading.close()
  106. this.$message({ message: `处理成功!`, type: 'success' })
  107. this.$emit('success')
  108. this.visible = false
  109. } catch (e) {
  110. loading.close()
  111. } finally {
  112. loading.close()
  113. }
  114. } else {
  115. this.$message({ message: '请输入相关信息', type: 'warning' })
  116. return false
  117. }
  118. })
  119. }
  120. }
  121. }
  122. </script>