feat: 新增广告唯一标识并优化相关功能

- 在广告模型中添加唯一标识字段
-优化广告编辑界面布局和提示文本
- 调整搜索按钮禁用逻辑,移除与 websiteId 相关的条件
- 修复优惠券列表中的数值格式化问题
- 优化经销商申请编辑界面布局
- 更新环境变量配置,注释掉 API URL
This commit is contained in:
2025-08-22 12:28:39 +08:00
parent 9aaaec8c26
commit d65cbc5d65
22 changed files with 62 additions and 46 deletions

View File

@@ -1,5 +1,5 @@
VITE_APP_NAME=后台管理(开发环境)
VITE_API_URL=http://127.0.0.1:9200/api
#VITE_API_URL=http://127.0.0.1:9200/api
#VITE_SERVER_API_URL=http://127.0.0.1:8000/api

Binary file not shown.

View File

@@ -8,6 +8,8 @@ export interface CmsAd {
adId?: number;
// 类型
type?: number;
// 唯一标识
code?: string;
// 栏目分类
categoryId?: number;
// 栏目名称

View File

@@ -65,5 +65,7 @@ export interface ShopCoupon {
*/
export interface ShopCouponParam extends PageParam {
id?: number;
name?: string;
type?: number;
keywords?: string;
}

View File

@@ -12,6 +12,10 @@ export interface ShopGift {
code?: string;
// 商品ID
goodsId?: number;
// 商品名称
goodsName?: string;
// 面值
faceValue?: string;
// 领取时间
takeTime?: string;
// 核销时间

View File

@@ -152,6 +152,7 @@ import {logout} from '@/utils/page-tab-util';
import {listRoles} from '@/api/system/role';
import { useSiteStore } from '@/store/modules/site';
import Qrcode from "@/components/QrCode/index.vue";
import {AppInfo} from "@/api/cms/cmsWebsite/model";
// 是否开启响应式布局
const themeStore = useThemeStore();
@@ -183,7 +184,7 @@ const settingVisible = ref(false);
// 当前用户信息
const loginUser = computed(() => userStore.info ?? {});
const website = ref<CmsWebsite>();
const website = ref<AppInfo>();
/* 用户信息下拉点击 */
const onUserDropClick = ({key}) => {

View File

@@ -19,12 +19,12 @@
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
"
>
<a-form-item label="标题" name="name">
<a-form-item label="名称" name="name">
<a-input
allow-clear
:maxlength="100"
style="width: 500px"
placeholder="请输入广告标题"
placeholder="请输入广告名称"
v-model:value="form.name"
/>
</a-form-item>
@@ -52,7 +52,7 @@
/>
</div>
<a-space class="flex flex-col gap-2">
<div class="w-[500px]" v-for="(item, index) in images" :key="index">
<div class="w-[500px]" v-for="(_, index) in images" :key="index">
<a-input
v-model:value="images[index].path"
placeholder="https://"
@@ -129,13 +129,13 @@
<span class="text-gray-400">广告位尺寸大小(默认值100% * 500px)</span>
</div>
</a-form-item>
<a-form-item label="栏目">
<a-form-item label="所属栏目">
<a-tree-select
allow-clear
:tree-data="navigationList"
tree-default-expand-all
style="width: 500px;"
placeholder="请选择栏目"
placeholder="请选择所属栏目"
:value="form.categoryId || undefined"
:listHeight="700"
:dropdown-style="{ overflow: 'auto' }"
@@ -143,6 +143,15 @@
@change="onCategoryId"
/>
</a-form-item>
<a-form-item label="唯一标识" name="code">
<a-input
allow-clear
:maxlength="100"
style="width: 500px"
placeholder="请输入广告唯一标识"
v-model:value="form.code"
/>
</a-form-item>
<a-form-item label="样式" name="style">
<a-input
allow-clear
@@ -229,6 +238,7 @@ const formRef = ref<FormInstance | null>(null);
const form = reactive<CmsAd>({
adId: undefined,
type: undefined,
code: undefined,
categoryId: undefined,
name: '',
style: '',
@@ -273,7 +283,7 @@ const rules = reactive({
type: 'string',
message: '请上传图片或视频',
trigger: 'blur',
validator: (_rule: Rule, value: string) => {
validator: (_rule: Rule, _: string) => {
return new Promise<void>((resolve, reject) => {
if (images.value.length == 0) {
return reject('请上传图片或视频文件');

View File

@@ -1,7 +1,7 @@
<!-- 搜索表单 -->
<template>
<a-space :size="10" style="flex-wrap: wrap">
<a-button type="primary" class="ele-btn-icon" :disabled="!websiteId" @click="add">
<a-button type="primary" class="ele-btn-icon" @click="add">
<template #icon>
<PlusOutlined />
</template>

View File

@@ -93,7 +93,6 @@ import type {CmsAd, CmsAdParam} from '@/api/cms/cmsAd/model';
import {CmsNavigation} from "@/api/cms/cmsNavigation/model";
import {listCmsNavigation} from "@/api/cms/cmsNavigation";
import {getPageTitle} from "@/utils/common";
import Extra from "@/views/cms/cmsNavigation/components/extra.vue";
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);

View File

@@ -1,7 +1,7 @@
<!-- 搜索表单 -->
<template>
<a-space :size="10" style="flex-wrap: wrap">
<a-button type="primary" class="ele-btn-icon" :disabled="!websiteId" @click="add">
<a-button type="primary" class="ele-btn-icon" @click="add">
<template #icon>
<PlusOutlined/>
</template>
@@ -68,8 +68,8 @@
@search="reload"
/>
<a-button type="text" @click="reset">重置</a-button>
<a-button type="text" :disabled="!websiteId" @click="handleExport">导出xls</a-button>
<a-button type="text" :disabled="!websiteId" @click="openImport">导入xls</a-button>
<a-button type="text" @click="handleExport">导出xls</a-button>
<a-button type="text" @click="openImport">导入xls</a-button>
</a-space>
<!-- 导入弹窗 -->

View File

@@ -1,7 +1,7 @@
<!-- 搜索表单 -->
<template>
<a-space :size="10" style="flex-wrap: wrap">
<a-button type="primary" class="ele-btn-icon" :disabled="!websiteId" @click="add">
<a-button type="primary" class="ele-btn-icon" @click="add">
<template #icon>
<PlusOutlined />
</template>

View File

@@ -1,7 +1,7 @@
<!-- 搜索表单 -->
<template>
<a-space :size="10" style="flex-wrap: wrap;">
<a-button type="primary" class="ele-btn-icon" :disabled="!websiteId" @click="add">
<a-button type="primary" class="ele-btn-icon" @click="add">
<template #icon>
<PlusOutlined />
</template>

View File

@@ -75,9 +75,8 @@
<!-- />-->
<!-- </a-form-item>-->
<a-form-item
:label="form.model == 'links' ? '链接地址' : '路由地址'"
:label="'path'"
name="path"
v-if="form.model == 'links'"
>
<a-input
allow-clear
@@ -252,7 +251,7 @@ const loading = ref(false);
// 已上传数据
const images = ref<ItemType[]>([]);
const password = ref();
const pathPlaceholder = ref<string>('请输入链接地址');
const pathPlaceholder = ref<string>('/pages/index/index');
const lang = ref(localStorage.getItem('i18n-lang'));
const zhCmsNavigationList = ref<CmsNavigation[]>([]);

View File

@@ -1,7 +1,7 @@
<!-- 搜索表单 -->
<template>
<a-space :size="10" style="flex-wrap: wrap">
<a-button type="primary" class="ele-btn-icon" :disabled="!websiteId" @click="openEdit()">
<a-button type="primary" class="ele-btn-icon" @click="openEdit()">
<template #icon>
<plus-outlined/>
</template>

View File

@@ -22,7 +22,7 @@
>
<template #toolbar>
<a-space>
<a-button type="primary" class="ele-btn-icon" :disabled="!websiteId" @click="openEdit()">
<a-button type="primary" class="ele-btn-icon" @click="openEdit()">
<template #icon>
<plus-outlined/>
</template>
@@ -76,7 +76,7 @@
<a-space>
<a-avatar v-if="record.icon" :size="22" :src="record.icon"/>
<a @click="push({
path: `/website/article`,
path: `/article`,
query: {
id: record.navigationId,
name: record.title,
@@ -431,6 +431,7 @@ const parseData = (data: CmsNavigation[]) => {
/* 表格渲染完成回调 */
const onDone: EleProTableDone<CmsNavigation> = ({data}) => {
navigationData.value = data;
expandAll()
};
/* 刷新表格 */

View File

@@ -1,5 +1,5 @@
<template>
<a-button @click="add" type="primary" :disabled="!websiteId">添加字段</a-button>
<a-button @click="add" type="primary" >添加字段</a-button>
</template>
<script lang="ts" setup>

View File

@@ -13,7 +13,7 @@
>
<template #toolbar>
<a-space>
<a-button type="primary" class="ele-btn-icon" :disabled="!websiteId" @click="openEdit()">
<a-button type="primary" class="ele-btn-icon" @click="openEdit()">
<template #icon>
<plus-outlined />
</template>

View File

@@ -13,7 +13,7 @@
>
<template #toolbar>
<a-space>
<a-button type="primary" class="ele-btn-icon" :disabled="!websiteId" @click="openEdit()">
<a-button type="primary" class="ele-btn-icon" @click="openEdit()">
<template #icon>
<plus-outlined />
</template>

View File

@@ -20,7 +20,7 @@
:accept="'image/*,application/*'"
:customRequest="onUpload"
>
<a-button type="primary" :disabled="!websiteId" class="ele-btn-icon">
<a-button type="primary" class="ele-btn-icon">
<template #icon>
<UploadOutlined />
</template>

View File

@@ -22,7 +22,6 @@
<a-input
allow-clear
:maxlength="20"
:disabled="isUpdate"
placeholder="请输入真实姓名"
v-model:value="form.realName"
/>

View File

@@ -133,16 +133,16 @@
<template v-if="column.key === 'value'">
<div class="coupon-value">
<template v-if="record.type === 10">
<span class="value-amount">¥{{ record.reducePrice?.toFixed(2) || '0.00' }}</span>
<div class="value-condition">¥{{ record.minPrice?.toFixed(2) || '0.00' }}可用</div>
<span class="value-amount">¥{{ Number(record.reducePrice).toFixed(2) || '0.00' }}</span>
<div class="value-condition">¥{{ Number(record.minPrice).toFixed(2) || '0.00' }}可用</div>
</template>
<template v-else-if="record.type === 20">
<span class="value-discount">{{ record.discount }}</span>
<div class="value-condition">¥{{ record.minPrice?.toFixed(2) || '0.00' }}可用</div>
<div class="value-condition">¥{{ Number(record.minPrice)?.toFixed(2) || '0.00' }}可用</div>
</template>
<template v-else-if="record.type === 30">
<span class="value-free">免费券</span>
<div class="value-condition">¥{{ record.minPrice?.toFixed(2) || '0.00' }}可用</div>
<div class="value-condition">¥{{ Number(record.minPrice)?.toFixed(2) || '0.00' }}可用</div>
</template>
</div>
</template>
@@ -272,10 +272,9 @@ const loading = ref(false);
// 搜索表单
const searchForm = reactive<ShopCouponParam>({
name: '',
type: undefined,
expireType: undefined,
isExpire: undefined
keywords: '',
name: undefined,
type: 0
});
// 表格数据源
@@ -467,7 +466,7 @@ const formatDate = (dateStr: string) => {
const getUsagePercent = (record: ShopCoupon) => {
if (record.totalCount === -1) return 0;
return Math.round(((record.issuedCount || 0) / record.totalCount) * 100);
return Math.round(((record.issuedCount || 0) / Number(record.totalCount)) * 100);
};
const getUsageColor = (record: ShopCoupon) => {

View File

@@ -92,17 +92,17 @@
</a-select>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="审核时间" name="auditTime" v-if="form.applyStatus === 20 || form.applyStatus === 30">
<a-date-picker
v-model:value="form.auditTime"
show-time
format="YYYY-MM-DD HH:mm:ss"
placeholder="请选择审核时间"
style="width: 100%"
/>
</a-form-item>
</a-col>
<!-- <a-col :span="12">-->
<!-- <a-form-item label="审核时间" name="auditTime" v-if="form.applyStatus === 20 || form.applyStatus === 30">-->
<!-- <a-date-picker-->
<!-- v-model:value="form.auditTime"-->
<!-- show-time-->
<!-- format="YYYY-MM-DD HH:mm:ss"-->
<!-- placeholder="请选择审核时间"-->
<!-- style="width: 100%"-->
<!-- />-->
<!-- </a-form-item>-->
<!-- </a-col>-->
</a-row>
<a-row :gutter="16" v-if="form.applyStatus === 30">