抽奖次数

This commit is contained in:
lf 2024-06-13 14:59:45 +08:00
parent b47502ebc4
commit 38ce83e085
1 changed files with 51 additions and 27 deletions

View File

@ -200,6 +200,10 @@ const receive_num = ref<number>(null)
const lottery_code = ref<string>('')
const prizes = reactive([])
const query = reactive<any>({})
// eslint-disable-next-line camelcase
const validate_whitelist = ref<number>(null)
// eslint-disable-next-line camelcase
const user_whitelist_count = ref<number>(null)
// ID
// eslint-disable-next-line camelcase
const product_id = ref(null)
@ -284,6 +288,12 @@ const flip = debounce(function (index) {
if (cardStateArray[index].state) {
return
}
if (
// eslint-disable-next-line camelcase
receive_num.value > 0 ||
// eslint-disable-next-line camelcase
(receive_num.value <= 0 && validate_whitelist.value === 1 && user_whitelist_count.value === 1)
) {
Api.lottery({
// eslint-disable-next-line camelcase
lottery_code: lottery_code.value,
@ -313,6 +323,12 @@ const flip = debounce(function (index) {
})
}
})
} else {
uni.showToast({
title: '次数已用完',
icon: 'none',
})
}
}, 300)
function getAccountInfo() {
const params = {
@ -324,6 +340,10 @@ function getAccountInfo() {
receive_num.value = res.data.lottery_count - res.data.use_lottery_count
// eslint-disable-next-line camelcase
lottery_code.value = res.data.lottery_code
// eslint-disable-next-line camelcase
validate_whitelist.value = res.data.validate_whitelist
// eslint-disable-next-line camelcase
user_whitelist_count.value = res.data.user_whitelist_count
} else {
uni.showToast({
title: res.message,
@ -374,6 +394,10 @@ function getData(aa?: any) {
receive_num.value = res.data.lottery_count - res.data.use_lottery_count
// eslint-disable-next-line camelcase
lottery_code.value = res.data.lottery_code
// eslint-disable-next-line camelcase
validate_whitelist.value = res.data.validate_whitelist
// eslint-disable-next-line camelcase
user_whitelist_count.value = res.data.user_whitelist_count
gethome()
} else {
uni.showToast({