修复:修复后台表格折叠与购物车美甲师选择
This commit is contained in:
@@ -155,6 +155,12 @@ adminApi.interceptors.response.use(
|
||||
console.error('权限不足:', error)
|
||||
}
|
||||
|
||||
if (error.response?.status === 403) {
|
||||
const errorMsg = (error.response?.data as any)?.message || '权限不足'
|
||||
console.error('Admin API Permission Error:', errorMsg)
|
||||
return Promise.reject(new Error(errorMsg))
|
||||
}
|
||||
|
||||
console.error('Admin API Error:', error)
|
||||
return Promise.reject(error)
|
||||
}
|
||||
|
||||
Vendored
+2
@@ -70,6 +70,7 @@ declare module 'vue' {
|
||||
ATextarea: typeof import('ant-design-vue/es')['Textarea']
|
||||
ATimeline: typeof import('ant-design-vue/es')['Timeline']
|
||||
ATimelineItem: typeof import('ant-design-vue/es')['TimelineItem']
|
||||
ATooltip: typeof import('ant-design-vue/es')['Tooltip']
|
||||
ATypographyText: typeof import('ant-design-vue/es')['TypographyText']
|
||||
AUpload: typeof import('ant-design-vue/es')['Upload']
|
||||
BottomNav: typeof import('./components/BottomNav.vue')['default']
|
||||
@@ -81,5 +82,6 @@ declare module 'vue' {
|
||||
HelloWorld: typeof import('./components/HelloWorld.vue')['default']
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
TableEllipsisText: typeof import('./components/TableEllipsisText.vue')['default']
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<span v-if="!displayText" class="empty-text">{{ emptyText }}</span>
|
||||
<a-tooltip v-else :title="displayText" placement="topLeft">
|
||||
<div class="ellipsis-text" :class="lineClass">
|
||||
{{ displayText }}
|
||||
</div>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
text?: string | number | null
|
||||
lines?: 1 | 2 | 3
|
||||
emptyText?: string
|
||||
}>(), {
|
||||
lines: 1,
|
||||
emptyText: '--'
|
||||
})
|
||||
|
||||
const displayText = computed(() => {
|
||||
if (props.text === undefined || props.text === null) {
|
||||
return ''
|
||||
}
|
||||
const value = String(props.text).trim()
|
||||
return value
|
||||
})
|
||||
|
||||
const lineClass = computed(() => {
|
||||
return props.lines > 1 ? `lines-${props.lines}` : ''
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ellipsis-text {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
word-break: break-all;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.lines-2,
|
||||
.lines-3 {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.lines-2 {
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
|
||||
.lines-3 {
|
||||
-webkit-line-clamp: 3;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
color: #bfbfbf;
|
||||
}
|
||||
</style>
|
||||
@@ -178,13 +178,11 @@ import { computed, inject, onMounted, ref, watch } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { DeleteOutlined, LeftOutlined, RightOutlined } from '@ant-design/icons-vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import api from '../api'
|
||||
import { cartApi } from '../api/cart'
|
||||
import { couponApi, type UserCoupon } from '../api/coupon'
|
||||
import { fileApi } from '../api/index'
|
||||
import { orderApi } from '../api/order'
|
||||
import { shopApi } from '../api/shop'
|
||||
import { userApi } from '../api/user'
|
||||
|
||||
const router = useRouter()
|
||||
const updateCartCount = inject<() => Promise<void>>('updateCartCount', async () => {})
|
||||
@@ -211,6 +209,9 @@ interface CartItem {
|
||||
tagNames?: string
|
||||
approximateDuration?: string
|
||||
bookableArtists?: string
|
||||
availableBookableArtistCount?: number
|
||||
bookableArtistRestricted?: boolean
|
||||
availableArtists?: ArtistOption[]
|
||||
appointmentTime?: string
|
||||
selected: boolean
|
||||
artistId?: number
|
||||
@@ -500,26 +501,19 @@ const openBookingModal = async (item: CartItem) => {
|
||||
}
|
||||
|
||||
const loadArtists = async (item: CartItem) => {
|
||||
const users = await userApi.listUsersByType(3) as unknown as any[]
|
||||
const allowedIds = new Set((item.bookableArtists || '').split(',').map(id => Number(id.trim())).filter(id => Number.isFinite(id) && id > 0))
|
||||
availableArtists.value = await Promise.all(
|
||||
users
|
||||
.filter(user => user.status === 1)
|
||||
.filter(user => {
|
||||
const matchedShop = !item.shopId
|
||||
|| user.shopId === item.shopId
|
||||
|| (Array.isArray((user as any).shopIds) && (user as any).shopIds.some((shopId: string | number) => String(shopId) === String(item.shopId)))
|
||||
return matchedShop && (!allowedIds.size || allowedIds.has(user.id))
|
||||
})
|
||||
.map(async user => {
|
||||
try {
|
||||
const detail = await api.get('/nail-artist/get/' + user.id) as any
|
||||
return { id: user.id, name: user.nickname, avatar: user.avatar || detail?.avatar }
|
||||
} catch {
|
||||
return { id: user.id, name: user.nickname, avatar: user.avatar }
|
||||
}
|
||||
})
|
||||
)
|
||||
availableArtists.value = Array.isArray(item.availableArtists)
|
||||
? item.availableArtists
|
||||
.filter(artist => artist && artist.id !== undefined && artist.id !== null)
|
||||
.map(artist => ({
|
||||
id: Number(artist.id),
|
||||
name: artist.name,
|
||||
avatar: artist.avatar
|
||||
}))
|
||||
: []
|
||||
|
||||
if (draftArtistId.value && !availableArtists.value.some(artist => artist.id === draftArtistId.value)) {
|
||||
draftArtistId.value = undefined
|
||||
}
|
||||
}
|
||||
|
||||
const loadShopHours = async (shopId?: number) => {
|
||||
|
||||
@@ -192,7 +192,7 @@ const getCurrentUserInfo = () => {
|
||||
isShopOwner.value = userInfo.type === 2
|
||||
return userInfo
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error('获取当前用户信息失败', error)
|
||||
}
|
||||
return null
|
||||
@@ -444,6 +444,11 @@ const handleModalOk = async () => {
|
||||
fetchNailArtistList()
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
const errorMessage = (error as Error)?.message
|
||||
if (errorMessage) {
|
||||
message.error(errorMessage)
|
||||
return
|
||||
}
|
||||
message.error('操作失败')
|
||||
} finally {
|
||||
modalLoading.value = false
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
:data-source="permissionList"
|
||||
:loading="loading"
|
||||
:pagination="permissionPagination"
|
||||
:scroll="{ x: 1080 }"
|
||||
@change="handlePermissionTableChange"
|
||||
row-key="id"
|
||||
>
|
||||
@@ -26,6 +27,21 @@
|
||||
<template v-if="column.key === 'permissionGroup'">
|
||||
<a-tag color="purple">{{ record.permissionGroup }}</a-tag>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'permissionCode'">
|
||||
<div style="max-width: 220px;">
|
||||
<TableEllipsisText :text="record.permissionCode" />
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'permissionName'">
|
||||
<div style="max-width: 180px;">
|
||||
<TableEllipsisText :text="record.permissionName" />
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'description'">
|
||||
<div style="max-width: 320px;">
|
||||
<TableEllipsisText :text="record.description" :lines="2" />
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'actions'">
|
||||
<a-space>
|
||||
<a-button v-if="hasPermission('permission:edit')" type="link" size="small" @click="showEditPermissionModal(record)">
|
||||
@@ -198,6 +214,7 @@ import type { FormInstance } from 'ant-design-vue'
|
||||
import type { Rule } from 'ant-design-vue/es/form'
|
||||
import { PlusOutlined } from '@ant-design/icons-vue'
|
||||
import DraftActions from '@/components/DraftActions.vue'
|
||||
import TableEllipsisText from '@/components/TableEllipsisText.vue'
|
||||
import { DEFAULT_AVATAR } from '@/constants'
|
||||
import { userApi, type UserVO } from '@/api/admin'
|
||||
import { permissionApi, type PermissionVO } from '@/api/permission'
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
:data-source="productList"
|
||||
:loading="loading"
|
||||
:pagination="pagination"
|
||||
:scroll="{ x: 1280 }"
|
||||
@change="handleTableChange"
|
||||
row-key="id"
|
||||
>
|
||||
@@ -53,6 +54,16 @@
|
||||
<template v-else-if="column.key === 'shop'">
|
||||
<span>{{ record.shopName || getShopName(record.shopId) }}</span>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'title'">
|
||||
<div style="max-width: 220px;">
|
||||
<TableEllipsisText :text="record.title" />
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'description'">
|
||||
<div style="max-width: 320px;">
|
||||
<TableEllipsisText :text="record.description" :lines="2" />
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'price'">
|
||||
<span style="color: #cf1322; font-weight: 600;">
|
||||
¥{{ record.price }}
|
||||
@@ -392,6 +403,7 @@ import { computed, ref, reactive, onMounted, watch } from 'vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { PlusOutlined } from '@ant-design/icons-vue'
|
||||
import DraftActions from '@/components/DraftActions.vue'
|
||||
import TableEllipsisText from '@/components/TableEllipsisText.vue'
|
||||
import { DEFAULT_PRODUCT_IMAGE } from '@/constants'
|
||||
import { adminProductApi, type Product, adminShopApi, type Shop, adminFileApi, adminTagApi, adminArtistApi, adminCouponApi } from '@/api/admin'
|
||||
import { createChunkUploadTask, type ChunkUploadTask } from '@/utils/chunk-upload'
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
:data-source="shopList"
|
||||
:loading="loading"
|
||||
:pagination="pagination"
|
||||
:scroll="{ x: 1380 }"
|
||||
@change="handleTableChange"
|
||||
row-key="id"
|
||||
>
|
||||
@@ -73,6 +74,26 @@
|
||||
@change="(checked: any) => handleStatusChange(record, checked === true)"
|
||||
/>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'shopName'">
|
||||
<div style="max-width: 180px;">
|
||||
<TableEllipsisText :text="record.shopName" />
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'description'">
|
||||
<div style="max-width: 280px;">
|
||||
<TableEllipsisText :text="record.description" :lines="2" />
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'address'">
|
||||
<div style="max-width: 260px;">
|
||||
<TableEllipsisText :text="record.address" :lines="2" />
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'businessHours'">
|
||||
<div style="max-width: 140px;">
|
||||
<TableEllipsisText :text="record.businessHours" />
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'actions'">
|
||||
<a-space>
|
||||
<a-button v-if="hasPermission('shop:view')" type="link" size="small" @click="showViewModal(record)">
|
||||
@@ -275,6 +296,7 @@ import { message } from 'ant-design-vue'
|
||||
import type { FormInstance } from 'ant-design-vue'
|
||||
import { PlusOutlined } from '@ant-design/icons-vue'
|
||||
import DraftActions from '@/components/DraftActions.vue'
|
||||
import TableEllipsisText from '@/components/TableEllipsisText.vue'
|
||||
import { DEFAULT_SHOP_IMAGE } from '@/constants'
|
||||
import { adminShopApi, adminFileApi, type Shop } from '@/api/admin'
|
||||
import { createChunkUploadTask, type ChunkUploadTask } from '@/utils/chunk-upload'
|
||||
|
||||
+114
-37
@@ -4,19 +4,28 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.xiaowang.yuminailcore.dto.CartDTO;
|
||||
import com.xiaowang.yuminailcore.entity.CartDO;
|
||||
import com.xiaowang.yuminailcore.entity.ProductDO;
|
||||
import com.xiaowang.yuminailcore.entity.UserDO;
|
||||
import com.xiaowang.yuminailcore.mapper.CartMapper;
|
||||
import com.xiaowang.yuminailcore.mapper.ProductMapper;
|
||||
import com.xiaowang.yuminailcore.mapper.UserMapper;
|
||||
import com.xiaowang.yuminailcore.service.CartService;
|
||||
import com.xiaowang.yuminailcore.service.TagService;
|
||||
import com.xiaowang.yuminailcore.support.BookableArtistSupport;
|
||||
import com.xiaowang.yuminailcore.support.UserShopBindingSupport;
|
||||
import com.xiaowang.yuminailcore.vo.CartArtistVO;
|
||||
import com.xiaowang.yuminailcore.vo.CartVO;
|
||||
import com.xiaowang.yuminailcore.vo.TagVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@@ -31,32 +40,38 @@ public class CartServiceImpl implements CartService {
|
||||
@Resource
|
||||
private TagService tagService;
|
||||
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Resource
|
||||
private UserShopBindingSupport userShopBindingSupport;
|
||||
|
||||
@Resource
|
||||
private BookableArtistSupport bookableArtistSupport;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void addToCart(Long userId, CartDTO cartDTO) {
|
||||
validateQuantity(cartDTO.getQuantity());
|
||||
|
||||
// 检查商品是否存在
|
||||
ProductDO product = productMapper.selectById(cartDTO.getProductId());
|
||||
if (product == null || product.getIsDelete() == 1) {
|
||||
if (product == null || Integer.valueOf(1).equals(product.getIsDelete())) {
|
||||
throw new RuntimeException("商品不存在");
|
||||
}
|
||||
|
||||
// 检查购物车中是否已有该商品
|
||||
CartDO existingCart = cartMapper.selectByUserIdAndProductId(userId, cartDTO.getProductId());
|
||||
if (existingCart != null) {
|
||||
// 更新数量
|
||||
existingCart.setQuantity(existingCart.getQuantity() + cartDTO.getQuantity());
|
||||
cartMapper.updateById(existingCart);
|
||||
} else {
|
||||
// 添加新商品到购物车
|
||||
CartDO newCart = new CartDO();
|
||||
newCart.setUserId(userId);
|
||||
newCart.setProductId(cartDTO.getProductId());
|
||||
newCart.setQuantity(cartDTO.getQuantity());
|
||||
newCart.setIsDelete(0);
|
||||
cartMapper.insert(newCart);
|
||||
return;
|
||||
}
|
||||
|
||||
CartDO newCart = new CartDO();
|
||||
newCart.setUserId(userId);
|
||||
newCart.setProductId(cartDTO.getProductId());
|
||||
newCart.setQuantity(cartDTO.getQuantity());
|
||||
newCart.setIsDelete(0);
|
||||
cartMapper.insert(newCart);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,30 +117,42 @@ public class CartServiceImpl implements CartService {
|
||||
List<CartVO> cartVOList = new ArrayList<>();
|
||||
|
||||
for (CartDO cart : cartList) {
|
||||
if (cart.getIsDelete() == 0) {
|
||||
ProductDO product = productMapper.selectById(cart.getProductId());
|
||||
if (product != null && product.getIsDelete() == 0) {
|
||||
CartVO cartVO = new CartVO();
|
||||
cartVO.setId(cart.getId());
|
||||
cartVO.setProductId(product.getId());
|
||||
cartVO.setShopId(product.getShopId());
|
||||
cartVO.setProductTitle(product.getTitle());
|
||||
// 简单处理,取第一张图片
|
||||
String imageFileIds = product.getImageFileIds();
|
||||
if (imageFileIds != null && !imageFileIds.isEmpty()) {
|
||||
String firstImageId = imageFileIds.split(",")[0];
|
||||
cartVO.setProductImage("/api/file/get/" + firstImageId);
|
||||
}
|
||||
cartVO.setPrice(product.getPrice());
|
||||
cartVO.setQuantity(cart.getQuantity());
|
||||
cartVO.setTotalPrice(product.getPrice().multiply(new BigDecimal(cart.getQuantity())));
|
||||
cartVO.setTags(product.getTags());
|
||||
cartVO.setTagNames(resolveTagNames(product.getTags()));
|
||||
cartVO.setApproximateDuration(product.getApproximateDuration());
|
||||
cartVO.setBookableArtists(product.getBookableArtists());
|
||||
cartVOList.add(cartVO);
|
||||
}
|
||||
if (!Integer.valueOf(0).equals(cart.getIsDelete())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ProductDO product = productMapper.selectById(cart.getProductId());
|
||||
if (product == null || Integer.valueOf(1).equals(product.getIsDelete())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CartVO cartVO = new CartVO();
|
||||
cartVO.setId(cart.getId());
|
||||
cartVO.setProductId(product.getId());
|
||||
cartVO.setShopId(product.getShopId());
|
||||
cartVO.setProductTitle(product.getTitle());
|
||||
|
||||
String imageFileIds = product.getImageFileIds();
|
||||
if (StringUtils.hasText(imageFileIds)) {
|
||||
String firstImageId = imageFileIds.split(",")[0];
|
||||
cartVO.setProductImage("/api/file/get/" + firstImageId);
|
||||
}
|
||||
|
||||
cartVO.setPrice(product.getPrice());
|
||||
cartVO.setQuantity(cart.getQuantity());
|
||||
cartVO.setTotalPrice(product.getPrice().multiply(new BigDecimal(cart.getQuantity())));
|
||||
cartVO.setTags(product.getTags());
|
||||
cartVO.setTagNames(resolveTagNames(product.getTags()));
|
||||
cartVO.setApproximateDuration(product.getApproximateDuration());
|
||||
|
||||
String validBookableArtists = bookableArtistSupport.filterValidBookableArtists(product.getShopId(), product.getBookableArtists());
|
||||
List<CartArtistVO> availableArtists = resolveAvailableArtists(product.getShopId(), product.getBookableArtists(), validBookableArtists);
|
||||
cartVO.setBookableArtists(validBookableArtists);
|
||||
cartVO.setAvailableBookableArtistCount(availableArtists.size());
|
||||
cartVO.setBookableArtistRestricted(StringUtils.hasText(product.getBookableArtists()));
|
||||
cartVO.setAvailableArtists(availableArtists);
|
||||
|
||||
cartVOList.add(cartVO);
|
||||
}
|
||||
|
||||
return cartVOList;
|
||||
@@ -142,12 +169,12 @@ public class CartServiceImpl implements CartService {
|
||||
|
||||
private void validateQuantity(Integer quantity) {
|
||||
if (quantity == null || quantity < 1 || quantity > 99) {
|
||||
throw new RuntimeException("购物车数量必须在1到99之间");
|
||||
throw new RuntimeException("购物车数量必须在 1 到 99 之间");
|
||||
}
|
||||
}
|
||||
|
||||
private String resolveTagNames(String tagIds) {
|
||||
if (tagIds == null || tagIds.isBlank()) {
|
||||
if (!StringUtils.hasText(tagIds)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -165,4 +192,54 @@ public class CartServiceImpl implements CartService {
|
||||
.filter(tagName -> tagName != null && !tagName.isBlank())
|
||||
.collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
private List<CartArtistVO> resolveAvailableArtists(Long shopId, String rawBookableArtists, String validBookableArtists) {
|
||||
LinkedHashSet<Long> candidateArtistIds = new LinkedHashSet<>();
|
||||
if (StringUtils.hasText(validBookableArtists)) {
|
||||
for (String artistIdText : validBookableArtists.split(",")) {
|
||||
if (!StringUtils.hasText(artistIdText)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
candidateArtistIds.add(Long.parseLong(artistIdText.trim()));
|
||||
} catch (NumberFormatException ignored) {
|
||||
// Ignore invalid ids and keep valid artists only.
|
||||
}
|
||||
}
|
||||
} else if (!StringUtils.hasText(rawBookableArtists) && shopId != null && shopId > 0) {
|
||||
candidateArtistIds.addAll(userShopBindingSupport.listUserIdsByShopId(shopId, true));
|
||||
}
|
||||
|
||||
if (candidateArtistIds.isEmpty()) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
List<UserDO> artistUsers = userMapper.selectList(
|
||||
new QueryWrapper<UserDO>()
|
||||
.in("id", candidateArtistIds)
|
||||
.eq("type", 3)
|
||||
.eq("status", 1)
|
||||
.eq("is_delete", 0)
|
||||
);
|
||||
if (artistUsers.isEmpty()) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
Map<Long, UserDO> artistMap = artistUsers.stream()
|
||||
.collect(Collectors.toMap(UserDO::getId, artist -> artist, (left, right) -> left));
|
||||
|
||||
return candidateArtistIds.stream()
|
||||
.map(artistMap::get)
|
||||
.filter(Objects::nonNull)
|
||||
.map(this::buildCartArtist)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private CartArtistVO buildCartArtist(UserDO artist) {
|
||||
CartArtistVO cartArtistVO = new CartArtistVO();
|
||||
cartArtistVO.setId(artist.getId());
|
||||
cartArtistVO.setName(artist.getNickname());
|
||||
cartArtistVO.setAvatar(artist.getAvatar());
|
||||
return cartArtistVO;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -65,7 +65,7 @@ public class NailArtistInfoServiceImpl extends ServiceImpl<NailArtistInfoMapper,
|
||||
|
||||
@Override
|
||||
public List<NailArtistInfoDTO> getByShopId(Long shopId) {
|
||||
List<Long> artistUserIds = userShopBindingSupport.listUserIdsByShopId(shopId, false);
|
||||
List<Long> artistUserIds = userShopBindingSupport.listUserIdsByShopId(shopId, true);
|
||||
if (artistUserIds.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public class NailArtistInfoServiceImpl extends ServiceImpl<NailArtistInfoMapper,
|
||||
nailArtistInfoDTO.setNickname(userDO.getNickname());
|
||||
nailArtistInfoDTO.setSignature(userDO.getSignature()); // 添加用户签名
|
||||
|
||||
List<ShopSimpleVO> shopOptions = userShopBindingSupport.listShopOptionsByUserId(userDO.getId(), false, false);
|
||||
List<ShopSimpleVO> shopOptions = userShopBindingSupport.listShopOptionsByUserId(userDO.getId(), true, true);
|
||||
if (!shopOptions.isEmpty()) {
|
||||
ShopSimpleVO primaryShop = shopOptions.get(0);
|
||||
nailArtistInfoDTO.setShopId(primaryShop.getId());
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.xiaowang.yuminailcore.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CartArtistVO {
|
||||
private Long id;
|
||||
private String name;
|
||||
private String avatar;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.xiaowang.yuminailcore.vo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CartVO {
|
||||
@@ -18,4 +19,7 @@ public class CartVO {
|
||||
private String tagNames;
|
||||
private String approximateDuration;
|
||||
private String bookableArtists;
|
||||
private Integer availableBookableArtistCount;
|
||||
private Boolean bookableArtistRestricted;
|
||||
private List<CartArtistVO> availableArtists;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
# 2026-03-27 后台表格与购物车美甲师修复
|
||||
|
||||
## 本轮目标
|
||||
|
||||
- 修复后台管理页超长文本撑坏表格的问题
|
||||
- 修复前端购物车中作品无法选择美甲师的问题
|
||||
- 修复店长编辑美甲师时前端提示不明确、列表范围与实际可编辑范围不一致的问题
|
||||
|
||||
## 变更内容
|
||||
|
||||
### 1. 后台长文本表格折叠
|
||||
|
||||
- 新增前端通用组件 `Frontend/src/components/TableEllipsisText.vue`
|
||||
- 在以下后台页面为长文本字段增加折叠与悬浮查看:
|
||||
- `Frontend/src/views/admin/ProductsView.vue`
|
||||
- `Frontend/src/views/admin/ShopsView.vue`
|
||||
- `Frontend/src/views/admin/PermissionsView.vue`
|
||||
- 同步为相关表格增加横向滚动,避免固定操作列与长文本同时出现时布局异常
|
||||
|
||||
### 2. 购物车美甲师选择逻辑修复
|
||||
|
||||
- 新增后端返回模型:
|
||||
- `YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/vo/CartArtistVO.java`
|
||||
- 扩展购物车返回字段:
|
||||
- `YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/vo/CartVO.java`
|
||||
- 重写购物车服务中美甲师可预约名单的生成逻辑:
|
||||
- `YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service/impl/CartServiceImpl.java`
|
||||
- 现在购物车接口会直接返回每个作品当前真正可预约的美甲师列表,不再依赖前端再去拼装 `/user/list/type/3` 的结果
|
||||
- 前端购物车改为直接使用后端返回的 `availableArtists`,与商品详情页、下单校验的口径保持一致:
|
||||
- `Frontend/src/views/CartView.vue`
|
||||
|
||||
### 3. 店长编辑美甲师作用域与错误提示修复
|
||||
|
||||
- 美甲师按店铺列表查询改为只返回当前店铺“有效绑定”的美甲师,避免店长看得到但保存时被店铺作用域拦截:
|
||||
- `YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service/impl/NailArtistInfoServiceImpl.java`
|
||||
- 美甲师 DTO 中默认店铺信息改为优先取有效绑定中的有效门店,避免展示错位
|
||||
- 后台接口层补充 `403` 错误原因透传,前端可以拿到后端返回的具体中文原因:
|
||||
- `Frontend/src/api/admin.ts`
|
||||
- 美甲师编辑页保存失败时优先展示后端返回的真实原因:
|
||||
- `Frontend/src/views/admin/NailArtistsView.vue`
|
||||
|
||||
## 验证结果
|
||||
|
||||
- 后端编译通过:`mvn -q -DskipTests compile`
|
||||
- 前端构建通过:`npm run build`
|
||||
|
||||
## SQL 变动
|
||||
|
||||
- 本轮无 SQL 变动
|
||||
|
||||
## 风险与说明
|
||||
|
||||
- 购物车中的预约信息仍然是前端本地暂存,刷新页面后不会保留,这是当前既有设计,本轮未改动
|
||||
- 前端构建仍有 Vite 大包体积警告,但不影响本轮功能正确性
|
||||
Reference in New Issue
Block a user