feat(管理员赠送): 增加检查是否有赠送权限的环节

This commit is contained in:
hzj 2025-09-16 17:05:57 +08:00
parent 51a92031dc
commit fc5f06129e
2 changed files with 30 additions and 7 deletions

View File

@ -23,3 +23,15 @@ export const giveProps = async (data) => {
throw error
}
}
// 是否有指定道具类型的权限
export const hasSendGiftsPermission = async (propsType) => {
try {
const response = await get(`/app/h5/own-permission?propsType=${propsType}`)
return response
} catch (error) {
console.error('Failed to fetch has send gifts permission:', error)
console.error('error:' + error.response.errorMsg)
throw error
}
}

View File

@ -150,7 +150,7 @@
<script setup>
import MobileHeader from '../components/MobileHeader.vue'
import { onMounted, ref, computed } from 'vue'
import { getAdminCenterList, giveProps } from '@/api/itemDistribution'
import { getAdminCenterList, giveProps, hasSendGiftsPermission } from '@/api/itemDistribution'
import { searchUser } from '@/api/userInfo'
import { showError, showWarning, showInfo, showSuccess } from '@/utils/toast.js'
@ -163,10 +163,6 @@ const tabList = ref([
id: 2,
name: 'Vehicles',
},
{
id: 3,
name: 'Vip',
},
// {
// id: 3,
// name: 'Chat Box',
@ -213,6 +209,13 @@ const underlineStyle = computed(() => {
const targetUserId = ref('')
//
const getHasSendVIPPermission = async (propsType) => {
const response = await hasSendGiftsPermission(propsType)
console.log('response:', response)
return response.body
}
const sendGoods = async () => {
if (confirmClick.value) {
confirmClick.value = false
@ -255,7 +258,7 @@ const getPropsType = () => {
Vehicles: 'RIDE',
'Chat Box': 'CHAT_BUBBLE',
Theme: 'THEME',
Vip: 'NOBLE_VIP',
VIP: 'NOBLE_VIP',
}
return typeMap[currentTab.value]
}
@ -282,7 +285,7 @@ const productList = ref([])
const selectedGoods = ref({})
const validityPeriod = computed(() => {
return currentTab.value == 'Vip' ? '3' : '7'
return currentTab.value == 'VIP' ? '3' : '7'
})
//
@ -309,6 +312,14 @@ const closedPopup = () => {
onMounted(() => {
console.log('onMounted')
// VIP
if (getHasSendVIPPermission('NOBLE_VIP')) {
tabList.value.push({
id: 3,
name: 'VIP',
})
}
if (tabItems.value.length > 0) {
underlineStyle.value //
}