feat(管理员赠送): 增加检查是否有赠送权限的环节
This commit is contained in:
parent
51a92031dc
commit
fc5f06129e
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 // 触发计算属性更新
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user