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

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

@@ -87,11 +87,11 @@
<view class="u-flex">
<view class="u-flex">
<view class="u-m-r-18 color-999">售罄</view>
<my-switch v-model="isPauseSale" @change="isPauseSaleChange"></my-switch>
<my-switch disabled v-model="isPauseSale" :openDisabledClass="false" @click="isPauseSaleChange"></my-switch>
</view>
<view class="u-flex u-m-l-30">
<view class="u-m-r-18 color-999">{{data.isGrounding?'下架产品':'上架产品' }}</view>
<my-switch v-model="isGrounding" @change="isGroundingChange"></my-switch>
<my-switch disabled v-model="isGrounding" :openDisabledClass="false" @click="isGroundingChange"></my-switch>
</view>
</view>
<view class="u-flex">
@@ -117,8 +117,8 @@
$goodsIsHot,
$tbProskuConV2,$updateProductData
} from '@/http/yskApi/goods.js'
import mySwitch from '@/components/my-components/my-switch.vue'
import go from '@/commons/utils/go.js';
import {hasPermission} from '@/commons/utils/hasPermission.js';
import {
ColorMain
} from '@/commons/color.js'
@@ -171,17 +171,24 @@
isGrounding.value=newval
})
function isPauseSaleChange(e) {
async function isPauseSaleChange(e) {
const res=await hasPermission('允许售罄商品')
if(!res){
return
}
upDateGoods({
key: 'pauseSale',
value: e
value: isPauseSale.value?0:1
})
}
function isGroundingChange(e) {
async function isGroundingChange(e) {
const res=await hasPermission('允许上下架商品')
if(!res){
return
}
upDateGoods({
key: 'grounding',
value: e
value: isGrounding.value?0:1
})
}
@@ -208,7 +215,11 @@
emits('del', props.index)
}
function changePrice() {
async function changePrice() {
const res=await hasPermission('允许修改商品')
if(!res){
return
}
emits('changePrice', props.index)
}
@@ -225,10 +236,11 @@
}
//携带参数type edit跳转到商品添加页面编辑与添加同一页面根据type值来判断
function toEdit() {
go.to('PAGES_PRODUCT_ADD', {
type: 'edit',
productId: props.data.id
})
emits('edit', props.data.id)
// go.to('PAGES_PRODUCT_ADD', {
// type: 'edit',
// productId: props.data.id
// })
}
</script>