Authored by lijing

秒杀详情页

... ... @@ -981,7 +981,6 @@ const getSeckillData = (param) => {
method: 'app.seckill.data',
product_skn: param.productskn
};
return api.get('', params, {
code: 200
})
... ... @@ -994,44 +993,6 @@ const getSeckillData = (param) => {
if (result.data) {
data = result.data;
}
data = {
'activityId': 226,
'currentTime': 1476265949,
'endTime': 1476343557,
'formatSecKillPrice': '¥5.00',
'id': 512,
'orderBy': 1,
'productSkn': 51165112,
'remindFlag': false,
'secKillPrice': 5646545,
'secKillSku': [
{
'activityId': 226,
'id': 199,
'productSkn': 51165112,
'productSku': 555,
'storageNum': 2
},
{
'activityId': 226,
'id': 200,
'productSkn': 51165112,
'productSku': 222,
'storageNum': 2
},
{
'activityId': 226,
'id': 200,
'productSkn': 51165112,
'productSku': 444,
'storageNum': 2
}
],
'secKillStatus': 0,
'startTime': 1476261000,
'status': 2,
'storageSum': 2
};
return data;
});
};
... ... @@ -1070,64 +1031,6 @@ let getProductData = (data) => {
return {};
}
result = result.data;
result.goodsList[1] = {
status: 1,
colorCode: '47ba17',
colorId: 10,
colorImage: 'http://img10.static.yhbimg.com/goodsimg/2015/11/02/06/01361c1986f1dd2eaff70e1f85a35bfacd.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/70',
colorName: '白色',
colorValue: '',
goodsId: 385777,
imagesList: [{ imageUrl: 'http://img10.static.yhbimg.com/goodsimg/2015/11/02/06/01361c1986f1dd2eaff70e1f85a35bfacd.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/70' }],
isDefault: 'N',
productSkc: 297246,
sizeList:
[
{
status: 1,
allStorageNumber: 0,
orderBy: 1,
productSku: 444,
sizeId: 199,
sizeName: 'F',
storageNumber: 136,
storeStorageNumber: 0
},
{
status: 1,
allStorageNumber: 0,
orderBy: 1,
productSku: 555,
sizeId: 200,
sizeName: 'A',
storageNumber: 136,
storeStorageNumber: 0
}
]
};
result.goodsList[0].sizeList = [
{
status: 1,
allStorageNumber: 1,
orderBy: 1,
productSku: 111,
sizeId: 199,
sizeName: 'F',
storageNumber: 1,
storeStorageNumber: 1
},
{
status: 1,
allStorageNumber: 1,
orderBy: 1,
productSku: 222,
sizeId: 200,
sizeName: 'A',
storageNumber: 1,
storeStorageNumber: 1
}
];
return Promise.all([
_getShopsInfo(_.get(result, 'brandInfo.brandId', 0)),
_getPromotionInfo(result.productSkn),
... ... @@ -1137,13 +1040,12 @@ let getProductData = (data) => {
_getCommonConsult(),
comment.getConsults(result.productId, 1, 2)
]).then((info) => {
result.promotionBoList = info[1];
finalResult = _detailDataPkg(result, data.uid, data.vipLevel, data.ua);
finalResult.enterStore = info[0];
finalResult.isStudent = data.isStudent;
Object.assign(finalResult.feedbacks, info[2]);
Object.assign(finalResult, {isSecKill: result.isSecKill});
/* 如果有咨询,显示咨询,否则显示常见问题 */
... ...
... ... @@ -226,5 +226,7 @@
<input type="hidden" id="showPannel" value="1">
{{/if}}
<input type="hidden" id="isSecKill" value = "{{isSecKill}}">
</div>
{{/ result}}
... ...
... ... @@ -226,8 +226,12 @@ function updateConformButtonClassAndText() {
} else {
$('#chose-btn-sure').css('background-color', '#eb0313').html(isEdit ? '确认' : '加入购物车');
}
if ($chosed.closest('.zero-stock').length === 2) {
$('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄');
} else {
$('#chose-btn-sure').css('background-color', '#eb0313').html(isEdit ? '确认' : '立即结算');
}
}
}
... ...
... ... @@ -23,7 +23,7 @@ var dialog = require('../plugin/dialog');
require('../common');
if (window.queryString.seckill) {
if ($('#isSecKill').val() === 'Y') {
require('./tick');
}
... ...
... ... @@ -5,8 +5,9 @@
*/
var $ = require('yoho-jquery'),
tip = require('../plugin/tip'),
seckillObj = {};
tip = require('../plugin/tip');
var seckillObj = {};
var timeObj = '';
... ... @@ -25,6 +26,8 @@ var dateText = 0,
newHour = 0,
newMinus = 0;
var skuFlag;
require('../common');
seckillObj = {
... ... @@ -61,6 +64,7 @@ $(
$('.cart-bar').hide();
$('.current-price').hide();
var ajaxUrl = '/product/detail/seckillData/' + $('#productSkn').val();
$.ajax({
type: 'GET',
url: ajaxUrl,
... ... @@ -97,31 +101,27 @@ $(
// 秒杀进行中
if (data.status === 2) {
if (seckillNum == 0) {
var thisSkn = $('#productSkn').val();
// window.location.href = '/product/show_' + thisSkn + '.html';
}
$('.chose-panel .size-list').find('li[data-skuid != \'\']').each(
function() {
var skuFlag = 0;
skuFlag = 0;
for (var i = 0; i < data.secKillSku.length; i++) {
if (data.secKillSku[i].productSku == $(this).attr('data-skuid')) {
if (data.secKillSku[i].productSku === $(this).attr('data-skuid')) {
skuFlag++;
} else {
// alert("没有匹配");
}
}
if (skuFlag === 0) {
$(this).addClass('zero-stock');
$(this).addClass('zero-stock').attr('data-num', '0');
var oneIndex = $(this).index() + 1;
var twoIndex = $(this).parent('ul').index() - 2;
$('.chose-panel .color-list ul:eq(' + oneIndex + ') li:eq(' + twoIndex + ')').addClass('zero-stock');
}
}
);
// $("li[data-skuid=111]").addClass("zero-stock");
$('.price-date').append(
'<div class="seckill-time seckill-time-border">' +
'<span>距结束&nbsp</span>' +
... ... @@ -153,6 +153,7 @@ $(
$('#chose-btn-sure').text('立即抢购').addClass('isSecKill');
$('.cart-bar').show();
var seckillNum = 0;
for (var i = 0; i < data.secKillSku.length; i++) {
seckillNum = seckillNum + data.secKillSku[i].storageNum;
}
... ...