Commit 7a114f4d by Sweet Zhang

双十二

parent bacfb039
...@@ -29,18 +29,18 @@ ...@@ -29,18 +29,18 @@
<div class="redPocketContent"> <div class="redPocketContent">
<ul> <ul>
<li id="task01"> <li id="task01">
<img src="./images/red_pocket_disabled.png" alt=""> <img src="./images/red_pocket_active.png" alt="">
</li> </li>
<li id="task02"> <li id="task02">
<img src="./images/red_pocket_disabled.png" alt=""> <img src="./images/red_pocket_active.png" alt="">
</li> </li>
<li id="task03"> <li id="task03">
<img src="./images/red_pocket_disabled.png" alt=""> <img src="./images/red_pocket_active.png" alt="">
<span style="position: absolute;bottom: 5%;color: #ffd899;font-size: 12px;">继续点我</span> <span style="position: absolute;bottom: 5%;color: #ffd899;font-size: 12px;">继续点我</span>
<span class="remainRedPocketCount">0</span> <span class="remainRedPocketCount">0</span>
</li> </li>
<li id="task04"> <li id="task04">
<img src="./images/red_pocket_disabled.png" alt=""> <img src="./images/red_pocket_active.png" alt="">
<span style=" position: absolute;bottom: 5%;color: #ffd899;font-size: 12px;">继续点我</span> <span style=" position: absolute;bottom: 5%;color: #ffd899;font-size: 12px;">继续点我</span>
<span class="remainRedPocketCount">0</span> <span class="remainRedPocketCount">0</span>
</li> </li>
......
...@@ -2,7 +2,7 @@ $(function () { ...@@ -2,7 +2,7 @@ $(function () {
// var api = 'https://' + window.location.host; // var api = 'https://' + window.location.host;
var api = 'https://mdev.zuihuibi.cn'; var api = 'https://mdev.zuihuibi.cn';
var gitUrlParam = window.location.search; var gitUrlParam = window.location.search;
var shareCode = null; var shareCode, customerId = null;
var customerEncryptResult = null; var customerEncryptResult = null;
var activityTaskInfoList = []; var activityTaskInfoList = [];
// 获取活动信息 // 获取活动信息
...@@ -28,6 +28,12 @@ $(function () { ...@@ -28,6 +28,12 @@ $(function () {
customerId: '', customerId: '',
name: '', name: '',
}; };
var double12_customerInfo = localStorage.getItem('double12_customerInfo');
if (getQueryString('customerId')) {
customerId = getQueryString('customerId');
} else if (double12_customerInfo) {
customerId = JSON.parse(double12_customerInfo).customerId;
}
const REG_CODE = /^(1)\d{10}$/; const REG_CODE = /^(1)\d{10}$/;
$("#phone,#name,#code").blur(function () { $("#phone,#name,#code").blur(function () {
window.scrollTo(0, 0); window.scrollTo(0, 0);
...@@ -187,9 +193,7 @@ $(function () { ...@@ -187,9 +193,7 @@ $(function () {
// 自定义分享 // 自定义分享
function wxShare() { function wxShare() {
var double12_customerInfo = localStorage.getItem('double12_customerInfo'); shareInfo.customerId = customerId;
var double12_customerInfo_id = JSON.parse(double12_customerInfo).customerId;
shareInfo.customerId = double12_customerInfo_id;
shareInfo.shareCode = Math.random().toString(36).substr(2, 15); shareInfo.shareCode = Math.random().toString(36).substr(2, 15);
shareInfo.url = `${api}/2019Double12/invitation.html?shareCode=${shareInfo.shareCode}`; shareInfo.url = `${api}/2019Double12/invitation.html?shareCode=${shareInfo.shareCode}`;
// 默认的分享信息 // 默认的分享信息
...@@ -285,7 +289,7 @@ $(function () { ...@@ -285,7 +289,7 @@ $(function () {
mobileNo: $("#loginPhone").val() mobileNo: $("#loginPhone").val()
}), }),
success: function (res) { success: function (res) {
param.customerId = res.data.customerId; customerId = param.customerId = res.data.customerId;
var double12_customerInfo = { var double12_customerInfo = {
customerId: res.data.customerId, customerId: res.data.customerId,
customerName: res.data.customerName, customerName: res.data.customerName,
...@@ -440,8 +444,7 @@ $(function () { ...@@ -440,8 +444,7 @@ $(function () {
}); });
return; return;
} else { } else {
var double12_customerInfo = JSON.parse(localStorage.getItem('double12_customerInfo')); if (customerId) {
if (double12_customerInfo) {
wxShare(); wxShare();
$('.markbox').show(); $('.markbox').show();
} else { } else {
...@@ -470,7 +473,7 @@ $(function () { ...@@ -470,7 +473,7 @@ $(function () {
contentType: "application/json", contentType: "application/json",
data: JSON.stringify({ data: JSON.stringify({
activityId: 12, activityId: 12,
customerId: JSON.parse(localStorage.getItem('double12_customerInfo')) && JSON.parse(localStorage.getItem('double12_customerInfo')).customerId || null customerId: customerId || null
}), }),
headers: { headers: {
"X-Authorization": token "X-Authorization": token
...@@ -504,9 +507,15 @@ $(function () { ...@@ -504,9 +507,15 @@ $(function () {
$('#task01 img').attr('src', './images/red_pocket_active.png') $('#task01 img').attr('src', './images/red_pocket_active.png')
} else if (task01.activityOpportunityUsedInfo.drawTimes > 0) { } else if (task01.activityOpportunityUsedInfo.drawTimes > 0) {
$('#task01 img').attr('src', './images/red_pocket_finish.png'); $('#task01 img').attr('src', './images/red_pocket_finish.png');
} else {
$('#task01 img').attr('src', './images/red_pocket_disabled.png')
}
if (task01.activityOpportunityUsedInfo.totalTimes > 0) {
$('#ai').html('查看方案'); $('#ai').html('查看方案');
$('.completeIcon1').show(); $('.completeIcon1').show();
} else { }
} else {
if (customerId) {
$('#task01 img').attr('src', './images/red_pocket_disabled.png') $('#task01 img').attr('src', './images/red_pocket_disabled.png')
} }
} }
...@@ -515,9 +524,15 @@ $(function () { ...@@ -515,9 +524,15 @@ $(function () {
$('#task02 img').attr('src', './images/red_pocket_active.png') $('#task02 img').attr('src', './images/red_pocket_active.png')
} else if (task02.activityOpportunityUsedInfo.drawTimes > 0) { } else if (task02.activityOpportunityUsedInfo.drawTimes > 0) {
$('#task02 img').attr('src', './images/red_pocket_finish.png') $('#task02 img').attr('src', './images/red_pocket_finish.png')
} else {
$('#task02 img').attr('src', './images/red_pocket_disabled.png')
}
if (task02.activityOpportunityUsedInfo.totalTimes > 0) {
$('#buyService').html('查看方案'); $('#buyService').html('查看方案');
$('.completeIcon2').show(); $('.completeIcon2').show();
} else { }
} else {
if (customerId) {
$('#task02 img').attr('src', './images/red_pocket_disabled.png') $('#task02 img').attr('src', './images/red_pocket_disabled.png')
} }
} }
...@@ -551,7 +566,7 @@ $(function () { ...@@ -551,7 +566,7 @@ $(function () {
contentType: "application/json", contentType: "application/json",
data: JSON.stringify({ data: JSON.stringify({
campaignCode: "double12", campaignCode: "double12",
customerId: JSON.parse(localStorage.getItem('double12_customerInfo')).customerId || null, customerId: customerId || null,
campaignTaskCode: campaignTaskCode campaignTaskCode: campaignTaskCode
}), }),
headers: { headers: {
...@@ -588,14 +603,14 @@ $(function () { ...@@ -588,14 +603,14 @@ $(function () {
function taskUrl(type) { function taskUrl(type) {
if (type === 1) { if (type === 1) {
// 问卷 // 问卷
if (task01 && task01.activityOpportunityUsedInfo && task01.activityOpportunityUsedInfo.drawTimes > 0) { if (task01 && task01.activityOpportunityUsedInfo && task01.activityOpportunityUsedInfo.totalTimes > 0) {
window.open(task01.activityOpportunityUsedInfo.finishedDirectUrl) window.open(task01.activityOpportunityUsedInfo.finishedDirectUrl)
} else { } else {
window.open(`${api}/questionnaire/#/index?campaign=double12&task=12task1`); window.open(`${api}/questionnaire/#/index?campaign=double12&task=12task1`);
} }
} else if (type === 2) { } else if (type === 2) {
// 购买獴哥服务 // 购买獴哥服务
if (task02 && task02.activityOpportunityUsedInfo && task02.activityOpportunityUsedInfo.drawTimes > 0) { if (task02 && task02.activityOpportunityUsedInfo && task02.activityOpportunityUsedInfo.totalTimes > 0) {
window.open(`${api}/member?customerIdEncrypt=${customerEncryptResult}`) window.open(`${api}/member?customerIdEncrypt=${customerEncryptResult}`)
} else { } else {
window.open(`${api}/consulting/?campaign=double12&task=12task2`); window.open(`${api}/consulting/?campaign=double12&task=12task2`);
...@@ -608,20 +623,21 @@ $(function () { ...@@ -608,20 +623,21 @@ $(function () {
// 点击开红包 // 点击开红包
$('#task01').click(function () { $('#task01').click(function () {
openRedPocket(task01.activityOpportunityUsedInfo && task01.activityOpportunityUsedInfo.leftTimes > 0, '12task1') openRedPocket(task01.activityOpportunityUsedInfo && task01.activityOpportunityUsedInfo.leftTimes > 0, task01.activityOpportunityUsedInfo && task01.activityOpportunityUsedInfo.drawTimes > 0, '12task1')
}); });
$('#task02').click(function () { $('#task02').click(function () {
openRedPocket(task02.activityOpportunityUsedInfo && task02.activityOpportunityUsedInfo.leftTimes > 0, '12task2') openRedPocket(task02.activityOpportunityUsedInfo && task02.activityOpportunityUsedInfo.leftTimes > 0, task02.activityOpportunityUsedInfo && task02.activityOpportunityUsedInfo.drawTimes > 0, '12task2')
}); });
$('#task03').click(function () { $('#task03').click(function () {
openRedPocket(task03.activityOpportunityUsedInfo && task03.activityOpportunityUsedInfo.leftTimes > 0, '12task3') openRedPocket(task03.activityOpportunityUsedInfo && task03.activityOpportunityUsedInfo.leftTimes > 0, false, '12task3')
}); });
$('#task04').click(function () { $('#task04').click(function () {
openRedPocket(task04.activityOpportunityUsedInfo && task04.activityOpportunityUsedInfo.leftTimes > 0, '12task4') openRedPocket(task04.activityOpportunityUsedInfo && task04.activityOpportunityUsedInfo.leftTimes > 0, false, '12task4')
}); });
// 开启红包 1可开启 0 不可开启 // 开启红包 1可开启 0 不可开启
function openRedPocket(status, campaignTaskCode) { // drawTimes 是否已经开启
if (localStorage.getItem('double12_customerInfo')) { function openRedPocket(status, drawTimes, campaignTaskCode) {
if (customerId) {
//已经登录 //已经登录
} else { } else {
// 未登录 // 未登录
...@@ -636,13 +652,20 @@ $(function () { ...@@ -636,13 +652,20 @@ $(function () {
if (status) { if (status) {
$('#luckDrawModal').show(); $('#luckDrawModal').show();
lottery(campaignTaskCode); lottery(campaignTaskCode);
} else if (!status) { } else if (!status && !drawTimes) {
layer.open({ layer.open({
content: '红包次数不足,赶快完成任务获取吧', content: '红包次数不足,赶快完成任务获取吧',
skin: 'msg', skin: 'msg',
time: 5, //2秒后自动关闭, time: 5, //2秒后自动关闭,
}); });
return; return;
} else if (!status && drawTimes) {
layer.open({
content: '该任务只能领取一次红包',
skin: 'msg',
time: 5, //2秒后自动关闭,
});
return;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment