抽奖次数

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