23情人节:购买接口增加未中奖提示

This commit is contained in:
qf
2023-02-06 18:46:18 +08:00
parent 82dc3faf62
commit 8729fc7f5b

View File

@@ -77,6 +77,7 @@ function getLetterInit() {
$('.letter-wrap .letter .imgbox img').attr('src', res.data.keepsake.icon)
$('.letter-wrap .letter p e').text(res.data.keepsakeNum)
$('.letter-wrap .get_letter').attr('id', res.data.keepsake.id)
$('.letter-wrap .get_letter').attr('type', res.data.keepsake.type)
if (nowTime >= res.data.endTime) {
$('.letter-wrap .get_letter').css('filter', 'grayscale(0.7)')
}
@@ -111,6 +112,7 @@ function getPetitionInit() {
$(`.petition-wrap .gift-wrap .li${i + 1} .giftbg img`).attr('src', res.icon)
$(`.petition-wrap .gift-wrap .li${i + 1} span`).html(res.name)
$(`.petition-wrap .gift-wrap .li${i + 1} .btn`).attr('id', res.id)
$(`.petition-wrap .gift-wrap .li${i + 1} .btn`).attr('type', res.type)
$(`.petition-wrap .gift-wrap .li${i + 1} .btn`).html(res.type == 2 ? '兌換銘牌' : res.type == 3 ? '兌換資料卡' : res.type == 4 ? '兌換頭飾' : '兌換座駕')
$(`.petition-wrap .gift-wrap .li${i + 1} p e`).html(res.price)
})
@@ -119,6 +121,7 @@ function getPetitionInit() {
$('.petition-wrap .number-wrap .giftbg img').attr('src', res.icon)
$('.petition-wrap .number-wrap span').html(res.name)
$('.petition-wrap .number-wrap .btn').attr('id', res.id)
$('.petition-wrap .number-wrap .btn').attr('type', res.type)
$('.petition-wrap .number-wrap p e').html(res.price)
})
@@ -350,7 +353,7 @@ function getDrawRecord(drawPage, tab) {
}
// 购买信物、兑换、抽奖 (道具id,数量)
function buy(id, num) {
function buy(id, num, type ) {
showLoading()
networkRequest({
type: 'POST',
@@ -379,7 +382,12 @@ function buy(id, num) {
$('.gx').show()
}
} else {
toastMsg(res.message)
if(type == 6) {
toastMsg('很遺憾沒有抽到,距離靚號就差一點啦~')
}else {
toastMsg(res.message)
}
canGet = true
}
@@ -558,6 +566,7 @@ $('.letter-wrap .get_letter').click(function () {
toastMsg('活動未開始~')
} else {
let id = $(this).attr('id')
let type = $(this).attr('type')
let num = $('.letter-wrap .but input').val()
if (num == 0) {
toastMsg('至少投入1')
@@ -565,7 +574,7 @@ $('.letter-wrap .get_letter').click(function () {
}
if (canGet) {
console.log('id:', id, 'num:', num);
buy(id, num)
buy(id, num, type)
} else {
toastMsg('信物獲取中,請稍後~')
}
@@ -614,7 +623,8 @@ $('.petition-wrap .gift-wrap li .btn').click(function () {
let liIndex = $(this).parents('li').index()
let num = $('.petition-wrap .gift-wrap li').eq(liIndex).find('.but input').val();
let id = $('.petition-wrap .gift-wrap li').eq(liIndex).find('.btn').attr('id');
buy(id, num)
let type = $('.petition-wrap .gift-wrap li').eq(liIndex).find('.btn').attr('type');
buy(id, num, type)
})
// 靓号按钮输入框
// 投入+
@@ -650,8 +660,9 @@ $('.petition-wrap .number-wrap .but').on('input', 'input', function () {
// 抽取靓号
$('.petition-wrap .number-wrap .btn').click(function () {
let id = $(this).attr('id');
let type = $(this).attr('type');
let num = $('.petition-wrap .number-wrap .but input').val();
buy(id, num)
buy(id, num, type)
})
// 关闭恭喜获得弹窗