feat(order): 更新订单页面表单内容与提示信息

- 修改页面提示标题为"欢迎留言"
- 简化表单字段,移除产品选择、参考链接及文件上传功能
- 调整表单布局和标签文案,统一使用"留言标题"和"留言内容"
- 更新内容输入框的占位符文本
- 修改必填项验证提示信息,适配新的留言场景
This commit is contained in:
2025-12-23 23:29:51 +08:00
parent 370dc69948
commit bdcb779cf8
4 changed files with 74 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
# 应用模块接口
VITE_SERVER_URL=https://server.gxbsnx.com/api
API_BASE=https://server.gxbsnx.com/api
#API_BASE=https://server.gxbsnx.com/api
#API_BASE=http://127.0.0.1:9001/api
API_BASE=http://127.0.0.1:9001/api
#VITE_SERVER_URL=http://127.0.0.1:8000/api

View File

@@ -19,6 +19,21 @@ export async function pageCmsOrder(params: CmsOrderParam) {
return Promise.reject(new Error(res.message));
}
export async function displayCmsOrder(params: CmsOrderParam) {
const res = await request.get<ApiResult<PageResult<CmsOrder>>>(
'/cms/cms-order/display',
{
params
}
);
if (res.code === 0) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 查询订单列表
*/

View File

@@ -73,5 +73,6 @@ export interface CmsOrderParam extends PageParam {
orderId?: number;
websiteId?: number;
isSettled?: boolean;
sceneType?: string;
keywords?: string;
}

View File

@@ -70,17 +70,30 @@
<div class="likes-list my2 w-full">
<div v-for="(item,index) in orders" :key="index" class="item flex justify-between bg-gray-50 p-4 mb-2">
<div class="text-sm">
<div class="avatar flex items-center">
<el-avatar src="/assets/default-avatar.png"/>
<div class="nickname flex flex-col ml-2">
<span>{{ item.realName }}</span>
<span class="text-sm text-gray-400">{{ item.createTime }}</span>
</div>
<div class="avatar flex">
<el-avatar src="/assets/default-avatar.png"/>
<div class="nickname flex flex-col ml-2">
<span class="font-bold">{{ item.realName }}</span>
<span class="text-sm text-gray-400">{{ item.createTime }}</span>
<div class="content py-1">{{ item.content }}</div>
<div class="content py-1 text-red-500">{{ item.comments }}</div>
</div>
</div>
<div class="content py-2">{{ item.content }}</div>
</div>
</div>
</div>
<div class="mt-4 flex justify-end" v-if="total > 0">
<el-pagination
:current-page="currentPage"
:page-size="pageSize"
:page-sizes="[5, 10, 20]"
background
layout="total, sizes, prev, pager, next"
:total="total"
@current-change="handlePageChange"
@size-change="handleSizeChange"
/>
</div>
</div>
</div>
</div>
@@ -132,6 +145,9 @@ const captcha = ref('');
const text = ref<string>('');
const loading = ref(false)
const orders = ref<CmsOrder[]>([])
const currentPage = ref(1)
const pageSize = ref(5)
const total = ref(0)
const {form, resetFields} = useFormData<CmsOrder>({
@@ -217,6 +233,24 @@ const changeCaptcha = async () => {
})
};
// 加载留言列表(带分页)
const loadOrders = async () => {
try {
const response = await pageCmsOrder({
isSettled: true,
page: currentPage.value,
limit: pageSize.value,
sort: 'createTime',
order: 'desc',
sceneType: 'display'
})
orders.value = response?.list || []
total.value = response?.count || 0
} catch (error) {
console.error('Failed to load orders:', error)
}
}
// 将 SEO 相关的逻辑修改为
const updateSeo = (data: any) => {
const title = data?.title || '';
@@ -262,10 +296,9 @@ const reload = async () => {
form.email = user.value.email
}
// 留言列表
pageCmsOrder({isSettled: true}).then(response => {
orders.value = response?.list || []
})
// 重置分页并加载留言列表
currentPage.value = 1
await loadOrders()
changeCaptcha()
} catch (error) {
@@ -340,6 +373,18 @@ const goBack = () => {
router.back();
}
// 分页切换
const handlePageChange = (pageNum: number) => {
currentPage.value = pageNum
loadOrders()
}
const handleSizeChange = (size: number) => {
pageSize.value = size
currentPage.value = 1
loadOrders()
}
watch(
() => route.params.id,
(id) => {