2025-04-17 10:17:52 +08:00
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { ref } from "vue";
|
|
|
|
|
import { PureTableBar } from "@/components/RePureTableBar";
|
|
|
|
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
2025-04-28 11:05:44 +08:00
|
|
|
|
import { getReturnApprovalListApi, deleteReturnApprovalApi, exportReturnApprovalExcelApi, ReturnApprovalDTO, SearchReturnApprovalQuery } from "@/api/shop/approval";
|
2025-04-17 10:17:52 +08:00
|
|
|
|
import Delete from "@iconify-icons/ep/delete";
|
|
|
|
|
import Search from "@iconify-icons/ep/search";
|
|
|
|
|
import Refresh from "@iconify-icons/ep/refresh";
|
|
|
|
|
import View from "@iconify-icons/ep/view";
|
|
|
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
|
|
|
2025-04-19 16:28:04 +08:00
|
|
|
|
defineOptions({
|
|
|
|
|
name: "Approval"
|
|
|
|
|
});
|
|
|
|
|
|
2025-04-17 10:17:52 +08:00
|
|
|
|
const formRef = ref();
|
|
|
|
|
const tableRef = ref();
|
|
|
|
|
|
|
|
|
|
// 搜索表单
|
2025-04-28 09:54:46 +08:00
|
|
|
|
const searchFormParams = ref<SearchReturnApprovalQuery>({
|
2025-04-17 10:17:52 +08:00
|
|
|
|
approvalId: null,
|
|
|
|
|
orderId: null,
|
|
|
|
|
goodsId: null,
|
2025-04-28 09:54:46 +08:00
|
|
|
|
status: null,
|
|
|
|
|
approvalTime: null,
|
|
|
|
|
paymentMethod: null
|
2025-04-17 10:17:52 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 分页参数
|
|
|
|
|
const pagination = ref({
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
currentPage: 1,
|
|
|
|
|
total: 0
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const loading = ref(false);
|
2025-04-28 11:05:44 +08:00
|
|
|
|
const exportLoading = ref(false);
|
2025-04-17 10:17:52 +08:00
|
|
|
|
const dataList = ref<ReturnApprovalDTO[]>([]);
|
|
|
|
|
const multipleSelection = ref<number[]>([]);
|
|
|
|
|
const detailVisible = ref(false);
|
|
|
|
|
const currentDetail = ref<ReturnApprovalDTO>();
|
|
|
|
|
|
|
|
|
|
// 获取审批列表
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
try {
|
|
|
|
|
loading.value = true;
|
|
|
|
|
const { data } = await getReturnApprovalListApi({
|
|
|
|
|
...searchFormParams.value,
|
|
|
|
|
pageSize: pagination.value.pageSize,
|
|
|
|
|
pageNum: pagination.value.currentPage
|
|
|
|
|
});
|
|
|
|
|
dataList.value = data.rows.map(item => ({
|
|
|
|
|
...item,
|
2025-04-28 09:54:46 +08:00
|
|
|
|
statusStr: { 1: '待审核', 2: '已通过', 3: '已驳回' }[item.status],
|
|
|
|
|
auditImages: item.status === 2 ? item.auditImages : ''
|
2025-04-17 10:17:52 +08:00
|
|
|
|
}));
|
|
|
|
|
pagination.value.total = data.total;
|
|
|
|
|
} finally {
|
|
|
|
|
loading.value = false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 搜索
|
|
|
|
|
const onSearch = () => {
|
|
|
|
|
pagination.value.currentPage = 1;
|
|
|
|
|
getList();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 重置
|
|
|
|
|
const resetForm = () => {
|
|
|
|
|
formRef.value.resetFields();
|
|
|
|
|
onSearch();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 分页变化
|
|
|
|
|
const handlePaginationChange = () => getList();
|
|
|
|
|
|
|
|
|
|
// 批量删除
|
2025-04-28 11:05:44 +08:00
|
|
|
|
const handleExport = async () => {
|
|
|
|
|
try {
|
|
|
|
|
exportLoading.value = true;
|
|
|
|
|
const dateSuffix = searchFormParams.value.approvalTime
|
|
|
|
|
? `_${searchFormParams.value.approvalTime.split(' ')[0].replace(/-/g, '')}`
|
|
|
|
|
: '';
|
|
|
|
|
const fileName = `退货审批列表${dateSuffix}.xlsx`;
|
|
|
|
|
await exportReturnApprovalExcelApi({
|
|
|
|
|
...searchFormParams.value,
|
|
|
|
|
pageSize: pagination.value.pageSize,
|
|
|
|
|
pageNum: pagination.value.currentPage
|
|
|
|
|
}, fileName);
|
|
|
|
|
ElMessage.success('导出任务已开始,请稍后查看下载文件');
|
|
|
|
|
} catch (e) {
|
|
|
|
|
ElMessage.error('导出失败');
|
|
|
|
|
} finally {
|
|
|
|
|
exportLoading.value = false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-04-17 10:17:52 +08:00
|
|
|
|
const handleBulkDelete = async () => {
|
|
|
|
|
if (multipleSelection.value.length === 0) return;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
await ElMessageBox.confirm(
|
|
|
|
|
`确认删除选中的${multipleSelection.value.length}项审批记录?`,
|
|
|
|
|
"警告",
|
|
|
|
|
{ confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" }
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await deleteReturnApprovalApi(multipleSelection.value);
|
|
|
|
|
ElMessage.success("批量删除成功");
|
|
|
|
|
multipleSelection.value = [];
|
|
|
|
|
getList();
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error("删除取消或失败", error);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 查看详情
|
|
|
|
|
const showDetail = (row: ReturnApprovalDTO) => {
|
|
|
|
|
currentDetail.value = row;
|
|
|
|
|
detailVisible.value = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
getList();
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div class="main">
|
|
|
|
|
<el-form ref="formRef" :inline="true" :model="searchFormParams"
|
|
|
|
|
class="search-form bg-bg_color w-[99/100] pl-8 pt-[12px]">
|
2025-04-28 09:54:46 +08:00
|
|
|
|
<el-form-item label="审批时间:">
|
|
|
|
|
<el-date-picker v-model="searchFormParams.approvalTime" type="date" placeholder="选择审批时间"
|
|
|
|
|
value-format="YYYY-MM-DD HH:mm:ss" class="!w-[200px]" />
|
|
|
|
|
</el-form-item>
|
2025-04-17 10:17:52 +08:00
|
|
|
|
<el-form-item label="审批ID:" prop="approvalId">
|
|
|
|
|
<el-input v-model.number="searchFormParams.approvalId" placeholder="请输入审批ID" clearable class="!w-[180px]" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="订单ID:" prop="orderId">
|
|
|
|
|
<el-input v-model.number="searchFormParams.orderId" placeholder="请输入订单ID" clearable class="!w-[180px]" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="商品ID:" prop="goodsId">
|
|
|
|
|
<el-input v-model.number="searchFormParams.goodsId" placeholder="请输入商品ID" clearable class="!w-[180px]" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="状态:" prop="status">
|
|
|
|
|
<el-select v-model="searchFormParams.status" placeholder="请选择状态" clearable class="!w-[180px]">
|
|
|
|
|
<el-option label="待审核" :value="1" />
|
|
|
|
|
<el-option label="已通过" :value="2" />
|
|
|
|
|
<el-option label="已驳回" :value="3" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
2025-04-28 09:54:46 +08:00
|
|
|
|
<el-form-item label="支付方式:" prop="paymentMethod">
|
|
|
|
|
<el-select v-model="searchFormParams.paymentMethod" placeholder="请选择支付方式" clearable class="!w-[180px]">
|
|
|
|
|
<el-option label="微信支付" value="wechat" />
|
|
|
|
|
<el-option label="余额支付" value="balance" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
2025-04-17 10:17:52 +08:00
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" :icon="useRenderIcon(Search)" @click="onSearch">
|
|
|
|
|
搜索
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button :icon="useRenderIcon(Refresh)" @click="resetForm">
|
|
|
|
|
重置
|
|
|
|
|
</el-button>
|
2025-04-28 11:05:44 +08:00
|
|
|
|
<el-button type="success" :loading="exportLoading" :icon="useRenderIcon('vscode-icons:file-type-excel2')"
|
|
|
|
|
@click="handleExport">
|
|
|
|
|
导出Excel
|
|
|
|
|
</el-button>
|
2025-04-17 10:17:52 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
<PureTableBar title="退货审批列表" @refresh="getList">
|
|
|
|
|
<template #buttons>
|
|
|
|
|
<el-button type="danger" :icon="useRenderIcon(Delete)" :disabled="multipleSelection.length === 0"
|
|
|
|
|
@click="handleBulkDelete">
|
|
|
|
|
批量删除
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
<el-table ref="tableRef" v-loading="loading" :data="dataList" row-key="approvalId"
|
|
|
|
|
@selection-change="rows => multipleSelection = rows.map(r => r.approvalId)" border>
|
2025-04-28 11:05:44 +08:00
|
|
|
|
<el-table-column label="审批ID" prop="approvalId" width="80" />
|
|
|
|
|
<el-table-column label="订单ID" prop="orderId" width="80" />
|
|
|
|
|
<el-table-column label="商品ID" prop="goodsId" width="80" />
|
2025-04-28 09:54:46 +08:00
|
|
|
|
<el-table-column label="用户姓名" prop="name" width="100" />
|
|
|
|
|
<el-table-column label="手机号" prop="mobile" width="120" />
|
|
|
|
|
<el-table-column label="商品名称" prop="goodsName" width="120" />
|
2025-04-28 11:05:44 +08:00
|
|
|
|
<el-table-column label="商品封面" width="120">
|
2025-04-28 09:54:46 +08:00
|
|
|
|
<template #default="{ row }">
|
2025-04-28 11:05:44 +08:00
|
|
|
|
<div v-if="row.coverImg" class="flex gap-2">
|
|
|
|
|
<el-image v-for="(img, index) in row.coverImg.split(',')" :key="index" :src="img"
|
|
|
|
|
:preview-src-list="row.coverImg.split(',')" :z-index="9999" :preview-teleported="true"
|
|
|
|
|
:hide-on-click-modal="true" fit="cover" class="rounded" width="40" height="40" />
|
|
|
|
|
</div>
|
2025-04-28 09:54:46 +08:00
|
|
|
|
<span v-else>-</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2025-04-28 11:05:44 +08:00
|
|
|
|
<el-table-column label="商品价格" prop="goodsPrice" width="90">
|
2025-04-28 09:54:46 +08:00
|
|
|
|
<template #default="{ row }">{{ row.goodsPrice }}元</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="支付方式" prop="paymentMethod" width="100">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
{{ { wechat: '微信支付', balance: '余额支付' }[row.paymentMethod] || row.paymentMethod }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2025-04-28 11:05:44 +08:00
|
|
|
|
<el-table-column label="退货数量" prop="returnQuantity" width="90" />
|
|
|
|
|
<el-table-column label="退款金额" prop="returnAmount" width="90">
|
2025-04-28 09:54:46 +08:00
|
|
|
|
<template #default="{ row }">{{ row.returnAmount }}元</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="提交时间" prop="createTime" width="180">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
{{ row.createTime ? new Date(row.createTime).toLocaleString() : '-' }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2025-04-28 11:05:44 +08:00
|
|
|
|
<el-table-column label="状态" prop="status" width="100">
|
2025-04-17 10:17:52 +08:00
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-tag :type="{ 1: 'warning', 2: 'success', 3: 'danger' }[row.status]">
|
|
|
|
|
{{ row.statusStr }}
|
|
|
|
|
</el-tag>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2025-04-28 09:54:46 +08:00
|
|
|
|
<el-table-column label="审批时间" prop="approvalTime" width="180">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
{{ row.approvalTime ? new Date(row.approvalTime).toLocaleString() : '-' }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="退货图片" width="140">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<div v-if="row.returnImages" class="flex gap-2">
|
|
|
|
|
<el-image v-for="(img, index) in row.returnImages.split(',')" :key="index" :src="img"
|
|
|
|
|
:preview-src-list="row.returnImages.split(',')" :z-index="9999" :preview-teleported="true"
|
|
|
|
|
:hide-on-click-modal="true" fit="cover" class="rounded" width="40" height="40" />
|
|
|
|
|
</div>
|
|
|
|
|
<span v-else>-</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2025-04-17 10:17:52 +08:00
|
|
|
|
<el-table-column label="操作" width="120" fixed="right">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-button type="primary" link :icon="useRenderIcon(View)" @click="showDetail(row)">
|
|
|
|
|
详情
|
|
|
|
|
</el-button>
|
2025-04-28 09:54:46 +08:00
|
|
|
|
<!-- <el-popconfirm :title="`确认删除审批记录#${row.approvalId}?`"
|
2025-04-17 10:17:52 +08:00
|
|
|
|
@confirm="() => deleteReturnApprovalApi([row.approvalId])">
|
|
|
|
|
<template #reference>
|
|
|
|
|
<el-button type="danger" link :icon="useRenderIcon(Delete)">
|
|
|
|
|
删除
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
2025-04-28 09:54:46 +08:00
|
|
|
|
</el-popconfirm> -->
|
2025-04-17 10:17:52 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<el-pagination v-model:current-page="pagination.currentPage" v-model:page-size="pagination.pageSize"
|
|
|
|
|
:page-sizes="[10, 20, 50]" layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"
|
|
|
|
|
@size-change="handlePaginationChange" @current-change="handlePaginationChange" />
|
|
|
|
|
</PureTableBar>
|
|
|
|
|
|
|
|
|
|
<!-- 详情弹窗 -->
|
|
|
|
|
<el-dialog v-model="detailVisible" title="审批详情" width="50%">
|
|
|
|
|
<el-descriptions :column="2" border>
|
2025-04-28 09:54:46 +08:00
|
|
|
|
<el-descriptions-item label="退货说明">{{ currentDetail?.returnRemark || '无' }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="审核说明">{{ currentDetail?.auditRemark || '无' }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="退货图片" :span="2">
|
2025-04-17 10:17:52 +08:00
|
|
|
|
<div class="flex flex-wrap gap-2">
|
2025-04-28 09:54:46 +08:00
|
|
|
|
<el-image v-for="(img, index) in currentDetail?.returnImages?.split(',')" :key="index" :src="img"
|
|
|
|
|
:preview-src-list="currentDetail?.returnImages?.split(',')" :initial-index="index" fit="cover"
|
2025-04-17 10:17:52 +08:00
|
|
|
|
class="w-20 h-20 rounded" />
|
|
|
|
|
</div>
|
|
|
|
|
</el-descriptions-item>
|
2025-04-28 09:54:46 +08:00
|
|
|
|
<el-descriptions-item label="审核图片" :span="2" v-if="currentDetail?.auditImages?.length">
|
2025-04-17 10:17:52 +08:00
|
|
|
|
<div class="flex flex-wrap gap-2">
|
2025-04-28 09:54:46 +08:00
|
|
|
|
<el-image v-for="(img, index) in currentDetail?.auditImages?.split(',')" :key="index" :src="img"
|
|
|
|
|
:preview-src-list="currentDetail?.auditImages?.split(',')" fit="cover" class="w-20 h-20 rounded" />
|
2025-04-17 10:17:52 +08:00
|
|
|
|
</div>
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
</el-descriptions>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
:deep(.el-image-viewer__wrapper) {
|
|
|
|
|
z-index: 9999 !important;
|
|
|
|
|
}
|
|
|
|
|
</style>
|