订单页面显示退款金额

This commit is contained in:
马梓彭 2026-04-21 08:39:02 +08:00
parent 7f66787c4f
commit dd83a55947
3 changed files with 77 additions and 36 deletions

View File

@ -90,38 +90,36 @@ export const usereventrecordMaterialPost = (registrationid, data) => {
};
/**
* 4. 上传付款凭证
* @param {number} registrationid - 报名记录ID (路径参数)
* @param {Object} data - 凭证表单数据
* @param {File} data.File - 凭证图片 (单张)
* @param {number} data.PayAmount - 支付金额
* @param {string} data.PayTime - 支付时间 (ISO格式)
* @param {string} data.PayChannel - 支付渠道 (微信/支付宝/银行转账)
* @param {string} [data.TransactionId] - 交易流水号 (可选)
* @returns {Promise<{
* code: number,
* message: string,
* data: {
* voucherId: string,
* ossUrl: string,
* auditStatus: string
* },
* success: boolean
* }>}
*/
* 4. 上传付款凭证
* @param {number} registrationid - 报名记录ID (路径参数)
* @param {Object} data - 凭证表单数据
* @param {File} data.File - 凭证图片 (单张)
* @param {number} data.PayAmount - 支付金额
* @param {string} data.PayTime - 支付时间 (ISO格式)
* @param {string} [data.TransactionId] - 交易流水号 (可选)
* @returns {Promise<{
* code: number,
* message: string,
* data: {
* voucherId: string,
* ossUrl: string,
* auditStatus: string
* },
* success: boolean
* }>}
*/
export const usereventrecordVoucherPost = (registrationid, data) => {
const formData = new FormData();
formData.append('File', data.File);
formData.append('PayAmount', data.PayAmount);
formData.append('PayTime', data.PayTime);
formData.append('PayChannel', data.PayChannel);
if (data.TransactionId) formData.append('TransactionId', data.TransactionId);
return http.post(`/usereventrecord/voucher/${registrationid}`, formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
});
const formData = new FormData();
formData.append('File', data.File);
formData.append('PayAmount', data.PayAmount);
formData.append('PayTime', data.PayTime);
if (data.TransactionId) formData.append('TransactionId', data.TransactionId);
return http.post(`/usereventrecord/voucher/${registrationid}`, formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
});
};
/**

View File

@ -11,11 +11,20 @@
<template #paymentMethod="scope">
{{ scope.row.paymentMethod || '-' }}
</template>
<template #originalAmount="scope">
{{ formatAmount(scope.row.originalAmount) }}
</template>
<template #discountAmount="scope">
{{ formatAmount(scope.row.discountAmount) }}
</template>
<template #orderStatus="scope">
{{ scope.row.orderStatusText || '-' }} {{ scope.row.orderStatus == 3 ? ':' + scope.row.refundAmount + '元' : '' }}
</template>
<template #refundAmount="scope">
{{ formatAmount(scope.row.refundAmount) }}
</template>
<template #actualAmount="scope">
{{ formatAmount(scope.row.actualAmount) }}
{{ formatActualAmount(scope.row) }}
</template>
<template #action="scope">
<el-button size="small" text type="primary" @click="onOpenMenu(scope.row.id)">
@ -79,6 +88,9 @@ const columns = ref([
{ prop: 'orderNo', label: '订单编号', align: 'center', search: { el: 'input', }, fixed: 'left', minWidth: 150 },
{ prop: 'eventName', label: '所属赛事', search: { el: 'input', }, minWidth: 150 },
{ prop: 'paymentMethod', label: '支付方式', search: { el: 'select', }, enum: [{ label: '全部', value: 0 }, { label: '线上', value: 2 }, { label: '线下', value: 1 },], minWidth: 100 },
{ prop: 'originalAmount', label: '原金额', minWidth: 120 },
{ prop: 'discountAmount', label: '优惠金额', minWidth: 120 },
{ prop: 'refundAmount', label: '退款金额', minWidth: 120 },
{ prop: 'actualAmount', label: '实付金额', minWidth: 120 },
{ width: 130, prop: 'orderStatus', label: '订单状态', search: { el: 'select', }, enum: [{ label: '全部', value: '' }, { label: '待支付', value: 0 }, { label: '已支付', value: 1 }, { label: '已取消', value: 2 }, { label: '已退款', value: 3 }, { label: '已发货', value: 4 }, { label: '已完成', value: 5 },], minWidth: 100 },
{ prop: 'createdTime', label: '生成时间', search: { el: 'date-picker', props: { type: 'daterange' } }, minWidth: 160 },
@ -91,7 +103,21 @@ const detailLoading = ref(false);
const formatAmount = (value) => {
if (value === null || value === undefined || value === '') return '-';
const num = Number(value);
return isNaN(num) ? '-' : num.toFixed(2);
if (isNaN(num) || num === 0) return '-';
return num.toFixed(2);
};
const formatActualAmount = (row) => {
if (row.isRefundOrder) {
if (row.relatedOrderActualAmount !== null && row.relatedOrderActualAmount !== undefined) {
const num = Number(row.relatedOrderActualAmount);
const amountStr = isNaN(num) || num === 0 ? '-' : num.toFixed(2);
return amountStr;
}
return '-';
} else {
return formatAmount(row.actualAmount);
}
};
const normalizeNames = (value) => {

View File

@ -39,8 +39,11 @@
<template #discountAmount="scope">
{{ formatAmount(scope.row.discountAmount) }}
</template>
<template #refundAmount="scope">
{{ formatAmount(scope.row.refundAmount) }}
</template>
<template #actualAmount="scope">
{{ formatAmount(scope.row.actualAmount) }}
{{ formatActualAmount(scope.row) }}
</template>
<template #action="scope">
<el-button size="small" text type="primary" @click="onOpenMenu(scope.row.id)">
@ -115,11 +118,11 @@ const columns = ref([
{ width: 120, prop: 'contactPhone', label: '报名账号', search: { el: 'input' } },
{ width: 120, prop: 'originalAmount', label: '原金额' },
{ width: 120, prop: 'discountAmount', label: '优惠金额' },
{ width: 120, prop: 'refundAmount', label: '退款金额', align: 'center' },
{ width: 120, prop: 'actualAmount', label: '实付金额' },
{ width: 130, prop: 'orderStatus', label: '订单状态', search: { el: 'select', }, enum: [{ label: '全部', value: '' }, { label: '待支付', value: 0 }, { label: '已支付', value: 1 }, { label: '已取消', value: 2 }, { label: '已退款', value: 3 }, { label: '已发货', value: 4 }, { label: '已完成', value: 5 },], },
{ width: 160, prop: 'createdTime', label: '生成时间', search: { el: 'date-picker', props: { type: 'daterange' } } },
{ prop: 'action', label: '操作', align: 'center', fixed: 'right', width: 120, },
{ prop: 'refundAmount', label: '退款金额', align: 'center', width: 120, isShow: false },
]);
const isShowDialog = ref(false);
@ -128,7 +131,21 @@ const detailLoading = ref(false);
const formatAmount = (value) => {
if (value === null || value === undefined || value === '') return '-';
const num = Number(value);
return isNaN(num) ? '-' : num.toFixed(2);
if (isNaN(num) || num === 0) return '-';
return num.toFixed(2);
};
const formatActualAmount = (row) => {
if (row.isRefundOrder) {
if (row.relatedOrderActualAmount !== null && row.relatedOrderActualAmount !== undefined) {
const num = Number(row.relatedOrderActualAmount);
const amountStr = isNaN(num) || num === 0 ? '-' : num.toFixed(2);
return amountStr;
}
return '-';
} else {
return formatAmount(row.actualAmount);
}
};
const normalizeNames = (value) => {