|
|
@@ -27,8 +27,10 @@
|
|
|
<template #status="scope">
|
|
|
<!-- 代金券:显示状态和审核状态两行 -->
|
|
|
<template v-if="activeName === '1'">
|
|
|
- <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>
|
|
|
+ <p style="margin: 0; line-height: 1.5">
|
|
|
+ 状态:{{ scope.row.dataType === 1 ? "草稿" : scope.row.statusName ? scope.row.statusName : "--" }}
|
|
|
+ </p>
|
|
|
+ <p style="margin: 0; line-height: 1.5" v-if="scope.row.dataType == 0">审核状态:{{ scope.row.reviewType || "--" }}</p>
|
|
|
</template>
|
|
|
<!-- 优惠券:只显示状态一行 -->
|
|
|
<template v-else>
|
|
|
@@ -64,20 +66,11 @@
|
|
|
>
|
|
|
修改库存
|
|
|
</el-button>
|
|
|
- <!-- 查看拒绝原因按钮(仅代金券) -->
|
|
|
- <el-button
|
|
|
- v-if="isVoucher && canShowButton(scope.row.status, VOUCHER_OPERATION_PERMISSIONS.查看拒绝原因)"
|
|
|
- link
|
|
|
- type="primary"
|
|
|
- @click="viewRejectReason(scope.row)"
|
|
|
- >
|
|
|
- 查看拒绝原因
|
|
|
- </el-button>
|
|
|
<!-- 查看详情按钮 -->
|
|
|
<el-button
|
|
|
v-if="
|
|
|
isVoucher
|
|
|
- ? canShowButton(scope.row.status, currentOperationPermissions.查看详情) && scope.row.dataType != 1
|
|
|
+ ? canShowButton(scope.row.status, currentOperationPermissions.查看详情) && scope.row.dataType == 0
|
|
|
: canShowButton(scope.row.status, currentOperationPermissions.查看详情)
|
|
|
"
|
|
|
link
|
|
|
@@ -90,8 +83,7 @@
|
|
|
<el-button
|
|
|
v-if="
|
|
|
isVoucher
|
|
|
- ? canShowButton(scope.row.status, currentOperationPermissions.编辑) ||
|
|
|
- (scope.row.dataType == 1 && scope.row.status == 0)
|
|
|
+ ? canShowButton(scope.row.status, currentOperationPermissions.编辑) || scope.row.dataType == 1
|
|
|
: canShowButton(scope.row.status, currentOperationPermissions.编辑)
|
|
|
"
|
|
|
link
|
|
|
@@ -104,8 +96,7 @@
|
|
|
<el-button
|
|
|
v-if="
|
|
|
isVoucher
|
|
|
- ? canShowButton(scope.row.status, currentOperationPermissions.删除) ||
|
|
|
- (scope.row.dataType == 1 && scope.row.status == 0)
|
|
|
+ ? canShowButton(scope.row.status, currentOperationPermissions.删除) || scope.row.dataType == 1
|
|
|
: canShowButton(scope.row.status, currentOperationPermissions.删除)
|
|
|
"
|
|
|
link
|
|
|
@@ -114,6 +105,15 @@
|
|
|
>
|
|
|
删除
|
|
|
</el-button>
|
|
|
+ <!-- 查看拒绝原因按钮(仅代金券) -->
|
|
|
+ <el-button
|
|
|
+ v-if="isVoucher && canShowButton(scope.row.status, VOUCHER_OPERATION_PERMISSIONS.查看拒绝原因)"
|
|
|
+ link
|
|
|
+ type="primary"
|
|
|
+ @click="viewRejectReason(scope.row)"
|
|
|
+ >
|
|
|
+ 查看拒绝原因
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
</ProTable>
|
|
|
<el-dialog v-model="dialogFormVisible" title="修改库存" width="500">
|
|
|
@@ -212,7 +212,7 @@ const rules = reactive<FormRules<RuleForm>>({
|
|
|
// 验证新库存值不能小于剩余库存
|
|
|
const currentQty = Number(formInventory.value.singleQty) || 0;
|
|
|
if (numValue < currentQty) {
|
|
|
- callback(new Error(`库存不能小于剩余库存(${currentQty})`));
|
|
|
+ callback(new Error(`新库存值不能小于剩余库存(${currentQty})张`));
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
@@ -352,9 +352,8 @@ const allTabOptions = [
|
|
|
{ label: "优惠券", name: "2" }
|
|
|
];
|
|
|
|
|
|
-// 状态枚举:1草稿 1待审核 2未开始 3审核拒绝 4已售罄 5进行中 6已下架 7已结束
|
|
|
+// 状态枚举: 1待审核 2未开始 3审核拒绝 4已售罄 5进行中 6已下架 7已结束
|
|
|
const VO_STATUS = {
|
|
|
- 草稿: 1,
|
|
|
待审核: 1,
|
|
|
未开始: 2,
|
|
|
审核拒绝: 3,
|
|
|
@@ -363,7 +362,8 @@ const VO_STATUS = {
|
|
|
已下架: 6,
|
|
|
已结束: 7
|
|
|
} as const;
|
|
|
-// 状态枚举:1草稿 1待审核 2未开始 3审核拒绝 4已售罄 5进行中 6已下架 7已结束
|
|
|
+
|
|
|
+// 状态枚举:0进行中 1已结束 2未开始 3已下架 4已售罄 5草稿
|
|
|
const CO_STATUS = {
|
|
|
进行中: 0,
|
|
|
已结束: 1,
|
|
|
@@ -372,7 +372,8 @@ const CO_STATUS = {
|
|
|
已售罄: 4,
|
|
|
草稿: 5
|
|
|
} as const;
|
|
|
-// 代金券操作按钮权限配置:定义每个操作按钮在哪些状态下显示
|
|
|
+
|
|
|
+// 代金券操作按钮权限配置:定义每个操作按钮在哪些状态下显示 草稿单独判断
|
|
|
const VOUCHER_OPERATION_PERMISSIONS = {
|
|
|
// 查看详情:待审核、未开始、审核拒绝、进行中、已售罄、已下架
|
|
|
查看详情: [VO_STATUS.待审核, VO_STATUS.未开始, VO_STATUS.审核拒绝, VO_STATUS.进行中, VO_STATUS.已售罄, VO_STATUS.已下架],
|
|
|
@@ -382,10 +383,10 @@ const VOUCHER_OPERATION_PERMISSIONS = {
|
|
|
下架: [VO_STATUS.进行中],
|
|
|
// 修改库存:未开始、进行中、已售罄
|
|
|
修改库存: [VO_STATUS.未开始, VO_STATUS.进行中, VO_STATUS.已售罄],
|
|
|
- // 编辑:草稿、审核拒绝、已售罄、已下架、已结束
|
|
|
- 编辑: [VO_STATUS.草稿, VO_STATUS.审核拒绝, VO_STATUS.已售罄, VO_STATUS.已下架, VO_STATUS.已结束],
|
|
|
- // 删除:草稿、未开始、审核拒绝、已售罄、已结束
|
|
|
- 删除: [VO_STATUS.草稿, VO_STATUS.未开始, VO_STATUS.审核拒绝, VO_STATUS.已售罄, VO_STATUS.已结束],
|
|
|
+ // 编辑:审核拒绝、已售罄、已下架、已结束
|
|
|
+ 编辑: [VO_STATUS.审核拒绝, VO_STATUS.已售罄, VO_STATUS.已下架, VO_STATUS.已结束],
|
|
|
+ // 删除:未开始、审核拒绝、已售罄、已结束
|
|
|
+ 删除: [VO_STATUS.未开始, VO_STATUS.审核拒绝, VO_STATUS.已售罄, VO_STATUS.已结束],
|
|
|
// 查看拒绝原因:审核拒绝
|
|
|
查看拒绝原因: [VO_STATUS.审核拒绝]
|
|
|
} as const;
|
|
|
@@ -421,17 +422,9 @@ const isVoucher = computed(() => activeName.value === "1");
|
|
|
const isCoupon = computed(() => activeName.value === "2");
|
|
|
|
|
|
// 获取状态标签
|
|
|
-const getStatusLabel = (status: number, dataType?: number) => {
|
|
|
- // 代金券且状态为1时,根据dataType判断
|
|
|
- if (isVoucher.value && status === 1) {
|
|
|
- if (dataType === 0) {
|
|
|
- return "待审核";
|
|
|
- } else if (dataType === 1) {
|
|
|
- return "草稿";
|
|
|
- }
|
|
|
- }
|
|
|
+const getStatusLabel = (status: any) => {
|
|
|
// 根据当前选中的tab选择对应的状态枚举
|
|
|
- const statusEnum = isVoucher.value ? VO_STATUS : CO_STATUS;
|
|
|
+ const statusEnum = CO_STATUS;
|
|
|
// 从状态枚举中查找对应的标签
|
|
|
for (const [label, value] of Object.entries(statusEnum)) {
|
|
|
if (value === status) {
|