增加导出

This commit is contained in:
zhx 2026-06-09 15:42:57 +08:00
parent 1995f9b078
commit c22cff97c3
2 changed files with 38 additions and 11 deletions

View File

@ -241,6 +241,17 @@ export async function listInAppPurchase(params: Record<string, any>) {
);
}
export async function exportInAppPurchaseDetails(
params: Record<string, any>,
filename = 'InAppPurchaseOrders',
) {
return downloadLegacyExcel(
'/order/in-app-purchase/details/export',
params,
filename,
);
}
export async function getInAppPurchase(id: number | string) {
return requestClient.get<Record<string, any>>(
'/order/in-app-purchase/details',

View File

@ -1,33 +1,30 @@
<script lang="ts" setup>
import {
computed,
reactive,
ref,
watch } from 'vue';
import { computed, reactive, ref, watch } from 'vue';
import { useRouter } from 'vue-router';
import { Page } from '@vben/common-ui';
import { useAccessStore } from '@vben/stores';
import {
exportInAppPurchaseDetails,
getOrderAmount,
listInAppPurchase,
} from '#/api/legacy/operate';
} from '#/api/legacy/operate';
import { regionConfigTable } from '#/api/legacy/system';
import AccountInput from '#/components/account-input.vue';
import SysOriginTag from '#/components/sys-origin-tag.vue';
import { formatDate,
getAllowedSysOrigins } from '#/views/system/shared';
import { formatDate, getAllowedSysOrigins } from '#/views/system/shared';
import {
Button,
Card,
DatePicker,
Input,
message,
Select,
Space,
Table,
Tag
Tag,
} from 'antdv-next';
import {
@ -50,6 +47,7 @@ const sysOriginOptions = computed(() => {
const loading = ref(false);
const loadMoreLoading = ref(false);
const exporting = ref(false);
const list = ref<Array<Record<string, any>>>([]);
const regions = ref<Array<Record<string, any>>>([]);
const totalInfo = ref<Record<string, any>>({});
@ -137,10 +135,15 @@ async function loadData(reset = false) {
}
}
function buildQueryParams() {
function buildQueryParams(includePaging = true) {
query.sysOrigins = getEffectiveSysOrigin();
const params = { ...query };
if (!includePaging) {
delete params.lastId;
delete params.limit;
}
return Object.fromEntries(
Object.entries({ ...query }).filter(([, value]) => {
Object.entries(params).filter(([, value]) => {
if (Array.isArray(value)) {
return value.length > 0;
}
@ -153,6 +156,16 @@ function handleSearch() {
void loadData(true);
}
async function handleExport() {
exporting.value = true;
try {
await exportInAppPurchaseDetails(buildQueryParams(false));
message.success('导出成功');
} finally {
exporting.value = false;
}
}
function openDetails(record: Record<string, any>) {
activeOrderId.value = record.details?.id || '';
detailsOpen.value = true;
@ -233,6 +246,9 @@ void loadData(true);
<Button :loading="loading" type="primary" @click="handleSearch">
搜索
</Button>
<Button :loading="exporting" @click="handleExport">
导出
</Button>
</div>
<div class="summary">