Authored by 毕凯

订单确认页面逻辑修改

... ... @@ -10,8 +10,9 @@ var $ = require('jquery'),
lazyLoad = require('yoho.lazyload');
var dialog = require('../me/dialog'),
tip = require('../plugin/tip'),
orderInfo = require('./order-info').orderInfo;
tip = require('../plugin/tip');
// orderInfo = require('./order-info').orderInfo;
var $selectAllBtn = $('.balance .checkbox'),
requesting = false;
... ... @@ -106,8 +107,9 @@ $('.icon-del').on('touchstart', function(e) {
autoHide: true,
fast: true
});
orderInfo('couponCode', null);
orderInfo('couponName', null);
// orderInfo('couponCode', null);
// orderInfo('couponName', null);
window.setCookie('_yoho-cart-refreshByDelete', true);
window.location.href = '/cart/index/index?cartType=' + $('#cartType').val();
} else {
... ...
... ... @@ -40,6 +40,12 @@ if ($couponUse.data('name') !== orderInfo('couponName')) {
orderInfo('couponName', null);
}
// 来自购物车的链接默认不使用优惠券
if (document.referrer && document.referrer.indexOf('/cart/index/index') !== -1) {
orderInfo('couponCode', null);
orderInfo('couponName', null);
}
orderInfo('cartType', queryString.cartType || queryString.carttype || 'ordinary');
function dispacthTapEvt(e) {
... ... @@ -120,6 +126,9 @@ function orderCompute() {
});
}
// 进入页面计算一次价格
orderCompute();
function submitOrder() {
var invoiceText = $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'),
msg = $('#msg').find('input').val() || orderInfo('msg');
... ...
... ... @@ -32,7 +32,7 @@ try {
info = JSON.parse(info);
// 2015/12/31 hf: fixes bug to 购物车页面调用该JS, 会导致有YOHO币,值却没有传给服务端. 因此需要再设置一下
info['yohoCoin'] = $('.coin').data('yoho-coin') || 0;
// info.yohoCoin = $('.coin').data('yoho-coin') || 0;
} catch (e) {
init();
}
... ...
... ... @@ -158,15 +158,14 @@ function getCouponHandle(coupons) {
couponCode: couponCode
}
}).then(function(res) {
if (res.message) {
tip.show(res.message);
}
if (res.code === 200) {
//tip.show('优惠券可用');
orderInfo('couponCode', res.data.coupon_code);
orderInfo('couponName', res.data.coupon_title);
window.location.href = '/cart/index/orderEnsure';
} else if (res.message) {
tip.show(res.message);
}
}).fail(function() {
tip.show('网络错误');
... ...