mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 19:49:28 +08:00
refactor(brush-order,promotion-fee): 重构为左侧店铺列表+右侧记录表格布局,支持快捷新增
This commit is contained in:
@@ -1,38 +1,56 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import type { BrushOrderDTO, BrushOrderVO } from '#/api/ecommerce/brush-order';
|
||||
import type { ProductDTO, ProductVO } from '#/api/ecommerce/product/types';
|
||||
import type { ShopVO } from '#/api/ecommerce/shop/types';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
import { Button, message, Popconfirm, Space } from 'ant-design-vue';
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
DatePicker,
|
||||
Empty,
|
||||
Flex,
|
||||
InputNumber,
|
||||
message,
|
||||
Popconfirm,
|
||||
Select,
|
||||
Space,
|
||||
Spin,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deleteBrushOrderApi,
|
||||
getBrushOrderPageApi,
|
||||
} from '#/api/ecommerce/brush-order';
|
||||
import { getShopPageApi } from '#/api/ecommerce/shop';
|
||||
import { getProductPageApi } from '#/api/ecommerce/product';
|
||||
import { getShopPageApi } from '#/api/ecommerce/shop/apis';
|
||||
|
||||
import BrushOrderFormModal from './components/BrushOrderFormModal.vue';
|
||||
|
||||
defineOptions({ name: 'BrushOrderManagement' });
|
||||
|
||||
// 创建图标组件
|
||||
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||
const StoreIcon = createIconifyIcon('lucide:store');
|
||||
|
||||
// 响应式数据
|
||||
const loading = ref(false);
|
||||
const shopsLoading = ref(false);
|
||||
const shops = ref<ShopVO.Info[]>([]);
|
||||
|
||||
/** 未选店铺:undefined 表示全部 */
|
||||
const selectedShopId = ref<number | undefined>(undefined);
|
||||
|
||||
const formModalVisible = ref(false);
|
||||
const currentBrushOrderData = ref<BrushOrderVO.Info | null>(null);
|
||||
const presetShopIdForModal = ref<number | null>(null);
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = ref({
|
||||
shopId: undefined as number | undefined,
|
||||
productId: undefined as number | undefined,
|
||||
minBrushAmount: undefined as number | undefined,
|
||||
maxBrushAmount: undefined as number | undefined,
|
||||
@@ -40,56 +58,146 @@ const searchForm = ref({
|
||||
endBrushTime: undefined as string | undefined,
|
||||
});
|
||||
|
||||
// 店铺选项(从搜索表单中获取)
|
||||
const shopOptions = ref<{ label: string; value: number }[]>([]);
|
||||
const productOptions = ref<{ label: string; value: number }[]>([]);
|
||||
const productPage = ref(1);
|
||||
const productPageSize = 20;
|
||||
const productTotal = ref(0);
|
||||
const productLoading = ref(false);
|
||||
const productSearchKeyword = ref('');
|
||||
const productLoaded = ref(false);
|
||||
let productSearchTimer: null | ReturnType<typeof setTimeout> = null;
|
||||
|
||||
// VbenVxeGrid 表格配置
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
function productOptionLabel(p: ProductVO.Info) {
|
||||
const code = p.productCode ? ` · ${p.productCode}` : '';
|
||||
return `${p.name}${code}`;
|
||||
}
|
||||
|
||||
async function fetchProducts(page = 1, append = false) {
|
||||
if (productLoading.value) return;
|
||||
productLoading.value = true;
|
||||
try {
|
||||
const kw = productSearchKeyword.value.trim();
|
||||
const params: PageQueryDTO<ProductDTO.Filters> = {
|
||||
page,
|
||||
pageSize: productPageSize,
|
||||
filters: kw ? { keywords: kw } : {},
|
||||
};
|
||||
const data = await getProductPageApi(params);
|
||||
const mapped = data.records.map((p: ProductVO.Info) => ({
|
||||
label: productOptionLabel(p),
|
||||
value: p.id,
|
||||
}));
|
||||
productOptions.value = append ? [...productOptions.value, ...mapped] : mapped;
|
||||
productTotal.value = data.total;
|
||||
productPage.value = page;
|
||||
productLoaded.value = true;
|
||||
} catch {
|
||||
message.error('获取商品列表失败');
|
||||
if (!append) productOptions.value = [];
|
||||
} finally {
|
||||
productLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function handleProductSearch(value: string) {
|
||||
if (productSearchTimer) clearTimeout(productSearchTimer);
|
||||
productSearchTimer = setTimeout(() => {
|
||||
productSearchKeyword.value = value;
|
||||
productPage.value = 1;
|
||||
void fetchProducts(1, false);
|
||||
}, 300);
|
||||
}
|
||||
|
||||
function handleProductPopupScroll(e: Event) {
|
||||
const target = e.target as HTMLElement;
|
||||
const { scrollTop, scrollHeight, clientHeight } = target;
|
||||
if (scrollHeight - scrollTop - clientHeight < 50) {
|
||||
const hasMore = productPage.value * productPageSize < productTotal.value;
|
||||
if (hasMore && !productLoading.value) {
|
||||
void fetchProducts(productPage.value + 1, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function loadShops() {
|
||||
shopsLoading.value = true;
|
||||
try {
|
||||
const response = await getShopPageApi({
|
||||
page: 1,
|
||||
pageSize: 500,
|
||||
filters: {},
|
||||
});
|
||||
shops.value = response.records ?? [];
|
||||
} catch {
|
||||
message.error('获取店铺列表失败');
|
||||
shops.value = [];
|
||||
} finally {
|
||||
shopsLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
const selectedShopLabel = computed(() => {
|
||||
if (selectedShopId.value == null) {
|
||||
return '全部店铺';
|
||||
}
|
||||
const s = shops.value.find((x) => x.id === selectedShopId.value);
|
||||
return s?.name ?? `店铺 #${selectedShopId.value}`;
|
||||
});
|
||||
|
||||
function selectShopAll() {
|
||||
selectedShopId.value = undefined;
|
||||
}
|
||||
|
||||
function selectShop(id: number) {
|
||||
selectedShopId.value = id;
|
||||
}
|
||||
|
||||
const gridOptions: VxeGridProps<BrushOrderVO.Info> = {
|
||||
columns: [
|
||||
{
|
||||
type: 'seq' as const,
|
||||
minWidth: 'auto',
|
||||
width: 56,
|
||||
title: '序号',
|
||||
},
|
||||
{
|
||||
field: 'shopName',
|
||||
title: '店铺名称',
|
||||
minWidth: 'auto',
|
||||
minWidth: 120,
|
||||
showOverflow: 'tooltip' as const,
|
||||
},
|
||||
{
|
||||
title: '商品信息',
|
||||
minWidth: 'auto',
|
||||
minWidth: 160,
|
||||
slots: { default: 'productInfo' },
|
||||
},
|
||||
{
|
||||
field: 'quantity',
|
||||
title: '刷单数量',
|
||||
minWidth: 'auto',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '刷单金额',
|
||||
minWidth: 'auto',
|
||||
width: 120,
|
||||
slots: { default: 'brushAmount' },
|
||||
},
|
||||
{
|
||||
field: 'brushTime',
|
||||
title: '刷单时间',
|
||||
minWidth: 'auto',
|
||||
minWidth: 160,
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
minWidth: 'auto',
|
||||
minWidth: 160,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
minWidth: 'auto',
|
||||
width: 140,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
height: 'auto',
|
||||
height: '100%',
|
||||
border: true,
|
||||
stripe: true,
|
||||
rowConfig: { isHover: true },
|
||||
@@ -124,7 +232,6 @@ const gridOptions: VxeGridProps<any> = {
|
||||
| 'Total'
|
||||
)[],
|
||||
},
|
||||
// 配置远程加载
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }) => {
|
||||
@@ -134,26 +241,19 @@ const gridOptions: VxeGridProps<any> = {
|
||||
page: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
filters: {
|
||||
shopId: searchForm.value.shopId,
|
||||
productId: searchForm.value.productId,
|
||||
shopId: selectedShopId.value,
|
||||
productId: searchForm.value.productId || undefined,
|
||||
minBrushAmount: searchForm.value.minBrushAmount,
|
||||
maxBrushAmount: searchForm.value.maxBrushAmount,
|
||||
startBrushTime: searchForm.value.startBrushTime,
|
||||
endBrushTime: searchForm.value.endBrushTime,
|
||||
startBrushTime: searchForm.value.startBrushTime || undefined,
|
||||
endBrushTime: searchForm.value.endBrushTime || undefined,
|
||||
},
|
||||
};
|
||||
const data = await getBrushOrderPageApi(params);
|
||||
return {
|
||||
items: data.records,
|
||||
total: data.total,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('获取刷单记录列表失败:', error);
|
||||
return { items: data.records, total: data.total };
|
||||
} catch {
|
||||
message.error('获取刷单记录列表失败');
|
||||
return {
|
||||
items: [],
|
||||
total: 0,
|
||||
};
|
||||
return { items: [], total: 0 };
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
@@ -162,116 +262,60 @@ const gridOptions: VxeGridProps<any> = {
|
||||
},
|
||||
};
|
||||
|
||||
// 搜索表单配置(避免 formOptions 与 gridApi 循环推断)
|
||||
const gridReloadRef = ref<(() => void) | null>(null);
|
||||
const formOptions = computed(() => ({
|
||||
schema: [
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
placeholder: '请选择店铺',
|
||||
options: shopOptions,
|
||||
allowClear: true,
|
||||
onChange: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'shopId',
|
||||
label: '店铺',
|
||||
},
|
||||
{
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '商品ID(可选)',
|
||||
min: 1,
|
||||
precision: 0,
|
||||
style: { width: '100%' },
|
||||
onPressEnter: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'productId',
|
||||
label: '商品',
|
||||
},
|
||||
{
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '最小金额',
|
||||
min: 0,
|
||||
precision: 2,
|
||||
style: { width: '100%' },
|
||||
onPressEnter: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'minBrushAmount',
|
||||
label: '金额范围',
|
||||
},
|
||||
{
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '最大金额',
|
||||
min: 0,
|
||||
precision: 2,
|
||||
style: { width: '100%' },
|
||||
onPressEnter: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'maxBrushAmount',
|
||||
label: '',
|
||||
},
|
||||
{
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
placeholder: '开始时间',
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
style: { width: '100%' },
|
||||
onChange: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'startBrushTime',
|
||||
label: '刷单时间',
|
||||
},
|
||||
{
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
placeholder: '结束时间',
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
style: { width: '100%' },
|
||||
onChange: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'endBrushTime',
|
||||
label: '',
|
||||
},
|
||||
],
|
||||
showDefaultActions: true,
|
||||
collapsed: true,
|
||||
collapsedRows: 1,
|
||||
}));
|
||||
|
||||
// 刷新表格数据
|
||||
function refreshTable() {
|
||||
if (gridApi) {
|
||||
gridApi.reload();
|
||||
}
|
||||
gridApi?.reload();
|
||||
}
|
||||
|
||||
// 创建 VbenVxeGrid 实例
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
formOptions: formOptions.value,
|
||||
showSearchForm: true,
|
||||
tableTitle: '刷单记录管理',
|
||||
showSearchForm: false,
|
||||
tableTitle: '刷单记录',
|
||||
});
|
||||
gridReloadRef.value = () => gridApi.reload();
|
||||
|
||||
// 处理新增
|
||||
watch(selectedShopId, () => {
|
||||
gridApi.reload();
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
void loadShops();
|
||||
});
|
||||
|
||||
function resetModalPreset() {
|
||||
presetShopIdForModal.value = null;
|
||||
}
|
||||
|
||||
function shopRowClass(id: number | 'all') {
|
||||
const active =
|
||||
id === 'all'
|
||||
? selectedShopId.value === undefined
|
||||
: selectedShopId.value === id;
|
||||
return [
|
||||
'flex cursor-pointer items-center gap-2 rounded-lg border px-3 py-2.5 text-sm font-semibold transition-colors',
|
||||
active
|
||||
? 'border-primary bg-primary/8 text-primary'
|
||||
: 'border-transparent bg-muted/30 text-foreground hover:bg-muted/60',
|
||||
].join(' ');
|
||||
}
|
||||
|
||||
const handleAdd = () => {
|
||||
currentBrushOrderData.value = null;
|
||||
resetModalPreset();
|
||||
formModalVisible.value = true;
|
||||
};
|
||||
|
||||
// 处理编辑
|
||||
function handleAddForShop(shopId: number) {
|
||||
selectShop(shopId);
|
||||
currentBrushOrderData.value = null;
|
||||
presetShopIdForModal.value = shopId;
|
||||
formModalVisible.value = true;
|
||||
}
|
||||
|
||||
const handleEdit = (record: BrushOrderVO.Info) => {
|
||||
resetModalPreset();
|
||||
currentBrushOrderData.value = record;
|
||||
formModalVisible.value = true;
|
||||
};
|
||||
|
||||
// 处理删除
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
await deleteBrushOrderApi(id);
|
||||
@@ -282,44 +326,24 @@ const handleDelete = async (id: number) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 处理表单成功
|
||||
const handleFormSuccess = () => {
|
||||
resetModalPreset();
|
||||
refreshTable();
|
||||
};
|
||||
|
||||
// 格式化金额
|
||||
const formatAmount = (amount: number) => {
|
||||
return `¥${amount.toFixed(2)}`;
|
||||
const handleFormCancel = () => {
|
||||
resetModalPreset();
|
||||
formModalVisible.value = false;
|
||||
};
|
||||
|
||||
// 加载店铺选项
|
||||
const loadShopOptions = async () => {
|
||||
try {
|
||||
const response = await getShopPageApi({
|
||||
page: 1,
|
||||
pageSize: 1000,
|
||||
filters: {},
|
||||
});
|
||||
shopOptions.value = response.records.map((shop: ShopVO.Info) => ({
|
||||
label: shop.name,
|
||||
value: shop.id,
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error('加载店铺列表失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
// 组件挂载时加载数据
|
||||
onMounted(() => {
|
||||
loadShopOptions();
|
||||
});
|
||||
const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page title="刷单记录管理" auto-content-height>
|
||||
<Page title="刷单记录管理" :auto-content-height="true">
|
||||
<template #description>
|
||||
<div class="text-foreground/80 mt-2">
|
||||
管理店铺刷单记录,支持按店铺、商品、金额、时间等维度查询和统计
|
||||
左侧选择店铺筛选右侧记录;未选店铺时展示全部。可在店铺行快捷新增该店铺刷单记录。
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -332,55 +356,222 @@ onMounted(() => {
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
<!-- 数据表格 -->
|
||||
<Grid :loading="loading">
|
||||
<!-- 工具栏工具 -->
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<span class="text-gray-500">
|
||||
支持按店铺、商品、金额、时间等维度查询刷单记录
|
||||
<Flex gap="middle" class="h-full min-h-0">
|
||||
<Card
|
||||
class="flex h-full w-[420px] shrink-0 flex-col"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: '8px',
|
||||
minHeight: 0,
|
||||
padding: '12px',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="flex items-center gap-2 text-base font-semibold">
|
||||
<StoreIcon class="h-4 w-4" />
|
||||
店铺
|
||||
</span>
|
||||
</Space>
|
||||
</template>
|
||||
</template>
|
||||
<Spin :spinning="shopsLoading" class="flex min-h-0 flex-1 flex-col">
|
||||
<div class="flex min-h-0 flex-1 flex-col overflow-y-auto">
|
||||
<button
|
||||
type="button"
|
||||
:class="shopRowClass('all')"
|
||||
class="mb-1 w-full text-left"
|
||||
@click="selectShopAll"
|
||||
>
|
||||
<span class="min-w-0 flex-1 truncate">全部店铺</span>
|
||||
<span class="shrink-0 text-xs font-normal text-muted-foreground">
|
||||
全部记录
|
||||
</span>
|
||||
</button>
|
||||
<Empty
|
||||
v-if="!shopsLoading && shops.length === 0"
|
||||
class="py-8"
|
||||
description="暂无店铺"
|
||||
/>
|
||||
<div v-else class="space-y-1">
|
||||
<div
|
||||
v-for="shop in shops"
|
||||
:key="shop.id"
|
||||
:class="shopRowClass(shop.id)"
|
||||
class="group w-full"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="min-w-0 flex-1 truncate text-left"
|
||||
@click="selectShop(shop.id)"
|
||||
>
|
||||
{{ shop.name }}
|
||||
</button>
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
class="!h-7 shrink-0 !px-1 !text-xs font-semibold opacity-80 group-hover:opacity-100"
|
||||
@click.stop="handleAddForShop(shop.id)"
|
||||
>
|
||||
<PlusIcon class="mr-0.5 inline h-3.5 w-3.5" />
|
||||
添加
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Spin>
|
||||
</Card>
|
||||
|
||||
<!-- 商品信息列 -->
|
||||
<template #productInfo="{ row }: { row: any }">
|
||||
<div v-if="row.productName">
|
||||
<div style="font-weight: bold">{{ row.productName }}</div>
|
||||
<div v-if="row.productSpecName" style="color: #666; font-size: 12px">
|
||||
{{ row.productSpecName }}
|
||||
<Card
|
||||
class="flex h-full min-h-0 min-w-0 flex-1 flex-col"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
minHeight: 0,
|
||||
padding: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="text-base font-semibold">刷单记录</span>
|
||||
</template>
|
||||
|
||||
<div
|
||||
class="shrink-0 space-y-2 border-t border-border px-4 py-3"
|
||||
>
|
||||
<div class="flex flex-wrap items-end gap-2">
|
||||
<div class="flex min-w-0 flex-col gap-0.5">
|
||||
<span class="text-xs text-muted-foreground">商品</span>
|
||||
<Select
|
||||
v-model:value="searchForm.productId"
|
||||
allow-clear
|
||||
show-search
|
||||
:filter-option="false"
|
||||
placeholder="名称/编码搜索"
|
||||
class="min-w-[220px] max-w-[320px]"
|
||||
:options="productOptions"
|
||||
:loading="productLoading"
|
||||
:dropdown-match-select-width="false"
|
||||
:dropdown-style="{ maxHeight: '300px', overflow: 'auto' }"
|
||||
@search="handleProductSearch"
|
||||
@popup-scroll="handleProductPopupScroll"
|
||||
@focus="
|
||||
() => {
|
||||
if (!productLoaded) void fetchProducts(1, false);
|
||||
}
|
||||
"
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-0.5">
|
||||
<span class="text-xs text-muted-foreground">金额 ≥</span>
|
||||
<InputNumber
|
||||
v-model:value="searchForm.minBrushAmount"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
placeholder="最小"
|
||||
class="!w-[110px]"
|
||||
allow-clear
|
||||
@press-enter="refreshTable"
|
||||
@blur="refreshTable"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-0.5">
|
||||
<span class="text-xs text-muted-foreground">金额 ≤</span>
|
||||
<InputNumber
|
||||
v-model:value="searchForm.maxBrushAmount"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
placeholder="最大"
|
||||
class="!w-[110px]"
|
||||
allow-clear
|
||||
@press-enter="refreshTable"
|
||||
@blur="refreshTable"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-0.5">
|
||||
<span class="text-xs text-muted-foreground">刷单时间起</span>
|
||||
<DatePicker
|
||||
v-model:value="searchForm.startBrushTime"
|
||||
show-time
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="开始"
|
||||
class="w-[180px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-0.5">
|
||||
<span class="text-xs text-muted-foreground">刷单时间止</span>
|
||||
<DatePicker
|
||||
v-model:value="searchForm.endBrushTime"
|
||||
show-time
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="结束"
|
||||
class="w-[180px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
</div>
|
||||
<Button type="default" size="small" class="mb-0.5" @click="refreshTable">
|
||||
查询
|
||||
</Button>
|
||||
</div>
|
||||
<div class="text-xs text-muted-foreground">
|
||||
当前:{{ selectedShopLabel }}
|
||||
</div>
|
||||
</div>
|
||||
<span v-else class="text-gray-400">-</span>
|
||||
</template>
|
||||
|
||||
<!-- 刷单金额列 -->
|
||||
<template #brushAmount="{ row }: { row: any }">
|
||||
<span class="font-medium text-green-600">
|
||||
{{ formatAmount(row.brushAmount || 0) }}
|
||||
</span>
|
||||
</template>
|
||||
<div class="min-h-0 flex-1 overflow-hidden px-2 pb-2 pt-0 sm:px-3 sm:pb-3">
|
||||
<Grid :loading="loading" class="h-full min-h-0">
|
||||
<template #toolbar-tools>
|
||||
<span class="text-xs text-muted-foreground">
|
||||
修改筛选后点击「查询」或失焦/回车刷新;左侧切换店铺立即刷新
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<!-- 操作列 -->
|
||||
<template #action="{ row }: { row: any }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)"> 编辑 </Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这条刷单记录吗?"
|
||||
@confirm="handleDelete(row.id)"
|
||||
>
|
||||
<Button size="small" danger> 删除 </Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
<template #productInfo="{ row }">
|
||||
<div v-if="row.productName">
|
||||
<div class="font-semibold">{{ row.productName }}</div>
|
||||
<div
|
||||
v-if="row.productSpecName"
|
||||
class="text-xs text-muted-foreground"
|
||||
>
|
||||
{{ row.productSpecName }}
|
||||
</div>
|
||||
</div>
|
||||
<span v-else class="text-muted-foreground">—</span>
|
||||
</template>
|
||||
|
||||
<template #brushAmount="{ row }">
|
||||
<span class="font-semibold text-green-600">
|
||||
{{ formatAmount(row.brushAmount ?? 0) }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这条刷单记录吗?"
|
||||
@confirm="handleDelete(row.id)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
</div>
|
||||
</Card>
|
||||
</Flex>
|
||||
|
||||
<!-- 表单弹窗 -->
|
||||
<BrushOrderFormModal
|
||||
v-model:open="formModalVisible"
|
||||
:brush-order-data="currentBrushOrderData"
|
||||
:preset-shop-id="presetShopIdForModal"
|
||||
@success="handleFormSuccess"
|
||||
@cancel="formModalVisible = false"
|
||||
@cancel="handleFormCancel"
|
||||
/>
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user