Skip to content

Commit 36b5db1

Browse files
committed
【功能优化】MALL:商品分类界面,增加【查看商品】按钮
1 parent 8bbe9ad commit 36b5db1

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

src/views/ai/chat/index/index.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<el-button size="small" class="btn">
2828
<Icon icon="ep:download" color="#787878" />
2929
</el-button>
30-
<el-button size="small" class="btn" @click="handleGoTopMessage" >
30+
<el-button size="small" class="btn" @click="handleGoTopMessage">
3131
<Icon icon="ep:top" color="#787878" />
3232
</el-button>
3333
</div>
@@ -119,7 +119,6 @@ import MessageList from './components/message/MessageList.vue'
119119
import MessageListEmpty from './components/message/MessageListEmpty.vue'
120120
import MessageLoading from './components/message/MessageLoading.vue'
121121
import MessageNewConversation from './components/message/MessageNewConversation.vue'
122-
import { Download, Top } from '@element-plus/icons-vue'
123122
124123
/** AI 聊天对话 列表 */
125124
defineOptions({ name: 'AiChat' })

src/views/mall/product/category/index.vue

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
width="180"
5757
:formatter="dateFormatter"
5858
/>
59-
<el-table-column label="操作" align="center">
59+
<el-table-column label="操作" align="center" min-width="180">
6060
<template #default="scope">
6161
<el-button
6262
link
@@ -66,6 +66,15 @@
6666
>
6767
编辑
6868
</el-button>
69+
<el-button
70+
link
71+
type="primary"
72+
v-if="scope.row.parentId > 0"
73+
@click="handleViewSpu(scope.row.id)"
74+
v-hasPermi="['product:spu:query']"
75+
>
76+
查看商品
77+
</el-button>
6978
<el-button
7079
link
7180
type="danger"
@@ -142,6 +151,15 @@ const handleDelete = async (id: number) => {
142151
} catch {}
143152
}
144153
154+
/** 查看商品操作 */
155+
const router = useRouter() // 路由
156+
const handleViewSpu = (id: number) => {
157+
router.push({
158+
name: 'ProductSpu',
159+
query: { categoryId: id }
160+
})
161+
}
162+
145163
/** 初始化 **/
146164
onMounted(() => {
147165
getList()

src/views/mall/product/spu/index.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ import * as ProductCategoryApi from '@/api/mall/product/category'
244244
defineOptions({ name: 'ProductSpu' })
245245
246246
const message = useMessage() // 消息弹窗
247+
const route = useRoute() // 路由
247248
const { t } = useI18n() // 国际化
248249
const { push } = useRouter() // 路由跳转
249250
@@ -431,6 +432,11 @@ onActivated(() => {
431432
432433
/** 初始化 **/
433434
onMounted(async () => {
435+
// 解析路由的 categoryId
436+
if (route.query.categoryId) {
437+
queryParams.value.categoryId = Number(route.query.categoryId)
438+
}
439+
// 获得商品信息
434440
await getTabsCount()
435441
await getList()
436442
// 获得分类树

0 commit comments

Comments
 (0)