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 }