Authored by 郝肖肖

Merge branch 'feature/orderEnsurefreight' into release/5.4.1

@@ -15,6 +15,7 @@ var $ = require('yoho-jquery'), @@ -15,6 +15,7 @@ var $ = require('yoho-jquery'),
15 var isGetData; 15 var isGetData;
16 16
17 var $newCoupon = $('#new-coupon'), 17 var $newCoupon = $('#new-coupon'),
  18 + linkUrl = document.referrer,
18 $couponList = $('#coupon-list'); 19 $couponList = $('#coupon-list');
19 20
20 var winH = $(window).height(); 21 var winH = $(window).height();
@@ -37,6 +38,14 @@ function fixedLayOut() { @@ -37,6 +38,14 @@ function fixedLayOut() {
37 38
38 ellipsis.init(); 39 ellipsis.init();
39 40
  41 +function goToBack() {
  42 + if (linkUrl) {
  43 + window.location.href = linkUrl;
  44 + } else {
  45 + history.go(-1);
  46 + }
  47 +}
  48 +
40 $newCoupon.on('submit', function() { 49 $newCoupon.on('submit', function() {
41 var $this = $(this); 50 var $this = $(this);
42 51
@@ -59,7 +68,7 @@ $newCoupon.on('submit', function() { @@ -59,7 +68,7 @@ $newCoupon.on('submit', function() {
59 orderInfo('yohoCoin', 0); 68 orderInfo('yohoCoin', 0);
60 orderInfo('couponCode', res.data.coupon_code); 69 orderInfo('couponCode', res.data.coupon_code);
61 orderInfo('couponName', res.data.coupon_title); 70 orderInfo('couponName', res.data.coupon_title);
62 - history.go(-1); 71 + goToBack();
63 } 72 }
64 }).fail(function() { 73 }).fail(function() {
65 tip.show('网络错误'); 74 tip.show('网络错误');
@@ -85,7 +94,7 @@ $('body').on('touchend', '.not-use', function() { @@ -85,7 +94,7 @@ $('body').on('touchend', '.not-use', function() {
85 94
86 // 实付金额发生变化,使用有货币为0 95 // 实付金额发生变化,使用有货币为0
87 orderInfo('yohoCoin', 0); 96 orderInfo('yohoCoin', 0);
88 - history.go(-1); 97 + goToBack();
89 }); 98 });
90 99
91 100
@@ -142,7 +151,7 @@ function getCouponHandle(allCoupons) { @@ -142,7 +151,7 @@ function getCouponHandle(allCoupons) {
142 151
143 // 实付金额发生变化,使用有货币为0 152 // 实付金额发生变化,使用有货币为0
144 orderInfo('yohoCoin', 0); 153 orderInfo('yohoCoin', 0);
145 - history.go(-1); 154 + goToBack();
146 } else if (res.message) { 155 } else if (res.message) {
147 tip.show(res.message); 156 tip.show(res.message);
148 } 157 }
@@ -18,6 +18,7 @@ var $invoiceNotice = $('.invoice-notice'), @@ -18,6 +18,7 @@ var $invoiceNotice = $('.invoice-notice'),
18 $company = $('.company'), 18 $company = $('.company'),
19 $telArea = $('.tel-area'), 19 $telArea = $('.tel-area'),
20 orderInfo = order.orderInfo, 20 orderInfo = order.orderInfo,
  21 + linkUrl = document.referrer,
21 $chooseContLi = $('.invoice-cont').find('.icon-cb-radio').parent(), 22 $chooseContLi = $('.invoice-cont').find('.icon-cb-radio').parent(),
22 $copyTel = $('.copy-tel'), 23 $copyTel = $('.copy-tel'),
23 isModifyTel = false; 24 isModifyTel = false;
@@ -33,6 +34,14 @@ if (window.getUid() !== orderInfo('uid')) { @@ -33,6 +34,14 @@ if (window.getUid() !== orderInfo('uid')) {
33 window.location.reload(); 34 window.location.reload();
34 } 35 }
35 36
  37 +function goToBack() {
  38 + if (linkUrl) {
  39 + window.location.href = linkUrl;
  40 + } else {
  41 + history.go(-1);
  42 + }
  43 +}
  44 +
36 // 单选效果 45 // 单选效果
37 function chooseAction(pDom, dom) { 46 function chooseAction(pDom, dom) {
38 if (dom.hasClass('icon-cb-radio')) { 47 if (dom.hasClass('icon-cb-radio')) {
@@ -92,13 +101,13 @@ function confirmAction() { @@ -92,13 +101,13 @@ function confirmAction() {
92 autoHide: true, 101 autoHide: true,
93 fast: true 102 fast: true
94 }); 103 });
95 - history.go(-1); 104 + goToBack();
96 }, function() { 105 }, function() {
97 - history.go(-1); 106 + goToBack();
98 }); 107 });
99 } 108 }
100 } else { 109 } else {
101 - history.go(-1); 110 + goToBack();
102 } 111 }
103 } 112 }
104 113