Authored by 郭成尧

verify-data

@@ -15,13 +15,13 @@ var $selectBtn = $('.select-btn'), @@ -15,13 +15,13 @@ var $selectBtn = $('.select-btn'),
15 /** 15 /**
16 * 选择商品颜色等 16 * 选择商品颜色等
17 */ 17 */
18 -$selectBtn.on('click', function() { 18 +$selectBtn.on('click', function () {
19 var self = $(this); 19 var self = $(this);
20 20
21 $.post('/product/detail/info', { 21 $.post('/product/detail/info', {
22 id: self.data('id'), 22 id: self.data('id'),
23 productSkn: self.data('skn') 23 productSkn: self.data('skn')
24 - }, function(data) { 24 + }, function (data) {
25 chosePanelRender(data); 25 chosePanelRender(data);
26 chosePanel.init(self.data('skn')); 26 chosePanel.init(self.data('skn'));
27 chosePanel.show(); 27 chosePanel.show();
@@ -31,11 +31,17 @@ $selectBtn.on('click', function() { @@ -31,11 +31,17 @@ $selectBtn.on('click', function() {
31 /** 31 /**
32 * 立即购买 32 * 立即购买
33 */ 33 */
34 -$buyNowBtn.on('click', function() { 34 +$buyNowBtn.on('click', function () {
35 var bundleGoods = [], 35 var bundleGoods = [],
36 - bundleId = $('#activityId').val(); 36 + bundleId = $('#activityId').val(),
  37 + gskn = $('span[id^="gskn"]');
37 38
38 - $('span[id^="gskn"]').each(function() { 39 + if (gskn.length < 1) {
  40 + tip.show('非法请求!');
  41 + return;
  42 + }
  43 +
  44 + gskn.each(function () {
39 if (!$(this).data('sku')) { 45 if (!$(this).data('sku')) {
40 tip.show('请为套餐商品选择属性'); 46 tip.show('请为套餐商品选择属性');
41 return; 47 return;
@@ -43,6 +49,7 @@ $buyNowBtn.on('click', function() { @@ -43,6 +49,7 @@ $buyNowBtn.on('click', function() {
43 49
44 bundleGoods.push({ 50 bundleGoods.push({
45 type: 'bundle', 51 type: 'bundle',
  52 + skn: $(this).data('skn'),
46 sku: $(this).data('sku'), 53 sku: $(this).data('sku'),
47 buy_number: 1 54 buy_number: 1
48 }); 55 });
@@ -53,6 +60,6 @@ $buyNowBtn.on('click', function() { @@ -53,6 +60,6 @@ $buyNowBtn.on('click', function() {
53 bundleId: bundleId 60 bundleId: bundleId
54 })); 61 }));
55 62
56 - window.location.href = '/cart/index/orderEnsure?cartType=ordinary&bundleId=' +  
57 - bundleId; 63 + window.location.href =
  64 + '/cart/index/orderEnsure?cartType=ordinary&bundleId=' + bundleId;
58 }); 65 });