抽奖次数

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,35 +288,47 @@ const flip = debounce(function (index) {
if (cardStateArray[index].state) {
return
}
Api.lottery({
if (
// eslint-disable-next-line camelcase
lottery_code: lottery_code.value,
}).then((res: any) => {
if (res.code === 200) {
link.value = res.data.show_pic
zjtitle.value = res.data.show_name
cardStateArray[index].show_name = res.data.show_name
curindex.value = index
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
product_id.value = res.data.product_id
id.value = res.data.coupon_id
// eslint-disable-next-line camelcase
receive_num.value = res.data.lottery_count
cardStateArray.forEach((item, index) => {
item.state = true
})
setTimeout(function () {
istype.value = 'iszj'
isshow.value = true
}, 300)
getAccountInfo()
} else {
uni.showToast({
title: res.message,
icon: 'none',
})
}
})
lottery_code: lottery_code.value,
}).then((res: any) => {
if (res.code === 200) {
link.value = res.data.show_pic
zjtitle.value = res.data.show_name
cardStateArray[index].show_name = res.data.show_name
curindex.value = index
// eslint-disable-next-line camelcase
product_id.value = res.data.product_id
id.value = res.data.coupon_id
// eslint-disable-next-line camelcase
receive_num.value = res.data.lottery_count
cardStateArray.forEach((item, index) => {
item.state = true
})
setTimeout(function () {
istype.value = 'iszj'
isshow.value = true
}, 300)
getAccountInfo()
} else {
uni.showToast({
title: res.message,
icon: 'none',
})
}
})
} 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({