<template>
|
<ProDialog
|
:title="form.title"
|
v-model="visible"
|
@close="onDialogClose"
|
destroy-on-close
|
draggable
|
>
|
<PortraitTableWithAttachment v-bind="portraitTableWithAttachmentProps" />
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button @click="emit('onCancel')">取 消</el-button>
|
<el-button type="primary" @click="handleConfirm">确 定</el-button>
|
</span>
|
</template>
|
</ProDialog>
|
</template>
|
|
<script setup lang="ts">
|
import { FormInstance } from 'element-plus';
|
import { ProDialog } from '@bole-core/components';
|
import { usePortraitTableWithAttachment } from '@/hooks';
|
import { convertApi2FormUrl } from '@/utils';
|
import { useQuery } from '@tanstack/vue-query';
|
import * as enterpriseCooperationWalletServices from '@/services/api/enterpriseCooperationWallet';
|
import { EnumEnterpriseCooperationWalletTransactionStatusText } from '@/constants';
|
|
defineOptions({
|
name: 'BalanceRechargeRecordDialog',
|
});
|
|
const visible = defineModel({ type: Boolean });
|
|
type Form = {
|
title?: string;
|
id: string;
|
};
|
|
const form = defineModel<Form>('form');
|
|
const emit = defineEmits<{
|
(e: 'onConfirm'): void;
|
(e: 'onCancel'): void;
|
}>();
|
|
watch(
|
() => visible.value,
|
(val) => {
|
if (val) {
|
refetch();
|
}
|
}
|
);
|
|
const { data: detail, refetch } = useQuery({
|
queryKey: [
|
'enterpriseCooperationWalletServices/getCooperationWalletRechargeTransaction',
|
form.value.id,
|
],
|
queryFn: async () => {
|
return await enterpriseCooperationWalletServices.getCooperationWalletRechargeTransaction({
|
id: form.value.id,
|
});
|
},
|
placeholderData: () => ({} as API.GetCooperationWalletRechargeTransactionQueryResult),
|
enabled: computed(() => !!form.value.id),
|
});
|
|
const { portraitTableWithAttachmentProps } = usePortraitTableWithAttachment({
|
data: detail,
|
annexList: computed(() =>
|
detail.value?.files ? detail.value?.files.map((item) => convertApi2FormUrl(item)) : []
|
),
|
columns: [
|
{
|
label: '进账单位',
|
key: 'receiveUnit',
|
},
|
{
|
label: '开户名称',
|
key: 'receiveName',
|
},
|
{
|
label: '开户银行',
|
key: 'receiveBank',
|
},
|
{
|
label: '开户账号',
|
key: 'receiveAccount',
|
},
|
{
|
label: '充值金额',
|
key: 'amount',
|
type: 'money',
|
},
|
{
|
label: '充值时间',
|
key: 'createdTime',
|
type: 'date',
|
},
|
{
|
label: '充值状态',
|
key: 'transactionStatus',
|
type: 'enum',
|
valueEnum: EnumEnterpriseCooperationWalletTransactionStatusText,
|
},
|
],
|
});
|
|
function handleApply() {
|
copyTextToClipboard(`开户名称:${form.value}\n开户银行:${form.value}\n开户账号:${form.value}`);
|
}
|
|
const dialogForm = ref<FormInstance>();
|
|
function onDialogClose() {
|
if (!dialogForm.value) return;
|
dialogForm.value.resetFields();
|
}
|
|
function handleConfirm() {
|
if (!dialogForm.value) return;
|
dialogForm.value.validate((valid) => {
|
if (valid) {
|
emit('onConfirm');
|
} else {
|
return;
|
}
|
});
|
}
|
</script>
|
<style lang="scss" scoped>
|
@use '@/style/common.scss' as *;
|
|
.portrait-table-with-attachment-title {
|
justify-content: space-between;
|
}
|
</style>
|