Authored by lijing

秒杀详情页

... ... @@ -994,7 +994,7 @@ const _getSeckillData = (productSkn) => {
'productSkn': 512581470,
'activityId': 4,
'startTime': 1375192655,
'endTime': 1475758971,
'endTime': 1475558971,
'formatSecKillPrice': '¥50.00',
'secKillPrice': 50,
'status': 1,
... ... @@ -1042,6 +1042,7 @@ let getProductData = (data) => {
}
return _getUserProfile(params.uid).then((user) => {
data.vipLevel = (user.data && user.data.vip_info && user.data.vip_info.cur_level) || '0';
data.isStudent = (user.data && user.data.vip_info && user.data.vip_info.is_student) ? true : false;
params.is_student = data.isStudent ? 1 : 0;
... ... @@ -1071,31 +1072,45 @@ let getProductData = (data) => {
Object.assign(finalResult.feedbacks, info[2]);
// 判断是否是秒杀
let is_secKill = result.isSecKill || true;
// 秒杀详情页
if (is_secKill && info[5]) {
let nowDate = Date.parse(new Date()) / 1000;
let end = nowDate > info[5].endTime ? true : false;
let nowDate = Date.parse(new Date()) / 1000;
if (!end) {
let notStart = nowDate < info[5].startTime ? true : false;
let notStart = nowDate < info[5].startTime ? true : false;
let startIng = info[5].startTime < nowDate && info[5].endTime > nowDate ? true : false;
let startIng = info[5].startTime < nowDate && info[5].endTime > nowDate ? true : false;
let end = nowDate > info[5].endTime ? true : false;
let leftCount = 0;
info[5].secKillSku.forEach(val => {
leftCount = leftCount + val.storageNum;
});
Object.assign(finalResult, {
isSecKill: {
notStart: notStart,
startIng: startIng,
startTime: info[5].startTime,
endTime: info[5].endTime,
secKillPrice: info[5].formatSecKillPrice,
noneLeft: leftCount === 0 ? true : false
}
});
Object.assign(finalResult, {
isSecKill: {
notStart: notStart,
startIng: startIng,
end: startIng,
startTime: info[5].startTime,
endTime: info[5].endTime,
secKillPrice: info[5].formatSecKillPrice,
noneLeft: false
}
});
/* 如果有咨询,显示咨询,否则显示常见问题 */
}
/* 如果有咨询,显示咨询,否则显示常见问题 */
if (info[4].total) {
finalResult.feedbacks.consultsNum = parseInt(info[4].total, 10);
... ...
... ... @@ -82,17 +82,20 @@
</div>
</div>
<div class="btn-wrap">
<button id="chose-btn-sure" class="btn btn-sure">
{{#if ../isSecKill/startIng}}
立即抢购
{{#if ../isSecKill/startIng}}
<button class="btn btn-sure go-pay">
立即抢购
</button>
{{else}}
<button id="chose-btn-sure" class="btn btn-sure go-pay">
{{#if ../tickets}}
立即购买
{{else}}
{{#if ../tickets}}
立即购买
{{else}}
加入购物车
{{/if}}
加入购物车
{{/if}}
</button>
</button>
{{/if}}
</div>
</div>
</div>
... ...
... ... @@ -203,15 +203,30 @@ function hide() {
}
// 修改加入购物车的文字和背景
var isSeckill = $('.limit-num-text').length;
function updateConformButtonClassAndText() {
$chosed = $allChoseItems.find('.chosed');
if ($chosed.closest('.zero-stock').length === 2) {
$('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄');
} else if (limitProductCode || ticketsLimit) {
$('#chose-btn-sure').css('background-color', '#eb0313').html('立即购买');
if (isSeckill > 0) {
$chosed = $allChoseItems.find('.chosed');
if ($chosed.closest('.zero-stock').length === 2) {
$('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄');
} else if (limitProductCode || ticketsLimit) {
$('#chose-btn-sure').css('background-color', '#eb0313').html('立即购买');
} else {
$('#chose-btn-sure').css('background-color', '#eb0313').html(isEdit ? '确认' : '立即结算');
}
} else {
$('#chose-btn-sure').css('background-color', '#eb0313').html(isEdit ? '确认' : '加入购物车');
$chosed = $allChoseItems.find('.chosed');
if ($chosed.closest('.zero-stock').length === 2) {
$('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄');
} else if (limitProductCode || ticketsLimit) {
$('#chose-btn-sure').css('background-color', '#eb0313').html('立即购买');
} else {
$('#chose-btn-sure').css('background-color', '#eb0313').html(isEdit ? '确认' : '加入购物车');
}
}
}
// 显示剩余件数
... ...
... ... @@ -11,6 +11,8 @@ require('../common');
var timeObj = '';
var offsetTime = 0;
var nowTime = Date.parse(new Date()) / 1000;
var startTime = $('.start-time-text').val();
... ... @@ -66,5 +68,10 @@ $(
var newHour = newDate.getHours();
var newMinus = newDate.getMinutes();
$('.notStart').find('.seckill-time-c').text(newMonth + '月' + newDay + '日' + newHour + ':' + newMinus);
$('.go-pay').click(
function() {
alert('去付款');
}
);
}
);
... ...
... ... @@ -401,8 +401,9 @@ $basicBtnC: #eb0313;
color: #d0021b;
font-size: 30px;
line-height: 80px;
text-align: right;
padding-left: 50px;
position: absolute;
right: 0px;
bottom: 90px;
}
.seckill-time-border {
... ...