Showing
4 changed files
with
33 additions
and
12 deletions
@@ -84,6 +84,12 @@ function orderCompute() { | @@ -84,6 +84,12 @@ function orderCompute() { | ||
84 | if (!res) { | 84 | if (!res) { |
85 | tip.show('网络出错'); | 85 | tip.show('网络出错'); |
86 | } else { | 86 | } else { |
87 | + if (res.order_amount) { | ||
88 | + res.order_amount = (+res.order_amount).toFixed(2); | ||
89 | + } | ||
90 | + if (res.discount_amount) { | ||
91 | + res.discount_amount = (+res.discount_amount).toFixed(2); | ||
92 | + } | ||
87 | if (res.last_order_amount) { | 93 | if (res.last_order_amount) { |
88 | res.last_order_amount = (+res.last_order_amount).toFixed(2); | 94 | res.last_order_amount = (+res.last_order_amount).toFixed(2); |
89 | } | 95 | } |
@@ -22,18 +22,24 @@ var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()), | @@ -22,18 +22,24 @@ var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()), | ||
22 | ellipsis.init(); | 22 | ellipsis.init(); |
23 | 23 | ||
24 | $newCoupon.on('submit', function() { | 24 | $newCoupon.on('submit', function() { |
25 | + var $this = $(this); | ||
26 | + | ||
27 | + if (!$this.find('[name="couponCode"]').val()) { | ||
28 | + tip.show('请输入优惠券码'); | ||
29 | + return false; | ||
30 | + } | ||
25 | $.ajax({ | 31 | $.ajax({ |
26 | method: 'POST', | 32 | method: 'POST', |
27 | url: '/cart/index/couponSearch', | 33 | url: '/cart/index/couponSearch', |
28 | - data: $(this).serialize() | 34 | + data: $this.serialize() |
29 | }).then(function(res) { | 35 | }).then(function(res) { |
30 | if (res.code === 200) { | 36 | if (res.code === 200) { |
31 | tip.show('优惠券可用'); | 37 | tip.show('优惠券可用'); |
32 | orderInfo('couponCode', res.data.coupon_code); | 38 | orderInfo('couponCode', res.data.coupon_code); |
33 | orderInfo('couponValue', res.data.coupon_value); | 39 | orderInfo('couponValue', res.data.coupon_value); |
34 | - window.location.href = '/shoppingCart/orderEnsure?coupon_code=' + res.data.coupon_code; | 40 | + window.location.href = '/cart/index/orderEnsure'; |
35 | } else { | 41 | } else { |
36 | - tip.show(res.message); | 42 | + tip.show(res.message || '网络错误'); |
37 | } | 43 | } |
38 | }).fail(function() { | 44 | }).fail(function() { |
39 | tip.show('网络错误'); | 45 | tip.show('网络错误'); |
@@ -78,8 +78,14 @@ $.ajax({ | @@ -78,8 +78,14 @@ $.ajax({ | ||
78 | type: 'GET', | 78 | type: 'GET', |
79 | url: '/cart/index/count', | 79 | url: '/cart/index/count', |
80 | success: function(data) { | 80 | success: function(data) { |
81 | + var count; | ||
82 | + | ||
81 | if (data.code === 200) { | 83 | if (data.code === 200) { |
82 | - $cart.find('.num-tag').html(data.data.cart_goods_count).removeClass('hide'); | 84 | + count = data.data.cart_goods_count || 0; |
85 | + if (count > 99) { | ||
86 | + count = '99+'; | ||
87 | + } | ||
88 | + $cart.find('.num-tag').html(count).removeClass('hide'); | ||
83 | } | 89 | } |
84 | } | 90 | } |
85 | }); | 91 | }); |
@@ -480,16 +480,19 @@ $basicBtnC:#eb0313; | @@ -480,16 +480,19 @@ $basicBtnC:#eb0313; | ||
480 | } | 480 | } |
481 | } | 481 | } |
482 | .num-tag { | 482 | .num-tag { |
483 | - position: absolute; | ||
484 | - left: pxToRem(66px); | ||
485 | - height: pxToRem(20px); | ||
486 | display: block; | 483 | display: block; |
487 | - width: pxToRem(36px); | ||
488 | - height: pxToRem(36px); | ||
489 | - background-color: $basicBtnC; | ||
490 | - border-radius: 50%; | 484 | + position: absolute; |
485 | + top: 0; | ||
486 | + left: pxToRem(48px); | ||
487 | + width: pxToRem(72px); | ||
488 | + height: pxToRem(72px); | ||
489 | + font-size: pxToRem(40px); | ||
490 | + line-height: pxToRem(72px); | ||
491 | color: #fff; | 491 | color: #fff; |
492 | - font-size: pxToRem(24px); | 492 | + background: $basicBtnC; |
493 | + text-align: center; | ||
494 | + border-radius: 50%; | ||
495 | + @include transform(scale(0.5)); | ||
493 | &.hide{ | 496 | &.hide{ |
494 | display: none; | 497 | display: none; |
495 | } | 498 | } |
-
Please register or login to post a comment