From 1671215071a23324d2dd4e99a19d65badf9a913d Mon Sep 17 00:00:00 2001 From: sparksfly Date: Sat, 8 Aug 2026 11:25:20 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=AE=8C=E6=88=90=E6=97=85?= =?UTF-8?q?=E6=B8=B8=E7=AE=A1=E7=90=86=E7=B3=BB=E7=BB=9F=E5=A4=9A=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96=E4=B8=8E=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=BF=AD=E4=BB=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 本次提交包含多维度更新: 1. 修复登录页默认密码为123456,优化产品标签分割逻辑 2. 重构文章摘要提取逻辑,使用DOM解析替代正则替换,更准确处理富文本 3. 重构游记服务层登录校验逻辑,新增getLoginUserId方法区分管理员与普通用户 4. 全面升级订单与游记管理页面: - 替换列表接口为分页接口,新增搜索、分页、空状态处理 - 重构表格列配置与状态映射,优化操作按钮逻辑 - 新增景点订单、商品订单详情查看与多状态操作能力 5. 重构后端接口与接口层代码,统一使用RESTful风格路由与请求方法 6. 优化订单列表展示字段,补充收货信息、商品明细等展示内容 --- tourism-admin/src/api/order.ts | 36 +-- tourism-admin/src/api/travel.ts | 17 +- tourism-admin/src/views/login/LoginView.vue | 2 +- .../src/views/order/AttractionOrderView.vue | 154 +++++++++--- .../src/views/order/ProductOrderView.vue | 199 ++++++++++++--- .../src/views/travel/TravelNoteView.vue | 232 ++++++++++++++++-- .../service/impl/ProductOrderServiceImpl.java | 4 +- .../service/impl/TravelNoteServiceImpl.java | 21 +- tourism-web/src/views/home/HomeView.vue | 5 +- .../src/views/product/ProductDetail.vue | 2 +- tourism-web/src/views/travel/TravelList.vue | 5 +- 11 files changed, 557 insertions(+), 120 deletions(-) diff --git a/tourism-admin/src/api/order.ts b/tourism-admin/src/api/order.ts index 164b81a..9a4ca15 100644 --- a/tourism-admin/src/api/order.ts +++ b/tourism-admin/src/api/order.ts @@ -1,21 +1,29 @@ import http from './index' -export function getAttractionOrderList() { - return http.get('/order/attraction/list') -} -export function processAttractionOrder(id: number) { - return http.post('/order/attraction/process', { id }) -} -export function cancelAttractionOrder(id: number) { - return http.post('/order/attraction/cancel', { id }) +export function getAttractionOrderPage(params: any) { + return http.get('/order/attraction/page', { params }) } -export function getProductOrderList() { - return http.get('/order/product/list') +export function markAttractionOrderUsed(id: number) { + return http.put(`/order/attraction/${id}/use`) } -export function processProductOrder(id: number) { - return http.post('/order/product/process', { id }) + +export function refundAttractionOrder(id: number) { + return http.put(`/order/attraction/${id}/refund`) } -export function cancelProductOrder(id: number) { - return http.post('/order/product/cancel', { id }) + +export function getProductOrderPage(params: any) { + return http.get('/order/product/page', { params }) +} + +export function deliverProductOrder(id: number) { + return http.put(`/order/product/${id}/deliver`) +} + +export function receiveProductOrder(id: number) { + return http.put(`/order/product/${id}/receive`) +} + +export function refundProductOrder(id: number) { + return http.put(`/order/product/${id}/refund`) } diff --git a/tourism-admin/src/api/travel.ts b/tourism-admin/src/api/travel.ts index 3cb10c8..9d47aa2 100644 --- a/tourism-admin/src/api/travel.ts +++ b/tourism-admin/src/api/travel.ts @@ -1,14 +1,17 @@ import http from './index' -export function getTravelNoteList() { - return http.get('/travel/list') +export function getTravelNotePage(params: any) { + return http.get('/travel/page', { params }) } -export function approveTravelNote(id: number) { - return http.post('/travel/approve', { id }) + +export function getTravelNoteById(id: number) { + return http.get(`/travel/${id}`) } -export function rejectTravelNote(id: number) { - return http.post('/travel/reject', { id }) + +export function auditTravelNote(data: { id: number; status: number; rejectReason?: string }) { + return http.put('/travel/audit', data) } + export function deleteTravelNote(id: number) { - return http.post('/travel/delete', { id }) + return http.delete(`/travel/${id}`) } diff --git a/tourism-admin/src/views/login/LoginView.vue b/tourism-admin/src/views/login/LoginView.vue index 3543d2f..050e95e 100644 --- a/tourism-admin/src/views/login/LoginView.vue +++ b/tourism-admin/src/views/login/LoginView.vue @@ -99,7 +99,7 @@ diff --git a/tourism-admin/src/views/order/AttractionOrderView.vue b/tourism-admin/src/views/order/AttractionOrderView.vue index b2d9163..960b28b 100644 --- a/tourism-admin/src/views/order/AttractionOrderView.vue +++ b/tourism-admin/src/views/order/AttractionOrderView.vue @@ -1,47 +1,101 @@ + + diff --git a/tourism-server/src/main/java/com/tourism/order/service/impl/ProductOrderServiceImpl.java b/tourism-server/src/main/java/com/tourism/order/service/impl/ProductOrderServiceImpl.java index 92d3b4b..be80932 100644 --- a/tourism-server/src/main/java/com/tourism/order/service/impl/ProductOrderServiceImpl.java +++ b/tourism-server/src/main/java/com/tourism/order/service/impl/ProductOrderServiceImpl.java @@ -227,7 +227,9 @@ public class ProductOrderServiceImpl extends ServiceImpl page = new Page<>(dto.getCurrent(), dto.getSize()); LambdaQueryWrapper wrapper = buildQueryWrapper(dto); wrapper.orderByDesc(ProductOrder::getCreateTime); - return baseMapper.selectPage(page, wrapper).convert(this::convertToVO); + IPage result = baseMapper.selectPage(page, wrapper).convert(this::convertToVO); + result.getRecords().forEach(vo -> vo.setItems(getOrderItems(vo.getId()))); + return result; } @Override diff --git a/tourism-server/src/main/java/com/tourism/travel/service/impl/TravelNoteServiceImpl.java b/tourism-server/src/main/java/com/tourism/travel/service/impl/TravelNoteServiceImpl.java index bd0a4f7..70f0961 100644 --- a/tourism-server/src/main/java/com/tourism/travel/service/impl/TravelNoteServiceImpl.java +++ b/tourism-server/src/main/java/com/tourism/travel/service/impl/TravelNoteServiceImpl.java @@ -37,7 +37,7 @@ public class TravelNoteServiceImpl extends ServiceImpl myPageQuery(Long current, Long size) { - Long userId = StpUtil.getLoginIdAsLong(); + Long userId = getLoginUserId(); Page page = new Page<>(current, size); LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(TravelNote::getUserId, userId); @@ -188,7 +188,7 @@ public class TravelNoteServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper<>(); wrapper.eq(Favorite::getUserId, userId) .eq(Favorite::getFavoriteType, 3) @@ -196,6 +196,17 @@ public class TravelNoteServiceImpl extends ServiceImpl 0; } + /** + * 获取当前登录用户ID;管理员登录 ID 形如 admin:1,不能作为用户ID使用 + */ + private Long getLoginUserId() { + String loginId = StpUtil.getLoginIdAsString(); + if (loginId.startsWith("admin:")) { + throw new BusinessException("请使用用户账号操作游记"); + } + return Long.parseLong(loginId); + } + private TravelNoteVO convertToVO(TravelNote note) { TravelNoteVO vo = new TravelNoteVO(); BeanUtils.copyProperties(note, vo); diff --git a/tourism-web/src/views/home/HomeView.vue b/tourism-web/src/views/home/HomeView.vue index 6a03055..9535617 100644 --- a/tourism-web/src/views/home/HomeView.vue +++ b/tourism-web/src/views/home/HomeView.vue @@ -177,7 +177,10 @@ function formatDate(dateStr: string | null): string { function extractExcerpt(content: string): string { if (!content) return '' - const stripped = content.replace(/[#*`\[\]()>|\\-]/g, '').replace(/\s+/g, ' ').trim() + const div = document.createElement('div') + div.innerHTML = content + const text = div.textContent || div.innerText || '' + const stripped = text.replace(/\s+/g, ' ').trim() return stripped.length > 100 ? stripped.slice(0, 100) + '...' : stripped } diff --git a/tourism-web/src/views/product/ProductDetail.vue b/tourism-web/src/views/product/ProductDetail.vue index 74bbccf..f392c92 100644 --- a/tourism-web/src/views/product/ProductDetail.vue +++ b/tourism-web/src/views/product/ProductDetail.vue @@ -124,7 +124,7 @@ const currentImage = computed(() => imageList.value[currentIndex.value] || image const tagList = computed(() => { if (!detail.value?.tags) return [] - return detail.value.tags.split(',').map((s: string) => s.trim()).filter(Boolean) + return detail.value.tags.split(/[;,]/).map((s: string) => s.trim()).filter(Boolean) }) const selectedPrice = computed(() => { diff --git a/tourism-web/src/views/travel/TravelList.vue b/tourism-web/src/views/travel/TravelList.vue index a92b151..b6962bc 100644 --- a/tourism-web/src/views/travel/TravelList.vue +++ b/tourism-web/src/views/travel/TravelList.vue @@ -100,7 +100,10 @@ function formatDate(dateStr: string | null): string { function extractExcerpt(content: string): string { if (!content) return '' - const stripped = content.replace(/[#*`\[\]()>|\\-]/g, '').replace(/\s+/g, ' ').trim() + const div = document.createElement('div') + div.innerHTML = content + const text = div.textContent || div.innerText || '' + const stripped = text.replace(/\s+/g, ' ').trim() return stripped.length > 100 ? stripped.slice(0, 100) + '...' : stripped }