code review by hf: fixes some bugs
Showing
8 changed files
with
119 additions
and
100 deletions
@@ -2376,6 +2376,8 @@ var tip = require("js/plugin/tip"); | @@ -2376,6 +2376,8 @@ var tip = require("js/plugin/tip"); | ||
2376 | var trim = $.trim; | 2376 | var trim = $.trim; |
2377 | var showErrTip = tip.show; | 2377 | var showErrTip = tip.show; |
2378 | 2378 | ||
2379 | +var requested = false; | ||
2380 | + | ||
2379 | api.selectCssHack($('#country-select')); | 2381 | api.selectCssHack($('#country-select')); |
2380 | 2382 | ||
2381 | api.bindClearEvt(); | 2383 | api.bindClearEvt(); |
@@ -2400,7 +2402,15 @@ $btnNext.on('touchstart', function() { | @@ -2400,7 +2402,15 @@ $btnNext.on('touchstart', function() { | ||
2400 | return; | 2402 | return; |
2401 | } | 2403 | } |
2402 | 2404 | ||
2405 | + if (requested) { | ||
2406 | + return false; | ||
2407 | + } | ||
2408 | + | ||
2409 | + | ||
2403 | if (api.phoneRegx[areaCode].test(pn)) { | 2410 | if (api.phoneRegx[areaCode].test(pn)) { |
2411 | + | ||
2412 | + requested = true; | ||
2413 | + | ||
2404 | $.ajax({ | 2414 | $.ajax({ |
2405 | url: '/passport/reg/verifymobile', | 2415 | url: '/passport/reg/verifymobile', |
2406 | type: 'POST', | 2416 | type: 'POST', |
@@ -2413,13 +2423,19 @@ $btnNext.on('touchstart', function() { | @@ -2413,13 +2423,19 @@ $btnNext.on('touchstart', function() { | ||
2413 | location.href = data.data; | 2423 | location.href = data.data; |
2414 | } else { | 2424 | } else { |
2415 | showErrTip(data.message); | 2425 | showErrTip(data.message); |
2426 | + requested = false; | ||
2416 | } | 2427 | } |
2428 | + }, | ||
2429 | + error: function(err) { | ||
2430 | + showErrTip('出错了,请重试'); | ||
2431 | + requested = false; | ||
2417 | } | 2432 | } |
2418 | }); | 2433 | }); |
2419 | } else { | 2434 | } else { |
2420 | showErrTip('手机号格式不正确,请重新输入'); | 2435 | showErrTip('手机号格式不正确,请重新输入'); |
2421 | } | 2436 | } |
2422 | }); | 2437 | }); |
2438 | + | ||
2423 | }); | 2439 | }); |
2424 | define("js/passport/api", ["jquery"], function(require, exports, module){ | 2440 | define("js/passport/api", ["jquery"], function(require, exports, module){ |
2425 | /** | 2441 | /** |
@@ -3340,14 +3356,14 @@ var api = require("js/passport/api"), | @@ -3340,14 +3356,14 @@ var api = require("js/passport/api"), | ||
3340 | var trim = $.trim; | 3356 | var trim = $.trim; |
3341 | var showErrTip = tip.show; | 3357 | var showErrTip = tip.show; |
3342 | 3358 | ||
3343 | -var requesting = false; | 3359 | +var requested = false; |
3344 | 3360 | ||
3345 | function nextStep(url, mobileNo, areaCode) { | 3361 | function nextStep(url, mobileNo, areaCode) { |
3346 | - if (requesting) { | 3362 | + if (requested) { |
3347 | return false; | 3363 | return false; |
3348 | } | 3364 | } |
3349 | 3365 | ||
3350 | - requesting = true; | 3366 | + requested = true; |
3351 | 3367 | ||
3352 | $.ajax({ | 3368 | $.ajax({ |
3353 | type: 'POST', | 3369 | type: 'POST', |
@@ -3359,13 +3375,10 @@ function nextStep(url, mobileNo, areaCode) { | @@ -3359,13 +3375,10 @@ function nextStep(url, mobileNo, areaCode) { | ||
3359 | success: function(res) { | 3375 | success: function(res) { |
3360 | console.log(res.data); | 3376 | console.log(res.data); |
3361 | location.href = url; | 3377 | location.href = url; |
3362 | - | ||
3363 | - requesting = false; | ||
3364 | }, | 3378 | }, |
3365 | error: function() { | 3379 | error: function() { |
3366 | tip.show('出错了,请重试!'); | 3380 | tip.show('出错了,请重试!'); |
3367 | - | ||
3368 | - requesting = false; | 3381 | + requested = false; |
3369 | } | 3382 | } |
3370 | }); | 3383 | }); |
3371 | } | 3384 | } |
@@ -5152,6 +5165,9 @@ function showFooter() { | @@ -5152,6 +5165,9 @@ function showFooter() { | ||
5152 | }, 200); | 5165 | }, 200); |
5153 | } | 5166 | } |
5154 | 5167 | ||
5168 | +if ($('#goodsDiscount h1').length < 1) { | ||
5169 | + $('.dropdown').remove(); | ||
5170 | +} | ||
5155 | showFooter(); | 5171 | showFooter(); |
5156 | 5172 | ||
5157 | lazyLoad($('img.lazy')); | 5173 | lazyLoad($('img.lazy')); |
@@ -5703,7 +5719,7 @@ function resetColorZeroStock($siblingBlock) { | @@ -5703,7 +5719,7 @@ function resetColorZeroStock($siblingBlock) { | ||
5703 | 5719 | ||
5704 | // 选择了颜色切换商品图片 | 5720 | // 选择了颜色切换商品图片 |
5705 | function changeGoodImgWhenClickColor() { | 5721 | function changeGoodImgWhenClickColor() { |
5706 | - if (hasChooseColor && curColorIndex) { | 5722 | + if (hasChooseColor && curColorIndex >= 0) { |
5707 | $imgsThumb.addClass('hide').eq(curColorIndex).removeClass('hide'); | 5723 | $imgsThumb.addClass('hide').eq(curColorIndex).removeClass('hide'); |
5708 | } | 5724 | } |
5709 | } | 5725 | } |
@@ -5790,6 +5806,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() { | @@ -5790,6 +5806,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() { | ||
5790 | // 当前颜色块 切换勾选样式 | 5806 | // 当前颜色块 切换勾选样式 |
5791 | $this.toggleClass('chosed'); | 5807 | $this.toggleClass('chosed'); |
5792 | curColorIndex = index; | 5808 | curColorIndex = index; |
5809 | + $('#good-num').val(1); | ||
5793 | 5810 | ||
5794 | // 设置按钮的样式和文字 | 5811 | // 设置按钮的样式和文字 |
5795 | updateConformButtonClassAndText(); | 5812 | updateConformButtonClassAndText(); |
@@ -5841,6 +5858,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() { | @@ -5841,6 +5858,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() { | ||
5841 | $this.toggleClass('chosed'); | 5858 | $this.toggleClass('chosed'); |
5842 | curSizeIndex = index; | 5859 | curSizeIndex = index; |
5843 | $curSizeBlock = $this; | 5860 | $curSizeBlock = $this; |
5861 | + $('#good-num').val(1); | ||
5844 | 5862 | ||
5845 | // 设置按钮的样式和文字 | 5863 | // 设置按钮的样式和文字 |
5846 | updateConformButtonClassAndText(); | 5864 | updateConformButtonClassAndText(); |
@@ -5859,6 +5877,11 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -5859,6 +5877,11 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
5859 | } | 5877 | } |
5860 | 5878 | ||
5861 | if (num === 1 || 0 === leftNum - 0) { | 5879 | if (num === 1 || 0 === leftNum - 0) { |
5880 | + tip.show('您选择的数量不能为零~'); | ||
5881 | + return; | ||
5882 | + } | ||
5883 | + if (num < 0) { | ||
5884 | + tip.show('您选择的数量不能为零~'); | ||
5862 | return; | 5885 | return; |
5863 | } | 5886 | } |
5864 | 5887 | ||
@@ -5878,8 +5901,8 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -5878,8 +5901,8 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
5878 | } | 5901 | } |
5879 | 5902 | ||
5880 | //TODO:库存数验证 | 5903 | //TODO:库存数验证 |
5881 | - if (num > leftNum) { | ||
5882 | - $num.val(leftNum); | 5904 | + if (num > leftNum - 1) { |
5905 | + tip.show('您选择的数量超过了最大库存量~'); | ||
5883 | return; | 5906 | return; |
5884 | } | 5907 | } |
5885 | $num.val(num + 1); | 5908 | $num.val(num + 1); |
@@ -5890,17 +5913,12 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -5890,17 +5913,12 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
5890 | 5913 | ||
5891 | promotionId, | 5914 | promotionId, |
5892 | isEdit = 0, | 5915 | isEdit = 0, |
5893 | - numInCart = $('.num-tag').html() - 0, | ||
5894 | num = parseInt($num.val(), 10); | 5916 | num = parseInt($num.val(), 10); |
5895 | 5917 | ||
5896 | //颜色尺码没有选择 | 5918 | //颜色尺码没有选择 |
5897 | if (!checkColorSizeNum()) { | 5919 | if (!checkColorSizeNum()) { |
5898 | return; | 5920 | return; |
5899 | } | 5921 | } |
5900 | - if (isNaN(num)) { | ||
5901 | - tip.show('您选择的数量不是一个数字~'); | ||
5902 | - return; | ||
5903 | - } | ||
5904 | 5922 | ||
5905 | //TODO status change | 5923 | //TODO status change |
5906 | if ($('#chose-btn-sure').html() === '已售罄') { | 5924 | if ($('#chose-btn-sure').html() === '已售罄') { |
@@ -5913,7 +5931,10 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -5913,7 +5931,10 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
5913 | tip.show('您选择的数量超过了最大库存量~'); | 5931 | tip.show('您选择的数量超过了最大库存量~'); |
5914 | return; | 5932 | return; |
5915 | } | 5933 | } |
5916 | - | 5934 | + if (num < 0) { |
5935 | + tip.show('您选择的数量小于一件~'); | ||
5936 | + return; | ||
5937 | + } | ||
5917 | $chosed = $('.block-list>ul>li.chosed'); | 5938 | $chosed = $('.block-list>ul>li.chosed'); |
5918 | 5939 | ||
5919 | if (2 === $chosed.length && 0 === $chosed.closest('.zero-stock').length) { | 5940 | if (2 === $chosed.length && 0 === $chosed.closest('.zero-stock').length) { |
@@ -5936,9 +5957,15 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -5936,9 +5957,15 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
5936 | cartType: queryString.cartType | 5957 | cartType: queryString.cartType |
5937 | } | 5958 | } |
5938 | }).done(function(res) { | 5959 | }).done(function(res) { |
5960 | + var cartNum; | ||
5961 | + | ||
5939 | loading.hideLoadingMask(); | 5962 | loading.hideLoadingMask(); |
5940 | if (res.code === 200) { | 5963 | if (res.code === 200) { |
5941 | - $('.num-tag').html(numInCart + buyNumber).removeClass('hide'); | 5964 | + cartNum = res.data.goods_count; |
5965 | + if (cartNum > 99) { | ||
5966 | + cartNum = '99+'; | ||
5967 | + } | ||
5968 | + $('.num-tag').html(cartNum).removeClass('hide'); | ||
5942 | confirming = false; | 5969 | confirming = false; |
5943 | 5970 | ||
5944 | if (cbFn) { | 5971 | if (cbFn) { |
@@ -6448,13 +6475,10 @@ optHammer.on('tap', function(e) { | @@ -6448,13 +6475,10 @@ optHammer.on('tap', function(e) { | ||
6448 | }).then(function(res) { | 6475 | }).then(function(res) { |
6449 | $('#dialog-wrapper').hide(); | 6476 | $('#dialog-wrapper').hide(); |
6450 | if (!res) { | 6477 | if (!res) { |
6451 | - tip.show('网络错误'); | ||
6452 | return; | 6478 | return; |
6453 | } | 6479 | } |
6454 | - if (res.code === 200) { | ||
6455 | - tip.show('删除成功'); | ||
6456 | - } else { | ||
6457 | - tip.show(res.message || '网络错误'); | 6480 | + if (res.message) { |
6481 | + tip.show(res.message); | ||
6458 | } | 6482 | } |
6459 | window.location.href = '/home/orders'; | 6483 | window.location.href = '/home/orders'; |
6460 | }).fail(function() { | 6484 | }).fail(function() { |
@@ -6480,13 +6504,10 @@ optHammer.on('tap', function(e) { | @@ -6480,13 +6504,10 @@ optHammer.on('tap', function(e) { | ||
6480 | }).then(function(res) { | 6504 | }).then(function(res) { |
6481 | $('#dialog-wrapper').hide(); | 6505 | $('#dialog-wrapper').hide(); |
6482 | if (!res) { | 6506 | if (!res) { |
6483 | - tip.show('网络错误'); | ||
6484 | return; | 6507 | return; |
6485 | } | 6508 | } |
6486 | - if (res.code === 200) { | ||
6487 | - tip.show('取消成功'); | ||
6488 | - } else { | ||
6489 | - tip.show(res.message || '网络错误'); | 6509 | + if (res.message) { |
6510 | + tip.show(res.message); | ||
6490 | } | 6511 | } |
6491 | window.location.href = '/home/orders'; | 6512 | window.location.href = '/home/orders'; |
6492 | }).fail(function() { | 6513 | }).fail(function() { |
@@ -8615,7 +8636,7 @@ var $cartContent = $('.cart-content'); | @@ -8615,7 +8636,7 @@ var $cartContent = $('.cart-content'); | ||
8615 | var navHammer, | 8636 | var navHammer, |
8616 | cartType = $('#cartType').val(); | 8637 | cartType = $('#cartType').val(); |
8617 | 8638 | ||
8618 | -var hasChecked = $('.cart-goods .icon-cb-checked').length > 0 ? true : false; //是否有选中商品 | 8639 | +var hasChecked = $('.cart-content:not(.hide) .icon-cb-checked').length > 0 ? true : false; //是否有选中商品 |
8619 | 8640 | ||
8620 | require("js/cart/good"); | 8641 | require("js/cart/good"); |
8621 | 8642 | ||
@@ -8664,6 +8685,11 @@ $('.freebie').on('touchend', function() { | @@ -8664,6 +8685,11 @@ $('.freebie').on('touchend', function() { | ||
8664 | }); | 8685 | }); |
8665 | 8686 | ||
8666 | $('.btn-balance').on('touchend', function() { | 8687 | $('.btn-balance').on('touchend', function() { |
8688 | + if ($('.low-stocks').length > 0) { | ||
8689 | + tip.show('库存不足无法结算'); | ||
8690 | + return false; | ||
8691 | + } | ||
8692 | + | ||
8667 | if (hasChecked) { | 8693 | if (hasChecked) { |
8668 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; | 8694 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; |
8669 | } else { | 8695 | } else { |
@@ -8726,6 +8752,13 @@ $('.shopping-cart-good .name').each(function() { | @@ -8726,6 +8752,13 @@ $('.shopping-cart-good .name').each(function() { | ||
8726 | this.mlellipsis(2); | 8752 | this.mlellipsis(2); |
8727 | }); | 8753 | }); |
8728 | 8754 | ||
8755 | +function GoodInfo(properties) { | ||
8756 | + this.goods_type = properties.goods_type; | ||
8757 | + this.buy_number = properties.buy_number; | ||
8758 | + this.product_sku = properties.product_sku; | ||
8759 | + this.selected = properties.selected; | ||
8760 | +} | ||
8761 | + | ||
8729 | //TIP:事件委托在.cart-goods,商品列表的容器统一需要有.cart-goods | 8762 | //TIP:事件委托在.cart-goods,商品列表的容器统一需要有.cart-goods |
8730 | $('.cart-goods').on('touchstart', '.checkbox', function() { | 8763 | $('.cart-goods').on('touchstart', '.checkbox', function() { |
8731 | var $this = $(this), | 8764 | var $this = $(this), |
@@ -8733,30 +8766,14 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -8733,30 +8766,14 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
8733 | id = $good.data('id'); | 8766 | id = $good.data('id'); |
8734 | 8767 | ||
8735 | var goodsList = [], | 8768 | var goodsList = [], |
8736 | - goodInfo = {}, | ||
8737 | - isSelected = true; | ||
8738 | - | ||
8739 | - if ($this.hasClass('icon-cb-checked')) { | ||
8740 | - isSelected = true; | ||
8741 | - } else { | ||
8742 | - isSelected = false; | ||
8743 | - } | ||
8744 | - | ||
8745 | - function GoodInfo(properties) { | ||
8746 | - this.goods_type = properties.goods_type; | ||
8747 | - this.buy_number = properties.buy_number; | ||
8748 | - this.product_sku = properties.product_sku; | ||
8749 | - this.selected = properties.selected; | ||
8750 | - } | 8769 | + goodInfo = {}; |
8751 | 8770 | ||
8752 | goodInfo.goods_type = cartType; | 8771 | goodInfo.goods_type = cartType; |
8753 | - goodInfo.selected = isSelected ? 'N' : 'Y'; | 8772 | + goodInfo.selected = $this.hasClass('icon-cb-checked') ? 'N' : 'Y'; |
8754 | goodInfo.product_sku = id; | 8773 | goodInfo.product_sku = id; |
8755 | goodInfo.buy_number = $good.find('.count').eq(0).text().trim().replace('×', ''); | 8774 | goodInfo.buy_number = $good.find('.count').eq(0).text().trim().replace('×', ''); |
8756 | - | ||
8757 | goodsList.push(new GoodInfo(goodInfo)); | 8775 | goodsList.push(new GoodInfo(goodInfo)); |
8758 | 8776 | ||
8759 | - | ||
8760 | $.ajax({ | 8777 | $.ajax({ |
8761 | type: 'post', | 8778 | type: 'post', |
8762 | url: 'select', | 8779 | url: 'select', |
@@ -8789,8 +8806,8 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -8789,8 +8806,8 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
8789 | rightBtnText: '确定' | 8806 | rightBtnText: '确定' |
8790 | } | 8807 | } |
8791 | }, function() { | 8808 | }, function() { |
8792 | - var id = $this.closest('.shopping-cart-good').data('id'); | ||
8793 | - var count = $this.data('count'); | 8809 | + var id = $this.closest('.shopping-cart-good').data('id'), |
8810 | + count = $this.data('count'); | ||
8794 | 8811 | ||
8795 | $.ajax({ | 8812 | $.ajax({ |
8796 | method: 'post', | 8813 | method: 'post', |
@@ -8816,7 +8833,6 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -8816,7 +8833,6 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
8816 | tip.show('网络异常'); | 8833 | tip.show('网络异常'); |
8817 | }); | 8834 | }); |
8818 | }); | 8835 | }); |
8819 | - | ||
8820 | }); | 8836 | }); |
8821 | 8837 | ||
8822 | function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) { | 8838 | function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) { |
@@ -8837,7 +8853,7 @@ function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) { | @@ -8837,7 +8853,7 @@ function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) { | ||
8837 | tip.show(res.message); | 8853 | tip.show(res.message); |
8838 | } | 8854 | } |
8839 | }, | 8855 | }, |
8840 | - error: function(err) { | 8856 | + error: function() { |
8841 | tip.show('网络异常'); | 8857 | tip.show('网络异常'); |
8842 | }, | 8858 | }, |
8843 | complete: function() { | 8859 | complete: function() { |
@@ -8873,17 +8889,10 @@ function didUpdateAllGoodsCheckStatus() { | @@ -8873,17 +8889,10 @@ function didUpdateAllGoodsCheckStatus() { | ||
8873 | } | 8889 | } |
8874 | 8890 | ||
8875 | function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { | 8891 | function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { |
8876 | - var goodInfo = {}; | ||
8877 | - var $goods = $('.cart-content:not(.hide) .shopping-cart-good'); | ||
8878 | - var $good = null; | ||
8879 | - var goodsList = []; | ||
8880 | - | ||
8881 | - function GoodInfo(properties) { | ||
8882 | - this.goods_type = properties.goods_type; | ||
8883 | - this.buy_number = properties.buy_number; | ||
8884 | - this.product_sku = properties.product_sku; | ||
8885 | - this.selected = properties.selected; | ||
8886 | - } | 8892 | + var goodInfo = {}, |
8893 | + $goods = $('.cart-content:not(.hide) .shopping-cart-good'), | ||
8894 | + $good = null, | ||
8895 | + goodsList = []; | ||
8887 | 8896 | ||
8888 | goodInfo.goods_type = type; | 8897 | goodInfo.goods_type = type; |
8889 | goodInfo.selected = isSelected ? 'N' : 'Y'; | 8898 | goodInfo.selected = isSelected ? 'N' : 'Y'; |
@@ -8900,26 +8909,9 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { | @@ -8900,26 +8909,9 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { | ||
8900 | requestUpdateAllGoodsCheckStatus(goodsList, handlerAfterTouch); | 8909 | requestUpdateAllGoodsCheckStatus(goodsList, handlerAfterTouch); |
8901 | } | 8910 | } |
8902 | 8911 | ||
8903 | - | ||
8904 | - | ||
8905 | -//是否要全选 | ||
8906 | -function willBeSelected($this) { | ||
8907 | - var isSelected = true; | ||
8908 | - | ||
8909 | - if ($this.hasClass('icon-cb-checked')) { | ||
8910 | - isSelected = true; | ||
8911 | - } else { | ||
8912 | - isSelected = false; | ||
8913 | - } | ||
8914 | - | ||
8915 | - return isSelected; | ||
8916 | -} | ||
8917 | - | ||
8918 | //全选按钮点击事件 | 8912 | //全选按钮点击事件 |
8919 | $selectAllBtn.on('touchend', function() { | 8913 | $selectAllBtn.on('touchend', function() { |
8920 | - var $this = $(this); | ||
8921 | - | ||
8922 | - bottomCheckBoxHandeler(willBeSelected($this), cartType, didUpdateAllGoodsCheckStatus); | 8914 | + bottomCheckBoxHandeler($(this).hasClass('icon-cb-checked'), cartType, didUpdateAllGoodsCheckStatus); |
8923 | }); | 8915 | }); |
8924 | 8916 | ||
8925 | $('.down').on('touchend', function() { | 8917 | $('.down').on('touchend', function() { |
@@ -8973,7 +8965,7 @@ exports.orderInfo = function(key, value) { | @@ -8973,7 +8965,7 @@ exports.orderInfo = function(key, value) { | ||
8973 | }; | 8965 | }; |
8974 | 8966 | ||
8975 | }); | 8967 | }); |
8976 | -define("js/cart/gift-advance", ["jquery","lazyload"], function(require, exports, module){ | 8968 | +define("js/cart/gift-advance", ["jquery","lazyload","hammer"], function(require, exports, module){ |
8977 | /** | 8969 | /** |
8978 | * 赠品/加价购 | 8970 | * 赠品/加价购 |
8979 | * @author: xuqi<qi.xu@yoho.cn> | 8971 | * @author: xuqi<qi.xu@yoho.cn> |
@@ -8982,6 +8974,7 @@ define("js/cart/gift-advance", ["jquery","lazyload"], function(require, exports, | @@ -8982,6 +8974,7 @@ define("js/cart/gift-advance", ["jquery","lazyload"], function(require, exports, | ||
8982 | 8974 | ||
8983 | var $ = require("jquery"), | 8975 | var $ = require("jquery"), |
8984 | lazyLoad = require("lazyload"), | 8976 | lazyLoad = require("lazyload"), |
8977 | + Hammer = require("hammer"), | ||
8985 | tip = require("js/plugin/tip"), | 8978 | tip = require("js/plugin/tip"), |
8986 | loading = require("js/plugin/loading"), | 8979 | loading = require("js/plugin/loading"), |
8987 | chosePanel = require("js/cart/chose-panel"); | 8980 | chosePanel = require("js/cart/chose-panel"); |
@@ -9011,14 +9004,26 @@ function getProductInfo(skn, promotionId) { | @@ -9011,14 +9004,26 @@ function getProductInfo(skn, promotionId) { | ||
9011 | }); | 9004 | }); |
9012 | } | 9005 | } |
9013 | 9006 | ||
9014 | -$page.on('touchend', '.chose', function() { | ||
9015 | - var $this = $(this), | ||
9016 | - id = $this.closest('.gift-advance-good').data('id'), | ||
9017 | - promotionId = $this.closest('.advance-block').data('promotion-id'); | 9007 | +$page.find('.chose').each(function(i, elem) { |
9008 | + var choseHammer = new Hammer(elem); | ||
9018 | 9009 | ||
9019 | - getProductInfo(id, promotionId); | 9010 | + choseHammer.on('tap', function(e) { |
9011 | + var $this = $(e.target), | ||
9012 | + id = $this.closest('.gift-advance-good').data('id'), | ||
9013 | + promotionId = $this.closest('.advance-block').data('promotion-id'); | ||
9014 | + | ||
9015 | + getProductInfo(id, promotionId); | ||
9016 | + }); | ||
9020 | }); | 9017 | }); |
9021 | 9018 | ||
9019 | +// $page.on('touchend', '.chose', function() { | ||
9020 | +// var $this = $(this), | ||
9021 | +// id = $this.closest('.gift-advance-good').data('id'), | ||
9022 | +// promotionId = $this.closest('.advance-block').data('promotion-id'); | ||
9023 | +// | ||
9024 | +// getProductInfo(id, promotionId); | ||
9025 | +// }); | ||
9026 | + | ||
9022 | }); | 9027 | }); |
9023 | define("js/cart/order-ensure", ["jquery","lazyload","hammer","handlebars","source-map"], function(require, exports, module){ | 9028 | define("js/cart/order-ensure", ["jquery","lazyload","hammer","handlebars","source-map"], function(require, exports, module){ |
9024 | /** | 9029 | /** |
@@ -9116,8 +9121,7 @@ function orderCompute() { | @@ -9116,8 +9121,7 @@ function orderCompute() { | ||
9116 | }).then(function(res) { | 9121 | }).then(function(res) { |
9117 | var priceHtml; | 9122 | var priceHtml; |
9118 | 9123 | ||
9119 | - if (!res) { | ||
9120 | - tip.show('网络出错'); | 9124 | + if ($.type(res) !== 'object') { |
9121 | window.location.reload(); | 9125 | window.location.reload(); |
9122 | } else { | 9126 | } else { |
9123 | /*if (res.order_amount) { | 9127 | /*if (res.order_amount) { |
@@ -9129,8 +9133,12 @@ function orderCompute() { | @@ -9129,8 +9133,12 @@ function orderCompute() { | ||
9129 | if (res.last_order_amount) { | 9133 | if (res.last_order_amount) { |
9130 | res.last_order_amount = (+res.last_order_amount).toFixed(2); | 9134 | res.last_order_amount = (+res.last_order_amount).toFixed(2); |
9131 | } | 9135 | } |
9132 | - $coinCheck.find('em').html('- ¥ ' + res.use_yoho_coin); | ||
9133 | - $coinUsed.html('已抵¥' + res.use_yoho_coin); | 9136 | + if (res.use_yoho_coin) { |
9137 | + $coinCheck.find('em').html('- ¥ ' + res.use_yoho_coin); | ||
9138 | + $coinUsed.html('已抵¥' + res.use_yoho_coin); | ||
9139 | + $coinCheck.find('em').show(); | ||
9140 | + $coinUsed.show(); | ||
9141 | + } | ||
9134 | priceHtml = priceTmpl({ | 9142 | priceHtml = priceTmpl({ |
9135 | cartPayData: res.promotion_formula_list, | 9143 | cartPayData: res.promotion_formula_list, |
9136 | price: res.last_order_amount | 9144 | price: res.last_order_amount |
@@ -9139,7 +9147,6 @@ function orderCompute() { | @@ -9139,7 +9147,6 @@ function orderCompute() { | ||
9139 | $price.html(priceHtml); | 9147 | $price.html(priceHtml); |
9140 | } | 9148 | } |
9141 | }).fail(function() { | 9149 | }).fail(function() { |
9142 | - tip.show('网络出错'); | ||
9143 | window.location.reload(); | 9150 | window.location.reload(); |
9144 | }); | 9151 | }); |
9145 | } | 9152 | } |
@@ -9186,7 +9193,6 @@ function submitOrder() { | @@ -9186,7 +9193,6 @@ function submitOrder() { | ||
9186 | var url; | 9193 | var url; |
9187 | 9194 | ||
9188 | if (!res) { | 9195 | if (!res) { |
9189 | - loading.hideLoadingMask(); | ||
9190 | tip.show('网络出错'); | 9196 | tip.show('网络出错'); |
9191 | return; | 9197 | return; |
9192 | } | 9198 | } |
@@ -9200,13 +9206,13 @@ function submitOrder() { | @@ -9200,13 +9206,13 @@ function submitOrder() { | ||
9200 | } | 9206 | } |
9201 | window.setCookie('order-info', ''); | 9207 | window.setCookie('order-info', ''); |
9202 | window.location.href = url; | 9208 | window.location.href = url; |
9203 | - } else { | ||
9204 | - loading.hideLoadingMask(); | ||
9205 | - tip.show(res.message || '网络出错'); | 9209 | + } else if (res.message) { |
9210 | + tip.show(res.message); | ||
9206 | } | 9211 | } |
9207 | }).fail(function() { | 9212 | }).fail(function() { |
9208 | - loading.hideLoadingMask(); | ||
9209 | tip.show('网络出错'); | 9213 | tip.show('网络出错'); |
9214 | + }).always(function() { | ||
9215 | + loading.hideLoadingMask(); | ||
9210 | }); | 9216 | }); |
9211 | } | 9217 | } |
9212 | 9218 | ||
@@ -9238,9 +9244,7 @@ $('.coin').on('touchend', function() { | @@ -9238,9 +9244,7 @@ $('.coin').on('touchend', function() { | ||
9238 | 9244 | ||
9239 | if ($this.find('.checkbox').hasClass('icon-cb-checked')) { | 9245 | if ($this.find('.checkbox').hasClass('icon-cb-checked')) { |
9240 | orderInfo('yohoCoin', $this.data('yoho-coin')); | 9246 | orderInfo('yohoCoin', $this.data('yoho-coin')); |
9241 | - $this.find('.coin-check em').show(); | ||
9242 | $this.find('.can-use').hide(); | 9247 | $this.find('.can-use').hide(); |
9243 | - $this.find('.used').show(); | ||
9244 | } else { | 9248 | } else { |
9245 | orderInfo('yohoCoin', 0); | 9249 | orderInfo('yohoCoin', 0); |
9246 | $this.find('.coin-check em').hide(); | 9250 | $this.find('.coin-check em').hide(); |
@@ -9349,6 +9353,16 @@ $('#coupon-list').on('touchend', '.employ-main', function() { | @@ -9349,6 +9353,16 @@ $('#coupon-list').on('touchend', '.employ-main', function() { | ||
9349 | 9353 | ||
9350 | orderInfo('couponCode', $this.data('coupon-code')); | 9354 | orderInfo('couponCode', $this.data('coupon-code')); |
9351 | orderInfo('couponName', $this.data('coupon-name')); | 9355 | orderInfo('couponName', $this.data('coupon-name')); |
9356 | +}).on('touchstart', '.employ-main', function() { | ||
9357 | + var $this = $(this); | ||
9358 | + | ||
9359 | + $this.siblings().removeClass('focus'); | ||
9360 | + $this.addClass('focus'); | ||
9361 | +}).on('touchend touchcancel', '.employ-main', function() { | ||
9362 | + var $this = $(this); | ||
9363 | + | ||
9364 | + $this.siblings().removeClass('focus'); | ||
9365 | + $this.removeClass('focus'); | ||
9352 | }); | 9366 | }); |
9353 | 9367 | ||
9354 | $('body').on('touchend', '.not-use', function() { | 9368 | $('body').on('touchend', '.not-use', function() { |
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
No preview for this file type
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > | 2 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > |
3 | <svg xmlns="http://www.w3.org/2000/svg"> | 3 | <svg xmlns="http://www.w3.org/2000/svg"> |
4 | <metadata> | 4 | <metadata> |
5 | -Created by FontForge 20120731 at Thu Dec 17 13:53:30 2015 | 5 | +Created by FontForge 20120731 at Mon Dec 21 17:16:11 2015 |
6 | By Ads | 6 | By Ads |
7 | </metadata> | 7 | </metadata> |
8 | <defs> | 8 | <defs> |
@@ -16,10 +16,10 @@ Created by FontForge 20120731 at Thu Dec 17 13:53:30 2015 | @@ -16,10 +16,10 @@ Created by FontForge 20120731 at Thu Dec 17 13:53:30 2015 | ||
16 | ascent="896" | 16 | ascent="896" |
17 | descent="-128" | 17 | descent="-128" |
18 | x-height="792" | 18 | x-height="792" |
19 | - bbox="-0.75 -224 3943 833" | 19 | + bbox="-0.75 -224 3943 893" |
20 | underline-thickness="50" | 20 | underline-thickness="50" |
21 | underline-position="-100" | 21 | underline-position="-100" |
22 | - unicode-range="U+0078-E640" | 22 | + unicode-range="U+0078-E641" |
23 | /> | 23 | /> |
24 | <missing-glyph horiz-adv-x="374" | 24 | <missing-glyph horiz-adv-x="374" |
25 | d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" /> | 25 | d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" /> |
@@ -263,5 +263,10 @@ q0 -2 2 -5l15 -32q9 -30 39 -38v-3h392l18 1v2q14 4 24.5 14t14.5 24l98 217q40 77 1 | @@ -263,5 +263,10 @@ q0 -2 2 -5l15 -32q9 -30 39 -38v-3h392l18 1v2q14 4 24.5 14t14.5 24l98 217q40 77 1 | ||
263 | q0 7 3 12.5t9 9t12 3.5h119l3 -1h2q1 0 2 -1l4 -2q2 -1 4 -3q1 -1 2 -1.5t1 -1.5l4 -6l38 -83h619q8 0 10 -3q3 -6 1 -19t-7.5 -29.5t-13.5 -31.5zM470 107q-33 0 -56.5 -23t-23.5 -56q0 -22 10.5 -40.5t29 -29t40.5 -10.5q33 0 56.5 23.5t23.5 56.5t-23.5 56t-56.5 23z | 263 | q0 7 3 12.5t9 9t12 3.5h119l3 -1h2q1 0 2 -1l4 -2q2 -1 4 -3q1 -1 2 -1.5t1 -1.5l4 -6l38 -83h619q8 0 10 -3q3 -6 1 -19t-7.5 -29.5t-13.5 -31.5zM470 107q-33 0 -56.5 -23t-23.5 -56q0 -22 10.5 -40.5t29 -29t40.5 -10.5q33 0 56.5 23.5t23.5 56.5t-23.5 56t-56.5 23z |
264 | M470 -23q-21 0 -36 15t-15 36t15 36t36 15q14 0 25.5 -7t18.5 -19t7 -25q0 -22 -15 -36.5t-36 -14.5zM747 107q-33 0 -56.5 -23t-23.5 -56q0 -22 10.5 -40.5t29 -29t40.5 -10.5q33 0 56.5 23.5t23.5 56.5t-23.5 56t-56.5 23zM747 -23q-14 0 -26 6.5t-18.5 18.5t-6.5 25.5 | 264 | M470 -23q-21 0 -36 15t-15 36t15 36t36 15q14 0 25.5 -7t18.5 -19t7 -25q0 -22 -15 -36.5t-36 -14.5zM747 107q-33 0 -56.5 -23t-23.5 -56q0 -22 10.5 -40.5t29 -29t40.5 -10.5q33 0 56.5 23.5t23.5 56.5t-23.5 56t-56.5 23zM747 -23q-14 0 -26 6.5t-18.5 18.5t-6.5 25.5 |
265 | t6.5 25.5t18.5 19t26 7q21 0 36 -15t15 -36t-15 -36t-36 -15z" /> | 265 | t6.5 25.5t18.5 19t26 7q21 0 36 -15t15 -36t-15 -36t-36 -15z" /> |
266 | + <glyph glyph-name="uniE641" unicode="" horiz-adv-x="1045" | ||
267 | +d="M522 893q-103 0 -197 -40t-162 -108t-108.5 -162t-40.5 -197.5t40.5 -197.5t108.5 -162t162 -108t197.5 -40t197.5 40t162 108t108 162t40 197.5t-40 197.5t-108 162t-162 108t-198 40zM522 -49q-88 0 -168.5 34.5t-138.5 93t-92.5 138.5t-34.5 168.5t34.5 169 | ||
268 | +t92.5 138.5t138.5 92.5t169 34.5t168.5 -34.5t138.5 -92.5t93 -138.5t34.5 -169t-34.5 -168.5t-93 -138.5t-138.5 -93t-169 -34.5zM775 268l-105 61q-11 4 -21 6.5t-18 2.5t-15 -0.5t-13 -4t-10 -5.5t-9 -6l-6 -7q-2 -2 -6 -7l-3 -4l-6 -10q-34 -4 -59 21l-51 50 | ||
269 | +q-24 25 -20 60l9 4q3 5 16 16t17 18t4 25t-11 43h-1l-60 105q-8 13 -20.5 20t-26 7t-27.5 -7l-62 -36q-3 -1 -6 -4l-6 -6l-6 -6q-3 -3 -5.5 -6t-4.5 -5t-3 -4l-1 -1q-14 -87 24.5 -183.5t121.5 -174.5q72 -68 157 -101.5t165 -29.5q4 1 10.5 2.5t20.5 10t21 20.5l36 62 | ||
270 | +q11 20 5.5 41.5t-25.5 32.5z" /> | ||
266 | </font> | 271 | </font> |
267 | </defs></svg> | 272 | </defs></svg> |
No preview for this file type
No preview for this file type
-
Please register or login to post a comment