Authored by hf

code review by hf: fixes bugs to merge liangzhifeng bikai zhangzhen codes

@@ -3340,7 +3340,15 @@ var api = require("js/passport/api"), @@ -3340,7 +3340,15 @@ var api = require("js/passport/api"),
3340 var trim = $.trim; 3340 var trim = $.trim;
3341 var showErrTip = tip.show; 3341 var showErrTip = tip.show;
3342 3342
  3343 +var requesting = false;
  3344 +
3343 function nextStep(url, mobileNo, areaCode) { 3345 function nextStep(url, mobileNo, areaCode) {
  3346 + if (requesting) {
  3347 + return false;
  3348 + }
  3349 +
  3350 + requesting = true;
  3351 +
3344 $.ajax({ 3352 $.ajax({
3345 type: 'POST', 3353 type: 'POST',
3346 url: '/passport/bind/sendBindMsg', 3354 url: '/passport/bind/sendBindMsg',
@@ -3351,9 +3359,13 @@ function nextStep(url, mobileNo, areaCode) { @@ -3351,9 +3359,13 @@ function nextStep(url, mobileNo, areaCode) {
3351 success: function(res) { 3359 success: function(res) {
3352 console.log(res.data); 3360 console.log(res.data);
3353 location.href = url; 3361 location.href = url;
  3362 +
  3363 + requesting = false;
3354 }, 3364 },
3355 error: function() { 3365 error: function() {
3356 tip.show('出错了,请重试!'); 3366 tip.show('出错了,请重试!');
  3367 +
  3368 + requesting = false;
3357 } 3369 }
3358 }); 3370 });
3359 } 3371 }
@@ -5402,7 +5414,7 @@ if (navtabHammer) { @@ -5402,7 +5414,7 @@ if (navtabHammer) {
5402 5414
5403 if (gotoConsultHammer) { 5415 if (gotoConsultHammer) {
5404 gotoConsultHammer.on('tap', function() { 5416 gotoConsultHammer.on('tap', function() {
5405 - location.href = $(gotoConsultEle).data('href'); 5417 + location.href = $(gotoConsultEle).find('a').attr('href');
5406 }); 5418 });
5407 } 5419 }
5408 5420
@@ -5585,8 +5597,8 @@ var $ = require("jquery"), @@ -5585,8 +5597,8 @@ var $ = require("jquery"),
5585 var $chosePanel = $('#chose-panel'), 5597 var $chosePanel = $('#chose-panel'),
5586 $num, 5598 $num,
5587 $chosed, 5599 $chosed,
5588 -  
5589 - // re = /\d+/, 5600 + $imgsThumb,
  5601 + $leftNum,
5590 leftNum, 5602 leftNum,
5591 confirming, 5603 confirming,
5592 curColorIndex, 5604 curColorIndex,
@@ -5595,7 +5607,11 @@ var $chosePanel = $('#chose-panel'), @@ -5595,7 +5607,11 @@ var $chosePanel = $('#chose-panel'),
5595 hasChooseColor, 5607 hasChooseColor,
5596 hasChooseSize, 5608 hasChooseSize,
5597 $curSizeBlock, 5609 $curSizeBlock,
5598 - $sizeRowList; 5610 + $sizeRowList,
  5611 + cbFn,
  5612 + $allChoseItems,
  5613 + queryString,
  5614 + $yohoPage = $('.yoho-page');
5599 5615
5600 //初始化购物车面板显示 5616 //初始化购物车面板显示
5601 function init() { 5617 function init() {
@@ -5604,12 +5620,15 @@ function init() { @@ -5604,12 +5620,15 @@ function init() {
5604 hasChooseColor = false; 5620 hasChooseColor = false;
5605 hasChooseSize = false; 5621 hasChooseSize = false;
5606 $curSizeBlock = null; 5622 $curSizeBlock = null;
  5623 + queryString = $.queryString();
  5624 + $imgsThumb = $('.chose-panel').find('.thumb');
  5625 + $allChoseItems = $('.chose-items');
5607 $sizeRowList = $('.size-list ul'); 5626 $sizeRowList = $('.size-list ul');
  5627 + $leftNum = $('#left-num');
5608 $firstRow = $sizeRowList.eq(0); 5628 $firstRow = $sizeRowList.eq(0);
5609 $firstRow.toggleClass('hide'); 5629 $firstRow.toggleClass('hide');
5610 $curSizeRow = $firstRow; 5630 $curSizeRow = $firstRow;
5611 } 5631 }
5612 -init();  
5613 5632
5614 function checkColorSizeNum() { 5633 function checkColorSizeNum() {
5615 if (!hasChooseColor && !hasChooseSize) { 5634 if (!hasChooseColor && !hasChooseSize) {
@@ -5625,32 +5644,28 @@ function checkColorSizeNum() { @@ -5625,32 +5644,28 @@ function checkColorSizeNum() {
5625 return true; 5644 return true;
5626 } 5645 }
5627 5646
5628 -function show(html) { 5647 +function show(html, cb) {
5629 if (html) { 5648 if (html) {
5630 $chosePanel.html(html); 5649 $chosePanel.html(html);
5631 init(); 5650 init();
5632 } 5651 }
5633 $('.chose-panel').show(); 5652 $('.chose-panel').show();
5634 -  
5635 - $('body').css('overflow', 'hidden');  
5636 $num = $('#good-num'); 5653 $num = $('#good-num');
  5654 + cbFn = cb;
5637 } 5655 }
5638 5656
5639 //隐藏当前Panel 5657 //隐藏当前Panel
5640 function hide() { 5658 function hide() {
5641 $('.chose-panel').hide(); 5659 $('.chose-panel').hide();
5642 - $('body').css('overflow', 'auto');  
5643 } 5660 }
5644 5661
5645 //修改加入购物车的文字和背景 5662 //修改加入购物车的文字和背景
5646 function updateConformButtonClassAndText() { 5663 function updateConformButtonClassAndText() {
5647 - $chosed = $('.chose-items').find('.chosed'); 5664 + $chosed = $allChoseItems.find('.chosed');
5648 if (2 === $chosed.closest('.zero-stock').length) { 5665 if (2 === $chosed.closest('.zero-stock').length) {
5649 - $('#chose-btn-sure').css('background-color', '#c0c0c0');  
5650 - $('#chose-btn-sure').html('已售罄'); 5666 + $('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄');
5651 } else { 5667 } else {
5652 - $('#chose-btn-sure').css('background-color', '#eb0313');  
5653 - $('#chose-btn-sure').html('确定'); 5668 + $('#chose-btn-sure').css('background-color', '#eb0313').html('确定');
5654 } 5669 }
5655 } 5670 }
5656 5671
@@ -5661,11 +5676,11 @@ function resetColorZeroStock($siblingBlock) { @@ -5661,11 +5676,11 @@ function resetColorZeroStock($siblingBlock) {
5661 5676
5662 if (!hasChooseSize) { 5677 if (!hasChooseSize) {
5663 $siblingBlock.find('ul>li').each(function() { 5678 $siblingBlock.find('ul>li').each(function() {
5664 - $(this).removeClass('zero-stock');  
5665 - if ('0' === $(this).data('num')) {  
5666 - $(this).addClass('zero-stock');  
5667 - }  
5668 - }); 5679 + $(this).removeClass('zero-stock');
  5680 + if ('0' === $(this).data('num')) {
  5681 + $(this).addClass('zero-stock');
  5682 + }
  5683 + });
5669 5684
5670 } else { 5685 } else {
5671 for (i = 0; i < numArray.length; i++) { 5686 for (i = 0; i < numArray.length; i++) {
@@ -5679,13 +5694,13 @@ function resetColorZeroStock($siblingBlock) { @@ -5679,13 +5694,13 @@ function resetColorZeroStock($siblingBlock) {
5679 // 选择了颜色切换商品图片 5694 // 选择了颜色切换商品图片
5680 function changeGoodImgWhenClickColor() { 5695 function changeGoodImgWhenClickColor() {
5681 if (hasChooseColor && curColorIndex) { 5696 if (hasChooseColor && curColorIndex) {
5682 - $('.chose-panel').find('.thumb').addClass('hide').eq(curColorIndex).removeClass('hide'); 5697 + $imgsThumb.addClass('hide').eq(curColorIndex).removeClass('hide');
5683 } 5698 }
5684 } 5699 }
5685 5700
5686 init(); 5701 init();
5687 5702
5688 -$('.yoho-page').on('touchstart', '.chose-panel', function(e) { 5703 +$yohoPage.on('touchstart', '.chose-panel', function(e) {
5689 var $cur = $(e.target); 5704 var $cur = $(e.target);
5690 5705
5691 if ($cur.closest('.main').length > 0) { 5706 if ($cur.closest('.main').length > 0) {
@@ -5696,12 +5711,11 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { @@ -5696,12 +5711,11 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
5696 hide(); 5711 hide();
5697 }); 5712 });
5698 5713
5699 -$('.color-list').on('touchstart', '.block', function(e) { 5714 +$yohoPage.on('touchstart', '.color-list .block', function(e) {
5700 var $this = $(this), 5715 var $this = $(this),
5701 - $that = $(e.target).closest('.chose-items'),  
5702 index, 5716 index,
5703 - curSelectedSizeBlock,  
5704 - $sizeChosed, 5717 + curSizeBlock,
  5718 + $preSiblingBlock,
5705 scindex, 5719 scindex,
5706 curGoodNum; 5720 curGoodNum;
5707 5721
@@ -5710,16 +5724,16 @@ $('.color-list').on('touchstart', '.block', function(e) { @@ -5710,16 +5724,16 @@ $('.color-list').on('touchstart', '.block', function(e) {
5710 $this.siblings('.chosed').removeClass('chosed'); 5724 $this.siblings('.chosed').removeClass('chosed');
5711 index = $this.index(); 5725 index = $this.index();
5712 5726
5713 - $sizeChosed = $siblingBlock.find('.chosed');  
5714 - scindex = $sizeChosed.index(); 5727 + $preSiblingBlock = $siblingBlock.find('.chosed');
  5728 + scindex = $preSiblingBlock.index();
5715 $curSizeRow = $sizeRowList.eq(index); 5729 $curSizeRow = $sizeRowList.eq(index);
5716 5730
5717 // 当前颜色已经是选中状态,再点击时 5731 // 当前颜色已经是选中状态,再点击时
5718 if ($this.hasClass('chosed')) { 5732 if ($this.hasClass('chosed')) {
5719 5733
5720 //颜色原来已经是勾选时,要清空剩余件数的提示 5734 //颜色原来已经是勾选时,要清空剩余件数的提示
5721 - $that.find('.num .left-num').html('');  
5722 - $('#left-num').val(0); 5735 + $allChoseItems.find('.num .left-num').html('');
  5736 + $leftNum.val(0);
5723 hasChooseColor = false; 5737 hasChooseColor = false;
5724 5738
5725 // 当前颜色不是选中状态,选中时 5739 // 当前颜色不是选中状态,选中时
@@ -5731,24 +5745,23 @@ $('.color-list').on('touchstart', '.block', function(e) { @@ -5731,24 +5745,23 @@ $('.color-list').on('touchstart', '.block', function(e) {
5731 $curSizeRow.removeClass('hide').addClass('show'); 5745 $curSizeRow.removeClass('hide').addClass('show');
5732 5746
5733 // 之前选中的尺码去掉勾选样式 5747 // 之前选中的尺码去掉勾选样式
5734 - if ($sizeChosed.length > 0) {  
5735 - $sizeChosed.removeClass('chosed');  
5736 - curSelectedSizeBlock = $curSizeRow.children().get(scindex); 5748 + if ($preSiblingBlock.length > 0) {
  5749 + $preSiblingBlock.removeClass('chosed');
  5750 + curSizeBlock = $curSizeRow.children().get(scindex);
5737 } 5751 }
5738 5752
5739 // 当前选中颜色对应的尺码行,其对应的尺码加上勾选样式 (前提是要判断下这个尺码是否存在) 5753 // 当前选中颜色对应的尺码行,其对应的尺码加上勾选样式 (前提是要判断下这个尺码是否存在)
5740 - if (curSelectedSizeBlock) {  
5741 - curGoodNum = $(curSelectedSizeBlock).data('num');  
5742 - $(curSelectedSizeBlock).addClass('chosed'); 5754 + if (curSizeBlock) {
  5755 + curGoodNum = $(curSizeBlock).data('num');
  5756 + $(curSizeBlock).addClass('chosed');
5743 5757
5744 //如果当前有尺码被选中,且数量等于0,则颜色块添加数量为0的样式 5758 //如果当前有尺码被选中,且数量等于0,则颜色块添加数量为0的样式
5745 if (curGoodNum > 0) { 5759 if (curGoodNum > 0) {
5746 - $that.find('.num .left-num').html('剩余' + curGoodNum + '件');  
5747 - $('#left-num').val(curGoodNum); 5760 + $allChoseItems.find('.num .left-num').html('剩余' + curGoodNum + '件');
  5761 + $leftNum.val(curGoodNum);
5748 } else { 5762 } else {
5749 - $(curSelectedSizeBlock).removeClass('zero-stock').addClass('zero-stock');  
5750 - $that.find('.num .left-num').html('');  
5751 - $('#left-num').val(0); 5763 + $allChoseItems.find('.num .left-num').html('');
  5764 + $leftNum.val(0);
5752 } 5765 }
5753 } 5766 }
5754 } 5767 }
@@ -5764,9 +5777,8 @@ $('.color-list').on('touchstart', '.block', function(e) { @@ -5764,9 +5777,8 @@ $('.color-list').on('touchstart', '.block', function(e) {
5764 changeGoodImgWhenClickColor(); 5777 changeGoodImgWhenClickColor();
5765 }); 5778 });
5766 5779
5767 -$('.size-list').on('touchstart', '.block', function(e) { 5780 +$yohoPage.on('touchstart', '.size-list .block', function(e) {
5768 var $this = $(this), 5781 var $this = $(this),
5769 - $that = $(e.target).closest('.chose-items'),  
5770 index, 5782 index,
5771 curGoodNum; 5783 curGoodNum;
5772 5784
@@ -5780,7 +5792,7 @@ $('.size-list').on('touchstart', '.block', function(e) { @@ -5780,7 +5792,7 @@ $('.size-list').on('touchstart', '.block', function(e) {
5780 if ($this.hasClass('chosed')) { 5792 if ($this.hasClass('chosed')) {
5781 5793
5782 //尺码原来已经是勾选时,要清空剩余件数的提示 5794 //尺码原来已经是勾选时,要清空剩余件数的提示
5783 - $that.find('.num .left-num').html(''); 5795 + $allChoseItems.find('.num .left-num').html('');
5784 $('#left-num').val(0); 5796 $('#left-num').val(0);
5785 hasChooseSize = false; 5797 hasChooseSize = false;
5786 5798
@@ -5795,12 +5807,12 @@ $('.size-list').on('touchstart', '.block', function(e) { @@ -5795,12 +5807,12 @@ $('.size-list').on('touchstart', '.block', function(e) {
5795 $curSizeBlock.removeClass('chosed'); 5807 $curSizeBlock.removeClass('chosed');
5796 } 5808 }
5797 5809
5798 - // 如果当前有尺码被选中,且数量等于0,则颜色块添加数量为0的样式, 否则显示剩余件数 5810 + // 如果当前有尺码被选中,且数量等于0, 否则显示剩余件数
5799 if (curGoodNum > 0 && hasChooseColor) { 5811 if (curGoodNum > 0 && hasChooseColor) {
5800 - $that.find('.num .left-num').html('剩余' + curGoodNum + '件'); 5812 + $allChoseItems.find('.num .left-num').html('剩余' + curGoodNum + '件');
5801 $('#left-num').val(curGoodNum); 5813 $('#left-num').val(curGoodNum);
5802 } else { 5814 } else {
5803 - $that.find('.num .left-num').html(''); 5815 + $allChoseItems.find('.num .left-num').html('');
5804 $('#left-num').val(0); 5816 $('#left-num').val(0);
5805 } 5817 }
5806 5818
@@ -5818,8 +5830,8 @@ $('.size-list').on('touchstart', '.block', function(e) { @@ -5818,8 +5830,8 @@ $('.size-list').on('touchstart', '.block', function(e) {
5818 5830
5819 }); 5831 });
5820 5832
5821 -$('.btn-minus').on('touchstart', function() {  
5822 - var num = $num.val(); 5833 +$yohoPage.on('touchstart', '.btn-minus', function() {
  5834 + var num = parseInt($num.val(), 10);
5823 5835
5824 leftNum = $('#left-num').val(); 5836 leftNum = $('#left-num').val();
5825 5837
@@ -5832,10 +5844,8 @@ $('.btn-minus').on('touchstart', function() { @@ -5832,10 +5844,8 @@ $('.btn-minus').on('touchstart', function() {
5832 } 5844 }
5833 5845
5834 $num.val(num - 1); 5846 $num.val(num - 1);
5835 -});  
5836 -  
5837 -$('.btn-plus').on('touchstart', function() {  
5838 - var num = $num.val(); 5847 +}).on('touchstart', '.btn-plus', function() {
  5848 + var num = parseInt($num.val(), 10);
5839 5849
5840 leftNum = $('#left-num').val(); 5850 leftNum = $('#left-num').val();
5841 5851
@@ -5850,9 +5860,7 @@ $('.btn-plus').on('touchstart', function() { @@ -5850,9 +5860,7 @@ $('.btn-plus').on('touchstart', function() {
5850 5860
5851 //TODO:库存数验证 5861 //TODO:库存数验证
5852 $num.val(num + 1); 5862 $num.val(num + 1);
5853 -});  
5854 -  
5855 -$('#chose-btn-sure').on('touchstart', function() { 5863 +}).on('touchstart', '#chose-btn-sure', function() {
5856 5864
5857 var productSku, 5865 var productSku,
5858 buyNumber = $('#good-num').val() - 0, 5866 buyNumber = $('#good-num').val() - 0,
@@ -5867,6 +5875,7 @@ $('#chose-btn-sure').on('touchstart', function() { @@ -5867,6 +5875,7 @@ $('#chose-btn-sure').on('touchstart', function() {
5867 return; 5875 return;
5868 } 5876 }
5869 5877
  5878 + //TODO status change
5870 if ($('#chose-btn-sure').html() === '已售罄') { 5879 if ($('#chose-btn-sure').html() === '已售罄') {
5871 return; 5880 return;
5872 } 5881 }
@@ -5896,15 +5905,19 @@ $('#chose-btn-sure').on('touchstart', function() { @@ -5896,15 +5905,19 @@ $('#chose-btn-sure').on('touchstart', function() {
5896 productSku: productSku, 5905 productSku: productSku,
5897 buyNumber: buyNumber, 5906 buyNumber: buyNumber,
5898 promotionId: promotionId, 5907 promotionId: promotionId,
5899 - isEdit: isEdit 5908 + isEdit: isEdit,
  5909 + cartType: queryString.cartType
5900 } 5910 }
5901 }).done(function(res) { 5911 }).done(function(res) {
5902 loading.hideLoadingMask(); 5912 loading.hideLoadingMask();
5903 if (res.code === 200) { 5913 if (res.code === 200) {
5904 - $('.num-tag').html(numInCart + buyNumber);  
5905 - $('.num-tag').removeClass('hide'); 5914 + $('.num-tag').html(numInCart + buyNumber).removeClass('hide');
5906 confirming = false; 5915 confirming = false;
5907 hide(); 5916 hide();
  5917 +
  5918 + if (cbFn) {
  5919 + cbFn();
  5920 + }
5908 } 5921 }
5909 if (res.message) { 5922 if (res.message) {
5910 tip.show(res.message); 5923 tip.show(res.message);
@@ -8614,6 +8627,10 @@ if ($('.cart-nav').length > 0) { @@ -8614,6 +8627,10 @@ if ($('.cart-nav').length > 0) {
8614 }, 3000); 8627 }, 3000);
8615 } 8628 }
8616 8629
  8630 +$('.advance-buy').on('touchend', function() {
  8631 + window.location.href = '/cart/index/advanceBuy?cartType=' + cartType;
  8632 +});
  8633 +
8617 $('.btn-balance').on('touchend', function() { 8634 $('.btn-balance').on('touchend', function() {
8618 if (hasChecked) { 8635 if (hasChecked) {
8619 window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; 8636 window.location.href = '/cart/index/orderEnsure?cartType=' + cartType;
@@ -8644,7 +8661,8 @@ var $ = require("jquery"), @@ -8644,7 +8661,8 @@ var $ = require("jquery"),
8644 lazyLoad = require("lazyload"); 8661 lazyLoad = require("lazyload");
8645 8662
8646 var dialog = require("js/me/dialog"), 8663 var dialog = require("js/me/dialog"),
8647 - tip = require("js/plugin/tip"); 8664 + tip = require("js/plugin/tip"),
  8665 + orderInfo = require("js/cart/order-info").orderInfo;
8648 8666
8649 var $selectAllBtn = $('.balance .checkbox'), 8667 var $selectAllBtn = $('.balance .checkbox'),
8650 cartType = $('#cartType').val(), 8668 cartType = $('#cartType').val(),
@@ -8740,6 +8758,8 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { @@ -8740,6 +8758,8 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
8740 autoHide: true, 8758 autoHide: true,
8741 fast: true 8759 fast: true
8742 }); 8760 });
  8761 + orderInfo('couponCode', null);
  8762 + orderInfo('couponName', null);
8743 history.go(0); 8763 history.go(0);
8744 } else { 8764 } else {
8745 tip.show(data.message); 8765 tip.show(data.message);
@@ -8858,7 +8878,51 @@ $('.down').on('touchend', function() { @@ -8858,7 +8878,51 @@ $('.down').on('touchend', function() {
8858 chosePanel.show(); 8878 chosePanel.show();
8859 }); 8879 });
8860 8880
  8881 +});
  8882 +define("js/cart/order-info", ["jquery"], function(require, exports, module){
  8883 +/**
  8884 + * 订单信息读取
  8885 + * @author: bikai<kai.bi@yoho.cn>
  8886 + * @date: 2015/12/14
  8887 + */
  8888 +var $ = require("jquery");
  8889 +var info = window.cookie('order-info');
  8890 +
  8891 +function init() {
  8892 + info = {
  8893 + uid: window.getUid(),
  8894 + deliveryId: 1,
  8895 + deliveryTimeId: 1,
  8896 + paymentTypeId: 1,
  8897 + yohoCoin: $('.coin').data('yoho-coin') || 0,
  8898 + addressId: null,
  8899 + couponCode: null,
  8900 + couponName: null,
  8901 + invoice: null,
  8902 + invoiceText: null,
  8903 + invoiceType: null,
  8904 + msg: null,
  8905 + cartType: 'ordinary'
  8906 + };
  8907 + window.setCookie('order-info', JSON.stringify(info));
  8908 +}
  8909 +
  8910 +// info 必须是 JSON 字符串
  8911 +try {
  8912 + info = JSON.parse(info);
  8913 +} catch (e) {
  8914 + init();
  8915 +}
  8916 +
  8917 +exports.init = init;
8861 8918
  8919 +exports.orderInfo = function(key, value) {
  8920 + if (value === undefined) {
  8921 + return info[key];
  8922 + }
  8923 + info[key] = value;
  8924 + window.setCookie('order-info', JSON.stringify(info));
  8925 +};
8862 8926
8863 }); 8927 });
8864 define("js/cart/gift-advance", ["jquery","lazyload"], function(require, exports, module){ 8928 define("js/cart/gift-advance", ["jquery","lazyload"], function(require, exports, module){
@@ -8874,7 +8938,8 @@ var $ = require("jquery"), @@ -8874,7 +8938,8 @@ var $ = require("jquery"),
8874 loading = require("js/plugin/loading"), 8938 loading = require("js/plugin/loading"),
8875 chosePanel = require("js/cart/chose-panel"); 8939 chosePanel = require("js/cart/chose-panel");
8876 8940
8877 -var $page = $('.gift-advance-page'); 8941 +var $page = $('.gift-advance-page'),
  8942 + queryString = $.queryString();
8878 8943
8879 lazyLoad($('.lazy')); 8944 lazyLoad($('.lazy'));
8880 8945
@@ -8888,7 +8953,9 @@ function getProductInfo(skn, promotionId) { @@ -8888,7 +8953,9 @@ function getProductInfo(skn, promotionId) {
8888 tip.show('网络错误'); 8953 tip.show('网络错误');
8889 return; 8954 return;
8890 } 8955 }
8891 - chosePanel.show(html); 8956 + chosePanel.show(html, function() {
  8957 + window.location.href = '/cart/index/index?cartType=' + queryString.cartType;
  8958 + });
8892 }, function() { 8959 }, function() {
8893 tip.show('网络错误'); 8960 tip.show('网络错误');
8894 }).always(function() { 8961 }).always(function() {
@@ -8936,11 +9003,13 @@ if (window.getUid() !== orderInfo('uid')) { @@ -8936,11 +9003,13 @@ if (window.getUid() !== orderInfo('uid')) {
8936 order.init(); 9003 order.init();
8937 } 9004 }
8938 9005
8939 -if ($couponUse.data('value') !== orderInfo('couponValue')) { 9006 +if ($couponUse.data('name') !== orderInfo('couponName')) {
8940 orderInfo('couponCode', null); 9007 orderInfo('couponCode', null);
8941 - orderInfo('couponValue', null); 9008 + orderInfo('couponName', null);
8942 } 9009 }
8943 9010
  9011 +orderInfo('cartType', queryString.cartType || queryString.carttype || 'ordinary');
  9012 +
8944 function dispacthTapEvt(e) { 9013 function dispacthTapEvt(e) {
8945 var $cur = $(e.target).closest('li'); 9014 var $cur = $(e.target).closest('li');
8946 9015
@@ -8986,7 +9055,7 @@ function orderCompute() { @@ -8986,7 +9055,7 @@ function orderCompute() {
8986 method: 'POST', 9055 method: 'POST',
8987 url: '/cart/index/orderCompute', 9056 url: '/cart/index/orderCompute',
8988 data: { 9057 data: {
8989 - cartType: queryString.cartType || queryString.carttype || 'ordinary', 9058 + cartType: orderInfo('cartType') || 'ordinary',
8990 deliveryId: orderInfo('deliveryId'), 9059 deliveryId: orderInfo('deliveryId'),
8991 paymentTypeId: orderInfo('paymentTypeId'), 9060 paymentTypeId: orderInfo('paymentTypeId'),
8992 couponCode: orderInfo('couponCode'), 9061 couponCode: orderInfo('couponCode'),
@@ -9047,11 +9116,12 @@ function submitOrder() { @@ -9047,11 +9116,12 @@ function submitOrder() {
9047 url: '/cart/index/orderSub', 9116 url: '/cart/index/orderSub',
9048 data: { 9117 data: {
9049 addressId: orderInfo('addressId'), 9118 addressId: orderInfo('addressId'),
9050 - cartType: queryString.cartType || queryString.carttype || 'ordinary', 9119 + cartType: orderInfo('cartType') || 'ordinary',
9051 deliveryId: orderInfo('deliveryId'), 9120 deliveryId: orderInfo('deliveryId'),
9052 deliveryTimeId: orderInfo('deliveryTimeId'), 9121 deliveryTimeId: orderInfo('deliveryTimeId'),
9053 - invoiceText: invoiceText,  
9054 - invoiceType: $invoice.find('.invoice-type').val() || orderInfo('invoiceType'), 9122 + invoiceText: orderInfo('invoice') ? invoiceText : null,
  9123 + invoiceType: orderInfo('invoice') ? ($invoice.find('.invoice-type').val() ||
  9124 + orderInfo('invoiceType')) : null,
9055 msg: msg, 9125 msg: msg,
9056 paymentTypeId: orderInfo('paymentTypeId'), 9126 paymentTypeId: orderInfo('paymentTypeId'),
9057 paymentType: orderInfo('paymentType'), //支付方式 9127 paymentType: orderInfo('paymentType'), //支付方式
@@ -9139,51 +9209,6 @@ $('.pay-mode').on('click', 'li', function() { @@ -9139,51 +9209,6 @@ $('.pay-mode').on('click', 'li', function() {
9139 }); 9209 });
9140 9210
9141 }); 9211 });
9142 -define("js/cart/order-info", ["jquery"], function(require, exports, module){  
9143 -/**  
9144 - * 订单信息读取  
9145 - * @author: bikai<kai.bi@yoho.cn>  
9146 - * @date: 2015/12/14  
9147 - */  
9148 -var $ = require("jquery");  
9149 -var info = window.cookie('order-info');  
9150 -  
9151 -function init() {  
9152 - info = {  
9153 - uid: window.getUid(),  
9154 - deliveryId: 1,  
9155 - deliveryTimeId: 1,  
9156 - paymentTypeId: 1,  
9157 - yohoCoin: $('.coin').data('yoho-coin') || 0,  
9158 - addressId: null,  
9159 - couponCode: null,  
9160 - couponValue: null,  
9161 - invoice: null,  
9162 - invoiceText: null,  
9163 - invoiceType: null,  
9164 - msg: null  
9165 - };  
9166 - window.setCookie('order-info', JSON.stringify(info));  
9167 -}  
9168 -  
9169 -// info 必须是 JSON 字符串  
9170 -try {  
9171 - info = JSON.parse(info);  
9172 -} catch (e) {  
9173 - init();  
9174 -}  
9175 -  
9176 -exports.init = init;  
9177 -  
9178 -exports.orderInfo = function(key, value) {  
9179 - if (value === undefined) {  
9180 - return info[key];  
9181 - }  
9182 - info[key] = value;  
9183 - window.setCookie('order-info', JSON.stringify(info));  
9184 -};  
9185 -  
9186 -});  
9187 define("js/cart/select-coupon", ["jquery","handlebars","source-map","mlellipsis"], function(require, exports, module){ 9212 define("js/cart/select-coupon", ["jquery","handlebars","source-map","mlellipsis"], function(require, exports, module){
9188 /** 9213 /**
9189 * 优惠券选择 9214 * 优惠券选择
@@ -9224,7 +9249,7 @@ $newCoupon.on('submit', function() { @@ -9224,7 +9249,7 @@ $newCoupon.on('submit', function() {
9224 if (res.code === 200) { 9249 if (res.code === 200) {
9225 tip.show('优惠券可用'); 9250 tip.show('优惠券可用');
9226 orderInfo('couponCode', res.data.coupon_code); 9251 orderInfo('couponCode', res.data.coupon_code);
9227 - orderInfo('couponValue', res.data.coupon_value); 9252 + orderInfo('couponName', res.data.coupon_title);
9228 window.location.href = '/cart/index/orderEnsure'; 9253 window.location.href = '/cart/index/orderEnsure';
9229 } else { 9254 } else {
9230 tip.show(res.message || '网络错误'); 9255 tip.show(res.message || '网络错误');
@@ -9239,12 +9264,12 @@ $('#coupon-list').on('touchend', '.employ-main', function() { @@ -9239,12 +9264,12 @@ $('#coupon-list').on('touchend', '.employ-main', function() {
9239 var $this = $(this); 9264 var $this = $(this);
9240 9265
9241 orderInfo('couponCode', $this.data('coupon-code')); 9266 orderInfo('couponCode', $this.data('coupon-code'));
9242 - orderInfo('couponValue', $this.data('coupon-value')); 9267 + orderInfo('couponName', $this.data('coupon-name'));
9243 }); 9268 });
9244 9269
9245 $('body').on('touchend', '.not-use', function() { 9270 $('body').on('touchend', '.not-use', function() {
9246 orderInfo('couponCode', null); 9271 orderInfo('couponCode', null);
9247 - orderInfo('couponValue', null); 9272 + orderInfo('couponName', null);
9248 }); 9273 });
9249 9274
9250 9275
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.
@@ -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 Sat Dec 5 16:26:44 2015 5 +Created by FontForge 20120731 at Thu Dec 17 13:53:30 2015
6 By Ads 6 By Ads
7 </metadata> 7 </metadata>
8 <defs> 8 <defs>
@@ -19,7 +19,7 @@ Created by FontForge 20120731 at Sat Dec 5 16:26:44 2015 @@ -19,7 +19,7 @@ Created by FontForge 20120731 at Sat Dec 5 16:26:44 2015
19 bbox="-0.75 -224 3943 833" 19 bbox="-0.75 -224 3943 833"
20 underline-thickness="50" 20 underline-thickness="50"
21 underline-position="-100" 21 underline-position="-100"
22 - unicode-range="U+0078-E63F" 22 + unicode-range="U+0078-E640"
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" />
@@ -257,5 +257,11 @@ d="M512 -66q-10 0 -24.5 -0.5t-25 -1t-24 0t-24.5 1.5l-222 -146q0 227 5 243q-164 1 @@ -257,5 +257,11 @@ d="M512 -66q-10 0 -24.5 -0.5t-25 -1t-24 0t-24.5 1.5l-222 -146q0 227 5 243q-164 1
257 q-91 0 -176.5 -31.5t-148.5 -83.5t-100.5 -124.5t-37.5 -150.5q0 -95 53 -179t142 -138v-170l146 97q16 -3 35.5 -4t49 0t37.5 1q41 0 81 6.5t77 18.5t72 29.5t65 39.5t56.5 47.5t47 55t35 61t22 66t7.5 69.5q0 104 -63.5 194.5t-170.5 143t-229 52.5zM768 300 257 q-91 0 -176.5 -31.5t-148.5 -83.5t-100.5 -124.5t-37.5 -150.5q0 -95 53 -179t142 -138v-170l146 97q16 -3 35.5 -4t49 0t37.5 1q41 0 81 6.5t77 18.5t72 29.5t65 39.5t56.5 47.5t47 55t35 61t22 66t7.5 69.5q0 104 -63.5 194.5t-170.5 143t-229 52.5zM768 300
258 q-27 0 -45.5 18.5t-18.5 45.5t18.5 45.5t45.5 18.5t45.5 -18.5t18.5 -45.5t-18.5 -45.5t-45.5 -18.5zM512 300q-27 0 -45.5 18.5t-18.5 45.5t18.5 45.5t45.5 18.5t45.5 -18.5t18.5 -45.5t-18.5 -45.5t-45.5 -18.5zM256 300q-27 0 -45.5 18.5t-18.5 45.5t18.5 45.5t45.5 18.5 258 q-27 0 -45.5 18.5t-18.5 45.5t18.5 45.5t45.5 18.5t45.5 -18.5t18.5 -45.5t-18.5 -45.5t-45.5 -18.5zM512 300q-27 0 -45.5 18.5t-18.5 45.5t18.5 45.5t45.5 18.5t45.5 -18.5t18.5 -45.5t-18.5 -45.5t-45.5 -18.5zM256 300q-27 0 -45.5 18.5t-18.5 45.5t18.5 45.5t45.5 18.5
259 t45.5 -18.5t18.5 -45.5t-18.5 -45.5t-45.5 -18.5z" /> 259 t45.5 -18.5t18.5 -45.5t-18.5 -45.5t-45.5 -18.5z" />
  260 + <glyph glyph-name="uniE640" unicode="&#xe640;"
  261 +d="M957 510q-5 8 -14 13.5t-24 5.5h-598l-29 62l-4 7q-1 3 -4 7t-8 8q-4 3 -7 6l-2 1l-8 4h-2q-5 2 -9 2l-4 1h-5h-118q-23 0 -40 -16.5t-17 -40.5q0 -6 1.5 -12.5t4.5 -12.5t7 -10.5t8.5 -8.5t10.5 -7t12.5 -4.5t12.5 -1.5h81l33 -71q3 -10 8 -21t8 -17l3 -5l81 -181
  262 +q0 -2 2 -5l15 -32q9 -30 39 -38v-3h392l18 1v2q14 4 24.5 14t14.5 24l98 217q40 77 19 112zM909 413l-93 -207l-3 1l-4 -15q-5 -19 -25 -19l-19 1v-1h-340h-18q-8 0 -15 5t-9 14l-4 15l-3 -1l-93 208q-1 1 -3.5 5.5t-7 14.5t-7.5 20l-42 92h-102q-10 0 -17 7t-7 17
  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
  265 +t6.5 25.5t18.5 19t26 7q21 0 36 -15t15 -36t-15 -36t-36 -15z" />
260 </font> 266 </font>
261 </defs></svg> 267 </defs></svg>