mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-23 23:59:19 +08:00
fix(ecom): 移除推广费前端的platform相关代码
- types.dto.ts/vo.ts 移除 platformId / platformName - PromotionFeeFormModal.vue 移除平台选择器和相关逻辑 - index.vue 移除平台筛选列和接口调用 - PromotionFeeCard.vue 移除平台筛选和列展示
This commit is contained in:
@@ -9,8 +9,6 @@ export namespace PromotionFeeDTO {
|
||||
shopId?: number;
|
||||
/** 推广费类型ID */
|
||||
feeTypeId?: number;
|
||||
/** 平台ID */
|
||||
platformId?: number;
|
||||
/** 商品ID(可选) */
|
||||
productId?: number;
|
||||
/** 推广费发生日期开始 */
|
||||
@@ -25,8 +23,6 @@ export namespace PromotionFeeDTO {
|
||||
shopId: number;
|
||||
/** 推广费类型ID */
|
||||
feeTypeId: number;
|
||||
/** 平台ID */
|
||||
platformId?: number;
|
||||
/** 商品ID(可选,关联到具体商品) */
|
||||
productId?: number;
|
||||
/** 推广活动名称 */
|
||||
@@ -47,8 +43,6 @@ export namespace PromotionFeeDTO {
|
||||
shopId: number;
|
||||
/** 推广费类型ID */
|
||||
feeTypeId: number;
|
||||
/** 平台ID */
|
||||
platformId?: number;
|
||||
/** 商品ID(可选,关联到具体商品) */
|
||||
productId?: number;
|
||||
/** 推广活动名称 */
|
||||
|
||||
@@ -17,10 +17,6 @@ export namespace PromotionFeeVO {
|
||||
feeTypeId: number;
|
||||
/** 推广费类型名称 */
|
||||
feeTypeName?: string;
|
||||
/** 平台ID */
|
||||
platformId?: number;
|
||||
/** 平台名称 */
|
||||
platformName?: string;
|
||||
/** 商品ID(可选) */
|
||||
productId?: number;
|
||||
/** 推广活动名称 */
|
||||
|
||||
-41
@@ -27,7 +27,6 @@ import {
|
||||
updatePromotionFeeApi,
|
||||
} from '#/api/ecommerce/promotion-fee';
|
||||
import { getActivePromotionFeeTypeListApi } from '#/api/ecommerce/promotion-fee-type';
|
||||
import { getActivePlatformsApi } from '#/api/ecommerce/platform';
|
||||
import { getProductPageApi } from '#/api/ecommerce/product';
|
||||
import { getShopPageApi } from '#/api/ecommerce/shop';
|
||||
|
||||
@@ -74,7 +73,6 @@ const isEdit = ref(false);
|
||||
const formData = ref<PromotionFeeDTO.Create>({
|
||||
shopId: undefined as any,
|
||||
feeTypeId: undefined as any,
|
||||
platformId: undefined,
|
||||
productId: undefined,
|
||||
campaignName: '',
|
||||
feeAmount: undefined as any,
|
||||
@@ -91,10 +89,6 @@ const rules = {
|
||||
feeDate: [{ required: true, message: '请选择发生日期', trigger: 'change' }],
|
||||
} as any;
|
||||
|
||||
// 平台选项(动态加载)
|
||||
const platformList = ref<{ label: string; value: number }[]>([]);
|
||||
const platformListLoading = ref(false);
|
||||
|
||||
// 店铺列表
|
||||
const shopList = ref<ShopVO.Info[]>([]);
|
||||
const shopListLoading = ref(false);
|
||||
@@ -119,7 +113,6 @@ watch(
|
||||
formData.value = {
|
||||
shopId: props.promotionFeeData.shopId,
|
||||
feeTypeId: props.promotionFeeData.feeTypeId,
|
||||
platformId: props.promotionFeeData.platformId,
|
||||
productId: props.promotionFeeData.productId,
|
||||
campaignName: props.promotionFeeData.campaignName || '',
|
||||
feeAmount: props.promotionFeeData.feeAmount,
|
||||
@@ -166,21 +159,6 @@ const loadFeeTypeList = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const loadPlatformList = async () => {
|
||||
platformListLoading.value = true;
|
||||
try {
|
||||
const list = await getActivePlatformsApi();
|
||||
platformList.value = list.map((p) => ({
|
||||
label: p.platformName,
|
||||
value: p.id,
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error('加载平台列表失败:', error);
|
||||
} finally {
|
||||
platformListLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const loadProductList = async () => {
|
||||
productListLoading.value = true;
|
||||
try {
|
||||
@@ -201,7 +179,6 @@ const resetFormData = () => {
|
||||
formData.value = {
|
||||
shopId: undefined as any,
|
||||
feeTypeId: undefined as any,
|
||||
platformId: undefined,
|
||||
productId: undefined,
|
||||
campaignName: '',
|
||||
feeAmount: undefined as any,
|
||||
@@ -242,7 +219,6 @@ const handleCancel = () => {
|
||||
onMounted(() => {
|
||||
loadShopList();
|
||||
loadFeeTypeList();
|
||||
loadPlatformList();
|
||||
loadProductList();
|
||||
});
|
||||
</script>
|
||||
@@ -288,23 +264,6 @@ onMounted(() => {
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="平台" name="platformId">
|
||||
<Select
|
||||
v-model:value="formData.platformId"
|
||||
placeholder="请选择平台"
|
||||
:loading="platformListLoading"
|
||||
allow-clear
|
||||
>
|
||||
<Select.Option
|
||||
v-for="option in platformList"
|
||||
:key="option.value"
|
||||
:value="option.value"
|
||||
>
|
||||
{{ option.label }}
|
||||
</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="商品(可选)" name="productId">
|
||||
<Select
|
||||
v-model:value="formData.productId"
|
||||
|
||||
@@ -11,7 +11,7 @@ import { computed, ref } from 'vue';
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
import { Button, message, Popconfirm, Space, Tag } from 'ant-design-vue';
|
||||
import { Button, message, Popconfirm, Space } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
@@ -19,32 +19,23 @@ import {
|
||||
getPromotionFeePageApi,
|
||||
} from '#/api/ecommerce/promotion-fee';
|
||||
import { getShopPageApi } from '#/api/ecommerce/shop/apis';
|
||||
import { getActivePlatformsApi } from '#/api/ecommerce/platform/apis';
|
||||
import { getAllPromotionFeeTypeListApi } from '#/api/ecommerce/promotion-fee-type/apis';
|
||||
|
||||
import PromotionFeeFormModal from './components/PromotionFeeFormModal.vue';
|
||||
|
||||
defineOptions({ name: 'PromotionFeeManagement' });
|
||||
|
||||
// 创建图标组件
|
||||
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||
|
||||
// 响应式数据
|
||||
const loading = ref(false);
|
||||
const formModalVisible = ref(false);
|
||||
const currentPromotionFeeData = ref<null | PromotionFeeVO.Info>(null);
|
||||
|
||||
// 店铺选择器(懒加载)
|
||||
// 店铺选择器(首次触发时加载)
|
||||
const shopOptions = ref<{ label: string; value: number }[]>([]);
|
||||
const shopLoading = ref(false);
|
||||
const shopFetched = ref(false);
|
||||
|
||||
// 推广费类型选择器(懒加载)
|
||||
const feeTypeOptions = ref<{ label: string; value: number }[]>([]);
|
||||
const feeTypeLoading = ref(false);
|
||||
const feeTypeFetched = ref(false);
|
||||
|
||||
// 获取店铺列表(首次触发时加载)
|
||||
async function fetchShopOptions() {
|
||||
if (shopFetched.value || shopLoading.value) return;
|
||||
shopLoading.value = true;
|
||||
@@ -62,7 +53,11 @@ async function fetchShopOptions() {
|
||||
}
|
||||
}
|
||||
|
||||
// 获取推广费类型列表(首次触发时加载)
|
||||
// 推广费类型选择器(首次触发时加载)
|
||||
const feeTypeOptions = ref<{ label: string; value: number }[]>([]);
|
||||
const feeTypeLoading = ref(false);
|
||||
const feeTypeFetched = ref(false);
|
||||
|
||||
async function fetchFeeTypeOptions() {
|
||||
if (feeTypeFetched.value || feeTypeLoading.value) return;
|
||||
feeTypeLoading.value = true;
|
||||
@@ -84,26 +79,10 @@ async function fetchFeeTypeOptions() {
|
||||
const searchForm = ref({
|
||||
shopId: undefined as number | undefined,
|
||||
feeTypeId: undefined as number | undefined,
|
||||
platformId: undefined as number | undefined,
|
||||
feeDateStart: undefined as string | undefined,
|
||||
feeDateEnd: undefined as string | undefined,
|
||||
});
|
||||
|
||||
// 平台选项(动态加载)
|
||||
const platformOptions = ref<{ label: string; value: number }[]>([]);
|
||||
const loadPlatformOptions = async () => {
|
||||
try {
|
||||
const list = await getActivePlatformsApi();
|
||||
platformOptions.value = list.map((p) => ({
|
||||
label: p.platformName,
|
||||
value: p.id,
|
||||
}));
|
||||
} catch (e) {
|
||||
console.error('加载平台列表失败', e);
|
||||
}
|
||||
};
|
||||
loadPlatformOptions();
|
||||
|
||||
// VbenVxeGrid 表格配置
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: [
|
||||
@@ -130,11 +109,6 @@ const gridOptions: VxeGridProps<any> = {
|
||||
minWidth: 'auto',
|
||||
showOverflow: 'tooltip' as const,
|
||||
},
|
||||
{
|
||||
title: '平台',
|
||||
minWidth: 'auto',
|
||||
slots: { default: 'platform' },
|
||||
},
|
||||
{
|
||||
field: 'campaignName',
|
||||
title: '推广活动',
|
||||
@@ -193,7 +167,6 @@ const gridOptions: VxeGridProps<any> = {
|
||||
| 'Total'
|
||||
)[],
|
||||
},
|
||||
// 配置远程加载
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }) => {
|
||||
@@ -205,23 +178,16 @@ const gridOptions: VxeGridProps<any> = {
|
||||
filters: {
|
||||
shopId: searchForm.value.shopId || undefined,
|
||||
feeTypeId: searchForm.value.feeTypeId || undefined,
|
||||
platformId: searchForm.value.platformId || undefined,
|
||||
feeDateStart: searchForm.value.feeDateStart || undefined,
|
||||
feeDateEnd: searchForm.value.feeDateEnd || undefined,
|
||||
},
|
||||
};
|
||||
const data = await getPromotionFeePageApi(params);
|
||||
return {
|
||||
items: data.records,
|
||||
total: data.total,
|
||||
};
|
||||
return { items: data.records, total: data.total };
|
||||
} catch (error) {
|
||||
console.error('获取推广费记录列表失败:', error);
|
||||
message.error('获取推广费记录列表失败');
|
||||
return {
|
||||
items: [],
|
||||
total: 0,
|
||||
};
|
||||
return { items: [], total: 0 };
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
@@ -270,17 +236,6 @@ const formOptions = computed(() => ({
|
||||
fieldName: 'feeTypeId',
|
||||
label: '推广费类型',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
placeholder: '请选择平台',
|
||||
options: platformOptions,
|
||||
allowClear: true,
|
||||
onChange: () => gridReloadRef.value?.(),
|
||||
},
|
||||
fieldName: 'platformId',
|
||||
label: '平台',
|
||||
},
|
||||
{
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
@@ -307,14 +262,10 @@ const formOptions = computed(() => ({
|
||||
collapsedRows: 1,
|
||||
}));
|
||||
|
||||
// 刷新表格数据
|
||||
function refreshTable() {
|
||||
if (gridApi) {
|
||||
gridApi.reload();
|
||||
}
|
||||
gridApi?.reload();
|
||||
}
|
||||
|
||||
// 创建 VbenVxeGrid 实例
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
formOptions: formOptions.value,
|
||||
@@ -323,20 +274,17 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
});
|
||||
gridReloadRef.value = () => gridApi.reload();
|
||||
|
||||
// 处理新增
|
||||
const handleAdd = () => {
|
||||
currentPromotionFeeData.value = null;
|
||||
formModalVisible.value = true;
|
||||
};
|
||||
|
||||
// 处理编辑
|
||||
const handleEdit = (record: PromotionFeeVO.Info) => {
|
||||
currentPromotionFeeData.value = record;
|
||||
formModalVisible.value = true;
|
||||
};
|
||||
|
||||
// 处理删除
|
||||
const handleDelete = async (id: number) => {
|
||||
async function handleDelete(id: number) {
|
||||
try {
|
||||
await deletePromotionFeeApi(id);
|
||||
message.success('删除成功');
|
||||
@@ -344,51 +292,20 @@ const handleDelete = async (id: number) => {
|
||||
} catch {
|
||||
message.error('删除失败');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// 处理表单成功
|
||||
const handleFormSuccess = () => {
|
||||
refreshTable();
|
||||
};
|
||||
|
||||
// 格式化金额
|
||||
const formatAmount = (amount: number) => {
|
||||
return `¥${amount.toFixed(2)}`;
|
||||
};
|
||||
|
||||
// 获取平台标签颜色
|
||||
const getPlatformColor = (platformName: string | undefined) => {
|
||||
switch (platformName) {
|
||||
case '京东': {
|
||||
return 'red';
|
||||
}
|
||||
case '天猫': {
|
||||
return 'purple';
|
||||
}
|
||||
case '快手': {
|
||||
return 'cyan';
|
||||
}
|
||||
case '抖音': {
|
||||
return 'blue';
|
||||
}
|
||||
case '拼多多': {
|
||||
return 'green';
|
||||
}
|
||||
case '淘宝': {
|
||||
return 'orange';
|
||||
}
|
||||
default: {
|
||||
return 'default';
|
||||
}
|
||||
}
|
||||
};
|
||||
const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page title="推广费管理" auto-content-height>
|
||||
<template #description>
|
||||
<div class="text-foreground/80 mt-2">
|
||||
管理店铺推广费用记录,支持按店铺、类型、平台等维度查询和统计
|
||||
管理店铺推广费用记录,支持按店铺、类型等维度查询和统计
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -401,33 +318,21 @@ const getPlatformColor = (platformName: string | undefined) => {
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
<!-- 数据表格 -->
|
||||
<Grid :loading="loading">
|
||||
<!-- 工具栏工具 -->
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<span class="text-gray-500">
|
||||
支持按店铺、类型、平台等维度查询推广费记录
|
||||
支持按店铺、类型等维度查询推广费记录
|
||||
</span>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
<!-- 平台列 -->
|
||||
<template #platform="{ row }: { row: any }">
|
||||
<Tag v-if="row.platformName" :color="getPlatformColor(row.platformName)">
|
||||
{{ row.platformName }}
|
||||
</Tag>
|
||||
<span v-else class="text-gray-400">-</span>
|
||||
</template>
|
||||
|
||||
<!-- 推广费金额列 -->
|
||||
<template #feeAmount="{ row }: { row: any }">
|
||||
<span class="font-medium text-red-600">
|
||||
{{ formatAmount(row.feeAmount) }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<!-- 操作列 -->
|
||||
<template #action="{ row }: { row: any }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)"> 编辑 </Button>
|
||||
@@ -441,7 +346,6 @@ const getPlatformColor = (platformName: string | undefined) => {
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
<!-- 表单弹窗 -->
|
||||
<PromotionFeeFormModal
|
||||
v-model:open="formModalVisible"
|
||||
:promotion-fee-data="currentPromotionFeeData"
|
||||
|
||||
+3
-28
@@ -4,7 +4,7 @@ import type { PromotionFeeDTO, PromotionFeeVO } from '#/api/ecommerce/promotion-
|
||||
import type { ShopVO } from '#/api/ecommerce/shop/types';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
|
||||
import { Button, DatePicker, Popconfirm, Select, Space } from 'ant-design-vue';
|
||||
import { Button, DatePicker, Popconfirm, Space } from 'ant-design-vue';
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
deletePromotionFeeApi,
|
||||
getPromotionFeePageApi,
|
||||
} from '#/api/ecommerce/promotion-fee';
|
||||
import { getActivePlatformsApi } from '#/api/ecommerce/platform';
|
||||
|
||||
import PromotionFeeFormModal from '#/views/ecommerce/promotion-fee/components/PromotionFeeFormModal.vue';
|
||||
|
||||
@@ -31,24 +30,10 @@ const kpi = computed(() => props.data);
|
||||
const gridReloadRef = ref<(() => void) | null>(null);
|
||||
|
||||
const searchForm = ref({
|
||||
platformId: undefined as number | undefined,
|
||||
feeDateStart: undefined as string | undefined,
|
||||
feeDateEnd: undefined as string | undefined,
|
||||
});
|
||||
|
||||
// 平台选项(动态加载)
|
||||
const platformList = ref<{ label: string; value: number }[]>([]);
|
||||
|
||||
const loadPlatformList = async () => {
|
||||
try {
|
||||
const list = await getActivePlatformsApi();
|
||||
platformList.value = list.map((p) => ({ label: p.platformName, value: p.id }));
|
||||
} catch (e) {
|
||||
console.error('加载平台列表失败', e);
|
||||
}
|
||||
};
|
||||
loadPlatformList();
|
||||
|
||||
const modalVisible = ref(false);
|
||||
const editingData = ref<PromotionFeeVO.Info | undefined>();
|
||||
|
||||
@@ -56,7 +41,6 @@ const gridOptions: VxeGridProps<any> = {
|
||||
columns: [
|
||||
{ type: 'seq', title: '序号', width: 60 },
|
||||
{ field: 'productId', title: '商品ID', width: 90 },
|
||||
{ field: 'platformName', title: '平台', width: 90 },
|
||||
{ field: 'campaignName', title: '活动名称', minWidth: 140 },
|
||||
{
|
||||
field: 'feeAmount', title: '费用金额', width: 130,
|
||||
@@ -85,7 +69,6 @@ const gridOptions: VxeGridProps<any> = {
|
||||
pageSize: page.pageSize,
|
||||
filters: {
|
||||
shopId: props.shopId || undefined,
|
||||
platformId: searchForm.value.platformId,
|
||||
feeDateStart: searchForm.value.feeDateStart,
|
||||
feeDateEnd: searchForm.value.feeDateEnd,
|
||||
},
|
||||
@@ -122,21 +105,13 @@ async function handleDelete(id: number) {
|
||||
|
||||
<template>
|
||||
<div class="rounded-2xl border border-slate-200/80 bg-white/90 shadow-sm dark:border-[hsl(222.34deg_10.43%_16%)] dark:bg-[hsl(222.34deg_10.43%_12.27%)]">
|
||||
<!-- 标题栏 + 筛选区(单行) -->
|
||||
<!-- 标题栏 + 筛选区 -->
|
||||
<div class="flex items-center justify-between gap-3 border-b border-slate-100 px-6 py-3 dark:border-[hsl(222.34deg_10.43%_16%)]">
|
||||
<h3 class="flex shrink-0 items-center gap-2 text-base font-semibold text-slate-800 dark:text-[hsl(0deg_0%_95%)]">
|
||||
<CoinsIcon class="h-4 w-4" />
|
||||
<span>推广费</span>
|
||||
</h3>
|
||||
<div class="flex items-center gap-2">
|
||||
<Select
|
||||
v-model:value="searchForm.platformId"
|
||||
placeholder="平台"
|
||||
class="!w-28"
|
||||
allow-clear
|
||||
:options="platformList"
|
||||
@change="() => gridReloadRef?.()"
|
||||
/>
|
||||
<DatePicker
|
||||
v-model:value="searchForm.feeDateStart"
|
||||
placeholder="开始日期"
|
||||
@@ -194,4 +169,4 @@ async function handleDelete(id: number) {
|
||||
@success="gridReloadRef?.()"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user