mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 15:49:20 +08:00
refactor: 重构电商模块目录结构
This commit is contained in:
+384
@@ -0,0 +1,384 @@
|
||||
<script setup lang="ts">
|
||||
import type { PromotionFeeTypeVO } from '#/api/ecommerce/promotion-fee-type';
|
||||
import type {
|
||||
PromotionFeeDTO,
|
||||
PromotionFeeVO,
|
||||
} from '#/api/shop/promotion-fee/types';
|
||||
import type { ShopVO } from '#/api/shop/shop/types';
|
||||
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import {
|
||||
DatePicker,
|
||||
Form,
|
||||
Input,
|
||||
InputNumber,
|
||||
message,
|
||||
Select,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { getActivePromotionFeeTypeListApi } from '#/api/ecommerce/promotion-fee-type';
|
||||
import {
|
||||
createPromotionFeeApi,
|
||||
updatePromotionFeeApi,
|
||||
} from '#/api/shop/promotion-fee';
|
||||
import { getShopPageApi } from '#/api/shop/shop';
|
||||
|
||||
defineOptions({ name: 'PromotionFeeFormModal' });
|
||||
|
||||
const props = defineProps<Props>();
|
||||
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
// Props
|
||||
interface Props {
|
||||
open: boolean;
|
||||
promotionFeeData?: null | PromotionFeeVO.Info;
|
||||
}
|
||||
|
||||
// Emits
|
||||
interface Emits {
|
||||
(e: 'update:open', value: boolean): void;
|
||||
(e: 'success'): void;
|
||||
(e: 'cancel'): void;
|
||||
}
|
||||
|
||||
// 创建 vben modal
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
draggable: true,
|
||||
class: 'w-[800px]',
|
||||
onCancel() {
|
||||
handleCancel();
|
||||
},
|
||||
onConfirm() {
|
||||
handleOk();
|
||||
},
|
||||
});
|
||||
|
||||
// 响应式数据
|
||||
const formRef = ref();
|
||||
const isEdit = ref(false);
|
||||
|
||||
// 表单数据
|
||||
const formData = ref<PromotionFeeDTO.Create>({
|
||||
shopId: undefined as any,
|
||||
feeTypeId: undefined as any,
|
||||
feeName: '',
|
||||
platform: undefined,
|
||||
campaignName: '',
|
||||
feeAmount: undefined as any,
|
||||
baseAmount: undefined,
|
||||
feeRate: undefined,
|
||||
clickCount: undefined,
|
||||
impressionCount: undefined,
|
||||
conversionCount: undefined,
|
||||
feeDate: undefined as any,
|
||||
remark: '',
|
||||
});
|
||||
|
||||
// 表单验证规则
|
||||
const rules = {
|
||||
shopId: [{ required: true, message: '请选择店铺', trigger: 'change' }],
|
||||
feeTypeId: [
|
||||
{ required: true, message: '请选择推广费类型', trigger: 'change' },
|
||||
],
|
||||
feeName: [{ required: true, message: '请输入推广费名称', trigger: 'blur' }],
|
||||
feeAmount: [{ required: true, message: '请输入推广费金额', trigger: 'blur' }],
|
||||
feeDate: [{ required: true, message: '请选择发生日期', trigger: 'change' }],
|
||||
} as any;
|
||||
|
||||
// 平台选项
|
||||
const platformOptions = [
|
||||
{ label: '淘宝', value: '淘宝' },
|
||||
{ label: '京东', value: '京东' },
|
||||
{ label: '拼多多', value: '拼多多' },
|
||||
{ label: '天猫', value: '天猫' },
|
||||
{ label: '抖音', value: '抖音' },
|
||||
{ label: '快手', value: '快手' },
|
||||
{ label: '其他', value: '其他' },
|
||||
];
|
||||
|
||||
// 店铺列表
|
||||
const shopList = ref<ShopVO.Info[]>([]);
|
||||
const shopListLoading = ref(false);
|
||||
|
||||
// 推广费类型列表
|
||||
const feeTypeList = ref<PromotionFeeTypeVO.Info[]>([]);
|
||||
const feeTypeListLoading = ref(false);
|
||||
|
||||
// 监听props变化
|
||||
watch(
|
||||
() => props.open,
|
||||
(newVal) => {
|
||||
if (newVal) {
|
||||
modalApi.open();
|
||||
isEdit.value = !!props.promotionFeeData;
|
||||
if (props.promotionFeeData) {
|
||||
// 编辑模式,填充表单数据
|
||||
formData.value = {
|
||||
shopId: props.promotionFeeData.shopId,
|
||||
feeTypeId: props.promotionFeeData.feeTypeId,
|
||||
feeName: props.promotionFeeData.feeName,
|
||||
platform: props.promotionFeeData.platform,
|
||||
campaignName: props.promotionFeeData.campaignName || '',
|
||||
feeAmount: props.promotionFeeData.feeAmount,
|
||||
baseAmount: props.promotionFeeData.baseAmount,
|
||||
feeRate: props.promotionFeeData.feeRate,
|
||||
clickCount: props.promotionFeeData.clickCount,
|
||||
impressionCount: props.promotionFeeData.impressionCount,
|
||||
conversionCount: props.promotionFeeData.conversionCount,
|
||||
feeDate: props.promotionFeeData.feeDate,
|
||||
remark: props.promotionFeeData.remark || '',
|
||||
};
|
||||
} else {
|
||||
// 新增模式,重置表单数据
|
||||
resetFormData();
|
||||
}
|
||||
} else {
|
||||
modalApi.close();
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
// 加载店铺列表
|
||||
const loadShopList = async () => {
|
||||
shopListLoading.value = true;
|
||||
try {
|
||||
const response = await getShopPageApi({
|
||||
page: 1,
|
||||
pageSize: 1000,
|
||||
filters: {},
|
||||
});
|
||||
shopList.value = response.records;
|
||||
} catch (error) {
|
||||
console.error('加载店铺列表失败:', error);
|
||||
} finally {
|
||||
shopListLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 加载推广费类型列表
|
||||
const loadFeeTypeList = async () => {
|
||||
feeTypeListLoading.value = true;
|
||||
try {
|
||||
const response = await getActivePromotionFeeTypeListApi();
|
||||
feeTypeList.value = response;
|
||||
} catch (error) {
|
||||
console.error('加载推广费类型列表失败:', error);
|
||||
} finally {
|
||||
feeTypeListLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 重置表单数据
|
||||
const resetFormData = () => {
|
||||
formData.value = {
|
||||
shopId: undefined as any,
|
||||
feeTypeId: undefined as any,
|
||||
feeName: '',
|
||||
platform: undefined,
|
||||
campaignName: '',
|
||||
feeAmount: undefined as any,
|
||||
baseAmount: undefined,
|
||||
feeRate: undefined,
|
||||
clickCount: undefined,
|
||||
impressionCount: undefined,
|
||||
conversionCount: undefined,
|
||||
feeDate: undefined as any,
|
||||
remark: '',
|
||||
};
|
||||
};
|
||||
|
||||
// 确认操作
|
||||
const handleOk = async () => {
|
||||
try {
|
||||
await formRef.value?.validate();
|
||||
|
||||
if (isEdit.value && props.promotionFeeData) {
|
||||
// 更新推广费记录
|
||||
const updateData: PromotionFeeDTO.Update = {
|
||||
id: props.promotionFeeData.id,
|
||||
...formData.value,
|
||||
};
|
||||
await updatePromotionFeeApi(updateData);
|
||||
message.success('更新成功');
|
||||
} else {
|
||||
// 创建推广费记录
|
||||
await createPromotionFeeApi(formData.value);
|
||||
message.success('创建成功');
|
||||
}
|
||||
|
||||
emit('success');
|
||||
modalApi.close();
|
||||
emit('update:open', false);
|
||||
} catch (error) {
|
||||
console.error('操作失败:', error);
|
||||
message.error(isEdit.value ? '更新失败' : '创建失败');
|
||||
}
|
||||
};
|
||||
|
||||
// 取消操作
|
||||
const handleCancel = () => {
|
||||
emit('cancel');
|
||||
modalApi.close();
|
||||
emit('update:open', false);
|
||||
resetFormData();
|
||||
};
|
||||
|
||||
// 组件挂载时加载数据
|
||||
onMounted(() => {
|
||||
loadShopList();
|
||||
loadFeeTypeList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal :title="isEdit ? '编辑推广费记录' : '新增推广费记录'">
|
||||
<Form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="rules"
|
||||
:label-col="{ span: 6 }"
|
||||
:wrapper-col="{ span: 18 }"
|
||||
>
|
||||
<Form.Item label="店铺" name="shopId">
|
||||
<Select
|
||||
v-model:value="formData.shopId"
|
||||
placeholder="请选择店铺"
|
||||
:loading="shopListLoading"
|
||||
>
|
||||
<Select.Option
|
||||
v-for="shop in shopList"
|
||||
:key="shop.id"
|
||||
:value="shop.id"
|
||||
>
|
||||
{{ shop.name }}
|
||||
</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="推广费类型" name="feeTypeId">
|
||||
<Select
|
||||
v-model:value="formData.feeTypeId"
|
||||
placeholder="请选择推广费类型"
|
||||
:loading="feeTypeListLoading"
|
||||
>
|
||||
<Select.Option
|
||||
v-for="feeType in feeTypeList"
|
||||
:key="feeType.id"
|
||||
:value="feeType.id"
|
||||
>
|
||||
{{ feeType.typeName }}
|
||||
</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="推广费名称" name="feeName">
|
||||
<Input
|
||||
v-model:value="formData.feeName"
|
||||
placeholder="请输入推广费名称"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="平台" name="platform">
|
||||
<Select
|
||||
v-model:value="formData.platform"
|
||||
placeholder="请选择平台"
|
||||
allow-clear
|
||||
>
|
||||
<Select.Option
|
||||
v-for="option in platformOptions"
|
||||
:key="option.value"
|
||||
:value="option.value"
|
||||
>
|
||||
{{ option.label }}
|
||||
</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="推广活动名称" name="campaignName">
|
||||
<Input
|
||||
v-model:value="formData.campaignName"
|
||||
placeholder="请输入推广活动名称"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="推广费金额" name="feeAmount">
|
||||
<InputNumber
|
||||
v-model:value="formData.feeAmount"
|
||||
placeholder="请输入推广费金额"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="基础金额" name="baseAmount">
|
||||
<InputNumber
|
||||
v-model:value="formData.baseAmount"
|
||||
placeholder="请输入基础金额(用于按比例计算)"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="费率" name="feeRate">
|
||||
<InputNumber
|
||||
v-model:value="formData.feeRate"
|
||||
placeholder="请输入费率(用于按比例计算)"
|
||||
:min="0"
|
||||
:max="1"
|
||||
:precision="4"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="点击次数" name="clickCount">
|
||||
<InputNumber
|
||||
v-model:value="formData.clickCount"
|
||||
placeholder="请输入点击次数"
|
||||
:min="0"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="展示次数" name="impressionCount">
|
||||
<InputNumber
|
||||
v-model:value="formData.impressionCount"
|
||||
placeholder="请输入展示次数"
|
||||
:min="0"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="转化次数" name="conversionCount">
|
||||
<InputNumber
|
||||
v-model:value="formData.conversionCount"
|
||||
placeholder="请输入转化次数"
|
||||
:min="0"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="发生日期" name="feeDate">
|
||||
<DatePicker
|
||||
v-model:value="formData.feeDate"
|
||||
placeholder="请选择推广费发生日期"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="备注" name="remark">
|
||||
<Input.TextArea
|
||||
v-model:value="formData.remark"
|
||||
placeholder="请输入备注"
|
||||
:rows="3"
|
||||
/>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
</template>
|
||||
@@ -0,0 +1,377 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import type {
|
||||
PromotionFeeDTO,
|
||||
PromotionFeeVO,
|
||||
} from '#/api/shop/promotion-fee/types';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
import { Button, message, Space, Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deletePromotionFeeApi,
|
||||
getPromotionFeePageApi,
|
||||
} from '#/api/shop/promotion-fee';
|
||||
|
||||
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 searchForm = ref({
|
||||
shopId: undefined as number | undefined,
|
||||
feeTypeId: undefined as number | undefined,
|
||||
platform: '',
|
||||
feeDateStart: undefined as string | undefined,
|
||||
feeDateEnd: undefined as string | undefined,
|
||||
});
|
||||
|
||||
// 平台选项
|
||||
const platformOptions = [
|
||||
{ label: '淘宝', value: '淘宝' },
|
||||
{ label: '京东', value: '京东' },
|
||||
{ label: '拼多多', value: '拼多多' },
|
||||
{ label: '天猫', value: '天猫' },
|
||||
{ label: '抖音', value: '抖音' },
|
||||
{ label: '快手', value: '快手' },
|
||||
{ label: '其他', value: '其他' },
|
||||
];
|
||||
|
||||
// VbenVxeGrid 表格配置
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: [
|
||||
{
|
||||
type: 'seq' as const,
|
||||
minWidth: 'auto',
|
||||
title: '序号',
|
||||
},
|
||||
{
|
||||
field: 'feeName',
|
||||
title: '推广费名称',
|
||||
minWidth: 'auto',
|
||||
showOverflow: 'tooltip' as const,
|
||||
},
|
||||
{
|
||||
field: 'shopName',
|
||||
title: '店铺名称',
|
||||
minWidth: 'auto',
|
||||
showOverflow: 'tooltip' as const,
|
||||
},
|
||||
{
|
||||
field: 'feeTypeName',
|
||||
title: '推广费类型',
|
||||
minWidth: 'auto',
|
||||
showOverflow: 'tooltip' as const,
|
||||
},
|
||||
{
|
||||
title: '平台',
|
||||
minWidth: 'auto',
|
||||
slots: { default: 'platform' },
|
||||
},
|
||||
{
|
||||
field: 'campaignName',
|
||||
title: '推广活动',
|
||||
minWidth: 'auto',
|
||||
showOverflow: 'tooltip' as const,
|
||||
},
|
||||
{
|
||||
title: '推广费金额',
|
||||
minWidth: 'auto',
|
||||
slots: { default: 'feeAmount' },
|
||||
},
|
||||
{
|
||||
field: 'feeDate',
|
||||
title: '发生日期',
|
||||
minWidth: 'auto',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
minWidth: 'auto',
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
height: 'auto',
|
||||
border: true,
|
||||
stripe: true,
|
||||
highlightHoverRow: true,
|
||||
showOverflow: true,
|
||||
size: 'small',
|
||||
toolbarConfig: {
|
||||
custom: true,
|
||||
refresh: true,
|
||||
zoom: true,
|
||||
},
|
||||
data: [],
|
||||
pagerConfig: {
|
||||
enabled: true,
|
||||
pageSizes: [10, 20, 50, 100],
|
||||
layouts: [
|
||||
'PrevJump',
|
||||
'PrevPage',
|
||||
'Number',
|
||||
'NextPage',
|
||||
'NextJump',
|
||||
'Sizes',
|
||||
'FullJump',
|
||||
'Total',
|
||||
] as (
|
||||
| 'FullJump'
|
||||
| 'NextJump'
|
||||
| 'NextPage'
|
||||
| 'Number'
|
||||
| 'PrevJump'
|
||||
| 'PrevPage'
|
||||
| 'Sizes'
|
||||
| 'Total'
|
||||
)[],
|
||||
},
|
||||
// 配置远程加载
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }) => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params: PageQueryDTO<PromotionFeeDTO.Filters> = {
|
||||
page: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
filters: {
|
||||
shopId: searchForm.value.shopId || undefined,
|
||||
feeTypeId: searchForm.value.feeTypeId || undefined,
|
||||
platform: searchForm.value.platform || undefined,
|
||||
feeDateStart: searchForm.value.feeDateStart || undefined,
|
||||
feeDateEnd: searchForm.value.feeDateEnd || undefined,
|
||||
},
|
||||
};
|
||||
const data = await getPromotionFeePageApi(params);
|
||||
return {
|
||||
items: data.records,
|
||||
total: data.total,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('获取推广费记录列表失败:', error);
|
||||
message.error('获取推广费记录列表失败');
|
||||
return {
|
||||
items: [],
|
||||
total: 0,
|
||||
};
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// 搜索表单配置
|
||||
const formOptions = computed(() => ({
|
||||
schema: [
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
placeholder: '请选择店铺',
|
||||
// TODO: 这里需要从店铺API获取店铺列表
|
||||
options: [],
|
||||
allowClear: true,
|
||||
},
|
||||
fieldName: 'shopId',
|
||||
label: '店铺',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
placeholder: '请选择推广费类型',
|
||||
// TODO: 这里需要从推广费类型API获取类型列表
|
||||
options: [],
|
||||
allowClear: true,
|
||||
},
|
||||
fieldName: 'feeTypeId',
|
||||
label: '推广费类型',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
placeholder: '请选择平台',
|
||||
options: platformOptions,
|
||||
allowClear: true,
|
||||
},
|
||||
fieldName: 'platform',
|
||||
label: '平台',
|
||||
},
|
||||
{
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
placeholder: '开始日期',
|
||||
style: { width: '100%' },
|
||||
},
|
||||
fieldName: 'feeDateStart',
|
||||
label: '发生日期',
|
||||
},
|
||||
{
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
placeholder: '结束日期',
|
||||
style: { width: '100%' },
|
||||
},
|
||||
fieldName: 'feeDateEnd',
|
||||
label: '至',
|
||||
},
|
||||
],
|
||||
showDefaultActions: true,
|
||||
collapsed: true,
|
||||
collapsedRows: 1,
|
||||
}));
|
||||
|
||||
// 刷新表格数据
|
||||
function refreshTable() {
|
||||
if (gridApi) {
|
||||
gridApi.reload();
|
||||
}
|
||||
}
|
||||
|
||||
// 创建 VbenVxeGrid 实例
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
formOptions: formOptions.value,
|
||||
showSearchForm: true,
|
||||
tableTitle: '推广费管理',
|
||||
});
|
||||
|
||||
// 处理新增
|
||||
const handleAdd = () => {
|
||||
currentPromotionFeeData.value = null;
|
||||
formModalVisible.value = true;
|
||||
};
|
||||
|
||||
// 处理编辑
|
||||
const handleEdit = (record: PromotionFeeVO.Info) => {
|
||||
currentPromotionFeeData.value = record;
|
||||
formModalVisible.value = true;
|
||||
};
|
||||
|
||||
// 处理删除
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
await deletePromotionFeeApi(id);
|
||||
message.success('删除成功');
|
||||
refreshTable();
|
||||
} catch {
|
||||
message.error('删除失败');
|
||||
}
|
||||
};
|
||||
|
||||
// 处理表单成功
|
||||
const handleFormSuccess = () => {
|
||||
refreshTable();
|
||||
};
|
||||
|
||||
// 格式化金额
|
||||
const formatAmount = (amount: number) => {
|
||||
return `¥${amount.toFixed(2)}`;
|
||||
};
|
||||
|
||||
// 获取平台标签颜色
|
||||
const getPlatformColor = (platform: string | undefined) => {
|
||||
switch (platform) {
|
||||
case '京东': {
|
||||
return 'red';
|
||||
}
|
||||
case '天猫': {
|
||||
return 'purple';
|
||||
}
|
||||
case '快手': {
|
||||
return 'cyan';
|
||||
}
|
||||
case '抖音': {
|
||||
return 'blue';
|
||||
}
|
||||
case '拼多多': {
|
||||
return 'green';
|
||||
}
|
||||
case '淘宝': {
|
||||
return 'orange';
|
||||
}
|
||||
default: {
|
||||
return 'default';
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page title="推广费管理" auto-content-height>
|
||||
<template #description>
|
||||
<div class="text-foreground/80 mt-2">
|
||||
管理店铺推广费用记录,支持按店铺、类型、平台等维度查询和统计
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #extra>
|
||||
<Space>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-2 h-4 w-4" />
|
||||
新增推广费记录
|
||||
</Button>
|
||||
</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.platform" :color="getPlatformColor(row.platform)">
|
||||
{{ row.platform }}
|
||||
</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>
|
||||
<Button size="small" danger @click="handleDelete(row.id)">
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
<!-- 表单弹窗 -->
|
||||
<PromotionFeeFormModal
|
||||
v-model:open="formModalVisible"
|
||||
:promotion-fee-data="currentPromotionFeeData"
|
||||
@success="handleFormSuccess"
|
||||
@cancel="formModalVisible = false"
|
||||
/>
|
||||
</Page>
|
||||
</template>
|
||||
Reference in New Issue
Block a user