feat: 商品列表查看详情跳转到商品管理进行编辑
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Agent
2026-04-02 12:56:32 +00:00
parent 7a9c31ca27
commit 1ea0fc04bf
2 changed files with 12 additions and 2 deletions

View File

@@ -159,8 +159,9 @@ export default {
this.loadProducts() this.loadProducts()
}, },
viewDetail(item) { viewDetail(item) {
// 跳转到商品管理页面进行编辑
uni.navigateTo({ uni.navigateTo({
url: `/pages/product/detail?productId=${item.productId}` url: `/pages/product/manage?productId=${item.productId}`
}) })
}, },
getStock(productId) { getStock(productId) {

View File

@@ -164,7 +164,7 @@ export default {
} }
} }
}, },
onLoad() { onLoad(options) {
if (!canManageProduct()) { if (!canManageProduct()) {
uni.showToast({ title: '无权限', icon: 'none' }) uni.showToast({ title: '无权限', icon: 'none' })
uni.navigateBack() uni.navigateBack()
@@ -172,6 +172,15 @@ export default {
} }
this.loadCategories() this.loadCategories()
this.loadProducts() this.loadProducts()
// 如果传入了 productId则打开编辑弹窗
if (options.productId) {
this.$nextTick(() => {
const item = this.productList.find(p => p.productId === options.productId)
if (item) {
this.editProduct(item)
}
})
}
}, },
computed: { computed: {
computedArea() { computedArea() {