订单统计筛选
This commit is contained in:
parent
f75fcab291
commit
9f92b4da87
@ -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,24 +152,31 @@ 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);
|
animateNumber('totalDiscountAmount', data.totalDiscountAmount);
|
||||||
animateNumber('totalDiscountAmount', data.totalDiscountAmount);
|
animateNumber('totalActualAmount', data.totalActualAmount);
|
||||||
animateNumber('totalActualAmount', data.totalActualAmount);
|
animateNumber('totalRefundAmount', data.totalRefundAmount);
|
||||||
animateNumber('totalRefundAmount', data.totalRefundAmount);
|
}
|
||||||
}
|
} catch (error) {
|
||||||
} catch (error) {
|
console.error('获取统计数据失败:', error);
|
||||||
console.error('获取统计数据失败:', error);
|
} finally {
|
||||||
} finally {
|
statsLoading.value = false;
|
||||||
statsLoading.value = false;
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
// 包装 orderPageGet,在数据加载完成后调用 fetchStats
|
||||||
|
const wrappedOrderPageGet = async (params) => {
|
||||||
|
const result = await orderPageGet(params);
|
||||||
|
// 等待结果返回后调用 fetchStats
|
||||||
|
fetchStats(params);
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
@ -330,9 +337,7 @@ const handleExport = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
fetchStats();
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user