Authored by biao

更新限购商品结算逻辑

... ... @@ -94,7 +94,7 @@ function setEditModeWithSknId(sknId, isThisGoodSelected) {
* @return {undefined}
*/
function setLimitGoodModeWithSknId(code, sknId) {
$('#chose-btn-sure').html('结算');
$('#chose-btn-sure').html('立即购买');
limitProductCode = code;
skn = sknId;
}
... ... @@ -172,7 +172,7 @@ function updateConformButtonClassAndText() {
if (2 === $chosed.closest('.zero-stock').length) {
$('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄');
} else if (limitProductCode) {
$('#chose-btn-sure').css('background-color', '#eb0313').html('结算');
$('#chose-btn-sure').css('background-color', '#eb0313').html('立即购买');
} else {
$('#chose-btn-sure').css('background-color', '#eb0313').html(isEdit ? '确认' : '加入购物车');
}
... ...
... ... @@ -30,6 +30,26 @@ require('../common');
lazyLoad();
function getQueryParam() {
var queryArray = location.search.substr(1).split('&&'),
i,
subArr = [],
obj = {};
for (i = 0; i < queryArray.length; i++) {
subArr = queryArray[i].split('=');
obj[subArr[0]] = subArr[1];
subArr = [];
}
return obj;
}
function isLimitGood() {
return getQueryParam().code;
}
if (window.getUid() !== orderInfo('uid')) {
order.init();
window.location.reload();
... ... @@ -46,6 +66,13 @@ if (document.referrer && document.referrer.indexOf('/cart/index/index') !== -1)
orderInfo('couponName', null);
}
isLimitGood() && (function() {
var a = [];
a.push(getQueryParam());
orderInfo('skuList', JSON.stringify(a));
})();
if (queryString.cartType || queryString.carttype || !orderInfo('cartType')) {
orderInfo('cartType', queryString.cartType || queryString.carttype || 'ordinary');
}
... ... @@ -102,7 +129,8 @@ function orderCompute() {
deliveryId: orderInfo('deliveryId'),
paymentTypeId: orderInfo('paymentTypeId'),
couponCode: orderInfo('couponCode'),
yohoCoin: yohoCoin
yohoCoin: yohoCoin,
skuList: isLimitGood() ? orderInfo('skuList') : undefined
}
}).then(function(res) {
var priceHtml;
... ... @@ -177,7 +205,9 @@ function submitOrder() {
paymentTypeId: orderInfo('paymentTypeId'),
paymentType: orderInfo('paymentType'), //支付方式
couponCode: orderInfo('couponCode'),
yohoCoin: orderInfo('yohoCoin')
yohoCoin: orderInfo('yohoCoin'),
skuList: isLimitGood() ? orderInfo('skuList') : undefined
}
}).then(function(res) {
var url;
... ...