audit.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <el-dialog v-model="visible" title="审核结算" width="600px" :close-on-click-modal="false" draggable>
  3. <el-form ref="formRef" :model="form" :rules="rules" label-width="100px" v-loading="loading">
  4. <el-row :gutter="20">
  5. <el-col :span="24" class="mb20">
  6. <el-form-item label="代理名称">
  7. <el-input v-model="form.agentName" disabled />
  8. </el-form-item>
  9. </el-col>
  10. <el-col :span="24" class="mb20">
  11. <el-form-item label="提现金额">
  12. <el-input v-model="form.amount" disabled>
  13. <template #prepend>¥</template>
  14. </el-input>
  15. </el-form-item>
  16. </el-col>
  17. <el-col :span="24" class="mb20">
  18. <el-form-item label="提现类型">
  19. <el-input :value="form.type === 1 ? '银行卡' : 'U'" disabled />
  20. </el-form-item>
  21. </el-col>
  22. <el-col :span="24" class="mb20">
  23. <el-form-item label="银行名称">
  24. <el-input v-model="form.bankName" disabled />
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="24" class="mb20">
  28. <el-form-item label="银行账号">
  29. <el-input v-model="form.bankAccount" disabled />
  30. </el-form-item>
  31. </el-col>
  32. <el-col :span="24" class="mb20">
  33. <el-form-item label="真实姓名">
  34. <el-input v-model="form.realName" disabled />
  35. </el-form-item>
  36. </el-col>
  37. <el-col :span="24" class="mb20">
  38. <el-form-item label="审核状态" prop="auditStatus">
  39. <el-radio-group v-model="form.auditStatus">
  40. <el-radio :label="1">通过</el-radio>
  41. <el-radio :label="2">拒绝</el-radio>
  42. </el-radio-group>
  43. </el-form-item>
  44. </el-col>
  45. <el-col :span="24" class="mb20" v-if="form.auditStatus === 2">
  46. <el-form-item label="拒绝原因" prop="failReason">
  47. <el-input v-model="form.failReason" type="textarea" :rows="3" placeholder="请输入拒绝原因" maxlength="200" show-word-limit />
  48. </el-form-item>
  49. </el-col>
  50. </el-row>
  51. </el-form>
  52. <template #footer>
  53. <span class="dialog-footer">
  54. <el-button @click="visible = false">取消</el-button>
  55. <el-button type="primary" @click="handleSubmit" :loading="loading">确定</el-button>
  56. </span>
  57. </template>
  58. </el-dialog>
  59. </template>
  60. <script lang="ts" name="settlementAgentWithdrawAudit" setup>
  61. import { auditAgentWithdraw } from '/@/api/order';
  62. import { useMessage } from '/@/hooks/message';
  63. const emit = defineEmits(['refresh']);
  64. const visible = ref(false);
  65. const loading = ref(false);
  66. const formRef = ref();
  67. const form = reactive({
  68. id: 0,
  69. agentName: '',
  70. amount: 0,
  71. type: 1,
  72. bankName: '',
  73. bankAccount: '',
  74. realName: '',
  75. auditStatus: 1,
  76. failReason: '',
  77. });
  78. const rules = reactive({
  79. auditStatus: [{ required: true, message: '请选择审核状态', trigger: 'change' }],
  80. failReason: [{ required: true, message: '请输入拒绝原因', trigger: 'blur' }],
  81. });
  82. // 打开弹窗
  83. const openDialog = (row: any) => {
  84. form.id = row.id;
  85. form.agentName = row.agentName;
  86. form.amount = row.amount;
  87. form.type = row.type;
  88. form.bankName = row.bankName;
  89. form.bankAccount = row.bankAccount;
  90. form.realName = row.realName;
  91. form.auditStatus = 1;
  92. form.failReason = '';
  93. visible.value = true;
  94. };
  95. // 提交审核
  96. const handleSubmit = async () => {
  97. try {
  98. await formRef.value.validate();
  99. loading.value = true;
  100. const submitData: any = {
  101. id: form.id,
  102. auditStatus: form.auditStatus,
  103. };
  104. if (form.auditStatus === 2) {
  105. submitData.failReason = form.failReason;
  106. }
  107. await auditAgentWithdraw(submitData);
  108. useMessage().success('审核成功');
  109. visible.value = false;
  110. emit('refresh');
  111. } catch (err: any) {
  112. if (err !== 'cancel') {
  113. useMessage().error(err.msg || '审核失败');
  114. }
  115. } finally {
  116. loading.value = false;
  117. }
  118. };
  119. defineExpose({
  120. openDialog,
  121. });
  122. </script>
  123. <style scoped></style>