feat: 优化内部订单管理页改用两栏布局

This commit is contained in:
2026-08-18 16:35:36 +08:00
parent 754ba31471
commit 5d965e91e3
10 changed files with 1036 additions and 690 deletions
@@ -1,6 +1,7 @@
package top.xyquan.ecomdmbbackend.modules.ec.order.model.dto;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@@ -9,7 +10,7 @@ import java.time.LocalDateTime;
import java.util.List;
/**
* 更新订单 DTO
* 更新订单 DTO(主表字段 + 明细全量替换;不兼容扁平单行)
*/
@Data
public class UpdateOrderDTO {
@@ -45,19 +46,11 @@ public class UpdateOrderDTO {
private BigDecimal sellerDiscount;
/** 明细全量替换,至少一行 */
@Valid
@NotEmpty(message = "订单明细不能为空")
private List<CreateOrderItemDTO> items;
/** 扁平字段(未传 items 时合成一行) */
private Long productSkuId;
private String skuCode;
private String linkProductName;
private String linkSkuName;
private Integer quantity;
private BigDecimal unitPrice;
private BigDecimal productCost;
private BigDecimal shippingCost;
private BigDecimal otherCost;
private String remark;
private Integer confirm;
}
@@ -8,7 +8,7 @@ import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 电商-内部订单主表(一单一行)
* 电商-内部订单主表(头表;明细在 ec_order_item)
*/
@Data
@EqualsAndHashCode(callSuper = false)
@@ -135,7 +135,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderPO> implemen
}
OrderPO order = new OrderPO();
BeanCopyUtils.copyProperties(updateOrderDTO, order);
BeanCopyUtils.copyProperties(updateOrderDTO, order, "items");
order.setId(id);
order.setCompanyId(companyId);
order.setUpdateBy(userId);
@@ -156,10 +156,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderPO> implemen
this.updateById(order);
List<CreateOrderItemDTO> itemDtos = OrderDtoSupport.resolveItems(updateOrderDTO);
if (itemDtos != null && !itemDtos.isEmpty()) {
validateItems(itemDtos, companyId);
replaceItems(existingOrder, itemDtos, userId);
}
validateItems(itemDtos, companyId);
replaceItems(existingOrder, itemDtos, userId);
OrderPO after = this.getById(id);
return convertToVO(after != null ? after : order);
@@ -42,24 +42,10 @@ public final class OrderDtoSupport {
}
public static List<CreateOrderItemDTO> resolveItems(UpdateOrderDTO dto) {
if (dto.getItems() != null && !dto.getItems().isEmpty()) {
return dto.getItems();
if (dto.getItems() == null || dto.getItems().isEmpty()) {
throw new BusinessException("订单明细不能为空");
}
if (dto.getProductSkuId() == null && (dto.getLinkProductName() == null || dto.getLinkProductName().isBlank())) {
return null;
}
CreateOrderItemDTO item = new CreateOrderItemDTO();
item.setProductSkuId(dto.getProductSkuId());
item.setSkuCode(dto.getSkuCode());
item.setLinkProductName(dto.getLinkProductName());
item.setLinkSkuName(dto.getLinkSkuName());
item.setQuantity(dto.getQuantity());
item.setUnitPrice(dto.getUnitPrice());
item.setProductCost(dto.getProductCost());
item.setShippingCost(dto.getShippingCost());
item.setOtherCost(dto.getOtherCost());
item.setRemark(dto.getRemark());
return List.of(item);
return dto.getItems();
}
public static OrderItemPO toItemPO(CreateOrderItemDTO dto, OrderPO order, ProductSkuPO sku,
@@ -47,6 +47,8 @@ export namespace OrderDTO {
serviceFee?: number;
/** 下单时间 */
orderTime: string;
/** 来源:manual / import / sync */
source?: string;
/** 订单明细(未传时后端用扁平字段合成一行) */
items?: OrderItemDTO.Create[];
/** 商品规格 ID(扁平导入/表单兼容) */
@@ -71,7 +73,7 @@ export namespace OrderDTO {
remark?: string;
}
/** 更新订单参数 */
/** 更新订单参数(明细全量替换) */
export interface Update {
/** 店铺 ID */
shopId: number;
@@ -87,18 +89,8 @@ export namespace OrderDTO {
serviceFee?: number;
/** 下单时间 */
orderTime: string;
/** 订单明细(全量替换) */
items?: OrderItemDTO.Create[];
/** 扁平字段(未传 items 时合成一行) */
productSkuId?: number;
skuCode?: string;
linkProductName?: string;
linkSkuName?: string;
quantity?: number;
unitPrice?: number;
productCost?: number;
shippingCost?: number;
otherCost?: number;
/** 订单明细(全量替换,至少一行) */
items: OrderItemDTO.Create[];
remark?: string;
}
@@ -0,0 +1,80 @@
<script setup lang="ts">
import type { ShopVO } from '#/api/ec/shop/types';
import { ColPage } from '@vben/common-ui';
import ShopSidebarList from '#/views/ec/components/ShopSidebarList.vue';
defineOptions({ name: 'EcShopColPage' });
withDefaults(
defineProps<{
/** undefined = 全部店铺 */
selectedShopId?: number;
showAddAction?: boolean;
autoContentHeight?: boolean;
/** 左栏默认宽度(百分比) */
leftWidth?: number;
leftMinWidth?: number;
leftMaxWidth?: number;
leftCollapsedWidth?: number;
leftCollapsible?: boolean;
resizable?: boolean;
splitHandle?: boolean;
splitLine?: boolean;
}>(),
{
showAddAction: true,
autoContentHeight: true,
leftWidth: 22,
leftMinWidth: 16,
leftMaxWidth: 36,
leftCollapsedWidth: 5,
leftCollapsible: true,
resizable: true,
splitHandle: false,
splitLine: false,
},
);
const emit = defineEmits<{
'update:selectedShopId': [id: number | undefined];
select: [shop: ShopVO.Info | null];
addForShop: [shopId: number];
}>();
</script>
<template>
<ColPage
:auto-content-height="autoContentHeight"
:left-width="leftWidth"
:left-min-width="leftMinWidth"
:left-max-width="leftMaxWidth"
:left-collapsed-width="leftCollapsedWidth"
:left-collapsible="leftCollapsible"
:right-width="100 - leftWidth"
:resizable="resizable"
:split-handle="splitHandle"
:split-line="splitLine"
content-class="!p-2 sm:!p-3"
>
<template #left="{ isCollapsed, expand, collapse }">
<div class="flex h-full min-h-0 min-w-0 flex-col overflow-hidden">
<ShopSidebarList
fluid
:collapsed="isCollapsed"
show-collapse-action
:selected-shop-id="selectedShopId"
:show-add-action="showAddAction"
@collapse="collapse"
@expand="expand"
@update:selected-shop-id="emit('update:selectedShopId', $event)"
@select="emit('select', $event)"
@add-for-shop="emit('addForShop', $event)"
/>
</div>
</template>
<slot />
</ColPage>
</template>
@@ -0,0 +1,61 @@
<script setup lang="ts">
import { computed } from 'vue';
import { createIconifyIcon } from '@vben/icons';
import { Avatar } from 'ant-design-vue';
defineOptions({ name: 'ShopLogoAvatar' });
const props = withDefaults(
defineProps<{
logo?: string;
name?: string;
size?: number;
}>(),
{
logo: undefined,
name: undefined,
size: 36,
},
);
const StoreIcon = createIconifyIcon('lucide:store');
/** 无 logo 时用名称首字;仍无则显示店铺图标 */
const fallbackText = computed(() => {
const text = props.name?.trim();
return text ? text.charAt(0).toUpperCase() : '';
});
</script>
<template>
<Avatar
:size="size"
:src="logo"
:alt="name"
shape="square"
class="shop-logo-avatar shrink-0 !rounded-md !bg-muted"
>
<span
v-if="fallbackText"
class="shop-logo-avatar__text text-xs font-medium"
>
{{ fallbackText }}
</span>
<StoreIcon v-else class="h-4 w-4 text-muted-foreground" />
</Avatar>
</template>
<style scoped>
.shop-logo-avatar {
display: inline-flex !important;
align-items: center !important;
justify-content: center !important;
}
.shop-logo-avatar__text {
display: block;
line-height: 1;
}
</style>
@@ -14,10 +14,12 @@ import {
Select,
Spin,
Tag,
Tooltip,
} from 'ant-design-vue';
import { getPlatformListApi } from '#/api/ec/platform';
import { getShopPageApi } from '#/api/ec/shop/apis';
import ShopLogoAvatar from '#/views/ec/components/ShopLogoAvatar.vue';
import {
getPlatformLabel,
getPlatformTagColor,
@@ -31,10 +33,19 @@ const props = withDefaults(
selectedShopId?: number;
/** 是否显示行内「添加」快捷按钮 */
showAddAction?: boolean;
/** 填满父容器宽度(ColPage 左栏);默认固定 320px */
fluid?: boolean;
/** 显示标题栏收起按钮(配合 ColPage collapse) */
showCollapseAction?: boolean;
/** 窄栏模式:仅展示 logo 列表(ColPage 收起态) */
collapsed?: boolean;
}>(),
{
selectedShopId: undefined,
showAddAction: true,
fluid: false,
showCollapseAction: false,
collapsed: false,
},
);
@@ -43,10 +54,16 @@ const emit = defineEmits<{
/** 选中店铺;null 表示「全部店铺」 */
select: [shop: ShopVO.Info | null];
addForShop: [shopId: number];
collapse: [];
expand: [];
}>();
const StoreIcon = createIconifyIcon('lucide:store');
const PlusIcon = createIconifyIcon('lucide:plus');
const PanelCloseIcon = createIconifyIcon('lucide:panel-left-close');
const PanelOpenIcon = createIconifyIcon('lucide:panel-left-open');
const ChevronUpIcon = createIconifyIcon('lucide:chevron-up');
const ChevronDownIcon = createIconifyIcon('lucide:chevron-down');
const shopSearchForm = ref({
name: '',
@@ -145,8 +162,95 @@ onMounted(() => {
</script>
<template>
<!-- 收起态:logo 窄栏,可切换店铺 -->
<div
v-if="collapsed"
class="flex h-full min-h-0 w-full flex-col items-center gap-1 pb-2 pt-3"
>
<Tooltip title="展开店铺列表">
<Button type="text" size="small" class="!px-1" @click="emit('expand')">
<PanelOpenIcon class="h-4 w-4" />
</Button>
</Tooltip>
<div
class="flex min-h-0 w-full flex-1 flex-col items-center gap-1.5 overflow-y-auto px-1 pb-1 pt-2"
>
<Tooltip title="全部店铺">
<button
type="button"
class="inline-flex shrink-0 rounded-md p-0.5 transition-colors hover:bg-accent"
:class="
allSelected
? 'ring-2 ring-primary ring-offset-1 ring-offset-background'
: undefined
"
@click="selectAll"
>
<div
class="flex h-9 w-9 items-center justify-center rounded-md border border-dashed border-border bg-muted/50"
>
<StoreIcon class="h-4 w-4 text-muted-foreground" />
</div>
</button>
</Tooltip>
<Spin
:spinning="shopsLoading"
size="small"
wrapper-class-name="shop-sidebar-collapsed-spin"
>
<div class="flex w-full flex-col items-center gap-1.5">
<Tooltip v-for="shop in shops" :key="shop.id" :title="shop.name">
<button
type="button"
class="inline-flex shrink-0 rounded-md p-0.5 transition-colors hover:bg-accent"
:class="
selectedShopId === shop.id
? 'ring-2 ring-primary ring-offset-1 ring-offset-background'
: undefined
"
@click="selectShop(shop)"
>
<ShopLogoAvatar :logo="shop.logo" :name="shop.name" :size="36" />
</button>
</Tooltip>
</div>
</Spin>
</div>
<div
v-if="shopTotalPages > 1"
class="flex shrink-0 flex-col items-center gap-0.5"
>
<Button
type="text"
size="small"
class="!h-6 !px-1"
:disabled="shopPagination.current <= 1 || shopsLoading"
@click="goShopPage(shopPagination.current - 1)"
>
<ChevronUpIcon class="h-3.5 w-3.5" />
</Button>
<span class="text-[10px] leading-none text-muted-foreground">
{{ shopPagination.current }}/{{ shopTotalPages }}
</span>
<Button
type="text"
size="small"
class="!h-6 !px-1"
:disabled="shopPagination.current >= shopTotalPages || shopsLoading"
@click="goShopPage(shopPagination.current + 1)"
>
<ChevronDownIcon class="h-3.5 w-3.5" />
</Button>
</div>
</div>
<Card
class="flex h-full w-[320px] shrink-0 flex-col overflow-hidden"
v-else
class="flex h-full flex-col overflow-hidden"
:class="fluid ? 'w-full min-w-0' : 'w-[320px] shrink-0'"
:body-style="{
height: '100%',
display: 'flex',
@@ -165,6 +269,14 @@ onMounted(() => {
</span>
</template>
<template v-if="showCollapseAction" #extra>
<Tooltip title="收起店铺列表">
<Button type="text" size="small" class="!px-1" @click="emit('collapse')">
<PanelCloseIcon class="h-4 w-4" />
</Button>
</Tooltip>
</template>
<div class="flex min-w-0 shrink-0 flex-col gap-2">
<Input
v-model:value="shopSearchForm.name"
@@ -197,9 +309,18 @@ onMounted(() => {
:class="allSelected ? 'border-primary bg-primary/5' : undefined"
@click="selectAll"
>
<div class="flex items-center justify-between gap-2">
<span class="min-w-0 truncate text-sm font-medium">全部店铺</span>
<span class="shrink-0 text-xs text-muted-foreground">全部记录</span>
<div class="flex items-center gap-2">
<div
class="flex h-9 w-9 shrink-0 items-center justify-center rounded-md border border-dashed border-border bg-muted/50"
>
<StoreIcon class="h-4 w-4 text-muted-foreground" />
</div>
<div class="min-w-0 flex-1">
<div class="flex items-center justify-between gap-2">
<span class="min-w-0 truncate text-sm font-medium">全部店铺</span>
<span class="shrink-0 text-xs text-muted-foreground">全部记录</span>
</div>
</div>
</div>
</Card>
@@ -223,33 +344,40 @@ onMounted(() => {
"
@click="selectShop(shop)"
>
<div class="flex items-start justify-between gap-2">
<div class="min-w-0 flex-1">
<div class="truncate text-sm font-medium">{{ shop.name }}</div>
<div
v-if="shop.platformCode || shop.platformName"
class="mt-1"
>
<Tag
class="m-0"
:color="getPlatformTagColor(shop.platformCode)"
<div class="flex items-start gap-2">
<ShopLogoAvatar
:logo="shop.logo"
:name="shop.name"
:size="36"
/>
<div class="flex min-w-0 flex-1 items-start justify-between gap-2">
<div class="min-w-0 flex-1">
<div class="truncate text-sm font-medium">{{ shop.name }}</div>
<div
v-if="shop.platformCode || shop.platformName"
class="mt-1"
>
{{
getPlatformLabel(shop.platformCode, shop.platformName)
}}
</Tag>
<Tag
class="m-0"
:color="getPlatformTagColor(shop.platformCode)"
>
{{
getPlatformLabel(shop.platformCode, shop.platformName)
}}
</Tag>
</div>
</div>
<Button
v-if="showAddAction"
type="link"
size="small"
class="!h-7 shrink-0 !px-1 !text-xs opacity-80 group-hover:opacity-100"
@click.stop="handleAdd(shop.id)"
>
<PlusIcon class="mr-0.5 inline h-3.5 w-3.5" />
添加
</Button>
</div>
<Button
v-if="showAddAction"
type="link"
size="small"
class="!h-7 shrink-0 !px-1 !text-xs opacity-80 group-hover:opacity-100"
@click.stop="handleAdd(shop.id)"
>
<PlusIcon class="mr-0.5 inline h-3.5 w-3.5" />
添加
</Button>
</div>
</Card>
</template>
@@ -287,3 +415,19 @@ onMounted(() => {
</div>
</Card>
</template>
<style scoped>
:deep(.shop-sidebar-collapsed-spin) {
display: flex;
width: 100%;
flex-direction: column;
align-items: center;
}
:deep(.shop-sidebar-collapsed-spin .ant-spin-container) {
display: flex;
width: 100%;
flex-direction: column;
align-items: center;
}
</style>
File diff suppressed because it is too large Load Diff
@@ -3,20 +3,20 @@ import type { VxeGridProps } from '#/adapter/vxe-table';
import type { OrderDTO, OrderVO } from '#/api/ec/order';
import { ORDER_STATUS_OPTIONS } from '#/api/ec/order/types/types.enum';
import type { ProductDTO, ProductVO } from '#/api/ec/product/types';
import type { ShopDTO, ShopVO } from '#/api/ec/shop/types';
import type { ShopVO } from '#/api/ec/shop/types';
import type { PageQueryDTO } from '#/types/common';
import { computed, onMounted, ref } from 'vue';
import { computed, onMounted, ref, watch } from 'vue';
import { useRouter } from 'vue-router';
import { Page } from '@vben/common-ui';
import { createIconifyIcon } from '@vben/icons';
import dayjs from 'dayjs';
import {
Button,
Card,
Image,
message,
Popconfirm,
@@ -32,7 +32,6 @@ import {
} from '#/api/ec/order';
import { getProductPageApi } from '#/api/ec/product';
import { getPlatformListApi } from '#/api/ec/platform';
import { getShopPageApi } from '#/api/ec/shop';
import PlatformTag from '#/components/platform/PlatformTag.vue';
import {
getFirstOrderItem,
@@ -40,6 +39,7 @@ import {
getOrderProduct,
getOrderReceivedAmount,
} from '#/utils/order-display';
import EcShopColPage from '#/views/ec/components/EcShopColPage.vue';
import OrderDetailDrawer from './components/OrderDetailDrawer.vue';
import OrderFormModal from './components/OrderFormModal.vue';
@@ -62,14 +62,9 @@ const hasSelected = ref(false);
const orderFormModalRef = ref<InstanceType<typeof OrderFormModal>>();
const detailDrawerRef = ref<InstanceType<typeof OrderDetailDrawer>>();
const shopOptions = ref<{ label: string; value: number }[]>([]);
const shopPage = ref(1);
const shopPageSize = 20;
const shopTotal = ref(0);
const shopLoading = ref(false);
const shopSearchKeyword = ref('');
const shopLoaded = ref(false);
let shopSearchTimer: null | ReturnType<typeof setTimeout> = null;
/** 左侧店铺:undefined = 全部 */
const selectedShopId = ref<number | undefined>(undefined);
const selectedShopName = ref<string | undefined>(undefined);
const orderStatusOptions = ORDER_STATUS_OPTIONS;
@@ -102,7 +97,6 @@ const defaultOrderTime = buildDefaultOrderTimeRange();
const searchForm = ref({
platformOrderNo: '',
shopId: undefined as number | undefined,
platformCode: undefined as string | undefined,
status: undefined as string | undefined,
startOrderTime: defaultOrderTime.start as string | undefined,
@@ -170,49 +164,14 @@ function ensureOrderTimeFilters(): boolean {
return true;
}
async function fetchShops(page = 1, append = false) {
if (shopLoading.value) return;
shopLoading.value = true;
try {
const params: PageQueryDTO<ShopDTO.Filters> = {
page,
pageSize: shopPageSize,
filters: shopSearchKeyword.value ? { name: shopSearchKeyword.value } : {},
};
const data = await getShopPageApi(params);
const mapped = data.records.map((shop: ShopVO.Info) => ({
label: shop.name,
value: shop.id,
}));
shopOptions.value = append ? [...shopOptions.value, ...mapped] : mapped;
shopTotal.value = data.total;
shopPage.value = page;
shopLoaded.value = true;
} catch (error) {
console.error('获取店铺列表失败:', error);
} finally {
shopLoading.value = false;
}
}
function handleShopSearch(value: string) {
if (shopSearchTimer) clearTimeout(shopSearchTimer);
shopSearchTimer = setTimeout(() => {
shopSearchKeyword.value = value;
shopPage.value = 1;
fetchShops(1, false);
}, 300);
}
function handleShopPopupScroll(e: Event) {
const target = e.target as HTMLElement;
const { scrollTop, scrollHeight, clientHeight } = target;
if (scrollHeight - scrollTop - clientHeight < 50) {
const hasMore = shopPage.value * shopPageSize < shopTotal.value;
if (hasMore && !shopLoading.value) {
fetchShops(shopPage.value + 1, true);
}
function onShopSelect(shop: ShopVO.Info | null) {
if (!shop) {
selectedShopId.value = undefined;
selectedShopName.value = undefined;
return;
}
selectedShopId.value = shop.id;
selectedShopName.value = shop.name;
}
async function fetchProducts(page = 1, append = false) {
@@ -358,7 +317,7 @@ const gridOptions: VxeGridProps<OrderVO.Info> = {
slots: { default: 'action' },
},
],
height: 'auto',
height: '100%',
border: true,
stripe: true,
rowConfig: { isHover: true, height: 72 },
@@ -413,7 +372,7 @@ const gridOptions: VxeGridProps<OrderVO.Info> = {
searchParams.platformOrderNo ||
searchForm.value.platformOrderNo ||
undefined,
shopId: searchParams.shopId ?? searchForm.value.shopId,
shopId: selectedShopId.value,
platformCode:
searchParams.platformCode ?? searchForm.value.platformCode,
status: searchParams.status ?? searchForm.value.status,
@@ -487,31 +446,6 @@ const formOptions = computed(() => ({
fieldName: 'platformCode',
label: '平台',
},
{
component: 'Select',
componentProps: {
placeholder: '请选择店铺(支持搜索)',
options: shopOptions,
allowClear: true,
showSearch: true,
filterOption: false,
onSearch: handleShopSearch,
onFocus: () => {
if (!shopLoaded.value) {
fetchShops(1, false);
}
},
onPopupScroll: handleShopPopupScroll,
onChange: (val: any) => {
searchForm.value.shopId = val;
gridReloadRef.value?.();
},
loading: shopLoading,
dropdownMenuColumnStyle: { maxHeight: '300px', overflow: 'auto' },
},
fieldName: 'shopId',
label: '店铺',
},
{
component: 'Select',
componentProps: {
@@ -609,7 +543,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
gridOptions,
formOptions: formOptions.value,
showSearchForm: true,
tableTitle: '订单管理',
tableTitle: '',
gridEvents: {
checkboxChange() {
const vxeTable = (gridApi as any).grid;
@@ -625,6 +559,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
});
gridReloadRef.value = () => gridApi.reload();
watch(selectedShopId, () => {
gridApi.reload();
});
function goToShopDetail(shopId: number) {
router.push(`/ec/shop/overview/${shopId}`);
}
@@ -634,7 +572,19 @@ function openDetail(row: OrderVO.Info) {
}
function handleAdd() {
orderFormModalRef.value?.open(false);
orderFormModalRef.value?.open(false, undefined, {
shopId: selectedShopId.value,
shopName: selectedShopName.value,
});
}
function handleAddForShop(shopId: number) {
const name =
selectedShopId.value === shopId ? selectedShopName.value : undefined;
orderFormModalRef.value?.open(false, undefined, {
shopId,
shopName: name,
});
}
function handleEdit(record: OrderVO.Info) {
@@ -692,116 +642,142 @@ onMounted(async () => {
</script>
<template>
<Page auto-content-height>
<Grid
class="order-grid"
:loading="loading"
@sort-change="handleSortChange"
<EcShopColPage
:selected-shop-id="selectedShopId"
@select="onShopSelect"
@add-for-shop="handleAddForShop"
>
<Card
class="ml-1 flex h-full min-h-0 min-w-0 flex-1 flex-col sm:ml-2"
:body-style="{
height: '100%',
minHeight: 0,
padding: 0,
display: 'flex',
flexDirection: 'column',
}"
>
<template #toolbar-tools>
<Space>
<Button type="primary" @click="handleAdd">
<PlusIcon />
添加订单
</Button>
<Popconfirm
title="确定删除选中的订单吗?删除后不可恢复。"
ok-text="确定删除"
cancel-text="取消"
:ok-button-props="{ danger: true, loading: batchDeleteLoading }"
:disabled="!hasSelected"
@confirm="handleBatchDelete"
>
<Button
danger
:disabled="!hasSelected"
:loading="batchDeleteLoading"
>
批量删除
<template #title>
<span class="text-base font-semibold">订单列表</span>
</template>
<template #extra>
<Space wrap size="small">
<Button type="primary" @click="handleAdd">
<PlusIcon class="mr-1 h-4 w-4" />
添加订单
</Button>
</Popconfirm>
</Space>
</template>
<Popconfirm
title="确定删除选中的订单吗?删除后不可恢复。"
ok-text="确定删除"
cancel-text="取消"
:ok-button-props="{ danger: true, loading: batchDeleteLoading }"
:disabled="!hasSelected"
@confirm="handleBatchDelete"
>
<Button
danger
:disabled="!hasSelected"
:loading="batchDeleteLoading"
>
批量删除
</Button>
</Popconfirm>
</Space>
</template>
<template #platform="{ row }: { row: OrderVO.Info }">
<PlatformTag :code="row.platformCode" :label="row.platformLabel" />
</template>
<template #shopName="{ row }: { row: OrderVO.Info }">
<a
style="color: #1890ff; cursor: pointer"
@click="goToShopDetail(row.shopId)"
<div
class="min-h-0 flex-1 overflow-hidden px-2 pb-2 pt-2 sm:px-3 sm:pb-3"
>
{{ row.shopName || `店铺#${row.shopId}` }}
</a>
</template>
<template #goods="{ row }: { row: OrderVO.Info }">
<div class="goods-cell">
<Image
v-if="goodsImg(row)"
:src="goodsImg(row)"
:width="40"
:height="40"
class="goods-img"
/>
<div class="goods-meta">
<div class="goods-name" :title="goodsTitle(row)">
{{ goodsTitle(row) }}
</div>
<div class="goods-spec">
{{ goodsSpec(row) }}
<span v-if="(row.itemCount ?? 0) > 1">
等 {{ row.itemCount }} 件
</span>
</div>
</div>
</div>
</template>
<template #payAmount="{ row }: { row: OrderVO.Info }">
{{ money(getOrderPayAmount(row)) }}
</template>
<template #receivedAmount="{ row }: { row: OrderVO.Info }">
{{ money(getOrderReceivedAmount(row)) }}
</template>
<template #orderStatus="{ row }: { row: OrderVO.Info }">
<Tag :color="row.statusColor || 'blue'">
{{ row.statusLabel || '未知状态' }}
</Tag>
</template>
<template #source="{ row }: { row: OrderVO.Info }">
{{ sourceText(row.source) }}
</template>
<template #region="{ row }: { row: OrderVO.Info }">
{{ regionText(row) }}
</template>
<template #action="{ row }: { row: OrderVO.Info }">
<Space>
<Button type="link" size="small" @click="openDetail(row)">
详情
</Button>
<Button type="link" size="small" @click="handleEdit(row)">
编辑
</Button>
<Popconfirm
title="确定要删除这个订单吗?"
@confirm="handleDelete(row)"
<Grid
class="order-grid h-full min-h-0"
:loading="loading"
@sort-change="handleSortChange"
>
<Button type="link" size="small" danger>删除</Button>
</Popconfirm>
</Space>
</template>
</Grid>
<template #platform="{ row }: { row: OrderVO.Info }">
<PlatformTag
:code="row.platformCode"
:label="row.platformLabel"
/>
</template>
<template #shopName="{ row }: { row: OrderVO.Info }">
<a
style="color: #1890ff; cursor: pointer"
@click="goToShopDetail(row.shopId)"
>
{{ row.shopName || `店铺#${row.shopId}` }}
</a>
</template>
<template #goods="{ row }: { row: OrderVO.Info }">
<div class="goods-cell">
<Image
v-if="goodsImg(row)"
:src="goodsImg(row)"
:width="40"
:height="40"
class="goods-img"
/>
<div class="goods-meta">
<div class="goods-name" :title="goodsTitle(row)">
{{ goodsTitle(row) }}
</div>
<div class="goods-spec">
{{ goodsSpec(row) }}
<span v-if="(row.itemCount ?? 0) > 1">
等 {{ row.itemCount }} 件
</span>
</div>
</div>
</div>
</template>
<template #payAmount="{ row }: { row: OrderVO.Info }">
{{ money(getOrderPayAmount(row)) }}
</template>
<template #receivedAmount="{ row }: { row: OrderVO.Info }">
{{ money(getOrderReceivedAmount(row)) }}
</template>
<template #orderStatus="{ row }: { row: OrderVO.Info }">
<Tag :color="row.statusColor || 'blue'">
{{ row.statusLabel || '未知状态' }}
</Tag>
</template>
<template #source="{ row }: { row: OrderVO.Info }">
{{ sourceText(row.source) }}
</template>
<template #region="{ row }: { row: OrderVO.Info }">
{{ regionText(row) }}
</template>
<template #action="{ row }: { row: OrderVO.Info }">
<Space>
<Button type="link" size="small" @click="openDetail(row)">
详情
</Button>
<Button type="link" size="small" @click="handleEdit(row)">
编辑
</Button>
<Popconfirm
title="确定要删除这个订单吗?"
@confirm="handleDelete(row)"
>
<Button type="link" size="small" danger>删除</Button>
</Popconfirm>
</Space>
</template>
</Grid>
</div>
</Card>
<OrderFormModal ref="orderFormModalRef" @success="handleModalSuccess" />
<OrderDetailDrawer ref="detailDrawerRef" />
</Page>
</EcShopColPage>
</template>
<style scoped>