修复:修复后台表格折叠与购物车美甲师选择
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user