|
@@ -1,19 +1,22 @@
|
|
|
// let activityInfo; // 活动信息
|
|
|
let ticketList // 奖券列表
|
|
|
-let baseUrl = getEVN('http://192.168.20.131:8080')
|
|
|
+let baseUrl = getEVN('https://web2-jytest.jydev.jianyu360.com')
|
|
|
let ticket // 可领取的奖券
|
|
|
+let lis
|
|
|
let activityId // 活动id
|
|
|
let isWX = isWeChat()
|
|
|
console.log(isWX);
|
|
|
ticketImg = [
|
|
|
- '/jyapp/squeeze/images/ticket5.png',
|
|
|
- '/jyapp/squeeze/images/ticket15.png',
|
|
|
- '/jyapp/squeeze/images/ticket38.png',
|
|
|
- '/jyapp/squeeze/images/ticket100.png',
|
|
|
- '/jyapp/squeeze/images/ticket250.png'
|
|
|
+ // '/frontRouter/wx/squeeze/images/ticket5.png',
|
|
|
+ // '/frontRouter/wx/squeeze/images/ticket15.png',
|
|
|
+ // '/frontRouter/wx/squeeze/images/ticket38.png',
|
|
|
+ // '/frontRouter/wx/squeeze/images/ticket100.png',
|
|
|
+ // '/frontRouter/wx/squeeze/images/ticket250.png'
|
|
|
+ '/frontRouter/wx/squeeze/images/ticket380.png',
|
|
|
+ '/frontRouter/wx/squeeze/images/ticket1000.png',
|
|
|
]
|
|
|
|
|
|
-activityId = GetRequest()
|
|
|
+activityId = GetRequest() || ''
|
|
|
console.log(activityId);
|
|
|
getTicket()
|
|
|
|
|
@@ -24,58 +27,70 @@ function getTicket() {
|
|
|
}).then(data => {
|
|
|
console.log(data)
|
|
|
ticketList = data.data
|
|
|
- let lis = ''
|
|
|
ticket = []
|
|
|
+ lis = ''
|
|
|
ticketList.forEach((item, index) => {
|
|
|
- // console.log(item);
|
|
|
- if (item.IsUser) {
|
|
|
- lis += `<li>
|
|
|
- <img src="${ticketImg[index]}" alt="">
|
|
|
- <div class="ticket-btn">
|
|
|
- <span data-id="${item.LotteryIdStr}">已结束</span>
|
|
|
- </div>
|
|
|
- </li>`
|
|
|
- } else {
|
|
|
- if (item.IsReceive) {
|
|
|
- li = `<li>
|
|
|
- <img src="${ticketImg[index]}" alt="">
|
|
|
- <div class="ticket-btn">
|
|
|
- <span data-id="${item.LotteryIdStr}">已结束</span>
|
|
|
- </div>
|
|
|
- </li>`
|
|
|
- if (item.StockNumber > 0) {
|
|
|
+ if(data.activity.ActivityendDate){
|
|
|
+ const ONE_DAY_TIMP = 86400000
|
|
|
+ let endT = new Date().getTime() + ONE_DAY_TIMP
|
|
|
+ let nowT = new Date().getTime()
|
|
|
+ if(endT<nowT){
|
|
|
+ activity(item, index)
|
|
|
+ }else{
|
|
|
+ if (item.IsUser) {
|
|
|
lis += `<li>
|
|
|
- <img src="${ticketImg[index]}" alt="">
|
|
|
- <div class="ticket-btn">
|
|
|
- <span data-id="${item.LotteryIdStr}">已结束</span>
|
|
|
- </div>
|
|
|
- </li>`
|
|
|
- ticket.push(item.LotteryIdStr)
|
|
|
+ <img src="${ticketImg[index]}" alt="">
|
|
|
+ <div class="ticket-btn">
|
|
|
+ <span data-id="${item.LotteryIdStr}">已使用</span>
|
|
|
+ </div>
|
|
|
+ </li>`
|
|
|
} else {
|
|
|
- lis += `<li>
|
|
|
+ if (item.IsReceive) {
|
|
|
+ if (item.StockNumber > 0) {
|
|
|
+ lis += `<li>
|
|
|
+ <img src="${ticketImg[index]}" alt="">
|
|
|
+ <div class="ticket-btn">
|
|
|
+ <button class="get" is-receive="true" data-id="${item.LotteryIdStr}">点击领取</button>
|
|
|
+ </div>
|
|
|
+ </li>`
|
|
|
+ ticket.push(item.LotteryIdStr)
|
|
|
+ } else {
|
|
|
+ lis += `<li>
|
|
|
+ <img src="${ticketImg[index]}" alt="">
|
|
|
+ <div class="ticket-btn">
|
|
|
+ <span data-id="${item.LotteryIdStr}">抢光了</span>
|
|
|
+ </div>
|
|
|
+ </li>`
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ lis += `<li>
|
|
|
<img src="${ticketImg[index]}" alt="">
|
|
|
<div class="ticket-btn">
|
|
|
- <span data-id="${item.LotteryIdStr}">已结束</span>
|
|
|
+ <button data-id="${item.LotteryIdStr}" class="use">去使用</button>
|
|
|
</div>
|
|
|
</li>`
|
|
|
+ }
|
|
|
}
|
|
|
- } else {
|
|
|
- lis += `<li>
|
|
|
- <img src="${ticketImg[index]}" alt="">
|
|
|
- <div class="ticket-btn">
|
|
|
- <span data-id="${item.LotteryIdStr}">已结束</span>
|
|
|
- </div>
|
|
|
- </li>`
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
})
|
|
|
$('.ticket ul').html(lis)
|
|
|
console.log(ticket);
|
|
|
- if (ticket.length == 0) {
|
|
|
- $('#getAll').attr('disabled', true).addClass('dis').text('活动已结束')
|
|
|
- }
|
|
|
+ // if (ticket.length == 0) {
|
|
|
+ // $('#getAll').attr('disabled', true).addClass('dis').text('活动已结束')
|
|
|
+ // }
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+function activity(item, index){
|
|
|
+ lis += `<li>
|
|
|
+ <img src="${ticketImg[index]}" alt="">
|
|
|
+ <div class="ticket-btn">
|
|
|
+ <span class="end" data-id="${item.LotteryIdStr}">已结束</span>
|
|
|
+ </div>
|
|
|
+ </li>`
|
|
|
+}
|
|
|
+
|
|
|
// 领取奖券
|
|
|
function drawTicket(id) {
|
|
|
request('/jyMarketing/lottery/lotteryReceive', 'POST', {
|
|
@@ -83,14 +98,14 @@ function drawTicket(id) {
|
|
|
}).then(data => {
|
|
|
// console.log(data);
|
|
|
if (data.code === 1) {
|
|
|
- $('#toast .toast-content').text('领取成功')
|
|
|
+ $('.ticket ul li button').text('去使用')
|
|
|
// $('#toast').show()
|
|
|
getTicket()
|
|
|
setTimeout(() => {
|
|
|
$('#toast').hide()
|
|
|
}, 1500)
|
|
|
} else {
|
|
|
- $('#toast .toast-content').text('领取失败')
|
|
|
+ $('.ticket ul li button').text('领取失败')
|
|
|
// $('#toast').show()
|
|
|
setTimeout(() => {
|
|
|
$('#toast').hide()
|
|
@@ -99,15 +114,14 @@ function drawTicket(id) {
|
|
|
})
|
|
|
}
|
|
|
$('.ticket ul').on('click', 'li button', function () {
|
|
|
- return
|
|
|
// 领取
|
|
|
if ($(this).attr('is-receive') === 'true') {
|
|
|
- $('#toast .toast-content').text('领取中')
|
|
|
- $('#toast').show()
|
|
|
+ // $('#toast .toast-content').text('领取中')
|
|
|
+ // $('#toast').show()
|
|
|
let ids = []
|
|
|
ids.push($(this).attr('data-id'))
|
|
|
drawTicket(ids)
|
|
|
- } else { // 使用
|
|
|
+ } else { // 使用 https://web2-jytest.jydev.jianyu360.com/weixin/frontPage/coupon/free/selectProduct?couponId=4d5f
|
|
|
if (isWX) {
|
|
|
location.href = '/weixin/frontPage/coupon/free/selectProduct?couponId=' + $(this).attr('data-id')
|
|
|
} else {
|
|
@@ -124,7 +138,7 @@ $('#getAll').click(function () {
|
|
|
drawTicket(ticket)
|
|
|
}
|
|
|
})
|
|
|
-$('#buy1').click(function () {
|
|
|
+$('.ticket ul li button.use').click(function () {
|
|
|
if (isWX) {
|
|
|
location.href = "/front/vipsubscribe/introducePage"
|
|
|
} else {
|
|
@@ -132,14 +146,14 @@ $('#buy1').click(function () {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
-$('#buy2').click(function () {
|
|
|
- if (isWX) {
|
|
|
- location.href = "/front/wx_dataExport/toSieve"
|
|
|
- } else {
|
|
|
- location.href = "/jyapp/front/dataExport/toSieve"
|
|
|
- }
|
|
|
-})
|
|
|
+// $('#buy2').click(function () {
|
|
|
+// if (isWX) {
|
|
|
+// location.href = "/front/wx_dataExport/toSieve"
|
|
|
+// } else {
|
|
|
+// location.href = "/jyapp/front/dataExport/toSieve"
|
|
|
+// }
|
|
|
+// })
|
|
|
|
|
|
-$('#buy3').click(function () {
|
|
|
- location.href = "/page_docs_mobile/home"
|
|
|
-})
|
|
|
+// $('#buy3').click(function () {
|
|
|
+// location.href = "/page_docs_mobile/home"
|
|
|
+// })
|