订单管理

This commit is contained in:
马梓彭 2026-04-09 23:12:14 +08:00
parent daeeac3992
commit 1cb0ac2978
4 changed files with 70 additions and 65 deletions

View File

@ -38,7 +38,6 @@ import { http } from '../../utils/request';
* paymentStatus: number,
* paymentProofUrl: string,
* registrationTime: string,
* registrationStatus: number,
* items: Array<{
* participantInfo: string,
* projectName: string,
@ -55,7 +54,7 @@ export const eventregistrationPagePost = (data) => {
* 批量审核
* @param {Object} data - 审核参数
* @param {Array<number>} data.ids - 报名记录ID数组
* @param {number} data.registrationStatus - 报名状态 (0:待审核, 1:审核通过, 2:审核驳回, 3:已取消, 4:已完成)
* @param {number} data.paymentStatus - 支付状态 (0:待审核, 1:审核通过, 2:审核驳回)
* @param {string} [data.reviewRemark] - 审核备注
*/
export const eventregistrationBatchauditPost = (data) => {

View File

@ -9,7 +9,13 @@
{{ scope.$index + 1 }}
</template>
<template #paymentMethod="scope">
{{ scope.row.paymentMethod }}
{{ scope.row.paymentMethod || '-' }}
</template>
<template #orderStatus="scope">
{{ scope.row.orderStatusText || '-' }}
</template>
<template #actualAmount="scope">
{{ formatAmount(scope.row.actualAmount) }}
</template>
<template #action="scope">
<el-button size="small" text type="primary" @click="onOpenMenu(scope.row.id)">
@ -25,7 +31,11 @@
<el-table-column prop="projectName" label="项目" align="center" />
<el-table-column prop="groupName" label="组别" align="center" />
<el-table-column prop="participantNames" label="参赛队员" align="center" show-overflow-tooltip />
<el-table-column prop="fee" label="费用(元)" align="center" width="120" />
<el-table-column prop="fee" label="费用(元)" align="center" width="120">
<template #default="scope">
{{ formatAmount(scope.row.fee) }}
</template>
</el-table-column>
</el-table>
<template #footer>
<span class="dialog-footer">
@ -43,8 +53,7 @@ import { ElMessage } from 'element-plus';
import ProTable from '/@/components/ProTable/index.vue';
import { orderPageGet , orderDetailGet} from '/@/api/match/order';
// 定义表单引用类型
const formRef = ref();
const tableRef = ref();
const formData = ref({
orderNo: '',
@ -67,19 +76,24 @@ const formData = ref({
const columns = ref([
{ prop: 'orderNo', label: '订单编号', align: 'center', search: { el: 'input', }, fixed: 'left', width: 150 },
{ prop: 'eventName', label: '所属赛事', search: { el: 'input', }, },
{ prop: 'paymentMethod', label: '支付方式', search: { el: 'select', }, enum: [{ label: '全部', value: 0 }, { label: '线上', value: 1 }, { label: '线下', value: 2 },], },
{ prop: 'actualAmount', label: '实付金额' },
{ prop: 'createdTime', label: '支付时间', search: { el: 'date-picker', props: { type: 'daterange' } } },
{ prop: 'orderStatus', label: '订单状态' },
{ 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: 'actualAmount', label: '实付金额', minWidth: 120 },
{ 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 },
{ prop: 'action', label: '操作', align: 'center', fixed: 'right', width: 120, },
]);
const isShowDialog = ref(false);
const dialogTitle = ref('新增');
const detailLoading = ref(false);
const formatAmount = (value) => {
if (value === null || value === undefined || value === '') return '-';
const num = Number(value);
return isNaN(num) ? '-' : num.toFixed(2);
};
const normalizeNames = (value) => {
if (Array.isArray(value)) return value.filter(Boolean).join('、');
if (typeof value === 'string') return value;
@ -97,7 +111,7 @@ const detailTableData = computed(() => {
const participantNames = normalizeNames(
item?.participantNames ?? item?.personNames ?? item?.memberNames ?? personNamesByItem
) || '-';
const fee = item?.subtotal ?? ((Number(item?.unitPrice) || 0) * (Number(item?.personCount) || 0));
const fee = item?.fee ?? item?.subtotal ?? ((Number(item?.unitPrice) || 0) * (Number(item?.personCount) || 0));
return {
projectName: item?.projectName ?? '-',
groupName: item?.groupName ?? item?.projectTypeName ?? '-',

View File

@ -57,7 +57,7 @@
<template #action="scope">
<el-popconfirm title="确认审核完毕吗?" @confirm="onSureOrder(scope.row.id)">
<template #reference>
<el-button size="small" :disabled="scope.row.registrationStatus !== 0" text
<el-button size="small" :disabled="scope.row.paymentStatus !== 0" text
type="primary"> 审核通过 </el-button>
</template>
</el-popconfirm>
@ -364,7 +364,7 @@ const columns = reactive([
]);
const onSureOrder = async (id) => {
const res = await eventregistrationBatchauditPost({ ids: [id], 'registrationStatus': 1 });
const res = await eventregistrationBatchauditPost({ ids: [id], 'paymentStatus': 1 });
if (res.succeeded) {
ElMessage.success('操作成功!');
initParam.value.refresh = !initParam.value.refresh;
@ -439,7 +439,7 @@ const onLookBook = async (id) => {
const allSure = async () => {
const res = await eventregistrationBatchauditPost({ ids: [...selectListIds.value], 'registrationStatus': 1 });
const res = await eventregistrationBatchauditPost({ ids: [...selectListIds.value], 'paymentStatus': 1 });
if (res.succeeded) {
ElMessage.success('操作成功!');
initParam.value.refresh = !initParam.value.refresh;

View File

@ -14,16 +14,33 @@
{{ scope.$index + 1 }}
</template>
<template #paymentMethod="scope">
{{ getPaymentMethodText(scope.row.paymentMethod) }}
{{ scope.row.paymentMethod || '-' }}
</template>
<template #orderType="scope">
{{ getOrderTypeText(scope.row.orderType) }}
{{ scope.row.orderType || '-' }}
</template>
<template #registrationMode="scope">
{{ getRegistrationModeText(scope.row.registrationMode) }}
{{ scope.row.registrationMode || '-' }}
</template>
<template #orderStatus="scope">
{{ scope.row.orderStatusText || getOrderStatusText(scope.row.orderStatus) }}
{{ scope.row.orderStatusText || '-' }}
</template>
<template #paymentProofUrl="scope">
<el-image v-if="scope.row.paymentProofUrl"
style="width: 40px; height: 40px"
:src="scope.row.paymentProofUrl"
:preview-src-list="[scope.row.paymentProofUrl]"
fit="cover" />
<span v-else>-</span>
</template>
<template #originalAmount="scope">
{{ formatAmount(scope.row.originalAmount) }}
</template>
<template #discountAmount="scope">
{{ formatAmount(scope.row.discountAmount) }}
</template>
<template #actualAmount="scope">
{{ formatAmount(scope.row.actualAmount) }}
</template>
<template #action="scope">
<el-button size="small" text type="primary" @click="onOpenMenu(scope.row.id)">
@ -39,7 +56,11 @@
<el-table-column prop="projectName" label="项目" align="center" />
<el-table-column prop="groupName" label="组别" align="center" />
<el-table-column prop="participantNames" label="参赛队员" align="center" show-overflow-tooltip />
<el-table-column prop="fee" label="费用(元)" align="center" width="120" />
<el-table-column prop="fee" label="费用(元)" align="center" width="120">
<template #default="scope">
{{ formatAmount(scope.row.fee) }}
</template>
</el-table-column>
</el-table>
<template #footer>
<span class="dialog-footer">
@ -58,8 +79,6 @@ import { Download } from '@element-plus/icons-vue';
import ProTable from '/@/components/ProTable/index.vue';
import { orderPageGet , orderDetailGet, orderExportGet } from '/@/api/match/order';
// 定义表单引用类型
const formRef = ref();
const tableRef = ref();
const exportLoading = ref(false);
@ -87,63 +106,36 @@ const columns = ref([
{ prop: 'orderNo', label: '订单编号', align: 'center', search: { el: 'input', }, fixed: 'left', width: 150 },
{ width: 180, prop: 'unitName', label: '单位名称', align: 'center', },
{ width: 120, prop: 'eventName', label: '所属赛事', search: { el: 'input', }, },
{ width: 120, prop: 'orderType', label: '订单类型', search: { el: 'select', }, enum: [{ label: '全部', value: 0 }, { label: '收款', value: 1 }, { label: '退款', value: 2 },], },
{ width: 100, prop: 'orderType', label: '订单类型', search: { el: 'select', }, enum: [{ label: '全部', value: 0 }, { label: '收款', value: 1 }, { label: '退款', value: 2 },], },
{ width: 120, prop: 'relatedOrderNo', label: '关联订单' },
{ width: 120, prop: 'paymentMethod', label: '支付方式', search: { el: 'select', }, enum: [{ label: '全部', value: 0 }, { label: '线上', value: 1 }, { label: '线下', value: 2 },], },
{ width: 120, prop: 'paymentProofUrl', label: '付款凭证' },
{ width: 120, prop: 'registrationMode', label: '报名方式', search: { el: 'select', }, enum: [{ label: '全部', value: 0 }, { label: '个人', value: 1 }, { label: '团队', value: 2 },], },
{ width: 120, prop: 'contactName', label: '报名用户' },
{ width: 100, prop: 'paymentMethod', label: '支付方式', search: { el: 'select', }, enum: [{ label: '全部', value: 0 }, { label: '线上', value: 2 }, { label: '线下', value: 1 },], },
{ width: 100, prop: 'paymentProofUrl', label: '付款凭证' },
{ width: 100, prop: 'registrationMode', label: '报名方式', search: { el: 'select', }, enum: [{ label: '全部', value: 0 }, { label: '个人', value: 1 }, { label: '团队', value: 2 },], },
{ width: 100, prop: 'contactName', label: '报名用户' },
{ width: 120, prop: 'contactPhone', label: '报名账号', search: { el: 'input' } },
{ width: 120, prop: 'originalAmount', label: '原金额' },
{ width: 120, prop: 'discountAmount', label: '优惠金额' },
{ width: 120, prop: 'actualAmount', label: '实付金额' },
{ width: 120, 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: 120, prop: 'createdTime', label: '生成时间', search: { el: 'date-picker', props: { type: 'daterange' } } },
{ width: 100, 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, },
]);
const isShowDialog = ref(false);
const dialogTitle = ref('新增');
const detailLoading = ref(false);
const formatAmount = (value) => {
if (value === null || value === undefined || value === '') return '-';
const num = Number(value);
return isNaN(num) ? '-' : num.toFixed(2);
};
const normalizeNames = (value) => {
if (Array.isArray(value)) return value.filter(Boolean).join('、');
if (typeof value === 'string') return value;
return '';
};
const getRegistrationModeText = (value) => {
const v = Number(value);
if (v === 1) return '个人';
if (v === 2) return '团队';
return '-';
};
const getOrderTypeText = (value) => {
const v = Number(value);
if (v === 1) return '收款';
if (v === 2) return '退款';
return '-';
};
const getPaymentMethodText = (value) => {
const v = Number(value);
if (v === 1) return '线上';
if (v === 2) return '线下';
return '-';
};
const getOrderStatusText = (value) => {
const v = Number(value);
if (v === 0) return '待支付';
if (v === 1) return '已支付';
if (v === 2) return '已取消';
if (v === 3) return '已退款';
if (v === 4) return '已发货';
if (v === 5) return '已完成';
return '-';
};
const detailTableData = computed(() => {
const items = formData.value?.items ?? [];
const persons = formData.value?.persons ?? [];
@ -155,7 +147,7 @@ const detailTableData = computed(() => {
const participantNames = normalizeNames(
item?.participantNames ?? item?.personNames ?? item?.memberNames ?? personNamesByItem
) || '-';
const fee = item?.subtotal ?? ((Number(item?.unitPrice) || 0) * (Number(item?.personCount) || 0));
const fee = item?.fee ?? item?.subtotal ?? ((Number(item?.unitPrice) || 0) * (Number(item?.personCount) || 0));
return {
projectName: item?.projectName ?? '-',
groupName: item?.groupName ?? item?.projectTypeName ?? '-',