增加修改分组名称,增加分组商品编辑权限验证

This commit is contained in:
YeMingfei666 2024-10-09 17:29:39 +08:00
parent 79255c2c94
commit 01610734c7
3 changed files with 24 additions and 9 deletions

View File

@ -118,7 +118,7 @@
tbProductGroupPost tbProductGroupPost
} from "@/http/yskApi/shop.js" } from "@/http/yskApi/shop.js"
import {hasPermission} from '@/commons/utils/hasPermission.js';
import { import {
returnAllCategory returnAllCategory
@ -260,6 +260,10 @@
} }
async function save() { async function save() {
const res=await hasPermission('允许修改分组')
if(!res){
return
}
console.log(pageData.goodsList); console.log(pageData.goodsList);
await tbProductGroupPut({ await tbProductGroupPut({
...option, ...option,
@ -275,7 +279,11 @@
} }
// //
function goodsDel(index) { async function goodsDel(index) {
const res=await hasPermission('允许修改分组')
if(!res){
return
}
const goods = pageData.bindGoodsList[index] const goods = pageData.bindGoodsList[index]
uni.showModal({ uni.showModal({
title: '提示', title: '提示',

View File

@ -8,11 +8,11 @@
</view> </view>
</view> </view>
<view class="u-m-t-36"> <view class="u-m-t-36">
<view>修改排序</view> <view>修改分组名称</view>
<view class="u-m-t-38"> <view class="u-m-t-38">
<view class="u-m-b-32"> <view class="u-m-b-32">
<view class="u-m-t-16"> <view class="u-m-t-16">
<up-input v-model="sort"> <up-input v-model="name">
</up-input> </up-input>
</view> </view>
</view> </view>
@ -59,7 +59,7 @@
item: { item: {
type: Object, type: Object,
default: () => { default: () => {
sort:'' name:''
} }
} }
}) })
@ -74,10 +74,10 @@
note: '' note: ''
}) })
let popShow = ref(props.show) let popShow = ref(props.show)
let sort=ref('') let name=ref('')
watch(()=>props.item.sort,(newval)=>{ watch(()=>props.item.name,(newval)=>{
sort.value=newval name.value=newval
}) })
watch(() => props.show, (newval) => { watch(() => props.show, (newval) => {
@ -105,7 +105,7 @@
function save() { function save() {
emits('save', { emits('save', {
...data.value, ...data.value,
sort:sort.value name:name.value
}) })
} }
</script> </script>

View File

@ -4,6 +4,7 @@
<view class="u-m-b-32" v-for="(item,index) in pageData.list" :key="index"> <view class="u-m-b-32" v-for="(item,index) in pageData.list" :key="index">
<my-category @del="categoryDel" @useTypeClick="categoryUseTypeClick" <my-category @del="categoryDel" @useTypeClick="categoryUseTypeClick"
@editName="popupShow($event,'name',true)"
@editSort="popupShow($event,'sort',true)" @edit="actionsShow" @radioClick="goodsRadioClick" @editSort="popupShow($event,'sort',true)" @edit="actionsShow" @radioClick="goodsRadioClick"
@isShowChange="isSHowChange" :index="index" :data="item" :showChecked="showChecked" @isShowChange="isSHowChange" :index="index" :data="item" :showChecked="showChecked"
:showDetail="pageData.showGoodsDetail"></my-category> :showDetail="pageData.showGoodsDetail"></my-category>
@ -23,6 +24,7 @@
</view> </view>
<edit-sort @save="updataGroup" :item="popup.selData" v-model:show="popup.sort.show"></edit-sort> <edit-sort @save="updataGroup" :item="popup.selData" v-model:show="popup.sort.show"></edit-sort>
<edit-name @save="updataGroup" :item="popup.selData" v-model:show="popup.name.show"></edit-name>
<up-action-sheet :round="10" @select="actionSelect" @close="actionsHide" cancelText="取消" :actions="actions.list" <up-action-sheet :round="10" @select="actionSelect" @close="actionsHide" cancelText="取消" :actions="actions.list"
:show="actions.show"></up-action-sheet> :show="actions.show"></up-action-sheet>
@ -41,6 +43,7 @@
import myCategory from './components/category.vue' import myCategory from './components/category.vue'
import infoBox from "@/commons/utils/infoBox.js" import infoBox from "@/commons/utils/infoBox.js"
import editSort from './components/edit-sort.vue'; import editSort from './components/edit-sort.vue';
import editName from './components/edit-name.vue';
import { import {
tbProductGroupGet, tbProductGroupGet,
tbProductGroupDelete, tbProductGroupDelete,
@ -100,6 +103,9 @@
}, },
sort: { sort: {
show: false show: false
},
name:{
show: false
} }
}) })
@ -112,6 +118,7 @@
console.log(e); console.log(e);
const res = await $productCategory.update(e) const res = await $productCategory.update(e)
popup.sort.show = false; popup.sort.show = false;
popup.name.show = false;
pageData.list[popup.selIndex] = e pageData.list[popup.selIndex] = e
infoBox.showToast('更新成功') infoBox.showToast('更新成功')
} }