Authored by biao

更新限购商品结算逻辑

@@ -94,7 +94,7 @@ function setEditModeWithSknId(sknId, isThisGoodSelected) { @@ -94,7 +94,7 @@ function setEditModeWithSknId(sknId, isThisGoodSelected) {
94 * @return {undefined} 94 * @return {undefined}
95 */ 95 */
96 function setLimitGoodModeWithSknId(code, sknId) { 96 function setLimitGoodModeWithSknId(code, sknId) {
97 - $('#chose-btn-sure').html('结算'); 97 + $('#chose-btn-sure').html('立即购买');
98 limitProductCode = code; 98 limitProductCode = code;
99 skn = sknId; 99 skn = sknId;
100 } 100 }
@@ -172,7 +172,7 @@ function updateConformButtonClassAndText() { @@ -172,7 +172,7 @@ function updateConformButtonClassAndText() {
172 if (2 === $chosed.closest('.zero-stock').length) { 172 if (2 === $chosed.closest('.zero-stock').length) {
173 $('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄'); 173 $('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄');
174 } else if (limitProductCode) { 174 } else if (limitProductCode) {
175 - $('#chose-btn-sure').css('background-color', '#eb0313').html('结算'); 175 + $('#chose-btn-sure').css('background-color', '#eb0313').html('立即购买');
176 } else { 176 } else {
177 $('#chose-btn-sure').css('background-color', '#eb0313').html(isEdit ? '确认' : '加入购物车'); 177 $('#chose-btn-sure').css('background-color', '#eb0313').html(isEdit ? '确认' : '加入购物车');
178 } 178 }
@@ -30,6 +30,26 @@ require('../common'); @@ -30,6 +30,26 @@ require('../common');
30 30
31 lazyLoad(); 31 lazyLoad();
32 32
  33 +function getQueryParam() {
  34 + var queryArray = location.search.substr(1).split('&&'),
  35 + i,
  36 + subArr = [],
  37 + obj = {};
  38 +
  39 + for (i = 0; i < queryArray.length; i++) {
  40 + subArr = queryArray[i].split('=');
  41 + obj[subArr[0]] = subArr[1];
  42 + subArr = [];
  43 + }
  44 +
  45 + return obj;
  46 +}
  47 +
  48 +function isLimitGood() {
  49 + return getQueryParam().code;
  50 +}
  51 +
  52 +
33 if (window.getUid() !== orderInfo('uid')) { 53 if (window.getUid() !== orderInfo('uid')) {
34 order.init(); 54 order.init();
35 window.location.reload(); 55 window.location.reload();
@@ -46,6 +66,13 @@ if (document.referrer && document.referrer.indexOf('/cart/index/index') !== -1) @@ -46,6 +66,13 @@ if (document.referrer && document.referrer.indexOf('/cart/index/index') !== -1)
46 orderInfo('couponName', null); 66 orderInfo('couponName', null);
47 } 67 }
48 68
  69 +isLimitGood() && (function() {
  70 + var a = [];
  71 +
  72 + a.push(getQueryParam());
  73 + orderInfo('skuList', JSON.stringify(a));
  74 +})();
  75 +
49 if (queryString.cartType || queryString.carttype || !orderInfo('cartType')) { 76 if (queryString.cartType || queryString.carttype || !orderInfo('cartType')) {
50 orderInfo('cartType', queryString.cartType || queryString.carttype || 'ordinary'); 77 orderInfo('cartType', queryString.cartType || queryString.carttype || 'ordinary');
51 } 78 }
@@ -102,7 +129,8 @@ function orderCompute() { @@ -102,7 +129,8 @@ function orderCompute() {
102 deliveryId: orderInfo('deliveryId'), 129 deliveryId: orderInfo('deliveryId'),
103 paymentTypeId: orderInfo('paymentTypeId'), 130 paymentTypeId: orderInfo('paymentTypeId'),
104 couponCode: orderInfo('couponCode'), 131 couponCode: orderInfo('couponCode'),
105 - yohoCoin: yohoCoin 132 + yohoCoin: yohoCoin,
  133 + skuList: isLimitGood() ? orderInfo('skuList') : undefined
106 } 134 }
107 }).then(function(res) { 135 }).then(function(res) {
108 var priceHtml; 136 var priceHtml;
@@ -177,7 +205,9 @@ function submitOrder() { @@ -177,7 +205,9 @@ function submitOrder() {
177 paymentTypeId: orderInfo('paymentTypeId'), 205 paymentTypeId: orderInfo('paymentTypeId'),
178 paymentType: orderInfo('paymentType'), //支付方式 206 paymentType: orderInfo('paymentType'), //支付方式
179 couponCode: orderInfo('couponCode'), 207 couponCode: orderInfo('couponCode'),
180 - yohoCoin: orderInfo('yohoCoin') 208 + yohoCoin: orderInfo('yohoCoin'),
  209 + skuList: isLimitGood() ? orderInfo('skuList') : undefined
  210 +
181 } 211 }
182 }).then(function(res) { 212 }).then(function(res) {
183 var url; 213 var url;