ViewWithdraw.vue 8.31 KB
<template>
    <a-alert type="info" :show-icon="true" :closable="false" message="请仔细核对收款账户信息,确保与申请人身份一致。">

    </a-alert>
    <a-descriptions :bordered="false" :column="3" size="small" v-if="withdraw" class=" mt-16">
        <template #title>
            <title-tip-icon></title-tip-icon>
            申请与账户信息
        </template>
        <a-descriptions-item label="流水号" name="name">
            {{ withdraw.withdrawCode }}
        </a-descriptions-item>
        <a-descriptions-item label="申请状态" name="auditState">
            <audit-state-tag :audit-state="withdraw.auditState"></audit-state-tag>
        </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="bankAccount">
            {{ withdraw.auditTime }}
        </a-descriptions-item>
    </a-descriptions>
    <a-descriptions :bordered="false" :column="3" size="small" v-if="withdraw" class="withdraw-view mt-16">
        <template #title>
            申请提现金额
        </template>
        <template #extra>
            申请时间: {{ withdraw.createTime }}
        </template>
        <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>

    <a-descriptions :bordered="false" :column="3" size="small" v-if="withdraw&&withdraw.auditState==='REJECTED'">
        <template #title>
            <title-tip-icon></title-tip-icon>
            驳回原因
        </template>
        <a-descriptions-item label="详细驳回原因" name="amount">
            {{ withdraw.rejectReason }}
        </a-descriptions-item>
    </a-descriptions>

    <!--    <a-descriptions v-if="withdraw&&withdraw.auditState==='AUDITED'" :bordered="false" :column="3" size="small">-->
    <!--        <template #title>-->
    <!--            <title-tip-icon></title-tip-icon>-->
    <!--            转账情况-->
    <!--        </template>-->
    <!--        <a-descriptions-item label="付款单号">-->
    <!--            {{ withdraw.transferBillNo }}-->
    <!--        </a-descriptions-item>-->
    <!--        <a-descriptions-item label="转账状态">-->
    <!--            <transfer-state-tag :state="withdraw.state"></transfer-state-tag>-->
    <!--        </a-descriptions-item>-->
    <!--        <a-descriptions-item label="失败原因" :span="2">-->
    <!--            {{ withdraw.failReason ?? '-' }}-->
    <!--        </a-descriptions-item>-->
    <!--        <a-descriptions-item label="转账时间">-->
    <!--            {{ withdraw.transferTime }}-->
    <!--        </a-descriptions-item>-->
    <!--        <a-descriptions-item label="付款成功时间">-->
    <!--            {{ withdraw.paymentTime }}-->
    <!--        </a-descriptions-item>-->
    <!--        <a-descriptions-item label="付款备注">-->
    <!--            {{ withdraw.transferRemark }}-->
    <!--        </a-descriptions-item>-->
    <!--    </a-descriptions>-->

    <template v-if="withdraw&&withdraw.auditState==='AUDITED'">
        <div class="mt-16"></div>
        <title-divider title="退款情况"></title-divider>
        <a-table :columns="columns" :data-source="refunds" :pagination="false" size="small"></a-table>
    </template>


    <br/>
    <title-divider title="审核记录"></title-divider>
    <approve-history-timeline v-if="withdraw" approve-type="WITHDRAW" :approve-id="withdraw.withdrawId" :create-time="withdraw.createTime" :starter="withdraw.account.accountName"></approve-history-timeline>

    <a-space :gap="8" v-if="withdraw&&withdraw.auditState==='UNAUDITED'">
        <a-button type="primary" @click="editWithdraw('AUDITED')">审核通过</a-button>
        <a-button type="default" @click="editWithdraw('REJECTED')">审核驳回</a-button>
        <a-button type="default" @click="this.$goBack()">取消</a-button>
    </a-space>
</template>
<script lang="ts">

import {Component, Vue} from "vue-facing-decorator";
import {Withdraw} from "lib/src/entity/finance/entity/Withdraw";
import AuditStateTag from "@/views/common/AuditStateTag.vue";
import TitleTipIcon from "@/components/icons/TitleTipIcon.vue";
import TransferStateTag from "@/views/finance/withdraw/TransferStateTag.vue";
import {WithdrawController} from "@/api/WithdrawController";
import ApproveHistoryTimeline from "@/views/common/ApproveHistoryTimeline.vue";
import TitleDivider from "@/components/TitleDivider.vue";
import {ModalService} from "@/components/ModalService";
import WithdrawForm from "@/views/finance/withdraw/WithdrawForm.vue";
import {AuditState} from "lib/src/entity/enum_types";
import {Refund} from "lib/src/entity/finance/entity/Refund";
import {Transaction} from "lib/src/entity/finance/entity/Transaction";
import {TransactionController} from "@/api/TransactionController";
import {TableColumnsType} from "ant-design-vue";

@Component({
    components: {TitleDivider, ApproveHistoryTimeline, TransferStateTag, TitleTipIcon, AuditStateTag}
})
export default class ViewWithdraw extends Vue {

    withdrawId: any;

    withdraw: Withdraw = null;

    refunds: Refund[] = [];

    /**
     * 表格列配置
     */
    columns: TableColumnsType = [
        {title: '支付流水号', dataIndex: ['recharge', 'outTradeNo'], key: 'outTradeNo', width: 150, resizable: true, ellipsis: true, sorter: false},
        {title: '微信支付订单号', dataIndex: ['recharge', 'transactionId'], key: 'transactionId', width: 170, resizable: true, ellipsis: true, sorter: false},
        {
            title: '支付金额', dataIndex: ['recharge', 'amount'], key: 'amount', width: 120, align: 'right', resizable: true, ellipsis: true, sorter: false,
            customRender: ({text, record, index, column}) => {
                return '¥' + text;
            }
        },
        {title: '支付时间', dataIndex: ['recharge', 'paymentTime'], key: 'paymentTime', align: 'center', width: 170, resizable: true, ellipsis: true, sorter: false},
        {title: '微信退款订单号', dataIndex: 'outRefundNo', key: 'outRefundNo', align: 'left', width: 170, resizable: true, ellipsis: true, sorter: false},
        {
            title: '退款金额', dataIndex: 'refundAmount', key: 'refundAmount', align: 'right', width: 120, resizable: true, ellipsis: true, sorter: false,
            customRender: ({text, record, index, column}) => {
                return '¥' + text;
            }
        },

        {title: '退款时间', dataIndex: 'refundTime', key: 'refundTime', align: 'center', width: 170, resizable: true, ellipsis: true, sorter: false},
        {title: '退款成功时间', dataIndex: 'refundSuccessTime', key: 'refundSuccessTime', align: 'center', width: 170, resizable: true, ellipsis: true, sorter: false},
    ];

    created(): void {
        this.withdrawId = Number(this.$route.query.withdrawId);
        this.loadData();
    }

    loadData(): void {
        WithdrawController.getWithdrawById(this.axios, this.withdrawId).then(response => {
            this.withdraw = response.data;
        });
        TransactionController.getRefundsByWithdrawId(this.axios, this.withdrawId).then(response => {
            this.refunds = response.data;
        });
    }

    /**
     * 编辑提现申请
     */
    editWithdraw(auditState: AuditState): void {
        const modal = ModalService.confirm({
            title: '提现审核', component: WithdrawForm, closable: true, appContext: this.$.appContext,
            props: {withdraw: this.withdraw, auditState: auditState},
            onOk: (component): void => {
                component.submitForm();
            },
            emits: {
                handleOk: (e) => {
                    modal.destroy();
                    this.loadData();
                }
            },
        });
    }
}
</script>

<style scoped lang="less">
.withdraw-view {
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(227, 240, 255, 1) 0%, rgba(249, 251, 254, 1) 100%), rgba(247, 248, 249, 1);
    padding: 16px 20px 16px 20px;
}
</style>