抽奖次数

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