替换商品为作品
This commit is contained in:
@@ -6,17 +6,17 @@ interface CartItem {
|
||||
}
|
||||
|
||||
export const cartApi = {
|
||||
// 添加商品到购物车
|
||||
// 添加作品到购物车
|
||||
addToCart: (item: CartItem) => {
|
||||
return api.post('/cart/add', item)
|
||||
},
|
||||
|
||||
// 从购物车移除商品
|
||||
// 从购物车移除作品
|
||||
removeFromCart: (productId: number) => {
|
||||
return api.delete(`/cart/remove/${productId}`)
|
||||
},
|
||||
|
||||
// 更新购物车商品数量
|
||||
// 更新购物车作品数量
|
||||
updateCartQuantity: (item: CartItem) => {
|
||||
return api.put('/cart/update', item)
|
||||
},
|
||||
|
||||
@@ -134,7 +134,7 @@ export const couponApi = {
|
||||
})
|
||||
},
|
||||
|
||||
// 获取商品可用的优惠券
|
||||
// 获取作品可用的优惠券
|
||||
getAvailableCoupons: (productTags: string, productPrice: number) => {
|
||||
return request({
|
||||
url: '/coupon/available',
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
<span class="nav-label">首页</span>
|
||||
</div>
|
||||
|
||||
<!-- 商品导航项 -->
|
||||
<!-- 作品导航项 -->
|
||||
<div class="nav-item" :class="{ active: currentRoute === 'products' }" @click="handleNavClick('products')">
|
||||
<a-badge :count="0" :offset="[0, 0]">
|
||||
<div class="nav-icon">
|
||||
<ShoppingOutlined :style="{ fontSize: '24px' }" />
|
||||
</div>
|
||||
</a-badge>
|
||||
<span class="nav-label">商品</span>
|
||||
<span class="nav-label">作品</span>
|
||||
</div>
|
||||
|
||||
<!-- 购物车导航项 -->
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
</a-button>
|
||||
</header>
|
||||
|
||||
<!-- 购物车商品列表 -->
|
||||
<!-- 购物车作品列表 -->
|
||||
<div class="cart-items">
|
||||
<a-empty v-if="cartItems.length === 0" description="购物车是空的">
|
||||
<a-button type="primary" @click="handleBrowseProducts">去逛逛</a-button>
|
||||
@@ -29,7 +29,7 @@
|
||||
<!-- 复选框 -->
|
||||
<a-checkbox v-model:checked="item.selected" @change="handleSelectChange" />
|
||||
|
||||
<!-- 商品图片 -->
|
||||
<!-- 作品图片 -->
|
||||
<div class="item-image" v-if="item.productImage" @click="handleProductClick(item)" style="cursor: pointer;">
|
||||
<img :src="item.productImage" :alt="item.productTitle" />
|
||||
</div>
|
||||
@@ -37,7 +37,7 @@
|
||||
<span>{{ item.productTitle[0] }}</span>
|
||||
</div>
|
||||
|
||||
<!-- 商品详情 -->
|
||||
<!-- 作品详情 -->
|
||||
<div class="item-details">
|
||||
<h3 class="item-name" @click="handleProductClick(item)" style="cursor: pointer;">{{ item.productTitle }}</h3>
|
||||
<p class="item-price">¥{{ item.price.toFixed(2) }}</p>
|
||||
@@ -62,7 +62,7 @@
|
||||
</a-button>
|
||||
</div>
|
||||
<a-popconfirm
|
||||
title="确定要删除这个商品吗?"
|
||||
title="确定要删除这个作品吗?"
|
||||
ok-text="确定"
|
||||
cancel-text="取消"
|
||||
@confirm="handleDeleteItem(item)"
|
||||
@@ -97,7 +97,7 @@
|
||||
<!-- 订单摘要 -->
|
||||
<div class="summary" v-if="cartItems.length > 0">
|
||||
<div class="summary-row">
|
||||
<span>商品数量</span>
|
||||
<span>作品数量</span>
|
||||
<span>{{ totalQuantity }} 件</span>
|
||||
</div>
|
||||
<div class="summary-row">
|
||||
@@ -288,7 +288,7 @@ interface CartItem {
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
// 购物车商品数据
|
||||
// 购物车作品数据
|
||||
const cartItems = ref<CartItem[]>([])
|
||||
|
||||
// 图片缓存
|
||||
@@ -318,7 +318,7 @@ const loadCartItems = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 加载商品图片
|
||||
// 加载作品图片
|
||||
const loadProductImages = async (items: CartItem[]) => {
|
||||
for (const item of items) {
|
||||
if (item.originalProductImage) {
|
||||
@@ -383,12 +383,12 @@ const loadAvailableCoupons = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 计算选中的商品数量
|
||||
// 计算选中的作品数量
|
||||
const selectedCount = computed(() => {
|
||||
return cartItems.value.filter(item => item.selected).length
|
||||
})
|
||||
|
||||
// 计算商品总数量
|
||||
// 计算作品总数量
|
||||
const totalQuantity = computed(() => {
|
||||
return cartItems.value.reduce((sum, item) => sum + item.quantity, 0)
|
||||
})
|
||||
@@ -478,21 +478,21 @@ const handleIncreaseQuantity = async (item: CartItem) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 处理删除商品
|
||||
// 处理删除作品
|
||||
const handleDeleteItem = async (item: CartItem) => {
|
||||
try {
|
||||
await cartApi.removeFromCart(item.productId)
|
||||
const index = cartItems.value.findIndex(i => i.id === item.id)
|
||||
if (index > -1) {
|
||||
cartItems.value.splice(index, 1)
|
||||
message.success('商品已删除')
|
||||
message.success('作品已删除')
|
||||
// 重新加载可用优惠券
|
||||
await loadAvailableCoupons()
|
||||
// 更新购物车数量
|
||||
await updateCartCount()
|
||||
}
|
||||
} catch (error) {
|
||||
message.error('删除商品失败')
|
||||
message.error('删除作品失败')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,7 +500,7 @@ const handleProductClick = (item: CartItem) => {
|
||||
router.push(`/product/${item.productId}`)
|
||||
}
|
||||
|
||||
// 处理浏览商品
|
||||
// 处理浏览作品
|
||||
const handleBrowseProducts = () => {
|
||||
router.push('/products')
|
||||
}
|
||||
@@ -589,7 +589,7 @@ const loadAvailableArtists = async () => {
|
||||
const handleCheckout = async () => {
|
||||
const selectedItems = cartItems.value.filter(item => item.selected)
|
||||
if (selectedItems.length === 0) {
|
||||
message.warning('请先选择要结算的商品')
|
||||
message.warning('请先选择要结算的作品')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -682,7 +682,7 @@ const toggleArtistSelection = (artist: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 监听选中商品变化,重新加载可用优惠券
|
||||
// 监听选中作品变化,重新加载可用优惠券
|
||||
watch(
|
||||
() => cartItems.value.map(item => ({ id: item.id, selected: item.selected, quantity: item.quantity })),
|
||||
async () => {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<div class="search-section">
|
||||
<a-input
|
||||
v-model:value="searchQuery"
|
||||
placeholder="搜索商品..."
|
||||
placeholder="搜索作品..."
|
||||
size="large"
|
||||
@input="handleSearch"
|
||||
>
|
||||
@@ -61,10 +61,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 精选商品区域 -->
|
||||
<!-- 精选作品区域 -->
|
||||
<section class="section">
|
||||
<div class="section-header">
|
||||
<h3>精选商品</h3>
|
||||
<h3>精选作品</h3>
|
||||
<a class="see-all" @click="handleSeeAll('featured')">查看全部 <RightOutlined /></a>
|
||||
</div>
|
||||
<div class="horizontal-scroll">
|
||||
@@ -87,10 +87,10 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 热门商品区域 -->
|
||||
<!-- 热门作品区域 -->
|
||||
<section class="section popular-section">
|
||||
<div class="section-header">
|
||||
<h3>热门商品</h3>
|
||||
<h3>热门作品</h3>
|
||||
<a class="see-all" @click="handleSeeAll('popular')">查看全部 <RightOutlined /></a>
|
||||
</div>
|
||||
<div class="product-grid">
|
||||
@@ -116,13 +116,13 @@
|
||||
<a-spin size="small" />
|
||||
<span style="margin-left: 8px;">加载中...</span>
|
||||
</div>
|
||||
<!-- 暂无更多商品 -->
|
||||
<!-- 暂无更多作品 -->
|
||||
<div v-else-if="!hasMore && popularItems.length > 0" class="no-more">
|
||||
暂无更多商品推荐
|
||||
暂无更多作品推荐
|
||||
</div>
|
||||
<!-- 无商品时的提示 -->
|
||||
<!-- 无作品时的提示 -->
|
||||
<div v-else-if="popularItems.length === 0 && !loading" class="no-products">
|
||||
暂无热门商品
|
||||
暂无热门作品
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
@@ -162,10 +162,10 @@ const searchQuery = ref('')
|
||||
// Banner图片数据
|
||||
const bannerImages = ref<string[]>([])
|
||||
|
||||
// 精选商品数据
|
||||
// 精选作品数据
|
||||
const featuredItems = ref<any[]>([])
|
||||
|
||||
// 热门商品数据
|
||||
// 热门作品数据
|
||||
const popularItems = ref<any[]>([])
|
||||
const loading = ref(false)
|
||||
const hasMore = ref(true)
|
||||
@@ -224,7 +224,7 @@ const loadBannerImages = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 加载精选商品
|
||||
// 加载精选作品
|
||||
const loadFeaturedProducts = async () => {
|
||||
try {
|
||||
const response = await productApi.getProductsByTag('精选') as any
|
||||
@@ -238,11 +238,11 @@ const loadFeaturedProducts = async () => {
|
||||
bgColor: getRandomColor()
|
||||
}))
|
||||
} catch (error) {
|
||||
console.error('获取精选商品失败:', error)
|
||||
console.error('获取精选作品失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 加载热门商品
|
||||
// 加载热门作品
|
||||
const loadPopularProducts = async (loadMore = false) => {
|
||||
if (loading.value || !hasMore.value) return
|
||||
|
||||
@@ -280,7 +280,7 @@ const loadPopularProducts = async (loadMore = false) => {
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取热门商品失败:', error)
|
||||
console.error('获取热门作品失败:', error)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
@@ -344,7 +344,7 @@ const handleSeeAll = (type: string) => {
|
||||
router.push('/products')
|
||||
}
|
||||
|
||||
// 处理商品卡片点击
|
||||
// 处理作品卡片点击
|
||||
const handleProductClick = (item: any) => {
|
||||
router.push(`/product/${item.id}`)
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ const loadOrders = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 加载商品图片
|
||||
// 加载作品图片
|
||||
const loadProductImages = async (orders: any[]) => {
|
||||
for (const order of orders) {
|
||||
if (order.items && order.items.length > 0) {
|
||||
@@ -136,7 +136,7 @@ const handleBackClick = () => {
|
||||
router.back()
|
||||
}
|
||||
|
||||
// 处理浏览商品
|
||||
// 处理浏览作品
|
||||
const handleBrowseProducts = () => {
|
||||
router.push('/products')
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<div class="back-btn" @click="handleBackClick">
|
||||
<el-icon><ArrowLeft /></el-icon>
|
||||
</div>
|
||||
<h1>{{ product.name || '商品详情' }}</h1>
|
||||
<h1>{{ product.name || '作品详情' }}</h1>
|
||||
<div class="actions">
|
||||
<el-icon @click="handleFavoriteClick" :style="{ fontSize: '20px' }" :class="{ active: isFavorite }"><Star /></el-icon>
|
||||
</div>
|
||||
@@ -152,7 +152,7 @@ const productImages = ref<string[]>([])
|
||||
const imageIdCache = ref<Record<string, string>>({})
|
||||
const DEFAULT_PRODUCT_IMAGE = 'data:image/svg+xml;base64,PHN2ZyB3aW0dPSJodHRwOi8vd3d3Lm9yZy8yMDAwL3N2ZyI+Pjwvc3ZnPg=='
|
||||
|
||||
// 从后端获取商品详情
|
||||
// 从后端获取作品详情
|
||||
const fetchProductDetail = async () => {
|
||||
const productId = route.params.id
|
||||
|
||||
@@ -168,7 +168,7 @@ const fetchProductDetail = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 检查商品是否在收藏列表中
|
||||
// 检查作品是否在收藏列表中
|
||||
const checkWishlistStatus = async () => {
|
||||
if (product.value.id) {
|
||||
const token = localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken')
|
||||
@@ -187,7 +187,7 @@ const checkWishlistStatus = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 检查用户是否已点赞商品
|
||||
// 检查用户是否已点赞作品
|
||||
const checkLikeStatus = async () => {
|
||||
if (product.value.id) {
|
||||
const token = localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken')
|
||||
@@ -206,7 +206,7 @@ const checkLikeStatus = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 加载商品图片
|
||||
// 加载作品图片
|
||||
const loadProductImages = async () => {
|
||||
if (product.value.imageFileIds) {
|
||||
const ids = product.value.imageFileIds.split(',')
|
||||
@@ -309,7 +309,7 @@ const handleAddToCart = async () => {
|
||||
try {
|
||||
await cartApi.addToCart({ productId: product.value.id, quantity: 1 })
|
||||
await updateCartCount()
|
||||
ElMessage.success(`已将 ${product.value.title || product.value.name || '商品'} 添加到购物车`)
|
||||
ElMessage.success(`已将 ${product.value.title || product.value.name || '作品'} 添加到购物车`)
|
||||
} catch (error) {
|
||||
console.error('添加到购物车失败:', error)
|
||||
ElMessage.error('添加到购物车失败,请重试')
|
||||
@@ -327,7 +327,7 @@ const handleBuyNow = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 页面挂载时获取商品详情
|
||||
// 页面挂载时获取作品详情
|
||||
onMounted(() => {
|
||||
fetchProductDetail()
|
||||
})
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
<a-button class="back-btn" type="text" @click="handleBackClick">
|
||||
<LeftOutlined :style="{ fontSize: '20px' }" />
|
||||
</a-button>
|
||||
<h1 v-if="!showSearch">商品列表</h1>
|
||||
<h1 v-if="!showSearch">作品列表</h1>
|
||||
<div v-else class="search-input-container">
|
||||
<a-input-search
|
||||
v-model:value="searchKeyword"
|
||||
placeholder="搜索商品"
|
||||
placeholder="搜索作品"
|
||||
class="search-input"
|
||||
@search="handleSearch"
|
||||
enter-button
|
||||
@@ -36,9 +36,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 右侧商品区域 -->
|
||||
<!-- 右侧作品区域 -->
|
||||
<div class="product-section">
|
||||
<!-- 商品网格 -->
|
||||
<!-- 作品网格 -->
|
||||
<div class="product-grid">
|
||||
<a-card
|
||||
v-for="item in products"
|
||||
@@ -48,7 +48,7 @@
|
||||
hoverable
|
||||
@click="handleProductClick(item)"
|
||||
>
|
||||
<!-- 商品图片 -->
|
||||
<!-- 作品图片 -->
|
||||
<div class="product-img">
|
||||
<img
|
||||
v-if="getProductImages(item) && getProductImages(item).length > 0"
|
||||
@@ -66,7 +66,7 @@
|
||||
class="product-tag"
|
||||
/>
|
||||
</div>
|
||||
<!-- 商品信息 -->
|
||||
<!-- 作品信息 -->
|
||||
<div class="product-info">
|
||||
<p class="name">{{ item.title || item.name }}</p>
|
||||
<div class="product-meta">
|
||||
@@ -139,7 +139,7 @@
|
||||
|
||||
<!-- 空状态 -->
|
||||
<div v-if="products.length === 0 && !loading" class="empty-state">
|
||||
<a-typography-text type="secondary">商家暂未上架更多商品</a-typography-text>
|
||||
<a-typography-text type="secondary">商家暂未上架更多作品</a-typography-text>
|
||||
</div>
|
||||
|
||||
<!-- 加载更多 -->
|
||||
@@ -147,7 +147,7 @@
|
||||
<a-button v-if="hasMore" type="link" @click="handleLoadMore">
|
||||
加载更多 <DownOutlined />
|
||||
</a-button>
|
||||
<a-typography-text v-else type="secondary">没有更多商品了</a-typography-text>
|
||||
<a-typography-text v-else type="secondary">没有更多作品了</a-typography-text>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -195,7 +195,7 @@ const selectedCategory = ref('全部')
|
||||
// 分类列表(动态从标签获取)
|
||||
const categories = ref<string[]>(['全部'])
|
||||
|
||||
// 商品数据
|
||||
// 作品数据
|
||||
const products = ref<ProductVO[]>([])
|
||||
|
||||
// 是否还有更多数据
|
||||
@@ -225,7 +225,7 @@ const fetchTags = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 加载商品列表
|
||||
// 加载作品列表
|
||||
const loadImageUrls = async (productList: ProductVO[]) => {
|
||||
for (const product of productList) {
|
||||
if (product.imageFileIds) {
|
||||
@@ -258,7 +258,7 @@ const getProductImages = (product: ProductVO): string[] => {
|
||||
return imageUrls.value[product.id] || [DEFAULT_PRODUCT_IMAGE]
|
||||
}
|
||||
|
||||
// 从后端获取商品数据
|
||||
// 从后端获取作品数据
|
||||
const fetchProducts = async () => {
|
||||
if (loading.value) return
|
||||
|
||||
@@ -300,7 +300,7 @@ const handleCategoryClick = (category: string) => {
|
||||
fetchProducts()
|
||||
}
|
||||
|
||||
// 处理商品卡片点击
|
||||
// 处理作品卡片点击
|
||||
const handleProductClick = (item: any) => {
|
||||
router.push(`/product/${item.id}`)
|
||||
}
|
||||
@@ -309,7 +309,7 @@ const handleProductClick = (item: any) => {
|
||||
const handleAddToCart = async (item: any) => {
|
||||
try {
|
||||
await cartApi.addToCart({ productId: item.id, quantity: 1 })
|
||||
message.success(`已将 ${item.title || item.name || '商品'} 添加到购物车`)
|
||||
message.success(`已将 ${item.title || item.name || '作品'} 添加到购物车`)
|
||||
} catch (error) {
|
||||
message.error('添加到购物车失败,请重试')
|
||||
}
|
||||
@@ -327,7 +327,7 @@ const toggleSearch = () => {
|
||||
if (!showSearch.value) {
|
||||
searchKeyword.value = ''
|
||||
isSearching.value = false
|
||||
fetchProducts() // 重置为默认商品列表
|
||||
fetchProducts() // 重置为默认作品列表
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ const handleSearch = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 页面挂载时获取标签和商品数据
|
||||
// 页面挂载时获取标签和作品数据
|
||||
onMounted(async () => {
|
||||
await fetchTags()
|
||||
fetchProducts()
|
||||
@@ -445,7 +445,7 @@ onMounted(async () => {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* 右侧商品区域 */
|
||||
/* 右侧作品区域 */
|
||||
.product-section {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<el-icon :size="60"><Star /></el-icon>
|
||||
<p>收藏列表为空</p>
|
||||
<el-button type="primary" @click="handleBrowseProducts">
|
||||
浏览商品
|
||||
浏览作品
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -130,7 +130,7 @@ const menuItems = [
|
||||
{
|
||||
key: '/admin/products',
|
||||
icon: ShopOutlined,
|
||||
label: '商品管理',
|
||||
label: '作品管理',
|
||||
permissionCode: 'product:view'
|
||||
},
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<a-col :span="6">
|
||||
<a-card>
|
||||
<a-statistic
|
||||
title="商品总数"
|
||||
title="作品总数"
|
||||
:value="stats.totalProducts"
|
||||
:value-style="{ color: '#1890ff' }"
|
||||
:loading="loading"
|
||||
@@ -71,7 +71,7 @@
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-card title="热门商品" :bordered="false" class="chart-card">
|
||||
<a-card title="热门作品" :bordered="false" class="chart-card">
|
||||
<a-spin :spinning="loading">
|
||||
<a-list :data-source="stats.hotProducts" size="small">
|
||||
<template #renderItem="{ item }">
|
||||
|
||||
@@ -119,7 +119,7 @@ const quickActions = computed(() => {
|
||||
},
|
||||
{
|
||||
key: 'products',
|
||||
title: '商品管理',
|
||||
title: '作品管理',
|
||||
path: '/admin/products',
|
||||
icon: ShopOutlined,
|
||||
permissionCode: 'product:view'
|
||||
|
||||
@@ -102,11 +102,11 @@
|
||||
<a-select-option :value="0">休息中</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="作品集" name="portfolio">
|
||||
<a-form-item label="作品" name="portfolio">
|
||||
<a-select
|
||||
v-model:value="formState.portfolio"
|
||||
mode="multiple"
|
||||
placeholder="请选择作品集商品"
|
||||
placeholder="请选择作品作品"
|
||||
:loading="productLoading"
|
||||
>
|
||||
<a-select-option
|
||||
@@ -157,7 +157,7 @@
|
||||
<a-form-item label="评分">
|
||||
<a-input v-model:value="viewFormState.rating" :disabled="true" />
|
||||
</a-form-item>
|
||||
<a-form-item label="作品集">
|
||||
<a-form-item label="作品">
|
||||
<a-input v-model:value="viewFormState.portfolioText" :disabled="true" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
@@ -243,7 +243,7 @@ const formRules = {
|
||||
experience: [{ required: true, message: '请输入从业年限', trigger: 'blur' }],
|
||||
skills: [{ required: true, message: '请选择技能标签', trigger: 'change' }],
|
||||
status: [{ required: true, message: '请选择状态', trigger: 'change' }],
|
||||
portfolio: [{ required: true, message: '请选择作品集商品', trigger: 'change' }]
|
||||
portfolio: [{ required: true, message: '请选择作品作品', trigger: 'change' }]
|
||||
}
|
||||
|
||||
const columns = [
|
||||
@@ -289,7 +289,7 @@ const fetchProductList = async () => {
|
||||
const res = await adminProductApi.listProducts(params)
|
||||
productList.value = res.list || []
|
||||
} catch (error) {
|
||||
console.error('获取商品列表失败:', error)
|
||||
console.error('获取作品列表失败:', error)
|
||||
} finally {
|
||||
productLoading.value = false
|
||||
}
|
||||
@@ -351,7 +351,7 @@ const showViewModal = (record: NailArtistInfoVO) => {
|
||||
return tag ? tag.tagName : skillId
|
||||
}).join(', ')
|
||||
|
||||
// 构建作品集文本
|
||||
// 构建作品文本
|
||||
const portfolioArray = record.portfolio ? record.portfolio.split(',').filter(Boolean) : []
|
||||
const portfolioText = portfolioArray.map(productId => {
|
||||
const product = productList.value.find(p => p.id.toString() === productId)
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<a-descriptions-item label="创建时间" :span="2">{{ currentOrder.createTime }}</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
|
||||
<a-divider>订单商品</a-divider>
|
||||
<a-divider>订单作品</a-divider>
|
||||
<a-table :columns="orderItemColumns" :data-source="currentOrder.items" row-key="id">
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'price'">
|
||||
@@ -112,8 +112,8 @@ const pagination = reactive({
|
||||
})
|
||||
|
||||
const orderItemColumns = [
|
||||
{ title: '商品ID', dataIndex: 'productId', key: 'productId' },
|
||||
{ title: '商品名称', dataIndex: 'productTitle', key: 'productTitle' },
|
||||
{ title: '作品ID', dataIndex: 'productId', key: 'productId' },
|
||||
{ title: '作品名称', dataIndex: 'productTitle', key: 'productTitle' },
|
||||
{ title: '单价', key: 'price', width: 100 },
|
||||
{ title: '数量', dataIndex: 'quantity', key: 'quantity', width: 100 },
|
||||
{ title: '总价', key: 'totalPrice', width: 100 }
|
||||
|
||||
@@ -150,11 +150,11 @@
|
||||
<a-input v-model:value="permissionFormState.permissionCode" placeholder="例如:product:add" />
|
||||
</a-form-item>
|
||||
<a-form-item label="权限名称" name="permissionName">
|
||||
<a-input v-model:value="permissionFormState.permissionName" placeholder="例如:添加商品" />
|
||||
<a-input v-model:value="permissionFormState.permissionName" placeholder="例如:添加作品" />
|
||||
</a-form-item>
|
||||
<a-form-item label="权限分组" name="permissionGroup">
|
||||
<a-select v-model:value="permissionFormState.permissionGroup" placeholder="请选择权限分组">
|
||||
<a-select-option value="商品管理">商品管理</a-select-option>
|
||||
<a-select-option value="作品管理">作品管理</a-select-option>
|
||||
<a-select-option value="店铺管理">店铺管理</a-select-option>
|
||||
<a-select-option value="用户管理">用户管理</a-select-option>
|
||||
<a-select-option value="权限管理">权限管理</a-select-option>
|
||||
@@ -231,7 +231,7 @@ const userList = ref<UserVO[]>([])
|
||||
const selectedUser = ref<UserVO | null>(null)
|
||||
const assignLoading = ref(false)
|
||||
const selectedPermissions = ref<number[]>([])
|
||||
const activeCollapseKeys = ref<string[]>(['商品管理', '店铺管理', '用户管理', '权限管理'])
|
||||
const activeCollapseKeys = ref<string[]>(['作品管理', '店铺管理', '用户管理', '权限管理'])
|
||||
const currentLoginUser = ref<UserVO | null>(null)
|
||||
|
||||
const groupedPermissions = computed(() => {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<div class="products">
|
||||
<a-page-header title="商品管理" sub-title="管理美甲商品" />
|
||||
<a-page-header title="作品管理" sub-title="管理美甲作品" />
|
||||
|
||||
<a-card :bordered="false">
|
||||
<template #extra>
|
||||
<a-space>
|
||||
<a-input-search
|
||||
v-model:value="searchText"
|
||||
placeholder="搜索商品名称"
|
||||
placeholder="搜索作品名称"
|
||||
style="width: 250px"
|
||||
@search="handleSearch"
|
||||
/>
|
||||
@@ -15,7 +15,7 @@
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
新增商品
|
||||
新增作品
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
@@ -69,7 +69,7 @@
|
||||
</a-button>
|
||||
<a-popconfirm
|
||||
v-if="hasPermission('product:delete')"
|
||||
title="确定要删除这个商品吗?"
|
||||
title="确定要删除这个作品吗?"
|
||||
@confirm="handleDelete(record)"
|
||||
>
|
||||
<a-button type="link" size="small" danger>
|
||||
@@ -84,7 +84,7 @@
|
||||
|
||||
<a-modal
|
||||
v-model:open="modalVisible"
|
||||
:title="isEdit ? '编辑商品' : '新增商品'"
|
||||
:title="isEdit ? '编辑作品' : '新增作品'"
|
||||
width="700px"
|
||||
@ok="handleModalOk"
|
||||
@cancel="handleModalCancel"
|
||||
@@ -97,13 +97,13 @@
|
||||
:label-col="{ span: 5 }"
|
||||
:wrapper-col="{ span: 18 }"
|
||||
>
|
||||
<a-form-item label="商品名称" name="title">
|
||||
<a-input v-model:value="formState.title" placeholder="请输入商品名称" />
|
||||
<a-form-item label="作品名称" name="title">
|
||||
<a-input v-model:value="formState.title" placeholder="请输入作品名称" />
|
||||
</a-form-item>
|
||||
<a-form-item label="商品描述" name="description">
|
||||
<a-form-item label="作品描述" name="description">
|
||||
<a-textarea
|
||||
v-model:value="formState.description"
|
||||
placeholder="请输入商品描述"
|
||||
placeholder="请输入作品描述"
|
||||
:rows="3"
|
||||
/>
|
||||
</a-form-item>
|
||||
@@ -132,7 +132,7 @@
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<template v-if="formState.shopId">
|
||||
<a-form-item label="商品图片">
|
||||
<a-form-item label="作品图片">
|
||||
<a-upload
|
||||
v-model:file-list="imageFileList"
|
||||
list-type="picture-card"
|
||||
@@ -245,10 +245,10 @@
|
||||
</a-form>
|
||||
</a-modal>
|
||||
|
||||
<!-- 查看商品详情模态框 -->
|
||||
<!-- 查看作品详情模态框 -->
|
||||
<a-modal
|
||||
v-model:open="viewModalVisible"
|
||||
title="查看商品详情"
|
||||
title="查看作品详情"
|
||||
width="700px"
|
||||
@cancel="handleViewModalCancel"
|
||||
>
|
||||
@@ -257,10 +257,10 @@
|
||||
:label-col="{ span: 5 }"
|
||||
:wrapper-col="{ span: 18 }"
|
||||
>
|
||||
<a-form-item label="商品名称">
|
||||
<a-form-item label="作品名称">
|
||||
<a-input v-model:value="viewFormState.title" :disabled="true" />
|
||||
</a-form-item>
|
||||
<a-form-item label="商品描述">
|
||||
<a-form-item label="作品描述">
|
||||
<a-textarea
|
||||
v-model:value="viewFormState.description"
|
||||
:rows="3"
|
||||
@@ -278,7 +278,7 @@
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="商品图片">
|
||||
<a-form-item label="作品图片">
|
||||
<div class="product-images">
|
||||
<a-image
|
||||
v-for="(url, index) in viewImageUrls"
|
||||
@@ -428,8 +428,8 @@ const formState = reactive({
|
||||
})
|
||||
|
||||
const formRules: any = {
|
||||
title: [{ required: true, message: '请输入商品名称', trigger: 'blur' }],
|
||||
description: [{ required: true, message: '请输入商品描述', trigger: 'blur' }],
|
||||
title: [{ required: true, message: '请输入作品名称', trigger: 'blur' }],
|
||||
description: [{ required: true, message: '请输入作品描述', trigger: 'blur' }],
|
||||
price: [{ required: true, message: '请输入价格', trigger: 'blur' }],
|
||||
shopId: [{ required: true, message: '请选择店铺', trigger: 'change' }],
|
||||
tags: [{ required: true, message: '请选择标签', trigger: 'change' }],
|
||||
@@ -438,7 +438,7 @@ const formRules: any = {
|
||||
|
||||
const columns = [
|
||||
{ title: '图片', key: 'image', width: 150 },
|
||||
{ title: '商品名称', dataIndex: 'title', key: 'title' },
|
||||
{ title: '作品名称', dataIndex: 'title', key: 'title' },
|
||||
{ title: '所属店铺', key: 'shop', width: 150 },
|
||||
{ title: '描述', dataIndex: 'description', key: 'description' },
|
||||
{ title: '价格', key: 'price', width: 100 },
|
||||
@@ -571,7 +571,7 @@ const fetchProductList = async () => {
|
||||
|
||||
await loadImageUrls(response?.list || [])
|
||||
} catch (error) {
|
||||
message.error('获取商品列表失败')
|
||||
message.error('获取作品列表失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user