线下支付退款流程优化
This commit is contained in:
parent
3729aa5a12
commit
514ccab94e
@ -2,9 +2,12 @@
|
||||
<div class="system-menu-container layout-padding">
|
||||
<ProTable ref="tableRef" :request-api="orderPageGet" :columns="columns" :pagination="true"
|
||||
:tool-button="true">
|
||||
<!-- <template #tools>
|
||||
<el-button v-auth="'order:export'" type="primary" icon="ele-Plus" @click="onOpenMenu"> 导出 </el-button>
|
||||
</template> -->
|
||||
<template #tools>
|
||||
<el-button type="primary" :loading="exportLoading" @click="handleExport">
|
||||
<el-icon><Download /></el-icon>
|
||||
导出
|
||||
</el-button>
|
||||
</template>
|
||||
<template #index="scope">
|
||||
{{ scope.$index + 1 }}
|
||||
</template>
|
||||
@ -18,7 +21,7 @@
|
||||
{{ formatAmount(scope.row.discountAmount) }}
|
||||
</template>
|
||||
<template #orderStatus="scope">
|
||||
{{ scope.row.orderStatusText || '-' }} {{ scope.row.orderStatus == 3 ? ':' + scope.row.refundAmount + '元' : '' }}
|
||||
{{ scope.row.orderStatusText || '-' }}
|
||||
</template>
|
||||
<template #refundAmount="scope">
|
||||
{{ formatAmount(scope.row.refundAmount) }}
|
||||
@ -59,10 +62,12 @@
|
||||
<script setup >
|
||||
import { ref, computed } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { Download } from '@element-plus/icons-vue';
|
||||
import ProTable from '/@/components/ProTable/index.vue';
|
||||
import { orderPageGet , orderDetailGet} from '/@/api/match/order';
|
||||
import { orderPageGet , orderDetailGet, orderExportGet} from '/@/api/match/order';
|
||||
|
||||
const tableRef = ref();
|
||||
const exportLoading = ref(false);
|
||||
|
||||
const formData = ref({
|
||||
orderNo: '',
|
||||
@ -169,6 +174,36 @@ const onOpenMenu = async(id) => {
|
||||
isShowDialog.value = true;
|
||||
};
|
||||
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
exportLoading.value = true;
|
||||
|
||||
const searchParams = tableRef.value?.searchParam || {};
|
||||
|
||||
const response = await orderExportGet(searchParams);
|
||||
|
||||
const blob = new Blob([response], {
|
||||
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
});
|
||||
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = `订单列表_${new Date().getTime()}.xlsx`;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
window.URL.revokeObjectURL(url);
|
||||
|
||||
ElMessage.success('导出成功');
|
||||
} catch (error) {
|
||||
console.error('导出失败:', error);
|
||||
ElMessage.error('导出失败,请稍后重试');
|
||||
} finally {
|
||||
exportLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
{{ scope.row.registrationMode || '-' }}
|
||||
</template>
|
||||
<template #orderStatus="scope">
|
||||
{{ scope.row.orderStatusText || '-' }} {{ scope.row.orderStatus == 3 ? ':' + scope.row.refundAmount : '' }}
|
||||
{{ scope.row.orderStatusText || '-' }}
|
||||
</template>
|
||||
<template #paymentProofUrl="scope">
|
||||
<el-image v-if="scope.row.paymentProofUrl"
|
||||
|
||||
@ -482,6 +482,25 @@
|
||||
项目完成人数错误
|
||||
</el-alert>
|
||||
</div>
|
||||
|
||||
<!-- 线下支付退款表单(仅在需要时显示) -->
|
||||
<template v-if="cancelPreviewData?.needPayeeInfo">
|
||||
<el-divider content-position="left">退款信息</el-divider>
|
||||
<el-form :model="refundForm" label-width="120px" style="max-width: 500px;">
|
||||
<el-form-item label="退款金额">
|
||||
<span style="font-size: 18px; font-weight: bold; color: #1fae66;">¥{{ totalRefundAmount.toFixed(2) }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="收款人姓名" required>
|
||||
<el-input v-model="refundForm.payeeName" placeholder="请输入收款人姓名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="收款人开户行" required>
|
||||
<el-input v-model="refundForm.payeeBankName" placeholder="请输入收款人开户行" />
|
||||
</el-form-item>
|
||||
<el-form-item label="收款人银行卡号" required>
|
||||
<el-input v-model="refundForm.payeeBankAccount" placeholder="请输入收款人银行卡号" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<!-- 确认阶段 -->
|
||||
@ -1025,13 +1044,19 @@ const mockMembers3 = ref([
|
||||
]);
|
||||
|
||||
// 新的响应式变量
|
||||
const selectedMembers = ref([]);
|
||||
const teamRemoved = ref(false);
|
||||
const cancelAll = ref(false);
|
||||
const hasValidationError = ref(false);
|
||||
const hasLimitError = ref(false);
|
||||
const hasCountError = ref(false);
|
||||
const isFreeProject = ref(false); // 控制是否为免费项目
|
||||
const selectedMembers = ref([]);
|
||||
const teamRemoved = ref(false);
|
||||
const cancelAll = ref(false);
|
||||
const hasValidationError = ref(false);
|
||||
const hasLimitError = ref(false);
|
||||
const hasCountError = ref(false);
|
||||
const isFreeProject = ref(false); // 控制是否为免费项目
|
||||
// 线下支付收款人信息
|
||||
const refundForm = reactive({
|
||||
payeeName: '',
|
||||
payeeBankName: '',
|
||||
payeeBankAccount: ''
|
||||
});
|
||||
|
||||
const totalRefundAmount = computed(() => {
|
||||
// 免费项目退款金额为0
|
||||
@ -1116,6 +1141,10 @@ const openCancelDialog = async (row) => {
|
||||
hasLimitError.value = false;
|
||||
hasCountError.value = false;
|
||||
isFreeProject.value = false; // 默认为收费项目
|
||||
// 重置收款人信息
|
||||
refundForm.payeeName = '';
|
||||
refundForm.payeeBankName = '';
|
||||
refundForm.payeeBankAccount = '';
|
||||
|
||||
try {
|
||||
const res = await usereventrecordCancelPreviewGet(row.registrationId);
|
||||
@ -1140,6 +1169,22 @@ const openCancelDialog = async (row) => {
|
||||
const submitCancel = async () => {
|
||||
if (!cancelPreviewData.value?.registrationId) return;
|
||||
|
||||
// 如果是线下支付且已支付,验证收款人信息
|
||||
if (cancelPreviewData.value?.needPayeeInfo) {
|
||||
if (!refundForm.payeeName.trim()) {
|
||||
ElMessage.warning('请填写收款人姓名');
|
||||
return;
|
||||
}
|
||||
if (!refundForm.payeeBankName.trim()) {
|
||||
ElMessage.warning('请填写收款人开户行');
|
||||
return;
|
||||
}
|
||||
if (!refundForm.payeeBankAccount.trim()) {
|
||||
ElMessage.warning('请填写收款人银行卡号');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
cancelSubmitting.value = true;
|
||||
try {
|
||||
const payload = {
|
||||
@ -1152,6 +1197,13 @@ const submitCancel = async () => {
|
||||
payload.personIds = selectedMembers.value;
|
||||
}
|
||||
|
||||
// 如果是线下支付且已支付,添加收款人信息
|
||||
if (cancelPreviewData.value?.needPayeeInfo) {
|
||||
payload.payeeName = refundForm.payeeName;
|
||||
payload.payeeBankName = refundForm.payeeBankName;
|
||||
payload.payeeBankAccount = refundForm.payeeBankAccount;
|
||||
}
|
||||
|
||||
const res = await usereventrecordCancelExecutePost(payload);
|
||||
const data = res.data || res;
|
||||
const succeeded = res.succeeded ?? (data?.success ?? true);
|
||||
@ -1206,6 +1258,10 @@ const onCancelDialogClosed = () => {
|
||||
hasLimitError.value = false;
|
||||
hasCountError.value = false;
|
||||
isFreeProject.value = false;
|
||||
// 重置收款人信息
|
||||
refundForm.payeeName = '';
|
||||
refundForm.payeeBankName = '';
|
||||
refundForm.payeeBankAccount = '';
|
||||
};
|
||||
|
||||
// ==================== 查看/更换参赛队员 ====================
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user