mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 06:29:20 +08:00
feat: 优化刷单,月度目标,推广管理页面
This commit is contained in:
@@ -2,10 +2,9 @@
|
|||||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||||
import type { BrushOrderDTO, BrushOrderVO } from '#/api/ec/brush-order';
|
import type { BrushOrderDTO, BrushOrderVO } from '#/api/ec/brush-order';
|
||||||
import type { ProductDTO, ProductVO } from '#/api/ec/product/types';
|
import type { ProductDTO, ProductVO } from '#/api/ec/product/types';
|
||||||
import type { ShopVO } from '#/api/ec/shop/types';
|
|
||||||
import type { PageQueryDTO } from '#/types/common';
|
import type { PageQueryDTO } from '#/types/common';
|
||||||
|
|
||||||
import { computed, onMounted, ref, watch } from 'vue';
|
import { computed, ref, watch } from 'vue';
|
||||||
|
|
||||||
import { Page } from '@vben/common-ui';
|
import { Page } from '@vben/common-ui';
|
||||||
import { createIconifyIcon } from '@vben/icons';
|
import { createIconifyIcon } from '@vben/icons';
|
||||||
@@ -14,14 +13,12 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
DatePicker,
|
DatePicker,
|
||||||
Empty,
|
|
||||||
Flex,
|
Flex,
|
||||||
InputNumber,
|
InputNumber,
|
||||||
message,
|
message,
|
||||||
Popconfirm,
|
Popconfirm,
|
||||||
Select,
|
Select,
|
||||||
Space,
|
Space,
|
||||||
Spin,
|
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
@@ -30,25 +27,19 @@ import {
|
|||||||
getBrushOrderPageApi,
|
getBrushOrderPageApi,
|
||||||
} from '#/api/ec/brush-order';
|
} from '#/api/ec/brush-order';
|
||||||
import { getProductPageApi } from '#/api/ec/product';
|
import { getProductPageApi } from '#/api/ec/product';
|
||||||
import { getShopPageApi } from '#/api/ec/shop/apis';
|
import ShopSidebarList from '#/views/ec/components/ShopSidebarList.vue';
|
||||||
|
|
||||||
import BrushOrderFormModal from './components/BrushOrderFormModal.vue';
|
import BrushOrderFormModal from './components/BrushOrderFormModal.vue';
|
||||||
import {
|
|
||||||
SIDEBAR_LIST_SHELL_CLASS,
|
|
||||||
sidebarListRowClass,
|
|
||||||
} from '#/utils/sidebar-list-styles';
|
|
||||||
|
|
||||||
defineOptions({ name: 'BrushOrderManagement' });
|
defineOptions({ name: 'BrushOrderManagement' });
|
||||||
|
|
||||||
const PlusIcon = createIconifyIcon('lucide:plus');
|
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||||
const StoreIcon = createIconifyIcon('lucide:store');
|
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const shopsLoading = ref(false);
|
|
||||||
const shops = ref<ShopVO.Info[]>([]);
|
|
||||||
|
|
||||||
/** 未选店铺:undefined 表示全部 */
|
/** 未选店铺:undefined 表示全部 */
|
||||||
const selectedShopId = ref<number | undefined>(undefined);
|
const selectedShopId = ref<number | undefined>(undefined);
|
||||||
|
const selectedShopName = ref<string | undefined>(undefined);
|
||||||
|
|
||||||
const formModalVisible = ref(false);
|
const formModalVisible = ref(false);
|
||||||
const currentBrushOrderData = ref<BrushOrderVO.Info | null>(null);
|
const currentBrushOrderData = ref<BrushOrderVO.Info | null>(null);
|
||||||
@@ -123,37 +114,27 @@ function handleProductPopupScroll(e: Event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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(() => {
|
const selectedShopLabel = computed(() => {
|
||||||
if (selectedShopId.value == null) {
|
if (selectedShopId.value == null) {
|
||||||
return '全部店铺';
|
return '全部店铺';
|
||||||
}
|
}
|
||||||
const s = shops.value.find((x) => x.id === selectedShopId.value);
|
return selectedShopName.value || `店铺 #${selectedShopId.value}`;
|
||||||
return s?.name ?? `店铺 #${selectedShopId.value}`;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function selectShopAll() {
|
function onShopSelect(shop: { id: number; name: string } | null) {
|
||||||
selectedShopId.value = undefined;
|
if (!shop) {
|
||||||
|
selectedShopId.value = undefined;
|
||||||
|
selectedShopName.value = undefined;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
selectedShopId.value = shop.id;
|
||||||
|
selectedShopName.value = shop.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectShop(id: number) {
|
function handleAddForShop(shopId: number) {
|
||||||
selectedShopId.value = id;
|
currentBrushOrderData.value = null;
|
||||||
|
presetShopIdForModal.value = shopId;
|
||||||
|
formModalVisible.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const gridOptions: VxeGridProps<BrushOrderVO.Info> = {
|
const gridOptions: VxeGridProps<BrushOrderVO.Info> = {
|
||||||
@@ -280,39 +261,16 @@ watch(selectedShopId, () => {
|
|||||||
gridApi.reload();
|
gridApi.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
void loadShops();
|
|
||||||
});
|
|
||||||
|
|
||||||
function resetModalPreset() {
|
function resetModalPreset() {
|
||||||
presetShopIdForModal.value = null;
|
presetShopIdForModal.value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function shopRowClass(id: number | 'all') {
|
|
||||||
const active =
|
|
||||||
id === 'all'
|
|
||||||
? selectedShopId.value === undefined
|
|
||||||
: selectedShopId.value === id;
|
|
||||||
const layout =
|
|
||||||
id === 'all'
|
|
||||||
? 'mb-1.5 flex w-full cursor-pointer items-center gap-2 text-left'
|
|
||||||
: 'group flex w-full cursor-pointer items-center gap-2';
|
|
||||||
return sidebarListRowClass(active, layout);
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
currentBrushOrderData.value = null;
|
currentBrushOrderData.value = null;
|
||||||
resetModalPreset();
|
resetModalPreset();
|
||||||
formModalVisible.value = true;
|
formModalVisible.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
function handleAddForShop(shopId: number) {
|
|
||||||
selectShop(shopId);
|
|
||||||
currentBrushOrderData.value = null;
|
|
||||||
presetShopIdForModal.value = shopId;
|
|
||||||
formModalVisible.value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleEdit = (record: BrushOrderVO.Info) => {
|
const handleEdit = (record: BrushOrderVO.Info) => {
|
||||||
resetModalPreset();
|
resetModalPreset();
|
||||||
currentBrushOrderData.value = record;
|
currentBrushOrderData.value = record;
|
||||||
@@ -359,69 +317,12 @@ const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
|||||||
</Space>
|
</Space>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<Flex gap="middle" class="h-full min-h-0">
|
<Flex gap="middle" class="h-full min-h-0 overflow-hidden">
|
||||||
<Card
|
<ShopSidebarList
|
||||||
class="flex h-full w-[420px] shrink-0 flex-col"
|
:selected-shop-id="selectedShopId"
|
||||||
:body-style="{
|
@select="onShopSelect"
|
||||||
height: '100%',
|
@add-for-shop="handleAddForShop"
|
||||||
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>
|
|
||||||
</template>
|
|
||||||
<Spin :spinning="shopsLoading" class="flex min-h-0 flex-1 flex-col">
|
|
||||||
<div :class="SIDEBAR_LIST_SHELL_CLASS">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
:class="shopRowClass('all')"
|
|
||||||
@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>
|
|
||||||
|
|
||||||
<Card
|
<Card
|
||||||
class="flex h-full min-h-0 min-w-0 flex-1 flex-col"
|
class="flex h-full min-h-0 min-w-0 flex-1 flex-col"
|
||||||
@@ -437,9 +338,7 @@ const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
|||||||
<span class="text-base font-semibold">刷单记录</span>
|
<span class="text-base font-semibold">刷单记录</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div
|
<div class="shrink-0 space-y-2 border-t border-border px-4 py-3">
|
||||||
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 flex-wrap items-end gap-2">
|
||||||
<div class="flex min-w-0 flex-col gap-0.5">
|
<div class="flex min-w-0 flex-col gap-0.5">
|
||||||
<span class="text-xs text-muted-foreground">商品</span>
|
<span class="text-xs text-muted-foreground">商品</span>
|
||||||
|
|||||||
@@ -0,0 +1,289 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { ShopVO } from '#/api/ec/shop/types';
|
||||||
|
|
||||||
|
import { computed, onMounted, ref } from 'vue';
|
||||||
|
|
||||||
|
import { createIconifyIcon } from '@vben/icons';
|
||||||
|
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Card,
|
||||||
|
Empty,
|
||||||
|
Input,
|
||||||
|
message,
|
||||||
|
Select,
|
||||||
|
Spin,
|
||||||
|
Tag,
|
||||||
|
} from 'ant-design-vue';
|
||||||
|
|
||||||
|
import { getPlatformListApi } from '#/api/ec/platform';
|
||||||
|
import { getShopPageApi } from '#/api/ec/shop/apis';
|
||||||
|
import {
|
||||||
|
getPlatformLabel,
|
||||||
|
getPlatformTagColor,
|
||||||
|
} from '#/utils/platform-display';
|
||||||
|
|
||||||
|
defineOptions({ name: 'EcShopSidebarList' });
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
/** undefined = 全部店铺 */
|
||||||
|
selectedShopId?: number;
|
||||||
|
/** 是否显示行内「添加」快捷按钮 */
|
||||||
|
showAddAction?: boolean;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
selectedShopId: undefined,
|
||||||
|
showAddAction: true,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
'update:selectedShopId': [id: number | undefined];
|
||||||
|
/** 选中店铺;null 表示「全部店铺」 */
|
||||||
|
select: [shop: ShopVO.Info | null];
|
||||||
|
addForShop: [shopId: number];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const StoreIcon = createIconifyIcon('lucide:store');
|
||||||
|
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||||
|
|
||||||
|
const shopSearchForm = ref({
|
||||||
|
name: '',
|
||||||
|
platformCode: undefined as string | undefined,
|
||||||
|
});
|
||||||
|
|
||||||
|
const shops = ref<ShopVO.Info[]>([]);
|
||||||
|
const shopsLoading = ref(false);
|
||||||
|
const shopPagination = ref({ current: 1, pageSize: 20, total: 0 });
|
||||||
|
|
||||||
|
const platformOptions = ref<{ label: string; value: string }[]>([]);
|
||||||
|
|
||||||
|
const shopTotalPages = computed(() => {
|
||||||
|
const { total, pageSize } = shopPagination.value;
|
||||||
|
return Math.max(1, Math.ceil(total / pageSize) || 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
const allSelected = computed(() => props.selectedShopId === undefined);
|
||||||
|
|
||||||
|
async function loadPlatformOptions() {
|
||||||
|
try {
|
||||||
|
const platforms = await getPlatformListApi();
|
||||||
|
platformOptions.value = (platforms ?? []).map((p) => ({
|
||||||
|
label: getPlatformLabel(p.code, p.label),
|
||||||
|
value: p.code,
|
||||||
|
}));
|
||||||
|
} catch {
|
||||||
|
platformOptions.value = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function searchShops(resetPage = false) {
|
||||||
|
if (resetPage) {
|
||||||
|
shopPagination.value.current = 1;
|
||||||
|
}
|
||||||
|
shopsLoading.value = true;
|
||||||
|
try {
|
||||||
|
const result = await getShopPageApi({
|
||||||
|
page: shopPagination.value.current,
|
||||||
|
pageSize: shopPagination.value.pageSize,
|
||||||
|
filters: {
|
||||||
|
name: shopSearchForm.value.name || undefined,
|
||||||
|
platformCode: shopSearchForm.value.platformCode,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
shops.value = result.records ?? [];
|
||||||
|
shopPagination.value.total = result.total ?? 0;
|
||||||
|
} catch (error: any) {
|
||||||
|
message.error(error?.message || '获取店铺列表失败');
|
||||||
|
shops.value = [];
|
||||||
|
} finally {
|
||||||
|
shopsLoading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetShopSearch() {
|
||||||
|
shopSearchForm.value = { name: '', platformCode: undefined };
|
||||||
|
void searchShops(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleShopPageChange(page: number, pageSize: number) {
|
||||||
|
shopPagination.value.current = page;
|
||||||
|
shopPagination.value.pageSize = pageSize;
|
||||||
|
void searchShops();
|
||||||
|
}
|
||||||
|
|
||||||
|
function goShopPage(page: number) {
|
||||||
|
const next = Math.min(shopTotalPages.value, Math.max(1, page));
|
||||||
|
if (next === shopPagination.value.current) return;
|
||||||
|
handleShopPageChange(next, shopPagination.value.pageSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectAll() {
|
||||||
|
emit('update:selectedShopId', undefined);
|
||||||
|
emit('select', null);
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectShop(shop: ShopVO.Info) {
|
||||||
|
emit('update:selectedShopId', shop.id);
|
||||||
|
emit('select', shop);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleAdd(shopId: number) {
|
||||||
|
const shop = shops.value.find((s) => s.id === shopId) ?? null;
|
||||||
|
emit('update:selectedShopId', shopId);
|
||||||
|
if (shop) {
|
||||||
|
emit('select', shop);
|
||||||
|
}
|
||||||
|
emit('addForShop', shopId);
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
void loadPlatformOptions();
|
||||||
|
void searchShops();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Card
|
||||||
|
class="flex h-full w-[320px] shrink-0 flex-col overflow-hidden"
|
||||||
|
:body-style="{
|
||||||
|
height: '100%',
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
gap: '8px',
|
||||||
|
minHeight: 0,
|
||||||
|
minWidth: 0,
|
||||||
|
overflow: 'hidden',
|
||||||
|
padding: '12px',
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<template #title>
|
||||||
|
<span class="flex items-center gap-2 text-base font-semibold">
|
||||||
|
<StoreIcon class="h-4 w-4" />
|
||||||
|
店铺
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div class="flex min-w-0 shrink-0 flex-col gap-2">
|
||||||
|
<Input
|
||||||
|
v-model:value="shopSearchForm.name"
|
||||||
|
placeholder="店铺名称"
|
||||||
|
allow-clear
|
||||||
|
class="w-full min-w-0"
|
||||||
|
@press-enter="searchShops(true)"
|
||||||
|
/>
|
||||||
|
<div class="flex min-w-0 items-center gap-2">
|
||||||
|
<Select
|
||||||
|
v-model:value="shopSearchForm.platformCode"
|
||||||
|
placeholder="平台"
|
||||||
|
allow-clear
|
||||||
|
class="min-w-0 flex-1"
|
||||||
|
:options="platformOptions"
|
||||||
|
/>
|
||||||
|
<Button type="primary" class="shrink-0" @click="searchShops(true)">
|
||||||
|
搜索
|
||||||
|
</Button>
|
||||||
|
<Button class="shrink-0" @click="resetShopSearch">重置</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
|
||||||
|
<div class="min-h-0 flex-1 overflow-y-auto">
|
||||||
|
<Card
|
||||||
|
size="small"
|
||||||
|
:body-style="{ padding: '10px 12px' }"
|
||||||
|
class="mb-2 cursor-pointer !shadow-none hover:border-primary"
|
||||||
|
: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>
|
||||||
|
</Card>
|
||||||
|
|
||||||
|
<Spin :spinning="shopsLoading">
|
||||||
|
<Empty
|
||||||
|
v-if="!shopsLoading && shops.length === 0"
|
||||||
|
class="py-8"
|
||||||
|
description="暂无店铺"
|
||||||
|
/>
|
||||||
|
<template v-else>
|
||||||
|
<Card
|
||||||
|
v-for="shop in shops"
|
||||||
|
:key="shop.id"
|
||||||
|
size="small"
|
||||||
|
:body-style="{ padding: '10px 12px' }"
|
||||||
|
class="group mb-2 cursor-pointer !shadow-none last:mb-0 hover:border-primary"
|
||||||
|
:class="
|
||||||
|
selectedShopId === shop.id
|
||||||
|
? 'border-primary bg-primary/5'
|
||||||
|
: undefined
|
||||||
|
"
|
||||||
|
@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)"
|
||||||
|
>
|
||||||
|
{{
|
||||||
|
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>
|
||||||
|
</Card>
|
||||||
|
</template>
|
||||||
|
</Spin>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="mt-2 flex w-full min-w-0 shrink-0 items-center justify-between gap-2"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
size="small"
|
||||||
|
class="shrink-0"
|
||||||
|
:disabled="shopPagination.current <= 1 || shopsLoading"
|
||||||
|
@click="goShopPage(shopPagination.current - 1)"
|
||||||
|
>
|
||||||
|
上一页
|
||||||
|
</Button>
|
||||||
|
<span
|
||||||
|
class="min-w-0 flex-1 truncate text-center text-xs text-muted-foreground"
|
||||||
|
>
|
||||||
|
{{ shopPagination.current }} / {{ shopTotalPages }}
|
||||||
|
<span class="ml-1 opacity-70">({{ shopPagination.total }})</span>
|
||||||
|
</span>
|
||||||
|
<Button
|
||||||
|
size="small"
|
||||||
|
class="shrink-0"
|
||||||
|
:disabled="
|
||||||
|
shopPagination.current >= shopTotalPages || shopsLoading
|
||||||
|
"
|
||||||
|
@click="goShopPage(shopPagination.current + 1)"
|
||||||
|
>
|
||||||
|
下一页
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
</template>
|
||||||
@@ -4,7 +4,6 @@ import type {
|
|||||||
PromotionFeeDTO,
|
PromotionFeeDTO,
|
||||||
PromotionFeeVO,
|
PromotionFeeVO,
|
||||||
} from '#/api/ec/promotion-fee/types';
|
} from '#/api/ec/promotion-fee/types';
|
||||||
import type { ShopVO } from '#/api/ec/shop/types';
|
|
||||||
import type { PageQueryDTO } from '#/types/common';
|
import type { PageQueryDTO } from '#/types/common';
|
||||||
|
|
||||||
import { computed, onMounted, ref, watch } from 'vue';
|
import { computed, onMounted, ref, watch } from 'vue';
|
||||||
@@ -16,13 +15,11 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
DatePicker,
|
DatePicker,
|
||||||
Empty,
|
|
||||||
Flex,
|
Flex,
|
||||||
message,
|
message,
|
||||||
Popconfirm,
|
Popconfirm,
|
||||||
Select,
|
Select,
|
||||||
Space,
|
Space,
|
||||||
Spin,
|
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
@@ -30,26 +27,20 @@ import {
|
|||||||
deletePromotionFeeApi,
|
deletePromotionFeeApi,
|
||||||
getPromotionFeePageApi,
|
getPromotionFeePageApi,
|
||||||
} from '#/api/ec/promotion-fee';
|
} from '#/api/ec/promotion-fee';
|
||||||
import { getShopPageApi } from '#/api/ec/shop/apis';
|
|
||||||
import { getAllPromotionFeeTypeListApi } from '#/api/ec/promotion-fee/type/apis';
|
import { getAllPromotionFeeTypeListApi } from '#/api/ec/promotion-fee/type/apis';
|
||||||
|
import ShopSidebarList from '#/views/ec/components/ShopSidebarList.vue';
|
||||||
|
|
||||||
import PromotionFeeFormModal from './components/PromotionFeeFormModal.vue';
|
import PromotionFeeFormModal from './components/PromotionFeeFormModal.vue';
|
||||||
import {
|
|
||||||
SIDEBAR_LIST_SHELL_CLASS,
|
|
||||||
sidebarListRowClass,
|
|
||||||
} from '#/utils/sidebar-list-styles';
|
|
||||||
|
|
||||||
defineOptions({ name: 'PromotionFeeManagement' });
|
defineOptions({ name: 'PromotionFeeManagement' });
|
||||||
|
|
||||||
const PlusIcon = createIconifyIcon('lucide:plus');
|
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||||
const StoreIcon = createIconifyIcon('lucide:store');
|
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const shopsLoading = ref(false);
|
|
||||||
const shops = ref<ShopVO.Info[]>([]);
|
|
||||||
|
|
||||||
/** 未选择具体店铺:undefined 表示全部店铺 */
|
/** 未选择具体店铺:undefined 表示全部店铺 */
|
||||||
const selectedShopId = ref<number | undefined>(undefined);
|
const selectedShopId = ref<number | undefined>(undefined);
|
||||||
|
const selectedShopName = ref<string | undefined>(undefined);
|
||||||
|
|
||||||
const formModalVisible = ref(false);
|
const formModalVisible = ref(false);
|
||||||
const currentPromotionFeeData = ref<null | PromotionFeeVO.Info>(null);
|
const currentPromotionFeeData = ref<null | PromotionFeeVO.Info>(null);
|
||||||
@@ -64,10 +55,12 @@ async function fetchFeeTypeOptions() {
|
|||||||
feeTypeLoading.value = true;
|
feeTypeLoading.value = true;
|
||||||
try {
|
try {
|
||||||
const data = await getAllPromotionFeeTypeListApi();
|
const data = await getAllPromotionFeeTypeListApi();
|
||||||
feeTypeOptions.value = (data || []).map((type: { id: number; typeName: string }) => ({
|
feeTypeOptions.value = (data || []).map(
|
||||||
label: type.typeName,
|
(type: { id: number; typeName: string }) => ({
|
||||||
value: type.id,
|
label: type.typeName,
|
||||||
}));
|
value: type.id,
|
||||||
|
}),
|
||||||
|
);
|
||||||
feeTypeFetched.value = true;
|
feeTypeFetched.value = true;
|
||||||
} catch {
|
} catch {
|
||||||
message.error('获取推广费类型失败');
|
message.error('获取推广费类型失败');
|
||||||
@@ -82,33 +75,27 @@ const searchForm = ref({
|
|||||||
feeDateEnd: undefined as string | undefined,
|
feeDateEnd: undefined as string | undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
async function loadShops() {
|
|
||||||
shopsLoading.value = true;
|
|
||||||
try {
|
|
||||||
const data = await getShopPageApi({ page: 1, pageSize: 500, filters: {} });
|
|
||||||
shops.value = data.records ?? [];
|
|
||||||
} catch {
|
|
||||||
message.error('获取店铺列表失败');
|
|
||||||
shops.value = [];
|
|
||||||
} finally {
|
|
||||||
shopsLoading.value = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectedShopLabel = computed(() => {
|
const selectedShopLabel = computed(() => {
|
||||||
if (selectedShopId.value == null) {
|
if (selectedShopId.value == null) {
|
||||||
return '全部店铺';
|
return '全部店铺';
|
||||||
}
|
}
|
||||||
const s = shops.value.find((x) => x.id === selectedShopId.value);
|
return selectedShopName.value || `店铺 #${selectedShopId.value}`;
|
||||||
return s?.name ?? `店铺 #${selectedShopId.value}`;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function selectShopAll() {
|
function onShopSelect(shop: { id: number; name: string } | null) {
|
||||||
selectedShopId.value = undefined;
|
if (!shop) {
|
||||||
|
selectedShopId.value = undefined;
|
||||||
|
selectedShopName.value = undefined;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
selectedShopId.value = shop.id;
|
||||||
|
selectedShopName.value = shop.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectShop(id: number) {
|
function handleAddForShop(shopId: number) {
|
||||||
selectedShopId.value = id;
|
currentPromotionFeeData.value = null;
|
||||||
|
presetShopIdForModal.value = shopId;
|
||||||
|
formModalVisible.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const gridOptions: VxeGridProps<PromotionFeeVO.Info> = {
|
const gridOptions: VxeGridProps<PromotionFeeVO.Info> = {
|
||||||
@@ -245,7 +232,6 @@ watch(selectedShopId, () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
void loadShops();
|
|
||||||
void fetchFeeTypeOptions();
|
void fetchFeeTypeOptions();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -259,13 +245,6 @@ const handleAdd = () => {
|
|||||||
formModalVisible.value = true;
|
formModalVisible.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
function handleAddForShop(shopId: number) {
|
|
||||||
selectShop(shopId);
|
|
||||||
currentPromotionFeeData.value = null;
|
|
||||||
presetShopIdForModal.value = shopId;
|
|
||||||
formModalVisible.value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleEdit = (record: PromotionFeeVO.Info) => {
|
const handleEdit = (record: PromotionFeeVO.Info) => {
|
||||||
resetModalPreset();
|
resetModalPreset();
|
||||||
currentPromotionFeeData.value = record;
|
currentPromotionFeeData.value = record;
|
||||||
@@ -293,18 +272,6 @@ const handleFormCancel = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
||||||
|
|
||||||
function shopRowClass(id: number | 'all') {
|
|
||||||
const active =
|
|
||||||
id === 'all'
|
|
||||||
? selectedShopId.value === undefined
|
|
||||||
: selectedShopId.value === id;
|
|
||||||
const layout =
|
|
||||||
id === 'all'
|
|
||||||
? 'mb-1.5 flex w-full cursor-pointer items-center gap-2 text-left'
|
|
||||||
: 'group flex w-full cursor-pointer items-center gap-2';
|
|
||||||
return sidebarListRowClass(active, layout);
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -324,72 +291,13 @@ function shopRowClass(id: number | 'all') {
|
|||||||
</Space>
|
</Space>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<Flex gap="middle" class="h-full min-h-0">
|
<Flex gap="middle" class="h-full min-h-0 overflow-hidden">
|
||||||
<!-- 左:店铺(与 company-menu-manage 一致:Card + h-full + 内部滚动) -->
|
<ShopSidebarList
|
||||||
<Card
|
:selected-shop-id="selectedShopId"
|
||||||
class="flex h-full w-[420px] shrink-0 flex-col"
|
@select="onShopSelect"
|
||||||
:body-style="{
|
@add-for-shop="handleAddForShop"
|
||||||
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>
|
|
||||||
</template>
|
|
||||||
<Spin :spinning="shopsLoading" class="flex min-h-0 flex-1 flex-col">
|
|
||||||
<div :class="SIDEBAR_LIST_SHELL_CLASS">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
:class="shopRowClass('all')"
|
|
||||||
@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>
|
|
||||||
|
|
||||||
<!-- 右:推广记录 -->
|
|
||||||
<Card
|
<Card
|
||||||
class="flex h-full min-h-0 min-w-0 flex-1 flex-col"
|
class="flex h-full min-h-0 min-w-0 flex-1 flex-col"
|
||||||
:body-style="{
|
:body-style="{
|
||||||
@@ -445,7 +353,9 @@ function shopRowClass(id: number | 'all') {
|
|||||||
当前:{{ selectedShopLabel }}
|
当前:{{ selectedShopLabel }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="min-h-0 flex-1 overflow-hidden px-2 pb-2 pt-0 sm:px-3 sm:pb-3">
|
<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">
|
<Grid :loading="loading" class="h-full min-h-0">
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<span class="text-xs text-muted-foreground">
|
<span class="text-xs text-muted-foreground">
|
||||||
|
|||||||
@@ -4,10 +4,9 @@ import type {
|
|||||||
ShopMonthlyTargetDTO,
|
ShopMonthlyTargetDTO,
|
||||||
ShopMonthlyTargetVO,
|
ShopMonthlyTargetVO,
|
||||||
} from '#/api/ec/shop/monthly-target';
|
} from '#/api/ec/shop/monthly-target';
|
||||||
import type { ShopVO } from '#/api/ec/shop/types';
|
|
||||||
import type { PageQueryDTO } from '#/types/common';
|
import type { PageQueryDTO } from '#/types/common';
|
||||||
|
|
||||||
import { computed, onMounted, ref, watch } from 'vue';
|
import { computed, ref, watch } from 'vue';
|
||||||
|
|
||||||
import { Page } from '@vben/common-ui';
|
import { Page } from '@vben/common-ui';
|
||||||
import { createIconifyIcon } from '@vben/icons';
|
import { createIconifyIcon } from '@vben/icons';
|
||||||
@@ -16,38 +15,30 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
DatePicker,
|
DatePicker,
|
||||||
Empty,
|
|
||||||
Flex,
|
Flex,
|
||||||
message,
|
message,
|
||||||
Popconfirm,
|
Popconfirm,
|
||||||
Space,
|
Space,
|
||||||
Spin,
|
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import { getShopPageApi } from '#/api/ec/shop/apis';
|
|
||||||
import {
|
import {
|
||||||
deleteShopMonthlyTargetApi,
|
deleteShopMonthlyTargetApi,
|
||||||
getShopMonthlyTargetPageApi,
|
getShopMonthlyTargetPageApi,
|
||||||
} from '#/api/ec/shop/monthly-target';
|
} from '#/api/ec/shop/monthly-target';
|
||||||
|
import ShopSidebarList from '#/views/ec/components/ShopSidebarList.vue';
|
||||||
|
|
||||||
import ShopMonthlyTargetFormModal from './components/ShopMonthlyTargetFormModal.vue';
|
import ShopMonthlyTargetFormModal from './components/ShopMonthlyTargetFormModal.vue';
|
||||||
import {
|
|
||||||
SIDEBAR_LIST_SHELL_CLASS,
|
|
||||||
sidebarListRowClass,
|
|
||||||
} from '#/utils/sidebar-list-styles';
|
|
||||||
|
|
||||||
defineOptions({ name: 'ShopMonthlyTargetManagement' });
|
defineOptions({ name: 'ShopMonthlyTargetManagement' });
|
||||||
|
|
||||||
const PlusIcon = createIconifyIcon('lucide:plus');
|
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||||
const StoreIcon = createIconifyIcon('lucide:store');
|
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const shopsLoading = ref(false);
|
|
||||||
const shops = ref<ShopVO.Info[]>([]);
|
|
||||||
|
|
||||||
/** 未选择具体店铺:undefined 表示全部店铺 */
|
/** 未选择具体店铺:undefined 表示全部店铺 */
|
||||||
const selectedShopId = ref<number | undefined>(undefined);
|
const selectedShopId = ref<number | undefined>(undefined);
|
||||||
|
const selectedShopName = ref<string | undefined>(undefined);
|
||||||
|
|
||||||
const formModalVisible = ref(false);
|
const formModalVisible = ref(false);
|
||||||
const currentShopMonthlyTargetData = ref<null | ShopMonthlyTargetVO.Info>(null);
|
const currentShopMonthlyTargetData = ref<null | ShopMonthlyTargetVO.Info>(null);
|
||||||
@@ -58,33 +49,27 @@ const searchForm = ref({
|
|||||||
endTargetMonth: undefined as string | undefined,
|
endTargetMonth: undefined as string | undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
async function loadShops() {
|
|
||||||
shopsLoading.value = true;
|
|
||||||
try {
|
|
||||||
const data = await getShopPageApi({ page: 1, pageSize: 500, filters: {} });
|
|
||||||
shops.value = data.records ?? [];
|
|
||||||
} catch {
|
|
||||||
message.error('获取店铺列表失败');
|
|
||||||
shops.value = [];
|
|
||||||
} finally {
|
|
||||||
shopsLoading.value = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectedShopLabel = computed(() => {
|
const selectedShopLabel = computed(() => {
|
||||||
if (selectedShopId.value == null) {
|
if (selectedShopId.value == null) {
|
||||||
return '全部店铺';
|
return '全部店铺';
|
||||||
}
|
}
|
||||||
const s = shops.value.find((x) => x.id === selectedShopId.value);
|
return selectedShopName.value || `店铺 #${selectedShopId.value}`;
|
||||||
return s?.name ?? `店铺 #${selectedShopId.value}`;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function selectShopAll() {
|
function onShopSelect(shop: { id: number; name: string } | null) {
|
||||||
selectedShopId.value = undefined;
|
if (!shop) {
|
||||||
|
selectedShopId.value = undefined;
|
||||||
|
selectedShopName.value = undefined;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
selectedShopId.value = shop.id;
|
||||||
|
selectedShopName.value = shop.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectShop(id: number) {
|
function handleAddForShop(shopId: number) {
|
||||||
selectedShopId.value = id;
|
currentShopMonthlyTargetData.value = null;
|
||||||
|
presetShopIdForModal.value = shopId;
|
||||||
|
formModalVisible.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const gridOptions: VxeGridProps<ShopMonthlyTargetVO.Info> = {
|
const gridOptions: VxeGridProps<ShopMonthlyTargetVO.Info> = {
|
||||||
@@ -209,10 +194,6 @@ watch(selectedShopId, () => {
|
|||||||
gridApi.reload();
|
gridApi.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
void loadShops();
|
|
||||||
});
|
|
||||||
|
|
||||||
function resetModalPreset() {
|
function resetModalPreset() {
|
||||||
presetShopIdForModal.value = null;
|
presetShopIdForModal.value = null;
|
||||||
}
|
}
|
||||||
@@ -223,13 +204,6 @@ const handleAdd = () => {
|
|||||||
formModalVisible.value = true;
|
formModalVisible.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
function handleAddForShop(shopId: number) {
|
|
||||||
selectShop(shopId);
|
|
||||||
currentShopMonthlyTargetData.value = null;
|
|
||||||
presetShopIdForModal.value = shopId;
|
|
||||||
formModalVisible.value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleEdit = (record: ShopMonthlyTargetVO.Info) => {
|
const handleEdit = (record: ShopMonthlyTargetVO.Info) => {
|
||||||
resetModalPreset();
|
resetModalPreset();
|
||||||
currentShopMonthlyTargetData.value = record;
|
currentShopMonthlyTargetData.value = record;
|
||||||
@@ -257,18 +231,6 @@ const handleFormCancel = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
||||||
|
|
||||||
function shopRowClass(id: number | 'all') {
|
|
||||||
const active =
|
|
||||||
id === 'all'
|
|
||||||
? selectedShopId.value === undefined
|
|
||||||
: selectedShopId.value === id;
|
|
||||||
const layout =
|
|
||||||
id === 'all'
|
|
||||||
? 'mb-1.5 flex w-full cursor-pointer items-center gap-2 text-left'
|
|
||||||
: 'group flex w-full cursor-pointer items-center gap-2';
|
|
||||||
return sidebarListRowClass(active, layout);
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -288,72 +250,13 @@ function shopRowClass(id: number | 'all') {
|
|||||||
</Space>
|
</Space>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<Flex gap="middle" class="h-full min-h-0">
|
<Flex gap="middle" class="h-full min-h-0 overflow-hidden">
|
||||||
<!-- 左:店铺 -->
|
<ShopSidebarList
|
||||||
<Card
|
:selected-shop-id="selectedShopId"
|
||||||
class="flex h-full w-[420px] shrink-0 flex-col"
|
@select="onShopSelect"
|
||||||
:body-style="{
|
@add-for-shop="handleAddForShop"
|
||||||
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>
|
|
||||||
</template>
|
|
||||||
<Spin :spinning="shopsLoading" class="flex min-h-0 flex-1 flex-col">
|
|
||||||
<div :class="SIDEBAR_LIST_SHELL_CLASS">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
:class="shopRowClass('all')"
|
|
||||||
@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>
|
|
||||||
|
|
||||||
<!-- 右:月销量目标 -->
|
|
||||||
<Card
|
<Card
|
||||||
class="flex h-full min-h-0 min-w-0 flex-1 flex-col"
|
class="flex h-full min-h-0 min-w-0 flex-1 flex-col"
|
||||||
:body-style="{
|
:body-style="{
|
||||||
|
|||||||
Reference in New Issue
Block a user