修复:修复后台表格折叠与购物车美甲师选择
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'
|
||||
|
||||
Reference in New Issue
Block a user