Showing
3 changed files
with
50 additions
and
9 deletions
@@ -5282,11 +5282,13 @@ var goodsDiscountEl = document.getElementById('goodsDiscount'), | @@ -5282,11 +5282,13 @@ var goodsDiscountEl = document.getElementById('goodsDiscount'), | ||
5282 | 5282 | ||
5283 | var $cart = $('.cart-bar'); | 5283 | var $cart = $('.cart-bar'); |
5284 | 5284 | ||
5285 | -var limitSaleBtn = document.getElementById('limit-sale'), | ||
5286 | - limitSaleHammer = limitSaleBtn && new Hammer(limitSaleBtn); | 5285 | +var limitSaleHammer = (limitSaleHammer = document.getElementById('limit-sale')) && new Hammer(limitSaleHammer); |
5286 | + | ||
5287 | +var appUrl = $('input[name="limitCodeUrl"]').val(); | ||
5287 | 5288 | ||
5288 | var dialog = require("js/me/dialog"); | 5289 | var dialog = require("js/me/dialog"); |
5289 | 5290 | ||
5291 | + | ||
5290 | //add extra marign-bottom for footer to show the yoho copyright | 5292 | //add extra marign-bottom for footer to show the yoho copyright |
5291 | function showFooter() { | 5293 | function showFooter() { |
5292 | var $cartBar = $('.cart-bar'); | 5294 | var $cartBar = $('.cart-bar'); |
@@ -5344,15 +5346,15 @@ if (goodsDiscountHammer && $discountFolder.children().length > 0) { | @@ -5344,15 +5346,15 @@ if (goodsDiscountHammer && $discountFolder.children().length > 0) { | ||
5344 | }); | 5346 | }); |
5345 | } | 5347 | } |
5346 | 5348 | ||
5347 | -limitSaleHammer ? limitSaleHammer.on('tap', function(e) { | 5349 | +limitSaleHammer && limitSaleHammer.on('tap', function(e) { |
5348 | e.srcEvent.stopPropagation(); | 5350 | e.srcEvent.stopPropagation(); |
5349 | dialog.showDialog({ | 5351 | dialog.showDialog({ |
5350 | - dialogText: '进入有货APP尖货频道分享\n以获取限购码', | 5352 | + dialogText: '打开有货APP限定发售频道\n获取限购码', |
5351 | hasFooter: { | 5353 | hasFooter: { |
5352 | rightBtnText: '打开Yoho!Buy有货APP' | 5354 | rightBtnText: '打开Yoho!Buy有货APP' |
5353 | } | 5355 | } |
5354 | }, function() { | 5356 | }, function() { |
5355 | - console.log('111'); | 5357 | + window.location.href = appUrl; |
5356 | }, undefined, true); | 5358 | }, undefined, true); |
5357 | 5359 | ||
5358 | $('.dialog-wrapper').off('touchstart').on('touchstart', function(e) { | 5360 | $('.dialog-wrapper').off('touchstart').on('touchstart', function(e) { |
@@ -5361,7 +5363,7 @@ limitSaleHammer ? limitSaleHammer.on('tap', function(e) { | @@ -5361,7 +5363,7 @@ limitSaleHammer ? limitSaleHammer.on('tap', function(e) { | ||
5361 | dialog.hideDialog(); | 5363 | dialog.hideDialog(); |
5362 | } | 5364 | } |
5363 | }); | 5365 | }); |
5364 | -}) : null; | 5366 | +}); |
5365 | 5367 | ||
5366 | require("js/product/detail/desc"); | 5368 | require("js/product/detail/desc"); |
5367 | require("js/product/detail/comments-consults"); | 5369 | require("js/product/detail/comments-consults"); |
@@ -5408,6 +5410,9 @@ var $ = require("jquery"), | @@ -5408,6 +5410,9 @@ var $ = require("jquery"), | ||
5408 | 5410 | ||
5409 | var productId = $('#productId').val(); | 5411 | var productId = $('#productId').val(); |
5410 | 5412 | ||
5413 | +var skn = $('#preferenceUrl').val().split('?')[1].split('&')[0].split('=')[1], | ||
5414 | + productCode = $('#limitProductCode').val(); | ||
5415 | + | ||
5411 | $('#likeBtn').on('touchstart', function() { | 5416 | $('#likeBtn').on('touchstart', function() { |
5412 | var opt, | 5417 | var opt, |
5413 | favorite; | 5418 | favorite; |
@@ -5462,6 +5467,7 @@ $('#likeBtn').on('touchstart', function() { | @@ -5462,6 +5467,7 @@ $('#likeBtn').on('touchstart', function() { | ||
5462 | 5467 | ||
5463 | $('#addtoCart').on('touchstart', function() { | 5468 | $('#addtoCart').on('touchstart', function() { |
5464 | $('.cart-bar').hide(); | 5469 | $('.cart-bar').hide(); |
5470 | + chosePanel.setLimitGoodModeWithSknId(productCode, skn); | ||
5465 | chosePanel.show(); | 5471 | chosePanel.show(); |
5466 | 5472 | ||
5467 | //统计代码:用于统计用户加入购物车的动作 | 5473 | //统计代码:用于统计用户加入购物车的动作 |
@@ -5474,6 +5480,7 @@ $('#addtoCart').on('touchstart', function() { | @@ -5474,6 +5480,7 @@ $('#addtoCart').on('touchstart', function() { | ||
5474 | 5480 | ||
5475 | return false; | 5481 | return false; |
5476 | }); | 5482 | }); |
5483 | + | ||
5477 | }); | 5484 | }); |
5478 | define("js/cart/chose-panel", ["jquery"], function(require, exports, module){ | 5485 | define("js/cart/chose-panel", ["jquery"], function(require, exports, module){ |
5479 | /** | 5486 | /** |
@@ -5516,12 +5523,19 @@ var $chosePanel = $('#chose-panel'), | @@ -5516,12 +5523,19 @@ var $chosePanel = $('#chose-panel'), | ||
5516 | $soonSoldOut = $('.soonSoldOut-tag'), | 5523 | $soonSoldOut = $('.soonSoldOut-tag'), |
5517 | $yohoPage = $('.yoho-page'); | 5524 | $yohoPage = $('.yoho-page'); |
5518 | 5525 | ||
5519 | -//购物车编辑标相关变量 | 5526 | +// 购物车编辑标相关变量 |
5520 | var isEdit, | 5527 | var isEdit, |
5521 | isSelected, | 5528 | isSelected, |
5522 | oldSknId; | 5529 | oldSknId; |
5523 | 5530 | ||
5524 | -//初始化购物车面板显示 | 5531 | +// 限购商品的商品码。只有限购商品时才会设置。 |
5532 | +var limitProductCode, | ||
5533 | + | ||
5534 | + // 限购商品的skn。只有限购商品时才会设置。 | ||
5535 | + skn; | ||
5536 | + | ||
5537 | + | ||
5538 | +// 初始化购物车面板显示 | ||
5525 | function init() { | 5539 | function init() { |
5526 | hasChooseColor = false; | 5540 | hasChooseColor = false; |
5527 | hasChooseSize = false; | 5541 | hasChooseSize = false; |
@@ -5555,6 +5569,21 @@ function setEditModeWithSknId(sknId, isThisGoodSelected) { | @@ -5555,6 +5569,21 @@ function setEditModeWithSknId(sknId, isThisGoodSelected) { | ||
5555 | isSelected = isThisGoodSelected; | 5569 | isSelected = isThisGoodSelected; |
5556 | } | 5570 | } |
5557 | 5571 | ||
5572 | +/* | ||
5573 | + * 设置当前面板为限购商品模式 | ||
5574 | + * | ||
5575 | + * @param {String} code 当前限购商品的商品码 | ||
5576 | + * | ||
5577 | + * @param {String} sknId. 当前限购商品的sknId | ||
5578 | + * | ||
5579 | + * @return {undefined} | ||
5580 | + */ | ||
5581 | +function setLimitGoodModeWithSknId(code, sknId) { | ||
5582 | + $('#chose-btn-sure').html('结算'); | ||
5583 | + limitProductCode = code; | ||
5584 | + skn = sknId; | ||
5585 | +} | ||
5586 | + | ||
5558 | //删除面板 | 5587 | //删除面板 |
5559 | function removePannel() { | 5588 | function removePannel() { |
5560 | var $pannel = $('.chose-panel'), | 5589 | var $pannel = $('.chose-panel'), |
@@ -5627,6 +5656,8 @@ function updateConformButtonClassAndText() { | @@ -5627,6 +5656,8 @@ function updateConformButtonClassAndText() { | ||
5627 | $chosed = $allChoseItems.find('.chosed'); | 5656 | $chosed = $allChoseItems.find('.chosed'); |
5628 | if (2 === $chosed.closest('.zero-stock').length) { | 5657 | if (2 === $chosed.closest('.zero-stock').length) { |
5629 | $('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄'); | 5658 | $('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄'); |
5659 | + } else if (limitProductCode) { | ||
5660 | + $('#chose-btn-sure').css('background-color', '#eb0313').html('结算'); | ||
5630 | } else { | 5661 | } else { |
5631 | $('#chose-btn-sure').css('background-color', '#eb0313').html(isEdit ? '确认' : '加入购物车'); | 5662 | $('#chose-btn-sure').css('background-color', '#eb0313').html(isEdit ? '确认' : '加入购物车'); |
5632 | } | 5663 | } |
@@ -5924,6 +5955,16 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -5924,6 +5955,16 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
5924 | 5955 | ||
5925 | url = '/cart/index/modify'; | 5956 | url = '/cart/index/modify'; |
5926 | 5957 | ||
5958 | + } else if (limitProductCode) { | ||
5959 | + | ||
5960 | + // 当前面板选择的是限购商品 | ||
5961 | + url = 'http://m.yohobuy.com/cart/index/orderEnsure?code=' + limitProductCode + '&&sku=' + | ||
5962 | + productSku + '&&skn=' + skn + '&&buy_num=' + buyNumber; | ||
5963 | + | ||
5964 | + //打开结算页面,结束函数执行。 | ||
5965 | + window.location.href = url; | ||
5966 | + return false; | ||
5967 | + | ||
5927 | } else { | 5968 | } else { |
5928 | cartGoodData = { | 5969 | cartGoodData = { |
5929 | productSku: productSku, | 5970 | productSku: productSku, |
@@ -5986,7 +6027,7 @@ exports.show = show; | @@ -5986,7 +6027,7 @@ exports.show = show; | ||
5986 | exports.remove = removePannel; | 6027 | exports.remove = removePannel; |
5987 | exports.setEditModeWithSknId = setEditModeWithSknId; | 6028 | exports.setEditModeWithSknId = setEditModeWithSknId; |
5988 | exports.disableNumEdit = disableNumEdit; | 6029 | exports.disableNumEdit = disableNumEdit; |
5989 | - | 6030 | +exports.setLimitGoodModeWithSknId = setLimitGoodModeWithSknId; |
5990 | 6031 | ||
5991 | }); | 6032 | }); |
5992 | define("js/plugin/inner-scroll", ["jquery"], function(require, exports, module){ | 6033 | define("js/plugin/inner-scroll", ["jquery"], function(require, exports, module){ |
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
-
Please register or login to post a comment