|
@@ -25,8 +25,8 @@
|
|
|
<template #status="scope">
|
|
<template #status="scope">
|
|
|
<!-- 代金券:显示状态和审核状态两行 -->
|
|
<!-- 代金券:显示状态和审核状态两行 -->
|
|
|
<template v-if="activeName === '1'">
|
|
<template v-if="activeName === '1'">
|
|
|
- <p style="margin: 0; line-height: 1.5">状态:{{ getStatusLabel(scope.row.status) || "--" }}</p>
|
|
|
|
|
- <p style="margin: 0; line-height: 1.5">审核状态:{{ getReviewStatusLabel(scope.row.reviewType) || "--" }}</p>
|
|
|
|
|
|
|
+ <p style="margin: 0; line-height: 1.5">状态:{{ getStatusLabel(scope.row.status, scope.row.dataType) || "--" }}</p>
|
|
|
|
|
+ <p style="margin: 0; line-height: 1.5">审核状态:{{ scope.row.statusName || "--" }}</p>
|
|
|
</template>
|
|
</template>
|
|
|
<!-- 优惠券:只显示状态一行 -->
|
|
<!-- 优惠券:只显示状态一行 -->
|
|
|
<template v-else>
|
|
<template v-else>
|
|
@@ -286,17 +286,19 @@ const voucherColumns = reactive<ColumnProps<any>[]>([
|
|
|
// 优惠券表格列配置
|
|
// 优惠券表格列配置
|
|
|
const couponColumns = reactive<ColumnProps<any>[]>([
|
|
const couponColumns = reactive<ColumnProps<any>[]>([
|
|
|
{
|
|
{
|
|
|
- prop: "couponName",
|
|
|
|
|
|
|
+ prop: "name",
|
|
|
label: "券名称",
|
|
label: "券名称",
|
|
|
search: {
|
|
search: {
|
|
|
el: "input"
|
|
el: "input"
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- prop: "saleNum",
|
|
|
|
|
|
|
+ prop: "quantityClaimed",
|
|
|
label: "已领",
|
|
label: "已领",
|
|
|
render: scope => {
|
|
render: scope => {
|
|
|
- return scope.row.saleNum === null || scope.row.saleNum === undefined || scope.row.saleNum === "" ? 0 : scope.row.saleNum;
|
|
|
|
|
|
|
+ return scope.row.quantityClaimed === null || scope.row.quantityClaimed === undefined || scope.row.quantityClaimed === ""
|
|
|
|
|
+ ? 0
|
|
|
|
|
+ : scope.row.quantityClaimed;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -315,6 +317,7 @@ const couponColumns = reactive<ColumnProps<any>[]>([
|
|
|
{
|
|
{
|
|
|
prop: "couponStatus",
|
|
prop: "couponStatus",
|
|
|
label: "状态",
|
|
label: "状态",
|
|
|
|
|
+ isShow: false,
|
|
|
search: {
|
|
search: {
|
|
|
el: "select",
|
|
el: "select",
|
|
|
props: { placeholder: "请选择" }
|
|
props: { placeholder: "请选择" }
|
|
@@ -322,6 +325,10 @@ const couponColumns = reactive<ColumnProps<any>[]>([
|
|
|
enum: statusEnumY,
|
|
enum: statusEnumY,
|
|
|
fieldNames: { label: "label", value: "value" }
|
|
fieldNames: { label: "label", value: "value" }
|
|
|
},
|
|
},
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: "status",
|
|
|
|
|
+ label: "状态"
|
|
|
|
|
+ },
|
|
|
{ prop: "operation", label: "操作", fixed: "right", width: 330 }
|
|
{ prop: "operation", label: "操作", fixed: "right", width: 330 }
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
@@ -336,7 +343,7 @@ const allTabOptions = [
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
// 状态枚举:1草稿 1待审核 2未开始 3审核拒绝 4已售罄 5进行中 6已下架 7已结束
|
|
// 状态枚举:1草稿 1待审核 2未开始 3审核拒绝 4已售罄 5进行中 6已下架 7已结束
|
|
|
-const STATUS = {
|
|
|
|
|
|
|
+const VO_STATUS = {
|
|
|
草稿: 1,
|
|
草稿: 1,
|
|
|
待审核: 1,
|
|
待审核: 1,
|
|
|
未开始: 2,
|
|
未开始: 2,
|
|
@@ -346,39 +353,47 @@ const STATUS = {
|
|
|
已下架: 6,
|
|
已下架: 6,
|
|
|
已结束: 7
|
|
已结束: 7
|
|
|
} as const;
|
|
} as const;
|
|
|
-
|
|
|
|
|
|
|
+// 状态枚举:1草稿 1待审核 2未开始 3审核拒绝 4已售罄 5进行中 6已下架 7已结束
|
|
|
|
|
+const CO_STATUS = {
|
|
|
|
|
+ 进行中: 0,
|
|
|
|
|
+ 已结束: 1,
|
|
|
|
|
+ 未开始: 2,
|
|
|
|
|
+ 已下架: 3,
|
|
|
|
|
+ 已售罄: 4,
|
|
|
|
|
+ 草稿: 5
|
|
|
|
|
+} as const;
|
|
|
// 代金券操作按钮权限配置:定义每个操作按钮在哪些状态下显示
|
|
// 代金券操作按钮权限配置:定义每个操作按钮在哪些状态下显示
|
|
|
const VOUCHER_OPERATION_PERMISSIONS = {
|
|
const VOUCHER_OPERATION_PERMISSIONS = {
|
|
|
// 查看详情:待审核、未开始、审核拒绝、进行中、已售罄、已下架
|
|
// 查看详情:待审核、未开始、审核拒绝、进行中、已售罄、已下架
|
|
|
- 查看详情: [STATUS.待审核, STATUS.未开始, STATUS.审核拒绝, STATUS.进行中, STATUS.已售罄, STATUS.已下架],
|
|
|
|
|
|
|
+ 查看详情: [VO_STATUS.待审核, VO_STATUS.未开始, VO_STATUS.审核拒绝, VO_STATUS.进行中, VO_STATUS.已售罄, VO_STATUS.已下架],
|
|
|
// 上架:未开始、已下架
|
|
// 上架:未开始、已下架
|
|
|
- 上架: [STATUS.未开始, STATUS.已下架],
|
|
|
|
|
|
|
+ 上架: [VO_STATUS.未开始, VO_STATUS.已下架],
|
|
|
// 下架:进行中
|
|
// 下架:进行中
|
|
|
- 下架: [STATUS.进行中],
|
|
|
|
|
|
|
+ 下架: [VO_STATUS.进行中],
|
|
|
// 修改库存:未开始、进行中、已售罄
|
|
// 修改库存:未开始、进行中、已售罄
|
|
|
- 修改库存: [STATUS.未开始, STATUS.进行中, STATUS.已售罄],
|
|
|
|
|
|
|
+ 修改库存: [VO_STATUS.未开始, VO_STATUS.进行中, VO_STATUS.已售罄],
|
|
|
// 编辑:草稿、审核拒绝、已售罄、已下架、已结束
|
|
// 编辑:草稿、审核拒绝、已售罄、已下架、已结束
|
|
|
- 编辑: [STATUS.草稿, STATUS.审核拒绝, STATUS.已售罄, STATUS.已下架, STATUS.已结束],
|
|
|
|
|
|
|
+ 编辑: [VO_STATUS.草稿, VO_STATUS.审核拒绝, VO_STATUS.已售罄, VO_STATUS.已下架, VO_STATUS.已结束],
|
|
|
// 删除:草稿、未开始、审核拒绝、已售罄、已结束
|
|
// 删除:草稿、未开始、审核拒绝、已售罄、已结束
|
|
|
- 删除: [STATUS.草稿, STATUS.未开始, STATUS.审核拒绝, STATUS.已售罄, STATUS.已结束],
|
|
|
|
|
|
|
+ 删除: [VO_STATUS.草稿, VO_STATUS.未开始, VO_STATUS.审核拒绝, VO_STATUS.已售罄, VO_STATUS.已结束],
|
|
|
// 查看拒绝原因:审核拒绝
|
|
// 查看拒绝原因:审核拒绝
|
|
|
- 查看拒绝原因: [STATUS.审核拒绝]
|
|
|
|
|
|
|
+ 查看拒绝原因: [VO_STATUS.审核拒绝]
|
|
|
} as const;
|
|
} as const;
|
|
|
|
|
|
|
|
// 优惠券操作按钮权限配置
|
|
// 优惠券操作按钮权限配置
|
|
|
const COUPON_OPERATION_PERMISSIONS = {
|
|
const COUPON_OPERATION_PERMISSIONS = {
|
|
|
// 查看详情:草稿、未开始、进行中、已下架、已结束、已售罄
|
|
// 查看详情:草稿、未开始、进行中、已下架、已结束、已售罄
|
|
|
- 查看详情: [STATUS.草稿, STATUS.未开始, STATUS.进行中, STATUS.已下架, STATUS.已结束, STATUS.已售罄],
|
|
|
|
|
|
|
+ 查看详情: [CO_STATUS.草稿, CO_STATUS.未开始, CO_STATUS.进行中, CO_STATUS.已下架, CO_STATUS.已结束, CO_STATUS.已售罄],
|
|
|
// 上架:未开始、已下架
|
|
// 上架:未开始、已下架
|
|
|
- 上架: [STATUS.未开始, STATUS.已下架],
|
|
|
|
|
|
|
+ 上架: [CO_STATUS.未开始, CO_STATUS.已下架],
|
|
|
// 下架:进行中
|
|
// 下架:进行中
|
|
|
- 下架: [STATUS.进行中],
|
|
|
|
|
|
|
+ 下架: [CO_STATUS.进行中],
|
|
|
// 修改库存:未开始、进行中、已售罄
|
|
// 修改库存:未开始、进行中、已售罄
|
|
|
- 修改库存: [STATUS.未开始, STATUS.进行中, STATUS.已售罄],
|
|
|
|
|
|
|
+ 修改库存: [CO_STATUS.未开始, CO_STATUS.进行中, CO_STATUS.已售罄],
|
|
|
// 编辑:草稿、未开始、进行中、已下架、已结束、已售罄
|
|
// 编辑:草稿、未开始、进行中、已下架、已结束、已售罄
|
|
|
- 编辑: [STATUS.草稿, STATUS.未开始, STATUS.进行中, STATUS.已下架, STATUS.已结束, STATUS.已售罄],
|
|
|
|
|
|
|
+ 编辑: [CO_STATUS.草稿, CO_STATUS.未开始, CO_STATUS.进行中, CO_STATUS.已下架, CO_STATUS.已结束, CO_STATUS.已售罄],
|
|
|
// 删除:草稿、已结束、已售罄
|
|
// 删除:草稿、已结束、已售罄
|
|
|
- 删除: [STATUS.草稿, STATUS.已结束, STATUS.已售罄]
|
|
|
|
|
|
|
+ 删除: [CO_STATUS.草稿, CO_STATUS.已结束, CO_STATUS.已售罄]
|
|
|
} as const;
|
|
} as const;
|
|
|
|
|
|
|
|
// 判断按钮是否显示的工具函数
|
|
// 判断按钮是否显示的工具函数
|
|
@@ -398,31 +413,24 @@ const isVoucher = computed(() => activeName.value === "1");
|
|
|
const isCoupon = computed(() => activeName.value === "2");
|
|
const isCoupon = computed(() => activeName.value === "2");
|
|
|
|
|
|
|
|
// 获取状态标签
|
|
// 获取状态标签
|
|
|
-const getStatusLabel = (status: number) => {
|
|
|
|
|
- const statusMap: Record<number, string> = {
|
|
|
|
|
- 0: "草稿",
|
|
|
|
|
- 1: "待审核",
|
|
|
|
|
- 2: "未开始",
|
|
|
|
|
- 3: "审核拒绝",
|
|
|
|
|
- 4: "已售罄",
|
|
|
|
|
- 5: "进行中",
|
|
|
|
|
- 6: "已下架",
|
|
|
|
|
- 7: "已结束"
|
|
|
|
|
- };
|
|
|
|
|
- return statusMap[status] || "--";
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
-// 获取审核状态标签
|
|
|
|
|
-const getReviewStatusLabel = (reviewType: string | number) => {
|
|
|
|
|
- if (reviewType === null || reviewType === undefined || reviewType === "") {
|
|
|
|
|
- return "";
|
|
|
|
|
|
|
+const getStatusLabel = (status: number, dataType?: number) => {
|
|
|
|
|
+ // 代金券且状态为1时,根据dataType判断
|
|
|
|
|
+ if (isVoucher.value && status === 1) {
|
|
|
|
|
+ if (dataType === 0) {
|
|
|
|
|
+ return "待审核";
|
|
|
|
|
+ } else if (dataType === 1) {
|
|
|
|
|
+ return "草稿";
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- const reviewStatusMap: Record<string, string> = {
|
|
|
|
|
- "0": "待审核",
|
|
|
|
|
- "1": "审核通过",
|
|
|
|
|
- "2": "审核驳回"
|
|
|
|
|
- };
|
|
|
|
|
- return reviewStatusMap[String(reviewType)] || "";
|
|
|
|
|
|
|
+ // 根据当前选中的tab选择对应的状态枚举
|
|
|
|
|
+ const statusEnum = isVoucher.value ? VO_STATUS : CO_STATUS;
|
|
|
|
|
+ // 从状态枚举中查找对应的标签
|
|
|
|
|
+ for (const [label, value] of Object.entries(statusEnum)) {
|
|
|
|
|
+ if (value === status) {
|
|
|
|
|
+ return label;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return "--";
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
|
|
// 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
|
|
@@ -459,17 +467,20 @@ onActivated(() => {
|
|
|
proTable.value?.getTableList();
|
|
proTable.value?.getTableList();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-// 监听路由变化,当从详情页返回时恢复 activeName
|
|
|
|
|
|
|
+// 监听路由变化,当从详情页或编辑页返回时恢复 activeName
|
|
|
watch(
|
|
watch(
|
|
|
() => route.path,
|
|
() => route.path,
|
|
|
(newPath, oldPath) => {
|
|
(newPath, oldPath) => {
|
|
|
- // 如果当前路径是列表页,且之前路径是详情页,则恢复 activeName
|
|
|
|
|
|
|
+ // 如果当前路径是列表页,且之前路径是详情页或编辑页,则恢复 activeName
|
|
|
if (
|
|
if (
|
|
|
newPath.includes("/ticketManagement") &&
|
|
newPath.includes("/ticketManagement") &&
|
|
|
!newPath.includes("/detail") &&
|
|
!newPath.includes("/detail") &&
|
|
|
!newPath.includes("/newVoucher") &&
|
|
!newPath.includes("/newVoucher") &&
|
|
|
!newPath.includes("/newCoupon") &&
|
|
!newPath.includes("/newCoupon") &&
|
|
|
- (oldPath?.includes("/ticketManagement/detail") || oldPath?.includes("/ticketManagement/couponDetail"))
|
|
|
|
|
|
|
+ (oldPath?.includes("/ticketManagement/detail") ||
|
|
|
|
|
+ oldPath?.includes("/ticketManagement/couponDetail") ||
|
|
|
|
|
+ oldPath?.includes("/ticketManagement/newVoucher") ||
|
|
|
|
|
+ oldPath?.includes("/ticketManagement/newCoupon"))
|
|
|
) {
|
|
) {
|
|
|
restoreActiveName();
|
|
restoreActiveName();
|
|
|
}
|
|
}
|
|
@@ -531,6 +542,8 @@ const toDetail = (row: any) => {
|
|
|
};
|
|
};
|
|
|
// 编辑行数据
|
|
// 编辑行数据
|
|
|
const editRow = (row: any) => {
|
|
const editRow = (row: any) => {
|
|
|
|
|
+ // 保存当前 activeName 到 sessionStorage
|
|
|
|
|
+ sessionStorage.setItem("ticketManagement_activeName", activeName.value);
|
|
|
const path = isVoucher.value
|
|
const path = isVoucher.value
|
|
|
? `/ticketManagement/newVoucher?id=${row.id}&type=edit`
|
|
? `/ticketManagement/newVoucher?id=${row.id}&type=edit`
|
|
|
: `/ticketManagement/newCoupon?id=${row.id}&type=edit`;
|
|
: `/ticketManagement/newCoupon?id=${row.id}&type=edit`;
|
|
@@ -570,7 +583,8 @@ const deleteRow = (row: any) => {
|
|
|
};
|
|
};
|
|
|
// Tab切换处理
|
|
// Tab切换处理
|
|
|
const handleClick = () => {
|
|
const handleClick = () => {
|
|
|
- proTable.value?.getTableList();
|
|
|
|
|
|
|
+ // initParam 中的 couponType 是响应式的,当 activeName 变化时会自动触发 ProTable 内部的 watch 监听,无需手动调用
|
|
|
|
|
+ // proTable.value?.getTableList();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 修改状态(上架/下架)
|
|
// 修改状态(上架/下架)
|