Authored by 毕凯

购物车 bug 修复

... ... @@ -84,6 +84,12 @@ function orderCompute() {
if (!res) {
tip.show('网络出错');
} else {
if (res.order_amount) {
res.order_amount = (+res.order_amount).toFixed(2);
}
if (res.discount_amount) {
res.discount_amount = (+res.discount_amount).toFixed(2);
}
if (res.last_order_amount) {
res.last_order_amount = (+res.last_order_amount).toFixed(2);
}
... ...
... ... @@ -22,18 +22,24 @@ var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()),
ellipsis.init();
$newCoupon.on('submit', function() {
var $this = $(this);
if (!$this.find('[name="couponCode"]').val()) {
tip.show('请输入优惠券码');
return false;
}
$.ajax({
method: 'POST',
url: '/cart/index/couponSearch',
data: $(this).serialize()
data: $this.serialize()
}).then(function(res) {
if (res.code === 200) {
tip.show('优惠券可用');
orderInfo('couponCode', res.data.coupon_code);
orderInfo('couponValue', res.data.coupon_value);
window.location.href = '/shoppingCart/orderEnsure?coupon_code=' + res.data.coupon_code;
window.location.href = '/cart/index/orderEnsure';
} else {
tip.show(res.message);
tip.show(res.message || '网络错误');
}
}).fail(function() {
tip.show('网络错误');
... ...
... ... @@ -78,8 +78,14 @@ $.ajax({
type: 'GET',
url: '/cart/index/count',
success: function(data) {
var count;
if (data.code === 200) {
$cart.find('.num-tag').html(data.data.cart_goods_count).removeClass('hide');
count = data.data.cart_goods_count || 0;
if (count > 99) {
count = '99+';
}
$cart.find('.num-tag').html(count).removeClass('hide');
}
}
});
... ...
... ... @@ -480,16 +480,19 @@ $basicBtnC:#eb0313;
}
}
.num-tag {
position: absolute;
left: pxToRem(66px);
height: pxToRem(20px);
display: block;
width: pxToRem(36px);
height: pxToRem(36px);
background-color: $basicBtnC;
border-radius: 50%;
position: absolute;
top: 0;
left: pxToRem(48px);
width: pxToRem(72px);
height: pxToRem(72px);
font-size: pxToRem(40px);
line-height: pxToRem(72px);
color: #fff;
font-size: pxToRem(24px);
background: $basicBtnC;
text-align: center;
border-radius: 50%;
@include transform(scale(0.5));
&.hide{
display: none;
}
... ...