|
|
@@ -6,7 +6,12 @@
|
|
|
<span class="filter-label">姓名</span>
|
|
|
<el-input v-model="searchForm.reservationUserName" placeholder="请输入姓名" clearable style="width: 160px" />
|
|
|
<span class="filter-label">状态</span>
|
|
|
- <el-select v-model="searchForm.orderStatus" placeholder="请选择" clearable style="width: 180px">
|
|
|
+ <el-select
|
|
|
+ v-model="searchForm.orderStatus"
|
|
|
+ clearable
|
|
|
+ style="width: 180px"
|
|
|
+ @clear="searchForm.orderStatus = STATUS_FILTER_ALL"
|
|
|
+ >
|
|
|
<el-option
|
|
|
v-for="opt in statusOptions"
|
|
|
:key="`${opt.label}-${String(opt.value)}`"
|
|
|
@@ -65,21 +70,17 @@
|
|
|
>
|
|
|
<el-button link type="primary" @click="handleDelete(scope.row)"> 删除 </el-button>
|
|
|
</template>
|
|
|
+ <!-- 已过期(3) 且结束未超 3 小时:付费先判断(退款+删除),否则仅删除;顺序不可颠倒,否则宽条件会吃掉窄条件 -->
|
|
|
<template
|
|
|
- v-else-if="
|
|
|
- (isOrderStatus(scope.row, 2) || isOrderStatus(scope.row, 7) || isOrderStatus(scope.row, 3)) &&
|
|
|
- !isMoreThanThreeHoursAfterEnd(scope.row)
|
|
|
- "
|
|
|
+ v-else-if="isOrderStatus(scope.row, 3) && !isMoreThanThreeHoursAfterEnd(scope.row) && orderCostTypeIsPaid(scope.row)"
|
|
|
>
|
|
|
+ <el-button link type="primary" @click="handleRefund(scope.row)"> 退款 </el-button>
|
|
|
<el-button link type="primary" @click="handleDelete(scope.row)"> 删除 </el-button>
|
|
|
</template>
|
|
|
- <template v-else-if="isOrderStatus(scope.row, 7) && !isMoreThanThreeHoursAfterEnd(scope.row)">
|
|
|
+ <template v-else-if="isOrderStatus(scope.row, 3) && !isMoreThanThreeHoursAfterEnd(scope.row)">
|
|
|
<el-button link type="primary" @click="handleDelete(scope.row)"> 删除 </el-button>
|
|
|
</template>
|
|
|
- <template
|
|
|
- v-else-if="isOrderStatus(scope.row, 3) && !isMoreThanThreeHoursAfterEnd(scope.row) && orderCostTypeIsPaid(scope.row)"
|
|
|
- >
|
|
|
- <el-button link type="primary" @click="handleRefund(scope.row)"> 退款 </el-button>
|
|
|
+ <template v-else-if="isOrderStatus(scope.row, 7) && !isMoreThanThreeHoursAfterEnd(scope.row)">
|
|
|
<el-button link type="primary" @click="handleDelete(scope.row)"> 删除 </el-button>
|
|
|
</template>
|
|
|
<template v-else-if="isOrderStatus(scope.row, 4) && !orderCostTypeIsPaid(scope.row)">
|
|
|
@@ -97,13 +98,20 @@
|
|
|
</ProTable>
|
|
|
|
|
|
<!-- 查看原因 -->
|
|
|
- <el-dialog v-model="reasonDialogVisible" title="原因" width="420px" append-to-body destroy-on-close>
|
|
|
- <div class="reason-dialog-body">取消原因:</div>
|
|
|
- <div class="reason-dialog-body">
|
|
|
+ <el-dialog
|
|
|
+ v-model="reasonDialogVisible"
|
|
|
+ title="原因"
|
|
|
+ width="420px"
|
|
|
+ append-to-body
|
|
|
+ destroy-on-close
|
|
|
+ class="cancel-reason-dialog"
|
|
|
+ >
|
|
|
+ <div class="reason-dialog-body">取消原因</div>
|
|
|
+ <div class="reason-dialog-body" style="padding-left: 20px">
|
|
|
{{ reasonDialogText || "—" }}
|
|
|
</div>
|
|
|
<template #footer>
|
|
|
- <el-button type="primary" @click="reasonDialogVisible = false"> 知道了 </el-button>
|
|
|
+ <el-button type="primary" @click="reasonDialogVisible = false"> 返回 </el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
|
|
|
@@ -237,9 +245,11 @@ const columns: ColumnProps<ReservationRow>[] = [
|
|
|
*/
|
|
|
const STATUS_FILTER_MERCHANT_CANCEL = "merchant_cancel";
|
|
|
const STATUS_FILTER_USER_CANCEL = "user_cancel";
|
|
|
+/** 占位选项值:勿用 "",el-select 常无法匹配空串而不显示「全部」 */
|
|
|
+const STATUS_FILTER_ALL = "__all__";
|
|
|
|
|
|
const statusOptions: { label: string; value: number | string }[] = [
|
|
|
- { label: "全部", value: "" },
|
|
|
+ { label: "全部", value: STATUS_FILTER_ALL },
|
|
|
{ label: "待使用", value: 1 },
|
|
|
{ label: "退款成功", value: 7 },
|
|
|
{ label: "商家取消", value: STATUS_FILTER_MERCHANT_CANCEL },
|
|
|
@@ -281,14 +291,14 @@ const initParam = reactive({
|
|
|
/** 已生效的查询条件(点击搜索后写入;接口字段 reservationUserName、orderStatus) */
|
|
|
const listFilter = reactive({
|
|
|
reservationUserName: "",
|
|
|
- orderStatus: "" as number | string,
|
|
|
+ orderStatus: STATUS_FILTER_ALL as number | string,
|
|
|
startDate: "",
|
|
|
endDate: ""
|
|
|
});
|
|
|
|
|
|
const searchForm = reactive({
|
|
|
reservationUserName: "",
|
|
|
- orderStatus: "" as number | string,
|
|
|
+ orderStatus: STATUS_FILTER_ALL as number | string,
|
|
|
dateRange: [] as string[]
|
|
|
});
|
|
|
|
|
|
@@ -478,7 +488,7 @@ async function getTableList(params: any) {
|
|
|
req.reservationUserName = listFilter.reservationUserName.trim();
|
|
|
}
|
|
|
const sf = listFilter.orderStatus;
|
|
|
- if (sf !== undefined && sf !== "" && sf !== null) {
|
|
|
+ if (sf !== undefined && sf !== "" && sf !== null && sf !== STATUS_FILTER_ALL) {
|
|
|
if (sf === STATUS_FILTER_USER_CANCEL || sf === STATUS_FILTER_MERCHANT_CANCEL) {
|
|
|
req.orderStatus = 4;
|
|
|
} else {
|
|
|
@@ -529,10 +539,10 @@ function handleSearch() {
|
|
|
|
|
|
function handleReset() {
|
|
|
searchForm.reservationUserName = "";
|
|
|
- searchForm.orderStatus = "";
|
|
|
+ searchForm.orderStatus = STATUS_FILTER_ALL;
|
|
|
searchForm.dateRange = [];
|
|
|
listFilter.reservationUserName = "";
|
|
|
- listFilter.orderStatus = "";
|
|
|
+ listFilter.orderStatus = STATUS_FILTER_ALL;
|
|
|
listFilter.startDate = "";
|
|
|
listFilter.endDate = "";
|
|
|
proTable.value?.getTableList();
|
|
|
@@ -654,7 +664,7 @@ function handleDelete(row: ReservationRow) {
|
|
|
})
|
|
|
.then(async () => {
|
|
|
try {
|
|
|
- await reservationDelete({ id: row.id });
|
|
|
+ await reservationDelete({ reservationId: row.id });
|
|
|
ElMessage.success("删除成功");
|
|
|
proTable.value?.getTableList();
|
|
|
} catch (e: any) {
|
|
|
@@ -766,6 +776,7 @@ function handleRefund(row: ReservationRow) {
|
|
|
color: #606266;
|
|
|
}
|
|
|
.cancel-reason-dialog.el-dialog .el-dialog__body {
|
|
|
+ height: 300px;
|
|
|
padding-top: 8px;
|
|
|
}
|
|
|
.cancel-reason-form {
|