fix(ecom-dmb): 订单管理页时间范围精确到秒,后端JsonFormat改为HH:mm:ss

This commit is contained in:
小蟑螂
2026-04-18 02:41:13 +08:00
parent c03fc306ef
commit d5c9e87833
2 changed files with 83 additions and 3 deletions
@@ -1,5 +1,6 @@
package top.xyquan.ecomdmbbackend.modules.ecom.order.model.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -46,13 +47,15 @@ public class OrderFilterDTO {
/**
* 下单时间范围-开始时间
*/
@Schema(description = "下单时间范围-开始时间", example = "2024-01-01T00:00:00")
@Schema(description = "下单时间范围-开始时间", example = "2024-01-01 00:00:00")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime startOrderTime;
/**
* 下单时间范围-结束时间
*/
@Schema(description = "下单时间范围-结束时间", example = "2024-12-31T23:59:59")
@Schema(description = "下单时间范围-结束时间", example = "2024-12-31 23:59:59")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endOrderTime;
/**
@@ -12,7 +12,17 @@ import { useRouter } from 'vue-router';
import { Page } from '@vben/common-ui';
import { createIconifyIcon } from '@vben/icons';
import { Button, message, Popconfirm, Popover, Space, Tag } from 'ant-design-vue';
import dayjs from 'dayjs';
import {
Button,
DatePicker,
message,
Popconfirm,
Popover,
Space,
Tag,
} from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteOrderApi, getOrderPageApi } from '#/api/ecommerce/order';
@@ -55,6 +65,8 @@ const searchForm = ref({
platformOrderNo: '',
shopId: undefined as number | undefined,
statusId: undefined as number | undefined,
startOrderTime: undefined as string | undefined,
endOrderTime: undefined as string | undefined,
});
// 当前排序状态
@@ -163,6 +175,27 @@ const gridOptions: VxeGridProps<any> = {
sortable: true,
slots: { default: 'receivedAmount' },
},
{
field: 'productCost',
title: '商品成本',
minWidth: 'auto',
sortable: true,
slots: { default: 'productCost' },
},
{
field: 'shippingCost',
title: '运费',
minWidth: 'auto',
sortable: true,
slots: { default: 'shippingCost' },
},
{
field: 'otherCost',
title: '其他成本',
minWidth: 'auto',
sortable: true,
slots: { default: 'otherCost' },
},
{
title: '订单状态',
minWidth: 'auto',
@@ -244,6 +277,8 @@ const gridOptions: VxeGridProps<any> = {
undefined,
shopId: searchParams.shopId ?? searchForm.value.shopId,
statusId: searchParams.statusId ?? searchForm.value.statusId,
startOrderTime: searchForm.value.startOrderTime,
endOrderTime: searchForm.value.endOrderTime,
};
const params: PageQueryDTO<OrderDTO.Filters> = {
page: page.currentPage,
@@ -326,6 +361,27 @@ const formOptions = computed(() => ({
fieldName: 'statusId',
label: '订单状态',
},
{
component: 'RangePicker',
componentProps: {
placeholder: ['下单开始时间', '下单结束时间'],
allowClear: true,
showTime: { format: 'HH:mm:ss' },
format: 'YYYY-MM-DD HH:mm:ss',
style: { width: '100%' },
onChange: (val: any) => {
searchForm.value.startOrderTime = val && val[0]
? (val[0] as dayjs.Dayjs).format('YYYY-MM-DD HH:mm:ss')
: undefined;
searchForm.value.endOrderTime = val && val[1]
? (val[1] as dayjs.Dayjs).format('YYYY-MM-DD HH:mm:ss')
: undefined;
gridReloadRef.value?.();
},
},
fieldName: 'orderTimeRange',
label: '下单时间',
},
],
showDefaultActions: true,
collapsed: true,
@@ -486,6 +542,27 @@ onMounted(async () => {
</span>
</template>
<!-- 商品成本列 -->
<template #productCost="{ row }: { row: any }">
<span style="color: #ff7875; font-weight: 500">
¥{{ (row.productCost || 0).toFixed(2) }}
</span>
</template>
<!-- 运费列 -->
<template #shippingCost="{ row }: { row: any }">
<span style="color: #ff7875; font-weight: 500">
¥{{ (row.shippingCost || 0).toFixed(2) }}
</span>
</template>
<!-- 其他成本列 -->
<template #otherCost="{ row }: { row: any }">
<span style="color: #ff7875; font-weight: 500">
¥{{ (row.otherCost || 0).toFixed(2) }}
</span>
</template>
<!-- 订单状态列 -->
<template #orderStatus="{ row }: { row: any }">
<Tag :color="row.orderStatus?.color || 'blue'" type="outline">