diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/ec/brush-order/index.vue b/ecom-dmb-frontend/apps/web-antd/src/views/ec/brush-order/index.vue index 277471df..92bef178 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/views/ec/brush-order/index.vue +++ b/ecom-dmb-frontend/apps/web-antd/src/views/ec/brush-order/index.vue @@ -2,10 +2,9 @@ import type { VxeGridProps } from '#/adapter/vxe-table'; import type { BrushOrderDTO, BrushOrderVO } from '#/api/ec/brush-order'; import type { ProductDTO, ProductVO } from '#/api/ec/product/types'; -import type { ShopVO } from '#/api/ec/shop/types'; 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 { createIconifyIcon } from '@vben/icons'; @@ -14,14 +13,12 @@ import { Button, Card, DatePicker, - Empty, Flex, InputNumber, message, Popconfirm, Select, Space, - Spin, } from 'ant-design-vue'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; @@ -30,25 +27,19 @@ import { getBrushOrderPageApi, } from '#/api/ec/brush-order'; 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 { - SIDEBAR_LIST_SHELL_CLASS, - sidebarListRowClass, -} from '#/utils/sidebar-list-styles'; defineOptions({ name: 'BrushOrderManagement' }); const PlusIcon = createIconifyIcon('lucide:plus'); -const StoreIcon = createIconifyIcon('lucide:store'); const loading = ref(false); -const shopsLoading = ref(false); -const shops = ref([]); /** 未选店铺:undefined 表示全部 */ const selectedShopId = ref(undefined); +const selectedShopName = ref(undefined); const formModalVisible = ref(false); const currentBrushOrderData = ref(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(() => { if (selectedShopId.value == null) { return '全部店铺'; } - const s = shops.value.find((x) => x.id === selectedShopId.value); - return s?.name ?? `店铺 #${selectedShopId.value}`; + return selectedShopName.value || `店铺 #${selectedShopId.value}`; }); -function selectShopAll() { - selectedShopId.value = undefined; +function onShopSelect(shop: { id: number; name: string } | null) { + if (!shop) { + selectedShopId.value = undefined; + selectedShopName.value = undefined; + return; + } + selectedShopId.value = shop.id; + selectedShopName.value = shop.name; } -function selectShop(id: number) { - selectedShopId.value = id; +function handleAddForShop(shopId: number) { + currentBrushOrderData.value = null; + presetShopIdForModal.value = shopId; + formModalVisible.value = true; } const gridOptions: VxeGridProps = { @@ -280,39 +261,16 @@ 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; - 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 = () => { 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; @@ -359,69 +317,12 @@ const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`; - - - - -
- - -
-
- - -
-
-
-
-
+ + `¥${amount.toFixed(2)}`; 刷单记录 -
+
商品 diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/ec/components/ShopSidebarList.vue b/ecom-dmb-frontend/apps/web-antd/src/views/ec/components/ShopSidebarList.vue new file mode 100644 index 00000000..5f0f47e6 --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/views/ec/components/ShopSidebarList.vue @@ -0,0 +1,289 @@ + + + diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/ec/promotion-fee/index.vue b/ecom-dmb-frontend/apps/web-antd/src/views/ec/promotion-fee/index.vue index 452deee9..9e7d1fdb 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/views/ec/promotion-fee/index.vue +++ b/ecom-dmb-frontend/apps/web-antd/src/views/ec/promotion-fee/index.vue @@ -4,7 +4,6 @@ import type { PromotionFeeDTO, PromotionFeeVO, } from '#/api/ec/promotion-fee/types'; -import type { ShopVO } from '#/api/ec/shop/types'; import type { PageQueryDTO } from '#/types/common'; import { computed, onMounted, ref, watch } from 'vue'; @@ -16,13 +15,11 @@ import { Button, Card, DatePicker, - Empty, Flex, message, Popconfirm, Select, Space, - Spin, } from 'ant-design-vue'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; @@ -30,26 +27,20 @@ import { deletePromotionFeeApi, getPromotionFeePageApi, } from '#/api/ec/promotion-fee'; -import { getShopPageApi } from '#/api/ec/shop/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 { - SIDEBAR_LIST_SHELL_CLASS, - sidebarListRowClass, -} from '#/utils/sidebar-list-styles'; defineOptions({ name: 'PromotionFeeManagement' }); const PlusIcon = createIconifyIcon('lucide:plus'); -const StoreIcon = createIconifyIcon('lucide:store'); const loading = ref(false); -const shopsLoading = ref(false); -const shops = ref([]); /** 未选择具体店铺:undefined 表示全部店铺 */ const selectedShopId = ref(undefined); +const selectedShopName = ref(undefined); const formModalVisible = ref(false); const currentPromotionFeeData = ref(null); @@ -64,10 +55,12 @@ async function fetchFeeTypeOptions() { feeTypeLoading.value = true; try { const data = await getAllPromotionFeeTypeListApi(); - feeTypeOptions.value = (data || []).map((type: { id: number; typeName: string }) => ({ - label: type.typeName, - value: type.id, - })); + feeTypeOptions.value = (data || []).map( + (type: { id: number; typeName: string }) => ({ + label: type.typeName, + value: type.id, + }), + ); feeTypeFetched.value = true; } catch { message.error('获取推广费类型失败'); @@ -82,33 +75,27 @@ const searchForm = ref({ 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(() => { if (selectedShopId.value == null) { return '全部店铺'; } - const s = shops.value.find((x) => x.id === selectedShopId.value); - return s?.name ?? `店铺 #${selectedShopId.value}`; + return selectedShopName.value || `店铺 #${selectedShopId.value}`; }); -function selectShopAll() { - selectedShopId.value = undefined; +function onShopSelect(shop: { id: number; name: string } | null) { + if (!shop) { + selectedShopId.value = undefined; + selectedShopName.value = undefined; + return; + } + selectedShopId.value = shop.id; + selectedShopName.value = shop.name; } -function selectShop(id: number) { - selectedShopId.value = id; +function handleAddForShop(shopId: number) { + currentPromotionFeeData.value = null; + presetShopIdForModal.value = shopId; + formModalVisible.value = true; } const gridOptions: VxeGridProps = { @@ -245,7 +232,6 @@ watch(selectedShopId, () => { }); onMounted(() => { - void loadShops(); void fetchFeeTypeOptions(); }); @@ -259,13 +245,6 @@ const handleAdd = () => { formModalVisible.value = true; }; -function handleAddForShop(shopId: number) { - selectShop(shopId); - currentPromotionFeeData.value = null; - presetShopIdForModal.value = shopId; - formModalVisible.value = true; -} - const handleEdit = (record: PromotionFeeVO.Info) => { resetModalPreset(); currentPromotionFeeData.value = record; @@ -293,18 +272,6 @@ const handleFormCancel = () => { }; 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); -} - - - - - -
- - -
-
- - -
-
-
-
-
+ + - +