do gulp gzip css and js
Showing
4 changed files
with
405 additions
and
164 deletions
@@ -2914,6 +2914,7 @@ $loginBtn.on('touchstart', function() { | @@ -2914,6 +2914,7 @@ $loginBtn.on('touchstart', function() { | ||
2914 | }); | 2914 | }); |
2915 | } else { | 2915 | } else { |
2916 | showErrTip('账号或密码有错误,请重新输入'); | 2916 | showErrTip('账号或密码有错误,请重新输入'); |
2917 | + $loginBtn.text('登录').removeClass('disable'); | ||
2917 | } | 2918 | } |
2918 | }); | 2919 | }); |
2919 | 2920 | ||
@@ -3062,6 +3063,7 @@ $loginBtn.on('touchstart', function() { | @@ -3062,6 +3063,7 @@ $loginBtn.on('touchstart', function() { | ||
3062 | }); | 3063 | }); |
3063 | } else { | 3064 | } else { |
3064 | showErrTip('账号或密码有错误,请重新输入'); | 3065 | showErrTip('账号或密码有错误,请重新输入'); |
3066 | + $loginBtn.text('登录').removeClass('disable'); | ||
3065 | } | 3067 | } |
3066 | }); | 3068 | }); |
3067 | 3069 | ||
@@ -4231,11 +4233,18 @@ $.ajax({ | @@ -4231,11 +4233,18 @@ $.ajax({ | ||
4231 | type: 'GET', | 4233 | type: 'GET', |
4232 | url: '/cart/index/count', | 4234 | url: '/cart/index/count', |
4233 | success: function(data) { | 4235 | success: function(data) { |
4236 | + var count; | ||
4237 | + | ||
4234 | if (data.code === 200) { | 4238 | if (data.code === 200) { |
4235 | - $cart.find('.cart-count').html(data.data.cart_goods_count).removeClass('hide'); | 4239 | + count = data.data.cart_goods_count; |
4240 | + if (count > 99) { | ||
4241 | + count = '99+'; | ||
4242 | + } | ||
4243 | + $cart.find('.cart-count').html(count).removeClass('hide'); | ||
4236 | } | 4244 | } |
4237 | } | 4245 | } |
4238 | }); | 4246 | }); |
4247 | + | ||
4239 | }); | 4248 | }); |
4240 | define("js/product/newsale/discount", ["jquery","swiper","lazyload","hammer","index"], function(require, exports, module){ | 4249 | define("js/product/newsale/discount", ["jquery","swiper","lazyload","hammer","index"], function(require, exports, module){ |
4241 | /** | 4250 | /** |
@@ -5578,13 +5587,17 @@ var panelTmpl, | @@ -5578,13 +5587,17 @@ var panelTmpl, | ||
5578 | $chosePanel = $('#chose-panel'), | 5587 | $chosePanel = $('#chose-panel'), |
5579 | $num, | 5588 | $num, |
5580 | $chosed, | 5589 | $chosed, |
5581 | - re = /\d+/, | 5590 | + |
5591 | + // re = /\d+/, | ||
5582 | leftNum, | 5592 | leftNum, |
5583 | - $colorList, | ||
5584 | - $sizeList, | ||
5585 | - firstColorId, | ||
5586 | - colorIndex, | ||
5587 | - confirming; | 5593 | + confirming, |
5594 | + hasChooseColor = false, | ||
5595 | + hasChooseSize = false, | ||
5596 | + curColorIndex, | ||
5597 | + curSizeIndex, | ||
5598 | + $curSizeRow, | ||
5599 | + $curSizeBlock = null, | ||
5600 | + $sizeRowList = $('.size-list ul'); | ||
5588 | 5601 | ||
5589 | // 读取模板 | 5602 | // 读取模板 |
5590 | $.get('/cart/index/giftinfoTpl', function(html) { | 5603 | $.get('/cart/index/giftinfoTpl', function(html) { |
@@ -5599,45 +5612,61 @@ $.get('/cart/index/giftinfoTpl', function(html) { | @@ -5599,45 +5612,61 @@ $.get('/cart/index/giftinfoTpl', function(html) { | ||
5599 | 5612 | ||
5600 | //初始化购物车面板显示 | 5613 | //初始化购物车面板显示 |
5601 | function init() { | 5614 | function init() { |
5602 | - $colorList = $('.chose-panel .color-list ul>li'); | ||
5603 | - $sizeList = $('.chose-panel .size-list ul>li'); | ||
5604 | - firstColorId = $colorList.eq(0).data('id'); | ||
5605 | - $sizeList.each(function() { | ||
5606 | - colorIndex = $(this).data('colorid'); | ||
5607 | 5615 | ||
5608 | - if (colorIndex === firstColorId) { | ||
5609 | - $(this).removeClass('hide'); | ||
5610 | - } | ||
5611 | - }); | ||
5612 | -} | 5616 | + //$colorList = $('.chose-panel .color-list ul>li'); |
5617 | + //$sizeList = $('.chose-panel .size-list ul>li'); | ||
5618 | + //firstColorId = $colorList.eq(0).data('id'); | ||
5619 | + //$sizeList.each(function() { | ||
5620 | + // colorIndex = $(this).data('colorid'); | ||
5621 | + // | ||
5622 | + // if (colorIndex === firstColorId) { | ||
5623 | + // $(this).removeClass('hide'); | ||
5624 | + // } | ||
5625 | + //}); | ||
5613 | 5626 | ||
5614 | -init(); | 5627 | + var $firstRow = $sizeRowList.eq(0); |
5615 | 5628 | ||
5616 | -//显示 | ||
5617 | -// function show(data) { | ||
5618 | -// // var html = tpl(data); | ||
5619 | -// $('.chose-panel').show(); | ||
5620 | -// // $page.append(html); | ||
5621 | -// $('.chose-panel') | ||
5622 | -// $num = $('#good-num'); | ||
5623 | -// } | 5629 | + $firstRow.toggleClass('hide'); |
5630 | + $curSizeRow = $firstRow; | ||
5631 | +} | ||
5624 | 5632 | ||
5633 | +function checkColorSizeNum() { | ||
5634 | + if (!hasChooseColor && !hasChooseSize) { | ||
5635 | + tip.show('请选择颜色和尺码~'); | ||
5636 | + return false; | ||
5637 | + } else if (!hasChooseColor) { | ||
5638 | + tip.show('请选择颜色~'); | ||
5639 | + return false; | ||
5640 | + } else if (!hasChooseSize) { | ||
5641 | + tip.show('请选择尺码~'); | ||
5642 | + return false; | ||
5643 | + } | ||
5644 | + return true; | ||
5645 | +} | ||
5625 | 5646 | ||
5647 | +init(); | ||
5626 | 5648 | ||
5627 | function show(data) { | 5649 | function show(data) { |
5628 | if (data) { | 5650 | if (data) { |
5629 | $chosePanel.html(panelTmpl(data)); | 5651 | $chosePanel.html(panelTmpl(data)); |
5630 | init(); | 5652 | init(); |
5631 | } | 5653 | } |
5632 | - | ||
5633 | $('.chose-panel').show(); | 5654 | $('.chose-panel').show(); |
5634 | 5655 | ||
5635 | $('body').css('overflow', 'hidden'); | 5656 | $('body').css('overflow', 'hidden'); |
5636 | $num = $('#good-num'); | 5657 | $num = $('#good-num'); |
5637 | } | 5658 | } |
5638 | 5659 | ||
5639 | -//移除当前Panel | ||
5640 | -function remove() { | 5660 | +////显示当前Panel |
5661 | +//function show() { | ||
5662 | +// $('.chose-panel').show(); | ||
5663 | +// | ||
5664 | +// $('body').css('overflow', 'hidden'); | ||
5665 | +// $num = $('#good-num'); | ||
5666 | +//} | ||
5667 | + | ||
5668 | +//隐藏当前Panel | ||
5669 | +function hide() { | ||
5641 | $('.chose-panel').hide(); | 5670 | $('.chose-panel').hide(); |
5642 | $('body').css('overflow', 'auto'); | 5671 | $('body').css('overflow', 'auto'); |
5643 | } | 5672 | } |
@@ -5650,87 +5679,223 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -5650,87 +5679,223 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
5650 | } | 5679 | } |
5651 | 5680 | ||
5652 | //点击蒙版消失 | 5681 | //点击蒙版消失 |
5653 | - remove(); | ||
5654 | -}).on('touchstart', '#chose-btn-sure', function() { | 5682 | + hide(); |
5683 | +}); | ||
5655 | 5684 | ||
5656 | - var productSku, | ||
5657 | - buyNumber = $('#good-num').val() - 0, | 5685 | +$('.color-list').on('touchstart', '.block', function(e) { |
5686 | + var $this = $(this), | ||
5687 | + $that = $(e.target).closest('.chose-items'), | ||
5688 | + index, | ||
5689 | + curSelectedSizeBlock, | ||
5690 | + $sizeChosed, | ||
5691 | + scindex, | ||
5692 | + curGoodNum; | ||
5658 | 5693 | ||
5659 | - promotionId, | ||
5660 | - isEdit = 0, | ||
5661 | - numInCart = $('.num-tag').html() - 0; | 5694 | + var $siblingBlock = $this.closest('.block-list').siblings(':first'); |
5662 | 5695 | ||
5663 | - // goodsType, | ||
5664 | - // isEdit; | 5696 | + $this.siblings('.chosed').removeClass('chosed'); |
5697 | + index = $this.index(); | ||
5665 | 5698 | ||
5666 | - $chosed = $('.block-list>ul>li.chosed'); | 5699 | + $sizeChosed = $siblingBlock.find('.chosed'); |
5700 | + scindex = $sizeChosed.index(); | ||
5701 | + $curSizeRow = $sizeRowList.eq(index); | ||
5667 | 5702 | ||
5668 | - if (2 === $chosed.length && 0 === $chosed.closest('.zero-stock').length) { | ||
5669 | - productSku = $sizeList.closest('.chosed').data('skuid'); | ||
5670 | - promotionId = $('[data-id="' + productSku + '"]').closest('.advance-block').data('promotion-id'); | ||
5671 | - if (confirming) { | ||
5672 | - return false; | 5703 | + // 当前颜色已经是选中状态,再点击时 |
5704 | + if ($this.hasClass('chosed')) { | ||
5705 | + | ||
5706 | + //颜色原来已经是勾选时,要清空剩余件数的提示 | ||
5707 | + $that.find('.num .left-num').html(''); | ||
5708 | + $('#left-num').val(0); | ||
5709 | + hasChooseColor = false; | ||
5710 | + | ||
5711 | + // 当前颜色不是选中状态,选中时 | ||
5712 | + } else { | ||
5713 | + hasChooseColor = true; | ||
5714 | + | ||
5715 | + //根据颜色切换图片 | ||
5716 | + if ($this.closest('.block-list').hasClass('color-list')) { | ||
5717 | + $('.chose-panel').find('.thumb').addClass('hide').eq(index).removeClass('hide'); | ||
5673 | } | 5718 | } |
5674 | 5719 | ||
5675 | - confirming = true; | ||
5676 | - loading.showLoadingMask(); | ||
5677 | - $.ajax({ | ||
5678 | - method: 'POST', | ||
5679 | - url: '/cart/index/add', | ||
5680 | - data: { | ||
5681 | - productSku: productSku, | ||
5682 | - buyNumber: buyNumber, | ||
5683 | - promotionId: promotionId, | ||
5684 | - isEdit: isEdit | 5720 | + //把当前选中颜色对应的尺码那一行显示出来 |
5721 | + $sizeRowList.addClass('hide'); | ||
5722 | + $curSizeRow.removeClass('hide').addClass('show'); | ||
5723 | + | ||
5724 | + // 之前选中的尺码去掉勾选样式 | ||
5725 | + if ($sizeChosed.length > 0) { | ||
5726 | + $sizeChosed.removeClass('chosed'); | ||
5727 | + curSelectedSizeBlock = $curSizeRow.children().get(scindex); | ||
5728 | + } | ||
5729 | + | ||
5730 | + // 当前选中颜色对应的尺码行,其对应的尺码加上勾选样式 (前提是要判断下这个尺码是否存在) | ||
5731 | + if (curSelectedSizeBlock) { | ||
5732 | + curGoodNum = $(curSelectedSizeBlock).data('num'); | ||
5733 | + $(curSelectedSizeBlock).addClass('chosed'); | ||
5734 | + | ||
5735 | + //如果当前有尺码被选中,且数量等于0,则颜色块添加数量为0的样式 | ||
5736 | + if (curGoodNum > 0) { | ||
5737 | + $that.find('.num .left-num').html('剩余' + curGoodNum + '件'); | ||
5738 | + $('#left-num').val(curGoodNum); | ||
5739 | + } else { | ||
5740 | + $(curSelectedSizeBlock).removeClass('zero-stock').addClass('zero-stock'); | ||
5741 | + $that.find('.num .left-num').html(''); | ||
5742 | + $('#left-num').val(0); | ||
5685 | } | 5743 | } |
5686 | - }).done(function(res) { | ||
5687 | - loading.hideLoadingMask(); | ||
5688 | - if (res.code === 200) { | ||
5689 | - $('.num-tag').html(numInCart + buyNumber); | ||
5690 | - $('.num-tag').removeClass('hide'); | ||
5691 | - remove(); | 5744 | + } |
5745 | + } | ||
5746 | + | ||
5747 | + // 当前颜色块 切换勾选样式 | ||
5748 | + $this.toggleClass('chosed'); | ||
5749 | + curColorIndex = index; | ||
5750 | + | ||
5751 | + // 设置按钮的样式和文字 | ||
5752 | + $chosed = $('.chose-items').find('.chosed'); | ||
5753 | + if (2 === $chosed.closest('.zero-stock').length) { | ||
5754 | + $('#chose-btn-sure').css('background-color', '#c0c0c0'); | ||
5755 | + $('#chose-btn-sure').html('已售罄'); | ||
5756 | + } else { | ||
5757 | + $('#chose-btn-sure').css('background-color', '#eb0313'); | ||
5758 | + $('#chose-btn-sure').html('确定'); | ||
5759 | + } | ||
5760 | + | ||
5761 | + /**if ($chosed.length === 0) { | ||
5762 | + $this.closest('ul>li').each(function() { | ||
5763 | + $(this).removeClass('zero-stock'); | ||
5764 | + if ('0' === $(this).data('num')) { | ||
5765 | + $(this).addClass('zero-stock'); | ||
5692 | } | 5766 | } |
5693 | - if (res.message) { | ||
5694 | - tip.show(res.message); | 5767 | + }); |
5768 | + | ||
5769 | + $siblingBlock.find('ul>li').each(function() { | ||
5770 | + $(this).removeClass('zero-stock'); | ||
5771 | + if ('0' === $(this).data('num')) { | ||
5772 | + $(this).addClass('zero-stock'); | ||
5773 | + } | ||
5774 | + }); | ||
5775 | + } else if ($chosed.length === 1 && $this.hasClass('chosed')) { | ||
5776 | + $sizeList.addClass('hide'); | ||
5777 | + | ||
5778 | + //切换尺码信息 | ||
5779 | + $sizeList.each(function() { | ||
5780 | + colorIndex = $(this).data('colorid'); | ||
5781 | + if (colorIndex === $this.data('id')) { | ||
5782 | + $(this).removeClass('hide'); | ||
5695 | } | 5783 | } |
5696 | - }).fail(function() { | ||
5697 | - tip.show('网络出了点问题~'); | ||
5698 | - }).always(function() { | ||
5699 | - confirming = false; | ||
5700 | }); | 5784 | }); |
5701 | - } | ||
5702 | 5785 | ||
5703 | -}).on('touchstart', '.block', function(e) { | 5786 | + numArray = ($chosed.data('numstr') + '').split('/'); |
5787 | + $siblingBlock.find('.block').removeClass('zero-stock'); | ||
5788 | + for (i = 0; i < numArray.length; i++) { | ||
5789 | + if ('0' === numArray[i]) { | ||
5790 | + $siblingBlock.find('.block').eq(i).addClass('zero-stock'); | ||
5791 | + } | ||
5792 | + } | ||
5793 | + } else if ($chosed.length === 1 && !$this.hasClass('chosed')) { | ||
5794 | + $('#chose-btn-sure').css('background-color', '#eb0313'); | ||
5795 | + $('#chose-btn-sure').html('确定'); | ||
5796 | + | ||
5797 | + $siblingBlock.find('ul>li').each(function() { | ||
5798 | + $(this).removeClass('zero-stock'); | ||
5799 | + if ('0' === $(this).data('num')) { | ||
5800 | + $(this).addClass('zero-stock'); | ||
5801 | + } | ||
5802 | + }); | ||
5803 | + $that.find('.num .left-num').html(''); | ||
5804 | + } else if ($chosed.length === 2) { | ||
5805 | + $siblingBlock.find('.block').removeClass('zero-stock'); | ||
5806 | + for (i = 0; i < currentNumArray.length; i++) { | ||
5807 | + if ('0' === currentNumArray[i]) { | ||
5808 | + $siblingBlock.find('.block').eq(i).addClass('zero-stock'); | ||
5809 | + } | ||
5810 | + } | ||
5811 | + numArray = ($siblingBlock.find('.chosed').data('numstr') + '').split('/'); | ||
5812 | + $that.find('.num .left-num').html('剩余' + numArray[index] + '件'); | ||
5813 | + if (2 === $chosed.closest('.zero-stock').length) { | ||
5814 | + $('#chose-btn-sure').css('background-color', '#c0c0c0'); | ||
5815 | + $('#chose-btn-sure').html('已售罄'); | ||
5816 | + } else { | ||
5817 | + $('#chose-btn-sure').css('background-color', '#eb0313'); | ||
5818 | + $('#chose-btn-sure').html('确定'); | ||
5819 | + } | ||
5820 | + }**/ | ||
5821 | + | ||
5822 | +}); | ||
5823 | + | ||
5824 | +$('.size-list').on('touchstart', '.block', function(e) { | ||
5704 | var $this = $(this), | 5825 | var $this = $(this), |
5705 | $that = $(e.target).closest('.chose-items'), | 5826 | $that = $(e.target).closest('.chose-items'), |
5706 | - numArray, | ||
5707 | index, | 5827 | index, |
5708 | - i; | 5828 | + $colorChosed, |
5829 | + curGoodNum; | ||
5709 | 5830 | ||
5710 | - var $siblingBlock = $this.closest('.block-list').siblings(':first'), | ||
5711 | - currentNumArray = ($this.data('numstr') + '').split('/'); | 5831 | + var $siblingBlock = $this.closest('.block-list').siblings(':first'); |
5712 | 5832 | ||
5713 | $this.siblings('.chosed').removeClass('chosed'); | 5833 | $this.siblings('.chosed').removeClass('chosed'); |
5714 | - $this.toggleClass('chosed'); | ||
5715 | index = $this.index(); | 5834 | index = $this.index(); |
5716 | - $chosed = $('.block-list>ul>li.chosed'); | ||
5717 | 5835 | ||
5718 | - //根据颜色切换图片 | ||
5719 | - if ($this.closest('.block-list').hasClass('color-list')) { | ||
5720 | - $('.chose-panel').find('.thumb').addClass('hide').eq(index).removeClass('hide'); | 5836 | + $colorChosed = $siblingBlock.find('.chosed'); |
5837 | + $curSizeRow = $sizeRowList.eq(index); | ||
5838 | + | ||
5839 | + // 当前尺码已经是选中状态,再点击时 | ||
5840 | + if ($this.hasClass('chosed')) { | ||
5841 | + | ||
5842 | + //尺码原来已经是勾选时,要清空剩余件数的提示 | ||
5843 | + $that.find('.num .left-num').html(''); | ||
5844 | + $('#left-num').val(0); | ||
5845 | + hasChooseSize = false; | ||
5846 | + | ||
5847 | + // 去掉已经选中颜色的 数量为0的样式 | ||
5848 | + if ($colorChosed.length > 0) { | ||
5849 | + $colorChosed.removeClass('zero-stock').addClass('zero-stock'); | ||
5850 | + } | ||
5851 | + | ||
5852 | + // 当前尺码不是选中状态,选中时 | ||
5853 | + } else { | ||
5854 | + hasChooseSize = true; | ||
5855 | + | ||
5856 | + curGoodNum = $this.data('num'); | ||
5857 | + | ||
5858 | + // 之前选中的尺码去掉勾选样式 | ||
5859 | + if ($curSizeBlock) { | ||
5860 | + $curSizeBlock.removeClass('chosed'); | ||
5861 | + } | ||
5862 | + | ||
5863 | + // 如果当前有尺码被选中,且数量等于0,则颜色块添加数量为0的样式, 否则显示剩余件数 | ||
5864 | + if (curGoodNum > 0 && hasChooseColor) { | ||
5865 | + $that.find('.num .left-num').html('剩余' + curGoodNum + '件'); | ||
5866 | + $('#left-num').val(curGoodNum); | ||
5867 | + } else { | ||
5868 | + $colorChosed.removeClass('zero-stock').addClass('zero-stock'); | ||
5869 | + $that.find('.num .left-num').html(''); | ||
5870 | + $('#left-num').val(0); | ||
5871 | + } | ||
5872 | + } | ||
5873 | + | ||
5874 | + $this.toggleClass('chosed'); | ||
5875 | + curSizeIndex = index; | ||
5876 | + $curSizeBlock = $this; | ||
5877 | + | ||
5878 | + // 设置按钮的样式和文字 | ||
5879 | + $chosed = $('.chose-items').find('.chosed'); | ||
5880 | + if (2 === $chosed.closest('.zero-stock').length) { | ||
5881 | + $('#chose-btn-sure').css('background-color', '#c0c0c0'); | ||
5882 | + $('#chose-btn-sure').html('已售罄'); | ||
5883 | + } else { | ||
5884 | + $('#chose-btn-sure').css('background-color', '#eb0313'); | ||
5885 | + $('#chose-btn-sure').html('确定'); | ||
5721 | } | 5886 | } |
5722 | 5887 | ||
5723 | - if ($chosed.length === 0) { | 5888 | + /**if ($chosed.length === 0) { |
5724 | $this.closest('ul>li').each(function() { | 5889 | $this.closest('ul>li').each(function() { |
5725 | $(this).removeClass('zero-stock'); | 5890 | $(this).removeClass('zero-stock'); |
5726 | - if (0 === $(this).data('num') - 0) { | 5891 | + if ('0' === $(this).data('num')) { |
5727 | $(this).addClass('zero-stock'); | 5892 | $(this).addClass('zero-stock'); |
5728 | } | 5893 | } |
5729 | }); | 5894 | }); |
5730 | 5895 | ||
5731 | $siblingBlock.find('ul>li').each(function() { | 5896 | $siblingBlock.find('ul>li').each(function() { |
5732 | $(this).removeClass('zero-stock'); | 5897 | $(this).removeClass('zero-stock'); |
5733 | - if (0 === $(this).data('num') - 0) { | 5898 | + if ('0' === $(this).data('num')) { |
5734 | $(this).addClass('zero-stock'); | 5899 | $(this).addClass('zero-stock'); |
5735 | } | 5900 | } |
5736 | }); | 5901 | }); |
@@ -5751,7 +5916,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -5751,7 +5916,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
5751 | numArray = ($chosed.data('numstr') + '').split('/'); | 5916 | numArray = ($chosed.data('numstr') + '').split('/'); |
5752 | $siblingBlock.find('.block').removeClass('zero-stock'); | 5917 | $siblingBlock.find('.block').removeClass('zero-stock'); |
5753 | for (i = 0; i < numArray.length; i++) { | 5918 | for (i = 0; i < numArray.length; i++) { |
5754 | - if (0 === numArray[i] - 0) { | 5919 | + if ('0' === numArray[i]) { |
5755 | $siblingBlock.find('.block').eq(i).addClass('zero-stock'); | 5920 | $siblingBlock.find('.block').eq(i).addClass('zero-stock'); |
5756 | } | 5921 | } |
5757 | } | 5922 | } |
@@ -5761,7 +5926,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -5761,7 +5926,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
5761 | 5926 | ||
5762 | $siblingBlock.find('ul>li').each(function() { | 5927 | $siblingBlock.find('ul>li').each(function() { |
5763 | $(this).removeClass('zero-stock'); | 5928 | $(this).removeClass('zero-stock'); |
5764 | - if (0 === $(this).data('num') - 0) { | 5929 | + if ('0' === $(this).data('num')) { |
5765 | $(this).addClass('zero-stock'); | 5930 | $(this).addClass('zero-stock'); |
5766 | } | 5931 | } |
5767 | }); | 5932 | }); |
@@ -5769,7 +5934,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -5769,7 +5934,7 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
5769 | } else if ($chosed.length === 2) { | 5934 | } else if ($chosed.length === 2) { |
5770 | $siblingBlock.find('.block').removeClass('zero-stock'); | 5935 | $siblingBlock.find('.block').removeClass('zero-stock'); |
5771 | for (i = 0; i < currentNumArray.length; i++) { | 5936 | for (i = 0; i < currentNumArray.length; i++) { |
5772 | - if (0 === currentNumArray[i] - 0) { | 5937 | + if ('0' === currentNumArray[i]) { |
5773 | $siblingBlock.find('.block').eq(i).addClass('zero-stock'); | 5938 | $siblingBlock.find('.block').eq(i).addClass('zero-stock'); |
5774 | } | 5939 | } |
5775 | } | 5940 | } |
@@ -5782,15 +5947,16 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -5782,15 +5947,16 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
5782 | $('#chose-btn-sure').css('background-color', '#eb0313'); | 5947 | $('#chose-btn-sure').css('background-color', '#eb0313'); |
5783 | $('#chose-btn-sure').html('确定'); | 5948 | $('#chose-btn-sure').html('确定'); |
5784 | } | 5949 | } |
5785 | - } | 5950 | + }**/ |
5786 | 5951 | ||
5787 | -}).on('touchstart', '.btn-minus', function() { | ||
5788 | - var num = +$num.val(), | ||
5789 | - $chosed = $('.block-list>ul>li.chosed'), | ||
5790 | - leftNum = re.exec($('.num .left-num').html()); | 5952 | +}); |
5953 | + | ||
5954 | +$('.btn-minus').on('touchstart', function() { | ||
5955 | + var num = $num.val(); | ||
5956 | + | ||
5957 | + leftNum = $('#left-num').val(); | ||
5791 | 5958 | ||
5792 | - //若颜色和尺码没有被同时选中,则不能点击 | ||
5793 | - if ($chosed.length < 2) { | 5959 | + if (!checkColorSizeNum()) { |
5794 | return; | 5960 | return; |
5795 | } | 5961 | } |
5796 | 5962 | ||
@@ -5799,15 +5965,19 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -5799,15 +5965,19 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
5799 | } | 5965 | } |
5800 | 5966 | ||
5801 | $num.val(num - 1); | 5967 | $num.val(num - 1); |
5802 | -}).on('touchstart', '.btn-plus', function() { | ||
5803 | - var num = +$num.val(); | 5968 | +}); |
5969 | + | ||
5970 | +$('.btn-plus').on('touchstart', function() { | ||
5971 | + var num = $num.val(); | ||
5804 | 5972 | ||
5805 | - //若颜色和尺码没有被同时选中,则不能点击 | ||
5806 | - if ($('.block-list>ul>li.chosed').length < 2) { | 5973 | + leftNum = $('#left-num').val(); |
5974 | + | ||
5975 | + if (!checkColorSizeNum()) { | ||
5807 | return; | 5976 | return; |
5808 | } | 5977 | } |
5809 | - leftNum = re.exec($('.num .left-num').html()); | ||
5810 | - if (num - 0 === leftNum - 0 || 0 === leftNum - 0) { | 5978 | + |
5979 | + | ||
5980 | + if (num - 0 === leftNum || 0 === leftNum) { | ||
5811 | return; | 5981 | return; |
5812 | } | 5982 | } |
5813 | 5983 | ||
@@ -5815,6 +5985,71 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | @@ -5815,6 +5985,71 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { | ||
5815 | $num.val(num + 1); | 5985 | $num.val(num + 1); |
5816 | }); | 5986 | }); |
5817 | 5987 | ||
5988 | +$('#chose-btn-sure').on('touchstart', function() { | ||
5989 | + | ||
5990 | + var productSku, | ||
5991 | + buyNumber = $('#good-num').val() - 0, | ||
5992 | + | ||
5993 | + promotionId, | ||
5994 | + isEdit = 0, | ||
5995 | + numInCart = $('.num-tag').html() - 0, | ||
5996 | + num = $num.val(); | ||
5997 | + | ||
5998 | + if (!checkColorSizeNum()) { | ||
5999 | + return; | ||
6000 | + } | ||
6001 | + | ||
6002 | + if ($('#chose-btn-sure').html() === '已售罄') { | ||
6003 | + return; | ||
6004 | + } | ||
6005 | + | ||
6006 | + leftNum = $('#left-num').val(); | ||
6007 | + | ||
6008 | + if (num > leftNum) { | ||
6009 | + tip.show('您选择的数量超过了最大库存量~'); | ||
6010 | + return; | ||
6011 | + } | ||
6012 | + | ||
6013 | + $chosed = $('.block-list>ul>li.chosed'); | ||
6014 | + | ||
6015 | + if (2 === $chosed.length && 0 === $chosed.closest('.zero-stock').length) { | ||
6016 | + productSku = $curSizeBlock.data('skuid'); | ||
6017 | + promotionId = $('[data-id="' + productSku + '"]').closest('.advance-block').data('promotion-id'); | ||
6018 | + if (confirming) { | ||
6019 | + return false; | ||
6020 | + } | ||
6021 | + | ||
6022 | + confirming = true; | ||
6023 | + loading.showLoadingMask(); | ||
6024 | + $.ajax({ | ||
6025 | + method: 'POST', | ||
6026 | + url: '/cart/index/add', | ||
6027 | + data: { | ||
6028 | + productSku: productSku, | ||
6029 | + buyNumber: buyNumber, | ||
6030 | + promotionId: promotionId, | ||
6031 | + isEdit: isEdit | ||
6032 | + } | ||
6033 | + }).done(function(res) { | ||
6034 | + loading.hideLoadingMask(); | ||
6035 | + if (res.code === 200) { | ||
6036 | + $('.num-tag').html(numInCart + buyNumber); | ||
6037 | + $('.num-tag').removeClass('hide'); | ||
6038 | + confirming = false; | ||
6039 | + hide(); | ||
6040 | + } | ||
6041 | + if (res.message) { | ||
6042 | + tip.show(res.message); | ||
6043 | + } | ||
6044 | + }).fail(function() { | ||
6045 | + tip.show('网络出了点问题~'); | ||
6046 | + }).always(function() { | ||
6047 | + confirming = false; | ||
6048 | + }); | ||
6049 | + } | ||
6050 | + | ||
6051 | +}); | ||
6052 | + | ||
5818 | exports.init = init; | 6053 | exports.init = init; |
5819 | exports.show = show; | 6054 | exports.show = show; |
5820 | 6055 | ||
@@ -8463,17 +8698,24 @@ var $ = require("jquery"), | @@ -8463,17 +8698,24 @@ var $ = require("jquery"), | ||
8463 | lazyLoad = require("lazyload"), | 8698 | lazyLoad = require("lazyload"), |
8464 | Hammer = require("hammer"); | 8699 | Hammer = require("hammer"); |
8465 | 8700 | ||
8466 | -var chosePanel = require("js/cart/chose-panel"); | 8701 | +var chosePanel = require("js/cart/chose-panel"), |
8702 | + tip = require("js/plugin/tip"); | ||
8467 | 8703 | ||
8468 | var $cartContent = $('.cart-content'); | 8704 | var $cartContent = $('.cart-content'); |
8469 | 8705 | ||
8470 | var navHammer, | 8706 | var navHammer, |
8471 | cartType = $('#cartType').val(); | 8707 | cartType = $('#cartType').val(); |
8472 | 8708 | ||
8709 | +var hasChecked = $('.cart-goods .icon-cb-checked').length > 0 ? true : false; //是否有选中商品 | ||
8710 | + | ||
8473 | require("js/cart/good"); | 8711 | require("js/cart/good"); |
8474 | 8712 | ||
8475 | lazyLoad($('img.lazy')); | 8713 | lazyLoad($('img.lazy')); |
8476 | 8714 | ||
8715 | +if ('advance' === cartType) { | ||
8716 | + $cartContent.toggleClass('hide'); | ||
8717 | +} | ||
8718 | + | ||
8477 | if ($('.cart-nav').length > 0) { | 8719 | if ($('.cart-nav').length > 0) { |
8478 | navHammer = new Hammer(document.getElementsByClassName('cart-nav')[0]); | 8720 | navHammer = new Hammer(document.getElementsByClassName('cart-nav')[0]); |
8479 | navHammer.on('tap', function(e) { | 8721 | navHammer.on('tap', function(e) { |
@@ -8501,7 +8743,11 @@ if ($('.cart-nav').length > 0) { | @@ -8501,7 +8743,11 @@ if ($('.cart-nav').length > 0) { | ||
8501 | } | 8743 | } |
8502 | 8744 | ||
8503 | $('.btn-balance').on('touchend', function() { | 8745 | $('.btn-balance').on('touchend', function() { |
8504 | - window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; | 8746 | + if (hasChecked) { |
8747 | + window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; | ||
8748 | + } else { | ||
8749 | + tip.show('请先勾选商品'); | ||
8750 | + } | ||
8505 | }); | 8751 | }); |
8506 | 8752 | ||
8507 | $('.chose').on('touchend', function() { | 8753 | $('.chose').on('touchend', function() { |
@@ -8510,6 +8756,8 @@ $('.chose').on('touchend', function() { | @@ -8510,6 +8756,8 @@ $('.chose').on('touchend', function() { | ||
8510 | chosePanel.show(); | 8756 | chosePanel.show(); |
8511 | }); | 8757 | }); |
8512 | 8758 | ||
8759 | +//提前触发lazyload | ||
8760 | +$(window).scrollTop(1).scrollTop(0); | ||
8513 | }); | 8761 | }); |
8514 | define("js/cart/good", ["jquery","mlellipsis","handlebars","source-map","lazyload","hammer"], function(require, exports, module){ | 8762 | define("js/cart/good", ["jquery","mlellipsis","handlebars","source-map","lazyload","hammer"], function(require, exports, module){ |
8515 | /** | 8763 | /** |
@@ -8526,8 +8774,7 @@ var $ = require("jquery"), | @@ -8526,8 +8774,7 @@ var $ = require("jquery"), | ||
8526 | var dialog = require("js/me/dialog"), | 8774 | var dialog = require("js/me/dialog"), |
8527 | tip = require("js/plugin/tip"); | 8775 | tip = require("js/plugin/tip"); |
8528 | 8776 | ||
8529 | -var $names, | ||
8530 | - $selectAllBtn = $('.balance .iconfont'), | 8777 | +var $selectAllBtn = $('.balance .checkbox'), |
8531 | cartType = $('#cartType').val(), | 8778 | cartType = $('#cartType').val(), |
8532 | requesting = false; | 8779 | requesting = false; |
8533 | 8780 | ||
@@ -8537,11 +8784,9 @@ lazyLoad({ | @@ -8537,11 +8784,9 @@ lazyLoad({ | ||
8537 | try_again_css: 'good-failure' | 8784 | try_again_css: 'good-failure' |
8538 | }); | 8785 | }); |
8539 | 8786 | ||
8540 | - | ||
8541 | -$names = $('.name'); | ||
8542 | -if ($names.length > 0) { | ||
8543 | - $names[0].mlellipsis(2); | ||
8544 | -} | 8787 | +$('.shopping-cart-good .name').each(function() { |
8788 | + this.mlellipsis(2); | ||
8789 | +}); | ||
8545 | 8790 | ||
8546 | //TIP:事件委托在.cart-goods,商品列表的容器统一需要有.cart-goods | 8791 | //TIP:事件委托在.cart-goods,商品列表的容器统一需要有.cart-goods |
8547 | $('.cart-goods').on('touchstart', '.checkbox', function() { | 8792 | $('.cart-goods').on('touchstart', '.checkbox', function() { |
@@ -8566,7 +8811,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -8566,7 +8811,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
8566 | this.selected = properties.selected; | 8811 | this.selected = properties.selected; |
8567 | } | 8812 | } |
8568 | 8813 | ||
8569 | - goodInfo.goods_type = getCartType(); | 8814 | + goodInfo.goods_type = cartType; |
8570 | goodInfo.selected = isSelected ? 'N' : 'Y'; | 8815 | goodInfo.selected = isSelected ? 'N' : 'Y'; |
8571 | goodInfo.product_sku = id; | 8816 | goodInfo.product_sku = id; |
8572 | goodInfo.buy_number = $good.find('.count').eq(0).text().trim().replace('×', ''); | 8817 | goodInfo.buy_number = $good.find('.count').eq(0).text().trim().replace('×', ''); |
@@ -8587,44 +8832,12 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -8587,44 +8832,12 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
8587 | } else { | 8832 | } else { |
8588 | $this.removeClass('icon-checkbox').addClass('icon-cb-checked'); | 8833 | $this.removeClass('icon-checkbox').addClass('icon-cb-checked'); |
8589 | } | 8834 | } |
8590 | - $.ajax({ | ||
8591 | - type: 'GET', | ||
8592 | - url: 'getCartData', | ||
8593 | - data: { | ||
8594 | - id: id | ||
8595 | - }, | ||
8596 | - success: function(data) { | ||
8597 | - if (data) { | ||
8598 | - if (cartType === 'ordinary') { | ||
8599 | - $('#good-totalprice').html('¥' + data.commonCart.price); | ||
8600 | - $('#good-activityPrice').html('¥' + data.commonCart.activityPrice); | ||
8601 | - $('#good-total').html('总计:¥' + data.commonCart.sumPrice + ' (' + data.commonCart.count + '件)'); | ||
8602 | - if (data.commonCart.isAllSelected) { | ||
8603 | - $('.balance span').removeClass('icon-checkbox').addClass('icon-cb-checked'); | ||
8604 | - } else { | ||
8605 | - $('.balance span').removeClass('icon-cb-checked').addClass('icon-checkbox'); | ||
8606 | - } | ||
8607 | - } else { | ||
8608 | - $('#good-totalprice').html('¥' + data.preSellCart.price); | ||
8609 | - $('#good-activityPrice').html('¥' + data.preSellCart.activityPrice); | ||
8610 | - $('#good-total').html('总计:¥' + data.preSellCart.sumPrice + ' (' + data.preSellCart.count + '件)'); | ||
8611 | - if (data.preSellCart.isAllSelected) { | ||
8612 | - $('.balance span').removeClass('icon-checkbox').addClass('icon-cb-checked'); | ||
8613 | - } else { | ||
8614 | - $('.balance span').removeClass('icon-cb-checked').addClass('icon-checkbox'); | ||
8615 | - } | ||
8616 | - } | ||
8617 | - } | ||
8618 | - }, | ||
8619 | - error: function() { | ||
8620 | - tip.show('网络错误'); | ||
8621 | - } | ||
8622 | - }); | 8835 | + window.history.go(0); |
8623 | } else if (data.code === 400) { | 8836 | } else if (data.code === 400) { |
8624 | - tip.show('网络错误'); | 8837 | + tip.show('网络异常'); |
8625 | } | 8838 | } |
8626 | - }).fail(function() { | ||
8627 | - tip.show('网络错误'); | 8839 | + }, function() { |
8840 | + tip.show('网络异常'); | ||
8628 | }); | 8841 | }); |
8629 | }).on('touchstart', '.icon-del', function(e) { | 8842 | }).on('touchstart', '.icon-del', function(e) { |
8630 | var $this = $(this); | 8843 | var $this = $(this); |
@@ -8657,10 +8870,10 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -8657,10 +8870,10 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
8657 | }); | 8870 | }); |
8658 | history.go(0); | 8871 | history.go(0); |
8659 | } | 8872 | } |
8660 | - }).fail(function() { | 8873 | + }, function() { |
8661 | dialog.showDialog({ | 8874 | dialog.showDialog({ |
8662 | autoHide: true, | 8875 | autoHide: true, |
8663 | - dialogText: '网络错误~' | 8876 | + dialogText: '网络异常' |
8664 | }); | 8877 | }); |
8665 | }); | 8878 | }); |
8666 | }); | 8879 | }); |
@@ -8717,6 +8930,7 @@ function didUpdateAllGoodsCheckStatus() { | @@ -8717,6 +8930,7 @@ function didUpdateAllGoodsCheckStatus() { | ||
8717 | $(checkedBox).removeClass('icon-cb-checked').addClass('icon-checkbox'); | 8930 | $(checkedBox).removeClass('icon-cb-checked').addClass('icon-checkbox'); |
8718 | }); | 8931 | }); |
8719 | } | 8932 | } |
8933 | + window.history.go(0); | ||
8720 | } | 8934 | } |
8721 | 8935 | ||
8722 | function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { | 8936 | function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { |
@@ -8765,6 +8979,7 @@ function willBeSelected($this) { | @@ -8765,6 +8979,7 @@ function willBeSelected($this) { | ||
8765 | //全选按钮点击事件 | 8979 | //全选按钮点击事件 |
8766 | $selectAllBtn.on('touchend', function() { | 8980 | $selectAllBtn.on('touchend', function() { |
8767 | var $this = $(this); | 8981 | var $this = $(this); |
8982 | + | ||
8768 | bottomCheckBoxHandeler(willBeSelected($this), cartType, didUpdateAllGoodsCheckStatus); | 8983 | bottomCheckBoxHandeler(willBeSelected($this), cartType, didUpdateAllGoodsCheckStatus); |
8769 | }); | 8984 | }); |
8770 | 8985 | ||
@@ -8844,6 +9059,7 @@ var dispatchModeHammer, | @@ -8844,6 +9059,7 @@ var dispatchModeHammer, | ||
8844 | dispatchTimeHammer, | 9059 | dispatchTimeHammer, |
8845 | $invoice = $('.invoice'), | 9060 | $invoice = $('.invoice'), |
8846 | $price = $('.price-cal'), | 9061 | $price = $('.price-cal'), |
9062 | + $couponUse = $('.coupon-use.used'), | ||
8847 | payType, | 9063 | payType, |
8848 | priceTmpl = Handlebars.compile($('#tmpl-price').html()), | 9064 | priceTmpl = Handlebars.compile($('#tmpl-price').html()), |
8849 | queryString = $.queryString(), | 9065 | queryString = $.queryString(), |
@@ -8855,6 +9071,11 @@ if (window.getUid() !== orderInfo('uid')) { | @@ -8855,6 +9071,11 @@ if (window.getUid() !== orderInfo('uid')) { | ||
8855 | order.init(); | 9071 | order.init(); |
8856 | } | 9072 | } |
8857 | 9073 | ||
9074 | +if ($couponUse.data('value') !== orderInfo('couponValue')) { | ||
9075 | + orderInfo('couponCode', null); | ||
9076 | + orderInfo('couponValue', null); | ||
9077 | +} | ||
9078 | + | ||
8858 | function dispacthTapEvt(e) { | 9079 | function dispacthTapEvt(e) { |
8859 | var $cur = $(e.target).closest('li'); | 9080 | var $cur = $(e.target).closest('li'); |
8860 | 9081 | ||
@@ -8912,21 +9133,17 @@ function orderCompute() { | @@ -8912,21 +9133,17 @@ function orderCompute() { | ||
8912 | if (!res) { | 9133 | if (!res) { |
8913 | tip.show('网络出错'); | 9134 | tip.show('网络出错'); |
8914 | } else { | 9135 | } else { |
8915 | - if (res.order_amount) { | 9136 | + /*if (res.order_amount) { |
8916 | res.order_amount = (+res.order_amount).toFixed(2); | 9137 | res.order_amount = (+res.order_amount).toFixed(2); |
8917 | } | 9138 | } |
8918 | if (res.discount_amount) { | 9139 | if (res.discount_amount) { |
8919 | res.discount_amount = (+res.discount_amount).toFixed(2); | 9140 | res.discount_amount = (+res.discount_amount).toFixed(2); |
8920 | - } | 9141 | + }*/ |
8921 | if (res.last_order_amount) { | 9142 | if (res.last_order_amount) { |
8922 | res.last_order_amount = (+res.last_order_amount).toFixed(2); | 9143 | res.last_order_amount = (+res.last_order_amount).toFixed(2); |
8923 | } | 9144 | } |
8924 | priceHtml = priceTmpl({ | 9145 | priceHtml = priceTmpl({ |
8925 | - sumPrice: res.order_amount, | ||
8926 | - salePrice: res.discount_amount, | ||
8927 | - freight: res.promotion_formula_list[1].promotion_amount, | ||
8928 | - couponPrice: res.coupon_amount, | ||
8929 | - yohoCoin: res.use_yoho_coin, | 9146 | + cartPayData: res.promotion_formula_list, |
8930 | price: res.last_order_amount | 9147 | price: res.last_order_amount |
8931 | }); | 9148 | }); |
8932 | 9149 | ||
@@ -8938,9 +9155,24 @@ function orderCompute() { | @@ -8938,9 +9155,24 @@ function orderCompute() { | ||
8938 | } | 9155 | } |
8939 | 9156 | ||
8940 | function submitOrder() { | 9157 | function submitOrder() { |
8941 | - if (orderInfo('invoice') && !orderInfo('invoiceText')) { | ||
8942 | - tip.show('请输入发票抬头'); | ||
8943 | - return; | 9158 | + var invoiceText = $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'), |
9159 | + msg = $('#msg').find('input').val() || orderInfo('msg'); | ||
9160 | + | ||
9161 | + if (orderInfo('invoice')) { | ||
9162 | + if (!invoiceText) { | ||
9163 | + tip.show('请输入发票抬头'); | ||
9164 | + return; | ||
9165 | + } | ||
9166 | + if (invoiceText.length > 30) { | ||
9167 | + tip.show('发票抬头不得超过30个汉字'); | ||
9168 | + return; | ||
9169 | + } | ||
9170 | + } | ||
9171 | + if (msg) { | ||
9172 | + if (msg.length > 40) { | ||
9173 | + tip.show('留言不得超过40个汉字'); | ||
9174 | + return; | ||
9175 | + } | ||
8944 | } | 9176 | } |
8945 | loading.showLoadingMask(); | 9177 | loading.showLoadingMask(); |
8946 | $.ajax({ | 9178 | $.ajax({ |
@@ -8951,9 +9183,9 @@ function submitOrder() { | @@ -8951,9 +9183,9 @@ function submitOrder() { | ||
8951 | cartType: queryString.cartType || queryString.carttype || 'ordinary', | 9183 | cartType: queryString.cartType || queryString.carttype || 'ordinary', |
8952 | deliveryId: orderInfo('deliveryId'), | 9184 | deliveryId: orderInfo('deliveryId'), |
8953 | deliveryTimeId: orderInfo('deliveryTimeId'), | 9185 | deliveryTimeId: orderInfo('deliveryTimeId'), |
8954 | - invoiceText: $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'), | 9186 | + invoiceText: invoiceText, |
8955 | invoiceType: $invoice.find('.invoice-type').val() || orderInfo('invoiceType'), | 9187 | invoiceType: $invoice.find('.invoice-type').val() || orderInfo('invoiceType'), |
8956 | - msg: $('#msg').find('input').val() || orderInfo('msg'), | 9188 | + msg: msg, |
8957 | paymentTypeId: orderInfo('paymentTypeId'), | 9189 | paymentTypeId: orderInfo('paymentTypeId'), |
8958 | paymentType: orderInfo('paymentType'), //支付方式 | 9190 | paymentType: orderInfo('paymentType'), //支付方式 |
8959 | couponCode: orderInfo('couponCode'), | 9191 | couponCode: orderInfo('couponCode'), |
@@ -9026,7 +9258,7 @@ $invoice.find('[name="invoice-title"]').on('blur', function() { | @@ -9026,7 +9258,7 @@ $invoice.find('[name="invoice-title"]').on('blur', function() { | ||
9026 | orderInfo('invoiceType', $(this).val()); | 9258 | orderInfo('invoiceType', $(this).val()); |
9027 | }); | 9259 | }); |
9028 | 9260 | ||
9029 | -$('#msg').find('input').on('blur', function() { | 9261 | +$('#msg').find('textarea').on('blur', function() { |
9030 | orderInfo('msg', $(this).val()); | 9262 | orderInfo('msg', $(this).val()); |
9031 | }); | 9263 | }); |
9032 | 9264 | ||
@@ -9104,9 +9336,10 @@ var page = 1, | @@ -9104,9 +9336,10 @@ var page = 1, | ||
9104 | isGetData; | 9336 | isGetData; |
9105 | 9337 | ||
9106 | var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()), | 9338 | var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()), |
9107 | - conponNotAvaliableTmpl = Handlebars.compile($('#tmpl-coupon-not-avaliable').html()), | ||
9108 | $newCoupon = $('#new-coupon'); | 9339 | $newCoupon = $('#new-coupon'); |
9109 | 9340 | ||
9341 | +// conponNotAvaliableTmpl = Handlebars.compile($('#tmpl-coupon-not-avaliable').html()), | ||
9342 | + | ||
9110 | ellipsis.init(); | 9343 | ellipsis.init(); |
9111 | 9344 | ||
9112 | $newCoupon.on('submit', function() { | 9345 | $newCoupon.on('submit', function() { |
@@ -9142,6 +9375,12 @@ $('#coupon-list').on('touchend', '.employ-main', function() { | @@ -9142,6 +9375,12 @@ $('#coupon-list').on('touchend', '.employ-main', function() { | ||
9142 | orderInfo('couponValue', $this.data('coupon-value')); | 9375 | orderInfo('couponValue', $this.data('coupon-value')); |
9143 | }); | 9376 | }); |
9144 | 9377 | ||
9378 | +$('body').on('touchend', '.not-use', function() { | ||
9379 | + orderInfo('couponCode', null); | ||
9380 | + orderInfo('couponValue', null); | ||
9381 | +}); | ||
9382 | + | ||
9383 | + | ||
9145 | $newCoupon.find('input').on('input', function() { | 9384 | $newCoupon.find('input').on('input', function() { |
9146 | if ($(this).val() !== '') { | 9385 | if ($(this).val() !== '') { |
9147 | $newCoupon.find('.submit').css('background', '#444'); | 9386 | $newCoupon.find('.submit').css('background', '#444'); |
@@ -9197,15 +9436,17 @@ function getCouponHandle(coupons) { | @@ -9197,15 +9436,17 @@ function getCouponHandle(coupons) { | ||
9197 | } | 9436 | } |
9198 | }); | 9437 | }); |
9199 | 9438 | ||
9200 | - if (notAvailableCoupons.length) { | ||
9201 | - $('.not-avaliable-coupon-line').show(); | ||
9202 | - } | ||
9203 | $('#coupon-list').append(conponTmpl({ | 9439 | $('#coupon-list').append(conponTmpl({ |
9204 | coupons: coupons | 9440 | coupons: coupons |
9205 | })); | 9441 | })); |
9206 | - $('#coupon-list-not').append(conponNotAvaliableTmpl({ | ||
9207 | - notAvailableCoupons: notAvailableCoupons | ||
9208 | - })); | 9442 | + |
9443 | + // 产品说,暂时不做不可使用的优惠券 | ||
9444 | + // if (notAvailableCoupons.length) { | ||
9445 | + // $('.not-avaliable-coupon-line').show(); | ||
9446 | + // } | ||
9447 | + // $('#coupon-list-not').append(conponNotAvaliableTmpl({ | ||
9448 | + // notAvailableCoupons: notAvailableCoupons | ||
9449 | + // })); | ||
9209 | window.rePosFooter(); | 9450 | window.rePosFooter(); |
9210 | } | 9451 | } |
9211 | 9452 |
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.
-
Please register or login to post a comment