套餐中所有商品均只有一个颜色、一个尺码时,跳转的结算页
Showing
1 changed file
with
21 additions
and
1 deletions
@@ -1393,7 +1393,7 @@ $(function() { | @@ -1393,7 +1393,7 @@ $(function() { | ||
1393 | type: 'GET', | 1393 | type: 'GET', |
1394 | url: '/product/detail/getPacakge', | 1394 | url: '/product/detail/getPacakge', |
1395 | data: { | 1395 | data: { |
1396 | - skn: '51127118' | 1396 | + skn: skn |
1397 | } | 1397 | } |
1398 | }).then(function(result) { | 1398 | }).then(function(result) { |
1399 | if (result.code === 200 && result.data.packageData.length > 0) { | 1399 | if (result.code === 200 && result.data.packageData.length > 0) { |
@@ -1415,6 +1415,26 @@ $(function() { | @@ -1415,6 +1415,26 @@ $(function() { | ||
1415 | 1415 | ||
1416 | // 套餐点击事件 | 1416 | // 套餐点击事件 |
1417 | $('.package-box').on('click', '#buy-detail', function() { | 1417 | $('.package-box').on('click', '#buy-detail', function() { |
1418 | + var isSingle = true, | ||
1419 | + singleSkuList = []; | ||
1420 | + | ||
1421 | + for (var i = 0; i < pkgData.packageData.length; i++) { | ||
1422 | + var pData = pkgData.packageData[i]; | ||
1423 | + if(pData.colors.length === 1 && pData.colors[0].size.length === 1) { | ||
1424 | + singleSkuList.push(pData.colors[0].size[0].sku); | ||
1425 | + } else { | ||
1426 | + isSingle = false; | ||
1427 | + } | ||
1428 | + } | ||
1429 | + //如果只有套餐中商品,都只有一个颜色一个尺码,就直接跳转结算页 | ||
1430 | + if (isSingle) { | ||
1431 | + if (!window.getUid()) { | ||
1432 | + return window.jumpUrl(window.signinUrl()); | ||
1433 | + } | ||
1434 | + window.location.href = '//www.yohobuy.com/cart/easypay?bundle=' + pkgData.bundleId + '&sku=' + singleSkuList.join(','); | ||
1435 | + return true; | ||
1436 | + } | ||
1437 | + | ||
1418 | var pkgDetailTpl = require('hbs/product/package-dialog.hbs'); | 1438 | var pkgDetailTpl = require('hbs/product/package-dialog.hbs'); |
1419 | var opt = { | 1439 | var opt = { |
1420 | className: 'pkg-dialog', | 1440 | className: 'pkg-dialog', |
-
Please register or login to post a comment