feat: implement gas and delivery admin systems

This commit is contained in:
david
2026-07-30 14:16:58 +08:00
parent 1093385f95
commit f5ecc0d973
252 changed files with 49385 additions and 363 deletions

View File

@@ -0,0 +1,38 @@
<template>
<a-spin :loading="loading" style="width: 100%">
<a-grid :cols="{ xs: 1, sm: 2, lg: 5 }" :col-gap="16" :row-gap="16">
<a-grid-item v-for="item in cards" :key="item.key">
<a-card :bordered="false">
<a-statistic :title="item.label" :value="overview[item.key]" show-group-separator />
</a-card>
</a-grid-item>
</a-grid>
</a-spin>
</template>
<script setup lang="ts">
import { Message } from '@arco-design/web-vue';
import { onMounted, reactive, ref } from 'vue';
import { request } from '@/api/http';
type Overview = Record<'delivery_count' | 'staff_count' | 'user_count' | 'contract_count' | 'order_count', number>;
const loading = ref(false);
const overview = reactive<Overview>({ delivery_count: 0, staff_count: 0, user_count: 0, contract_count: 0, order_count: 0 });
const cards: Array<{ key: keyof Overview; label: string }> = [
{ key: 'delivery_count', label: '配送点' },
{ key: 'staff_count', label: '工作人员' },
{ key: 'user_count', label: '服务用户' },
{ key: 'contract_count', label: '配送合同' },
{ key: 'order_count', label: '燃气配送订单' },
];
onMounted(async () => {
loading.value = true;
try {
Object.assign(overview, await request<Overview>('/dashboard/overview'));
} catch (error) {
Message.error((error as Error).message);
} finally {
loading.value = false;
}
});
</script>

View File

@@ -0,0 +1,31 @@
<template>
<a-card title="订单状态统计" :bordered="false">
<a-spin :loading="loading">
<a-table :data="rows" :pagination="false" row-key="status">
<a-table-column title="订单状态" data-index="status" />
<a-table-column title="订单数量" data-index="count" />
</a-table>
</a-spin>
</a-card>
</template>
<script setup lang="ts">
import { Message } from '@arco-design/web-vue';
import { onMounted, ref } from 'vue';
import { request } from '@/api/http';
type Row = { status: number; count: number };
const loading = ref(false);
const rows = ref<Row[]>([]);
onMounted(async () => {
loading.value = true;
try {
const result = await request<{ orders_by_status: Row[] }>('/dashboard/reports');
rows.value = result.orders_by_status;
} catch (error) {
Message.error((error as Error).message);
} finally {
loading.value = false;
}
});
</script>