WithdrawForm.vue 7.33 KB
<template>
    <a-card :bordered="false" class="card no-border-card" title="请确认以下信息" size="small">
        <a-descriptions :bordered="false" :column="2" size="small">
            <a-descriptions-item label="流水号" name="name">
                {{ withdraw.withdrawCode }}
            </a-descriptions-item>
            <a-descriptions-item label="申请人" name="updateBy">
                {{ withdraw.account.accountName }}
            </a-descriptions-item>
            <a-descriptions-item label="申请时间" name="createTime">
                {{ withdraw.createTime }}
            </a-descriptions-item>
            <a-descriptions-item label="申请提现金额" name="amount">
                ¥{{ withdraw.amount }}
            </a-descriptions-item>
            <a-descriptions-item label="账户余额" name="amount">
                ¥{{ withdraw.account.surplus }}
            </a-descriptions-item>
            <a-descriptions-item label="当前冻结金额" name="amount">
                ¥{{ withdraw.account.frozenDeposit }}
            </a-descriptions-item>
            <a-descriptions-item label="提现账户" name="bankAccount">

                原充值渠道
            </a-descriptions-item>
        </a-descriptions>
    </a-card>
    <a-card :bordered="false" class=" no-border-card" title="历史驳回记录" size="small" v-if="withdraws.length>0">
        <a-table :columns="columns" :data-source="withdraws" :bordered="false" @resizeColumn="this.$filters.tableResizeColumn"
                 size="small" :pagination="false" :row-key="record => record.withdrawId" :scroll="{y: '350px)'}">
            <template #bodyCell="{column,record}">

                <template v-if="column.key === 'auditor'">
                    <user-real-name :user-name="record.auditor"></user-real-name>
                </template>
            </template>
            <!--提现申请列表end-->
        </a-table>
    </a-card>

    <a-spin :spinning="submitted">
        <a-alert show-icon v-if="formState.approveResult==='AUDITED'" type="info" message="审核通过后将自动进入打款流程" class="mt-10 mb-8"></a-alert>
        <a-alert show-icon v-if="formState.approveResult==='REJECTED'" type="warning" message="用户将收到驳回通知,请谨慎操作!" class="mt-10 mb-8"></a-alert>
        <a-form v-if="formState" :model="formState" :label-col="labelCol" :wrapper-col="wrapperCol" ref="formRef">
            <a-form-item label="审核结果" name="approveResult">
                <a-radio-group v-model:value="formState.approveResult">
                    <a-radio value="AUDITED">审核通过</a-radio>
                    <a-radio value="REJECTED">驳回申请</a-radio>
                </a-radio-group>
            </a-form-item>
            <a-form-item v-if="formState.approveResult==='REJECTED'" label="驳回原因" name="rejectReason" :rules="[{ required: true, message: '请选择驳回原因!' } ]">
                <a-select v-model:value="formState.rejectReason" placeholder="请选择驳回原因">
                    <a-select-option value="账户信息异常">账户信息异常</a-select-option>
                    <a-select-option value="涉嫌违规操作">涉嫌违规操作</a-select-option>
                    <a-select-option value="资料不全">资料不全</a-select-option>
                    <a-select-option value="其它">其它</a-select-option>
                </a-select>
            </a-form-item>
            <a-form-item label="详细驳回原因" name="rejectOtherReason" v-if="formState.rejectReason==='其它'"
                         :rules="[{ required: true, message: '请输入详细驳回原因!' },{max: 120, message: '最多输入120个字符!'}]">
                <a-textarea v-model:value="formState.rejectOtherReason" rows="3" placeholder="请输入详细驳回原因"/>
            </a-form-item>
            <a-form-item label="备注" name="remark" :rules="[ {max: 120, message: '最多不能超过120个字符!' }]">
                <a-textarea v-model:value="formState.remark" rows="6" placeholder="请输入备注"/>
            </a-form-item>
        </a-form>
    </a-spin>
</template>

<script lang="ts">

import {message, TableColumnsType} from 'ant-design-vue';
import {Component, Prop} from "vue-facing-decorator";
import {reactive} from 'vue';
import {Withdraw} from "lib/src/entity/finance/entity/Withdraw";
import {EnhanceFormComponent} from "@/core/form/EnhanceFormComponent";
import {ApproveHistory} from "lib/src/entity/track/entity/ApproveHistory";
import {WithdrawController} from "@/api/WithdrawController";
import {AuditState} from "lib/src/entity/enum_types";
import AuditStateTag from "@/views/common/AuditStateTag.vue";
import TransferStateTag from "@/views/finance/withdraw/TransferStateTag.vue";
import UserRealName from "@/components/UserRealName.vue";

@Component({
    components: {UserRealName, TransferStateTag, AuditStateTag}
})
export default class WithdrawForm extends EnhanceFormComponent<ApproveHistory> {
    @Prop({type: Object, required: true})
    withdraw: Withdraw;
    @Prop({type: String, required: false, default: 'AUDITED'})
    auditState: AuditState;

    columns: TableColumnsType = [
        {title: '流水号', dataIndex: 'withdrawCode', key: 'withdrawCode', width: 150, resizable: true, ellipsis: true, sorter: true},

        {
            title: '申请提现金额', dataIndex: 'amount', key: 'amount', width: 120, align: 'right', resizable: true, ellipsis: true, sorter: true,
            customRender: ({text, record, index, column}) => {
                return '¥' + text;
            }
        },
        {title: '申请时间', dataIndex: 'createTime', key: 'createTime', align: 'center', width: 170, resizable: true, ellipsis: true, sorter: true},
        {title: '审核人', dataIndex: 'auditor', key: 'auditor', width: 120, resizable: true, ellipsis: true, sorter: true},
        {title: '审核备注', dataIndex: 'auditRemark', key: 'auditRemark', width: 120, resizable: true, ellipsis: true, sorter: true},
        {title: '审核时间', dataIndex: 'auditTime', key: 'auditTime', align: 'center', width: 170, resizable: true, ellipsis: true, sorter: true},
    ];

    withdraws: Withdraw[] = [];

    created(): void {
        this.formState = reactive<ApproveHistory>(new ApproveHistory());
        this.formState.approveResult = this.auditState;
        WithdrawController.getWithdrawsByAccountId(this.axios, this.withdraw.account.accountId).then(response => {
            this.withdraws = response.data;
        });
    }


    /**
     * 在实例挂载后调用
     */
    mounted() {
    }

    onValidSuccess(formValue: ApproveHistory): void {
        formValue.approveId = this.withdraw.withdrawId;
        if (formValue.rejectReason === '其它') {
            formValue.rejectReason = formValue.rejectOtherReason;
        }
        WithdrawController.auditWithdraw(this.axios, formValue).then(response => {
            message.success('提交成功');
            this.$emit('handleOk', response.data);
        });
    }

    /**
     * 失败回调
     * @param errorMessage
     */
    onValidFailure(errorMessage: any) {
        console.error('错误信息:', errorMessage);
    }

}
</script>

<style lang="less" scoped>
.card {
    background: #F7F8F9FF;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 16px 16px 16px 16px;
}
</style>