订单统计筛选

This commit is contained in:
马梓彭 2026-05-18 11:46:13 +08:00
parent f75fcab291
commit 9f92b4da87

View File

@ -26,8 +26,8 @@
</div> </div>
</div> </div>
</div> </div>
<ProTable ref="tableRef" :request-api="orderPageGet" :columns="columns" :pagination="true" <ProTable ref="tableRef" :request-api="wrappedOrderPageGet" :columns="columns" :pagination="true"
:tool-button="true" @search="fetchStats" @reset="fetchStats"> :tool-button="true">
<template #tools> <template #tools>
<el-button v-auth="'order:export'" type="primary" :loading="exportLoading" @click="handleExport"> <el-button v-auth="'order:export'" type="primary" :loading="exportLoading" @click="handleExport">
<template #icon> <template #icon>
@ -105,7 +105,7 @@
</template> </template>
<script setup> <script setup>
import { ref, computed, onMounted } from 'vue'; import { ref, computed } from 'vue';
import { ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus';
import { Download } from '@element-plus/icons-vue'; import { Download } from '@element-plus/icons-vue';
import ProTable from '/@/components/ProTable/index.vue'; import ProTable from '/@/components/ProTable/index.vue';
@ -152,12 +152,11 @@ const animateNumber = (key, targetValue) => {
}; };
// 获取统计数据 // 获取统计数据
const fetchStats = async () => { const fetchStats = async (searchParams) => {
try { try {
statsLoading.value = true; statsLoading.value = true;
await new Promise(resolve => setTimeout(resolve, 200)); const params = searchParams || tableRef.value?.searchParam || {};
const searchParams = tableRef.value?.searchParam || {}; const { succeeded, data } = await orderStatsGet(params);
const { succeeded, data } = await orderStatsGet(searchParams);
if (succeeded && data) { if (succeeded && data) {
statsData.value = data; statsData.value = data;
animateNumber('totalOriginalAmount', data.totalOriginalAmount); animateNumber('totalOriginalAmount', data.totalOriginalAmount);
@ -172,6 +171,14 @@ const fetchStats = async () => {
} }
}; };
// 包装 orderPageGet,在数据加载完成后调用 fetchStats
const wrappedOrderPageGet = async (params) => {
const result = await orderPageGet(params);
// 等待结果返回后调用 fetchStats
fetchStats(params);
return result;
};
const formData = ref({ const formData = ref({
orderNo: '', orderNo: '',
eventId: 0, eventId: 0,
@ -330,9 +337,7 @@ const handleExport = async () => {
} }
}; };
onMounted(() => {
fetchStats();
});
</script> </script>