增加商品管理编辑权限验证

This commit is contained in:
2024-10-09 17:33:22 +08:00
parent f700096359
commit fbfcfc4d82
5 changed files with 261 additions and 93 deletions

View File

@@ -42,6 +42,7 @@
<template v-if="pageData.goodsList.length">
<view class="u-m-b-32" v-for="(item,index) in pageData.goodsList" :key="index">
<my-goods :key="item.id" @update="getGoodsList" @changePrice="changePriceShow" @changeClick="goodsChangeClick"
@edit="toGoodsDetail"
@editStock="changeStockShow" @guigeClick="editGuigeShow" @baosun="baosunShow"
@radioClick="goodsRadioClick" :index="index" :data="item" @del="goodsDel"
:showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods>
@@ -149,6 +150,7 @@
watch
} from 'vue';
import go from '@/commons/utils/go.js';
import {hasPermission} from '@/commons/utils/hasPermission.js';
import myGoods from './components/goods.vue'
import myControl from './components/control.vue'
import myCategory from './components/category.vue'
@@ -285,7 +287,11 @@
// 修改库存弹窗展示
function changeStockShow(index) {
async function changeStockShow(index) {
const res= await hasPermission('允许修改商品库存')
if(!res){
return
}
pageData.selGoodsIndex = index
const goods = pageData.goodsList[index]
goods.skuList = goods.skuList.map(v => {
@@ -387,8 +393,15 @@
pageData.totalElements = res.totalElements
})
}
function watchEmitInit(){
uni.$off('update:productIndex')
uni.$on('update:productIndex',(data)=>{
getGoodsList()
})
}
onShow(() => {
// getGoodsList()
watchEmitInit()
})
onLoad(() => {
getGoodsList()
@@ -484,7 +497,18 @@
pageData.totalElements=0;
pageData.query.page=0;
}
async function toGoodsDetail(id){
const res= await hasPermission('允许修改商品')
if(!res){
return
}
go.to('PAGES_PRODUCT_ADD', {
type: 'edit',
productId: id
})
}
function statesTableClick(index) {
pageData.stateCurrent = index;
resetQuery()