diff --git a/src/pages/activity/index.vue b/src/pages/activity/index.vue index 98a458f..f9b99f3 100644 --- a/src/pages/activity/index.vue +++ b/src/pages/activity/index.vue @@ -200,6 +200,10 @@ const receive_num = ref(null) const lottery_code = ref('') const prizes = reactive([]) const query = reactive({}) +// eslint-disable-next-line camelcase +const validate_whitelist = ref(null) +// eslint-disable-next-line camelcase +const user_whitelist_count = ref(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({