增加商品规格权限验证

This commit is contained in:
2024-10-10 09:39:22 +08:00
parent 703da8e683
commit 8329d9cfad
2 changed files with 33 additions and 17 deletions

View File

@@ -4,19 +4,16 @@
"version" : "0.0", "version" : "0.0",
"configurations" : [ "configurations" : [
{ {
"app-plus" : "app-plus" : {
{ "launchtype" : "local"
"launchtype" : "local" },
}, "default" : {
"default" : "launchtype" : "local"
{ },
"launchtype" : "local" "mp-weixin" : {
}, "launchtype" : "local"
"mp-weixin" : },
{ "type" : "uniCloud"
"launchtype" : "local"
},
"type" : "uniCloud"
}, },
{ {
"playground" : "custom", "playground" : "custom",

View File

@@ -10,18 +10,20 @@
<view class="u-m-t-48"> <view class="u-m-t-48">
<view class="u-flex u-row-between border-bottom u-p-b-30"> <view class="u-flex u-row-between border-bottom u-p-b-30">
<view>当前状态</view> <view>当前状态</view>
<view class="u-flex"> <view class="u-flex u-relative">
<up-radio-group v-model="isGrounding" placement="row" @change="isGroundingChange"> <up-radio-group v-model="isGrounding" placement="row" @change="isGroundingChange">
<up-radio :customStyle="{marginRight: '10px'}" v-for="(item, index) in status.list" <up-radio :customStyle="{marginRight: '10px'}" v-for="(item, index) in status.list"
:key="index" :label="item.label" :name="item.name"> :key="index" :label="item.label" :name="item.name">
</up-radio> </up-radio>
</up-radio-group> </up-radio-group>
<view class="u-absolute position-all" @click="hasShangXiajia(true)" v-if="!canShangXiaJia"></view>
</view> </view>
</view> </view>
<view class=" u-flex u-row-between u-m-t-30"> <view class=" u-flex u-row-between u-m-t-30 u-relative">
<view>售罄</view> <view>售罄</view>
<up-switch :activeValue="1" :inactiveValue="0" :size="20" @change="isPauseSaleChange" v-model="isPauseSale"></up-switch> <up-switch :activeValue="1" :inactiveValue="0" :size="20" @change="isPauseSaleChange" v-model="isPauseSale"></up-switch>
<view class="u-absolute position-all" @click="hasShouQing(true)" v-if="!canShouQing"></view>
</view> </view>
</view> </view>
</view> </view>
@@ -44,6 +46,7 @@
$updateProductStatus,$updateProductData, $updateProductStatus,$updateProductData,
$tbProskuConV2 $tbProskuConV2
} from '@/http/yskApi/goods.js' } from '@/http/yskApi/goods.js'
import {hasPermission} from '@/commons/utils/hasPermission.js'
import infoBox from '@/commons/utils/infoBox.js' import infoBox from '@/commons/utils/infoBox.js'
const props = defineProps({ const props = defineProps({
show: { show: {
@@ -98,7 +101,8 @@
} }
function open() { function open() {
hasShangXiajia()
hasShouQing()
} }
function save() { function save() {
@@ -113,8 +117,20 @@
...par ...par
}]) }])
} }
let canShangXiaJia=ref(false)
async function hasShangXiajia(tips=false){
canShangXiaJia.value=await hasPermission({text:'允许上下架商品',tips})
}
let canShouQing=ref(false)
async function hasShouQing(tips=false){
canShouQing.value=await hasPermission({text:'允许售罄商品',tips})
}
async function isGroundingChange(e) { async function isGroundingChange(e) {
if(!canShangXiaJia.value){
return
}
await upDateGoods({ await upDateGoods({
key:'grounding', key:'grounding',
value: e value: e
@@ -124,6 +140,9 @@
} }
async function isPauseSaleChange(e) { async function isPauseSaleChange(e) {
if(!canShouQing.value){
return
}
console.log(e); console.log(e);
await upDateGoods({ await upDateGoods({
key:'pauseSale', key:'pauseSale',