mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 13:49:20 +08:00
refactor(frontend): 店铺概览页移除订单明细列表
- 删除店铺概览页中的第五层「店铺订单明细」VxeGrid 及相关搜索表单 - 清理不再使用的 orderGrid / orderSearchForm / orderSortFieldOptions 等变量和导入 - 移除 OrderGrid 组件及相关样式
This commit is contained in:
@@ -1,9 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
|
||||||
import type { OrderDTO } from '#/api/ecommerce/order';
|
|
||||||
import type { OrderStatusVO } from '#/api/ecommerce/order-status/types';
|
|
||||||
import type { ShopDTO, ShopVO } from '#/api/ecommerce/shop/types';
|
import type { ShopDTO, ShopVO } from '#/api/ecommerce/shop/types';
|
||||||
import type { PageQueryDTO } from '#/types/common';
|
|
||||||
import type { Dayjs } from 'dayjs';
|
import type { Dayjs } from 'dayjs';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -16,12 +12,9 @@ import {
|
|||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import { Page } from '@vben/common-ui';
|
import { Page } from '@vben/common-ui';
|
||||||
import { message, Spin, Tag } from 'ant-design-vue';
|
import { message, Spin } from 'ant-design-vue';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
||||||
import { getOrderPageApi } from '#/api/ecommerce/order';
|
|
||||||
import { getAllOrderStatusListApi } from '#/api/ecommerce/order-status';
|
|
||||||
import { getShopOverviewStatisticsApi } from '#/api/ecommerce/shop';
|
import { getShopOverviewStatisticsApi } from '#/api/ecommerce/shop';
|
||||||
import { exportByPost } from '#/utils/export';
|
import { exportByPost } from '#/utils/export';
|
||||||
|
|
||||||
@@ -43,10 +36,6 @@ const shopId = computed(() => {
|
|||||||
|
|
||||||
// 响应式数据
|
// 响应式数据
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const orderLoading = ref(false);
|
|
||||||
|
|
||||||
// 订单状态选项
|
|
||||||
const orderStatusOptions = ref<{ label: string; value: number }[]>([]);
|
|
||||||
const exportLoading = ref(false);
|
const exportLoading = ref(false);
|
||||||
const overviewData = ref<null | ShopVO.OverviewStatistics>(null);
|
const overviewData = ref<null | ShopVO.OverviewStatistics>(null);
|
||||||
|
|
||||||
@@ -307,289 +296,13 @@ watch(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
// 订单列表排序选项
|
|
||||||
const orderSortFieldOptions = [
|
|
||||||
{ label: '下单时间', value: 'orderTime' },
|
|
||||||
{ label: '创建时间', value: 'createTime' },
|
|
||||||
{ label: '实收金额', value: 'receivedAmount' },
|
|
||||||
{ label: '数量', value: 'quantity' },
|
|
||||||
];
|
|
||||||
const orderSortOrderOptions = [
|
|
||||||
{ label: '降序(从高到低)', value: 'desc' },
|
|
||||||
{ label: '升序(从低到高)', value: 'asc' },
|
|
||||||
];
|
|
||||||
|
|
||||||
// 订单搜索表单
|
|
||||||
const orderSearchForm = ref({
|
|
||||||
platformOrderNo: '',
|
|
||||||
statusId: undefined as number | undefined,
|
|
||||||
minReceivedAmount: undefined as number | undefined,
|
|
||||||
maxReceivedAmount: undefined as number | undefined,
|
|
||||||
confirm: undefined as number | undefined,
|
|
||||||
sortField: 'orderTime' as string | undefined,
|
|
||||||
sortOrder: 'desc' as string | undefined,
|
|
||||||
});
|
|
||||||
|
|
||||||
// 订单列表 VxeGrid 配置
|
|
||||||
const orderGridOptions: VxeGridProps<any> = {
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
type: 'seq' as const,
|
|
||||||
width: 60,
|
|
||||||
title: '序号',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'platformOrderNo',
|
|
||||||
title: '平台订单号',
|
|
||||||
minWidth: 140,
|
|
||||||
showOverflow: 'tooltip' as const,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '商品信息',
|
|
||||||
minWidth: 160,
|
|
||||||
slots: { default: 'productInfo' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '数量',
|
|
||||||
minWidth: 80,
|
|
||||||
slots: { default: 'quantity' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '实收金额',
|
|
||||||
minWidth: 100,
|
|
||||||
slots: { default: 'receivedAmount' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '订单状态',
|
|
||||||
minWidth: 100,
|
|
||||||
slots: { default: 'orderStatus' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'orderTime',
|
|
||||||
title: '下单时间',
|
|
||||||
minWidth: 160,
|
|
||||||
sortable: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
height: 1000,
|
|
||||||
border: true,
|
|
||||||
stripe: true,
|
|
||||||
rowConfig: { isHover: true },
|
|
||||||
showOverflow: true,
|
|
||||||
size: 'small',
|
|
||||||
toolbarConfig: {
|
|
||||||
custom: true,
|
|
||||||
refresh: true,
|
|
||||||
zoom: true,
|
|
||||||
},
|
|
||||||
data: [],
|
|
||||||
pagerConfig: {
|
|
||||||
enabled: true,
|
|
||||||
pageSizes: [10, 20, 50, 100],
|
|
||||||
layouts: [
|
|
||||||
'PrevJump',
|
|
||||||
'PrevPage',
|
|
||||||
'Number',
|
|
||||||
'NextPage',
|
|
||||||
'NextJump',
|
|
||||||
'Sizes',
|
|
||||||
'FullJump',
|
|
||||||
'Total',
|
|
||||||
] as (
|
|
||||||
| 'FullJump'
|
|
||||||
| 'NextJump'
|
|
||||||
| 'NextPage'
|
|
||||||
| 'Number'
|
|
||||||
| 'PrevJump'
|
|
||||||
| 'PrevPage'
|
|
||||||
| 'Sizes'
|
|
||||||
| 'Total'
|
|
||||||
)[],
|
|
||||||
},
|
|
||||||
proxyConfig: {
|
|
||||||
ajax: {
|
|
||||||
query: async ({ page }) => {
|
|
||||||
if (!shopId.value) {
|
|
||||||
return { items: [], total: 0 };
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
orderLoading.value = true;
|
|
||||||
const params: PageQueryDTO<OrderDTO.Filters> = {
|
|
||||||
page: page.currentPage,
|
|
||||||
pageSize: page.pageSize,
|
|
||||||
filters: {
|
|
||||||
shopId: shopId.value,
|
|
||||||
platformOrderNo:
|
|
||||||
orderSearchForm.value.platformOrderNo || undefined,
|
|
||||||
statusId: orderSearchForm.value.statusId,
|
|
||||||
minReceivedAmount: orderSearchForm.value.minReceivedAmount,
|
|
||||||
maxReceivedAmount: orderSearchForm.value.maxReceivedAmount,
|
|
||||||
confirm: orderSearchForm.value.confirm,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
if (
|
|
||||||
orderSearchForm.value.sortField &&
|
|
||||||
orderSearchForm.value.sortOrder
|
|
||||||
) {
|
|
||||||
params.sorts = [
|
|
||||||
{
|
|
||||||
field: orderSearchForm.value.sortField,
|
|
||||||
order: orderSearchForm.value.sortOrder as 'asc' | 'desc',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
const data = await getOrderPageApi(params);
|
|
||||||
return {
|
|
||||||
items: data.records,
|
|
||||||
total: data.total,
|
|
||||||
};
|
|
||||||
} catch (error: any) {
|
|
||||||
console.error('获取订单列表失败:', error);
|
|
||||||
message.error(
|
|
||||||
`获取订单列表失败: ${
|
|
||||||
error?.message || error?.response?.data?.message || '未知错误'
|
|
||||||
}`,
|
|
||||||
);
|
|
||||||
return {
|
|
||||||
items: [],
|
|
||||||
total: 0,
|
|
||||||
};
|
|
||||||
} finally {
|
|
||||||
orderLoading.value = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 避免 orderFormOptions 与 orderGridApi 循环引用导致隐式 any */
|
|
||||||
const orderGridReloadRef = ref<(() => void) | null>(null);
|
|
||||||
|
|
||||||
// 订单搜索表单配置
|
|
||||||
const orderFormOptions = computed(() => ({
|
|
||||||
schema: [
|
|
||||||
{
|
|
||||||
component: 'Input',
|
|
||||||
componentProps: {
|
|
||||||
placeholder: '请输入平台订单号(回车搜索)',
|
|
||||||
onPressEnter: () => orderGridReloadRef.value?.(),
|
|
||||||
},
|
|
||||||
fieldName: 'platformOrderNo',
|
|
||||||
label: '订单号',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
placeholder: '请选择订单状态',
|
|
||||||
options: orderStatusOptions,
|
|
||||||
allowClear: true,
|
|
||||||
onChange: () => orderGridReloadRef.value?.(),
|
|
||||||
},
|
|
||||||
fieldName: 'statusId',
|
|
||||||
label: '订单状态',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
component: 'InputNumber',
|
|
||||||
componentProps: {
|
|
||||||
placeholder: '最小金额',
|
|
||||||
min: 0,
|
|
||||||
style: { width: '100%' },
|
|
||||||
onPressEnter: () => orderGridReloadRef.value?.(),
|
|
||||||
},
|
|
||||||
fieldName: 'minReceivedAmount',
|
|
||||||
label: '实收金额(起)',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
component: 'InputNumber',
|
|
||||||
componentProps: {
|
|
||||||
placeholder: '最大金额',
|
|
||||||
min: 0,
|
|
||||||
style: { width: '100%' },
|
|
||||||
onPressEnter: () => orderGridReloadRef.value?.(),
|
|
||||||
},
|
|
||||||
fieldName: 'maxReceivedAmount',
|
|
||||||
label: '实收金额(止)',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
placeholder: '请选择确认状态',
|
|
||||||
options: [
|
|
||||||
{ label: '已确认', value: 1 },
|
|
||||||
{ label: '未确认', value: 0 },
|
|
||||||
],
|
|
||||||
allowClear: true,
|
|
||||||
onChange: () => orderGridReloadRef.value?.(),
|
|
||||||
},
|
|
||||||
fieldName: 'confirm',
|
|
||||||
label: '确认状态',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
placeholder: '选择排序字段',
|
|
||||||
options: orderSortFieldOptions,
|
|
||||||
allowClear: true,
|
|
||||||
onChange: () => orderGridReloadRef.value?.(),
|
|
||||||
},
|
|
||||||
fieldName: 'sortField',
|
|
||||||
label: '排序字段',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
placeholder: '选择排序方式',
|
|
||||||
options: orderSortOrderOptions,
|
|
||||||
allowClear: true,
|
|
||||||
onChange: () => orderGridReloadRef.value?.(),
|
|
||||||
},
|
|
||||||
fieldName: 'sortOrder',
|
|
||||||
label: '排序方式',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
showDefaultActions: true,
|
|
||||||
collapsed: true,
|
|
||||||
collapsedRows: 2,
|
|
||||||
}));
|
|
||||||
|
|
||||||
// 创建订单列表 Grid 实例
|
|
||||||
const [OrderGrid, orderGridApi] = useVbenVxeGrid({
|
|
||||||
gridOptions: orderGridOptions,
|
|
||||||
formOptions: orderFormOptions.value,
|
|
||||||
showSearchForm: true,
|
|
||||||
});
|
|
||||||
orderGridReloadRef.value = () => orderGridApi.reload();
|
|
||||||
|
|
||||||
// 刷新订单列表
|
|
||||||
function refreshOrderGrid() {
|
|
||||||
if (orderGridApi) {
|
|
||||||
orderGridApi.reload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取订单状态选项
|
|
||||||
async function fetchOrderStatusOptions() {
|
|
||||||
try {
|
|
||||||
const data = await getAllOrderStatusListApi();
|
|
||||||
orderStatusOptions.value = data.map((status: OrderStatusVO.Info) => ({
|
|
||||||
label: status.statusName,
|
|
||||||
value: status.id,
|
|
||||||
}));
|
|
||||||
} catch (error) {
|
|
||||||
console.error('获取订单状态列表失败:', error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 初始化
|
// 初始化
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await refreshOverviewByCurrentParams(true);
|
await refreshOverviewByCurrentParams(true);
|
||||||
await fetchOrderStatusOptions();
|
|
||||||
refreshOrderGrid();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
onActivated(async () => {
|
onActivated(async () => {
|
||||||
await refreshOverviewByCurrentParams(true);
|
await refreshOverviewByCurrentParams(true);
|
||||||
refreshOrderGrid();
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -640,76 +353,12 @@ onActivated(async () => {
|
|||||||
@export-toggle="handleCategoryExportToggle"
|
@export-toggle="handleCategoryExportToggle"
|
||||||
@category-select-all="handleCategorySelectAllChange"
|
@category-select-all="handleCategorySelectAllChange"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 第五层:店铺订单列表 -->
|
|
||||||
<div
|
|
||||||
class="overflow-hidden rounded-[20px] border border-slate-200/80 dark:border-[hsl(240deg_3.7%_22%)] bg-white/85 dark:bg-[hsl(222.34deg_10.43%_12.27%)] shadow-[0_4px_20px_rgba(0,0,0,0.02)] dark:shadow-none backdrop-blur-[12px]"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="flex items-center justify-between border-b border-slate-100 dark:border-[hsl(240deg_3.7%_22%)] bg-white/40 dark:bg-[hsl(222.34deg_10.43%_12.27%)] p-6"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<h3 class="text-lg font-black text-slate-800 dark:text-[hsl(0deg_0%_95%)]">店铺订单明细</h3>
|
|
||||||
<p class="mt-1 text-xs font-bold text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
|
||||||
当前时间范围内的订单列表,支持按订单号搜索和排序
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<OrderGrid :loading="orderLoading">
|
|
||||||
<!-- 商品信息列 -->
|
|
||||||
<template #productInfo="{ row }: { row: any }">
|
|
||||||
<div v-if="row.linkProductName">
|
|
||||||
<div class="font-bold">{{ row.linkProductName }}</div>
|
|
||||||
<div v-if="row.linkSpecName" class="text-xs text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">
|
|
||||||
{{ row.linkSpecName }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<span v-else class="text-slate-300">暂无</span>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- 数量列 -->
|
|
||||||
<template #quantity="{ row }: { row: any }">
|
|
||||||
{{ row.quantity || 0 }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- 实收金额列 -->
|
|
||||||
<template #receivedAmount="{ row }: { row: any }">
|
|
||||||
<span class="font-bold text-emerald-600 dark:text-emerald-400">
|
|
||||||
¥{{ (row.receivedAmount || 0).toFixed(2) }}
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- 订单状态列 -->
|
|
||||||
<template #orderStatus="{ row }: { row: any }">
|
|
||||||
<Tag :color="row.orderStatus?.color || 'blue'">
|
|
||||||
{{ row.statusName || '未知' }}
|
|
||||||
</Tag>
|
|
||||||
</template>
|
|
||||||
</OrderGrid>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</Spin>
|
</Spin>
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
/* 表格滚动条优化 */
|
|
||||||
.table-container::-webkit-scrollbar {
|
|
||||||
height: 6px;
|
|
||||||
}
|
|
||||||
.table-container::-webkit-scrollbar-thumb {
|
|
||||||
background: #e2e8f0;
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 固定商品名称列 */
|
|
||||||
.sticky-col {
|
|
||||||
position: sticky;
|
|
||||||
left: 0;
|
|
||||||
z-index: 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
:deep(.shop-overview-page-header) {
|
:deep(.shop-overview-page-header) {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -735,15 +384,4 @@ html.dark .shop-overview-thead table thead th {
|
|||||||
html.dark .shop-overview-thead table thead th {
|
html.dark .shop-overview-thead table thead th {
|
||||||
border-color: hsl(240deg 3.7% 22%) !important;
|
border-color: hsl(240deg 3.7% 22%) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.dark .table-container table tbody tr:hover td {
|
|
||||||
background-color: hsl(217.2deg 32.6% 17.5% / 30%) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
html.dark .table-container::-webkit-scrollbar-thumb {
|
|
||||||
background: hsl(240deg 3.7% 22%);
|
|
||||||
}
|
|
||||||
html.dark .table-container::-webkit-scrollbar-track {
|
|
||||||
background: hsl(240deg 3.7% 15.9%);
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user