Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
7 changed files
with
61 additions
and
80 deletions
@@ -16,6 +16,8 @@ var $cartContent = $('.cart-content'); | @@ -16,6 +16,8 @@ var $cartContent = $('.cart-content'); | ||
16 | var navHammer, | 16 | var navHammer, |
17 | cartType = $('#cartType').val(); | 17 | cartType = $('#cartType').val(); |
18 | 18 | ||
19 | +var hasChecked = $('.cart-goods .icon-cb-checked').length > 0 ? true : false; //是否有选中商品 | ||
20 | + | ||
19 | require('./good'); | 21 | require('./good'); |
20 | 22 | ||
21 | lazyLoad($('img.lazy')); | 23 | lazyLoad($('img.lazy')); |
@@ -51,10 +53,10 @@ if ($('.cart-nav').length > 0) { | @@ -51,10 +53,10 @@ if ($('.cart-nav').length > 0) { | ||
51 | } | 53 | } |
52 | 54 | ||
53 | $('.btn-balance').on('touchend', function() { | 55 | $('.btn-balance').on('touchend', function() { |
54 | - if ($('.balance span').hasClass('icon-cb-checked')) { | 56 | + if (hasChecked) { |
55 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; | 57 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; |
56 | } else { | 58 | } else { |
57 | - tip.show('请先勾选商品~'); | 59 | + tip.show('请先勾选商品'); |
58 | } | 60 | } |
59 | }); | 61 | }); |
60 | 62 | ||
@@ -63,3 +65,6 @@ $('.chose').on('touchend', function() { | @@ -63,3 +65,6 @@ $('.chose').on('touchend', function() { | ||
63 | //var id = $(this).closest('.gift-advance-good').data('id'); | 65 | //var id = $(this).closest('.gift-advance-good').data('id'); |
64 | chosePanel.show(); | 66 | chosePanel.show(); |
65 | }); | 67 | }); |
68 | + | ||
69 | +//提前触发lazyload | ||
70 | +$(window).scrollTop(1).scrollTop(0); |
@@ -12,8 +12,7 @@ var $ = require('jquery'), | @@ -12,8 +12,7 @@ var $ = require('jquery'), | ||
12 | var dialog = require('../me/dialog'), | 12 | var dialog = require('../me/dialog'), |
13 | tip = require('../plugin/tip'); | 13 | tip = require('../plugin/tip'); |
14 | 14 | ||
15 | -var $names, | ||
16 | - $selectAllBtn = $('.balance .iconfont'), | 15 | +var $selectAllBtn = $('.balance .checkbox'), |
17 | cartType = $('#cartType').val(), | 16 | cartType = $('#cartType').val(), |
18 | requesting = false; | 17 | requesting = false; |
19 | 18 | ||
@@ -23,11 +22,9 @@ lazyLoad({ | @@ -23,11 +22,9 @@ lazyLoad({ | ||
23 | try_again_css: 'good-failure' | 22 | try_again_css: 'good-failure' |
24 | }); | 23 | }); |
25 | 24 | ||
26 | - | ||
27 | -$names = $('.name'); | ||
28 | -if ($names.length > 0) { | ||
29 | - $names[0].mlellipsis(2); | ||
30 | -} | 25 | +$('.shopping-cart-good .name').each(function() { |
26 | + this.mlellipsis(2); | ||
27 | +}); | ||
31 | 28 | ||
32 | //TIP:事件委托在.cart-goods,商品列表的容器统一需要有.cart-goods | 29 | //TIP:事件委托在.cart-goods,商品列表的容器统一需要有.cart-goods |
33 | $('.cart-goods').on('touchstart', '.checkbox', function() { | 30 | $('.cart-goods').on('touchstart', '.checkbox', function() { |
@@ -73,44 +70,12 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -73,44 +70,12 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
73 | } else { | 70 | } else { |
74 | $this.removeClass('icon-checkbox').addClass('icon-cb-checked'); | 71 | $this.removeClass('icon-checkbox').addClass('icon-cb-checked'); |
75 | } | 72 | } |
76 | - $.ajax({ | ||
77 | - type: 'GET', | ||
78 | - url: 'getCartData', | ||
79 | - data: { | ||
80 | - id: id | ||
81 | - }, | ||
82 | - success: function(data) { | ||
83 | - if (data) { | ||
84 | - if (cartType === 'ordinary') { | ||
85 | - $('#good-totalprice').html('¥' + data.commonCart.price); | ||
86 | - $('#good-activityPrice').html('¥' + data.commonCart.activityPrice); | ||
87 | - $('#good-total').html('总计:¥' + data.commonCart.sumPrice + ' (' + data.commonCart.count + '件)'); | ||
88 | - if (data.commonCart.isAllSelected) { | ||
89 | - $('.balance span').removeClass('icon-checkbox').addClass('icon-cb-checked'); | ||
90 | - } else { | ||
91 | - $('.balance span').removeClass('icon-cb-checked').addClass('icon-checkbox'); | ||
92 | - } | ||
93 | - } else { | ||
94 | - $('#good-totalprice').html('¥' + data.preSellCart.price); | ||
95 | - $('#good-activityPrice').html('¥' + data.preSellCart.activityPrice); | ||
96 | - $('#good-total').html('总计:¥' + data.preSellCart.sumPrice + ' (' + data.preSellCart.count + '件)'); | ||
97 | - if (data.preSellCart.isAllSelected) { | ||
98 | - $('.balance span').removeClass('icon-checkbox').addClass('icon-cb-checked'); | ||
99 | - } else { | ||
100 | - $('.balance span').removeClass('icon-cb-checked').addClass('icon-checkbox'); | ||
101 | - } | ||
102 | - } | ||
103 | - } | ||
104 | - }, | ||
105 | - error: function() { | ||
106 | - tip.show('网络错误'); | ||
107 | - } | ||
108 | - }); | 73 | + window.history.go(0); |
109 | } else if (data.code === 400) { | 74 | } else if (data.code === 400) { |
110 | - tip.show('网络错误'); | 75 | + tip.show('网络异常'); |
111 | } | 76 | } |
112 | - }).fail(function() { | ||
113 | - tip.show('网络错误'); | 77 | + }, function() { |
78 | + tip.show('网络异常'); | ||
114 | }); | 79 | }); |
115 | }).on('touchstart', '.icon-del', function(e) { | 80 | }).on('touchstart', '.icon-del', function(e) { |
116 | var $this = $(this); | 81 | var $this = $(this); |
@@ -143,10 +108,10 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -143,10 +108,10 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
143 | }); | 108 | }); |
144 | history.go(0); | 109 | history.go(0); |
145 | } | 110 | } |
146 | - }).fail(function() { | 111 | + }, function() { |
147 | dialog.showDialog({ | 112 | dialog.showDialog({ |
148 | autoHide: true, | 113 | autoHide: true, |
149 | - dialogText: '网络错误~' | 114 | + dialogText: '网络异常' |
150 | }); | 115 | }); |
151 | }); | 116 | }); |
152 | }); | 117 | }); |
@@ -203,6 +168,7 @@ function didUpdateAllGoodsCheckStatus() { | @@ -203,6 +168,7 @@ function didUpdateAllGoodsCheckStatus() { | ||
203 | $(checkedBox).removeClass('icon-cb-checked').addClass('icon-checkbox'); | 168 | $(checkedBox).removeClass('icon-cb-checked').addClass('icon-checkbox'); |
204 | }); | 169 | }); |
205 | } | 170 | } |
171 | + window.history.go(0); | ||
206 | } | 172 | } |
207 | 173 | ||
208 | function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { | 174 | function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { |
@@ -251,6 +217,7 @@ function willBeSelected($this) { | @@ -251,6 +217,7 @@ function willBeSelected($this) { | ||
251 | //全选按钮点击事件 | 217 | //全选按钮点击事件 |
252 | $selectAllBtn.on('touchend', function() { | 218 | $selectAllBtn.on('touchend', function() { |
253 | var $this = $(this); | 219 | var $this = $(this); |
220 | + | ||
254 | bottomCheckBoxHandeler(willBeSelected($this), cartType, didUpdateAllGoodsCheckStatus); | 221 | bottomCheckBoxHandeler(willBeSelected($this), cartType, didUpdateAllGoodsCheckStatus); |
255 | }); | 222 | }); |
256 | 223 |
@@ -63,36 +63,31 @@ | @@ -63,36 +63,31 @@ | ||
63 | } | 63 | } |
64 | 64 | ||
65 | .deps { | 65 | .deps { |
66 | - margin-left: 173rem / $pxConvertRem; | ||
67 | - padding-bottom: 72rem / $pxConvertRem; | ||
68 | - border-bottom: 1px solid #e0e0e0; | ||
69 | - width: 380rem / $pxConvertRem; | ||
70 | position: relative; | 66 | position: relative; |
71 | - min-height: 140rem / $pxConvertRem; | 67 | + width: 380rem / $pxConvertRem; |
68 | + height: 5.3rem; | ||
69 | + margin-left: 4.7rem; | ||
70 | + border-bottom: 1px solid #e0e0e0; | ||
71 | + padding-top: 0.5rem; | ||
72 | } | 72 | } |
73 | 73 | ||
74 | .name { | 74 | .name { |
75 | - font-size: 28rem / $pxConvertRem; | 75 | + font-size: 18px; |
76 | color: #5a5a5a; | 76 | color: #5a5a5a; |
77 | width: 80%; | 77 | width: 80%; |
78 | display: inline-block; | 78 | display: inline-block; |
79 | } | 79 | } |
80 | 80 | ||
81 | - .row:nth-child(2) { | ||
82 | - font-size: 22rem / $pxConvertRem; | ||
83 | - height: 45rem / $pxConvertRem; | ||
84 | - line-height: 45rem / $pxConvertRem; | 81 | + .color-size-row { |
82 | + margin: 0.2rem 0; | ||
85 | 83 | ||
86 | > span { | 84 | > span { |
87 | margin-right: 15rem / $pxConvertRem; | 85 | margin-right: 15rem / $pxConvertRem; |
88 | } | 86 | } |
89 | } | 87 | } |
90 | 88 | ||
91 | - .row:nth-child(3) { | ||
92 | - position: relative; | ||
93 | - } | ||
94 | - | ||
95 | .color, .size { | 89 | .color, .size { |
90 | + font-size: 16px; | ||
96 | color: #b6b6b6; | 91 | color: #b6b6b6; |
97 | } | 92 | } |
98 | 93 | ||
@@ -103,7 +98,7 @@ | @@ -103,7 +98,7 @@ | ||
103 | } | 98 | } |
104 | 99 | ||
105 | .price { | 100 | .price { |
106 | - font-size: 24rem / $pxConvertRem; | 101 | + font-size: 16px; |
107 | color: $cartRed; | 102 | color: $cartRed; |
108 | } | 103 | } |
109 | 104 |
@@ -25,14 +25,14 @@ | @@ -25,14 +25,14 @@ | ||
25 | {{#if cartNav}} | 25 | {{#if cartNav}} |
26 | <ul class="cart-nav clearfix"> | 26 | <ul class="cart-nav clearfix"> |
27 | <li class="active"> | 27 | <li class="active"> |
28 | - <span> | ||
29 | - 普通商品({{commonGoodsCount}}) | ||
30 | - </span> | 28 | + <span> |
29 | + 普通商品({{commonGoodsCount}}) | ||
30 | + </span> | ||
31 | </li> | 31 | </li> |
32 | <li> | 32 | <li> |
33 | - <span> | ||
34 | - 预售商品({{presellGoodsCount}}) | ||
35 | - </span> | 33 | + <span> |
34 | + 预售商品({{presellGoodsCount}}) | ||
35 | + </span> | ||
36 | </li> | 36 | </li> |
37 | </ul> | 37 | </ul> |
38 | {{/if}} | 38 | {{/if}} |
@@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
25 | <span class="count"> | 25 | <span class="count"> |
26 | ×{{count}} | 26 | ×{{count}} |
27 | </span> | 27 | </span> |
28 | - <p class="row"> | 28 | + <p class="row color-size-row"> |
29 | {{#if color}} | 29 | {{#if color}} |
30 | <span class="color"> | 30 | <span class="color"> |
31 | 颜色:{{color}} | 31 | 颜色:{{color}} |
@@ -50,23 +50,22 @@ | @@ -50,23 +50,22 @@ | ||
50 | </span> | 50 | </span> |
51 | {{/if}} | 51 | {{/if}} |
52 | 52 | ||
53 | - | ||
54 | <span class="iconfont icon-del" data-count="{{count}}"></span> | 53 | <span class="iconfont icon-del" data-count="{{count}}"></span> |
55 | </p> | 54 | </p> |
56 | - <p class="row"> | ||
57 | - {{#if lowStocks}} | 55 | + {{#if lowStocks}} |
56 | + <p class="row"> | ||
58 | <span class="low-stocks"> | 57 | <span class="low-stocks"> |
59 | 库存不足 | 58 | 库存不足 |
60 | </span> | 59 | </span> |
61 | - {{/if}} | ||
62 | - </p> | ||
63 | - <p class="row"> | ||
64 | - {{#if appearDate}} | 60 | + </p> |
61 | + {{/if}} | ||
62 | + {{#if appearDate}} | ||
63 | + <p class="row"> | ||
65 | <span class="appear-date"> | 64 | <span class="appear-date"> |
66 | 上市期:{{appearDate}} | 65 | 上市期:{{appearDate}} |
67 | </span> | 66 | </span> |
68 | - {{/if}} | ||
69 | - </p> | 67 | + </p> |
68 | + {{/if}} | ||
70 | </div> | 69 | </div> |
71 | <div class="calculate-num hide"> | 70 | <div class="calculate-num hide"> |
72 | <div class="calculate"> | 71 | <div class="calculate"> |
@@ -769,12 +769,27 @@ class CartModel | @@ -769,12 +769,27 @@ class CartModel | ||
769 | $result['advanceBuy'] = Helpers::formatAdvanceGoods($data['price_gift'], $result['advanceBuyCount']); | 769 | $result['advanceBuy'] = Helpers::formatAdvanceGoods($data['price_gift'], $result['advanceBuyCount']); |
770 | } | 770 | } |
771 | 771 | ||
772 | + // 已参加的活动 | ||
773 | + if (!empty($data['promotion_info'])) { | ||
774 | + $result['promotionInfo'] = array(); | ||
775 | + $info = array(); | ||
776 | + foreach ($data['promotion_info'] as $val) { | ||
777 | + $info = array(); | ||
778 | + $info['id'] = $val['promotion_id']; | ||
779 | + $info['name'] = $val['promotion_title']; | ||
780 | + | ||
781 | + $result['promotionInfo'][] = $info; | ||
782 | + } | ||
783 | + | ||
784 | + $result['promotionFormula'] = $data['shopping_cart_data']['promotion_formula']; | ||
785 | + } | ||
786 | + | ||
772 | // 结算数据 | 787 | // 结算数据 |
773 | $result['price'] = Helpers::transPrice($data['shopping_cart_data']['order_amount']); | 788 | $result['price'] = Helpers::transPrice($data['shopping_cart_data']['order_amount']); |
774 | $result['activityPrice'] = Helpers::transPrice($data['shopping_cart_data']['discount_amount']); | 789 | $result['activityPrice'] = Helpers::transPrice($data['shopping_cart_data']['discount_amount']); |
775 | $result['count'] = $data['shopping_cart_data']['selected_goods_count']; | 790 | $result['count'] = $data['shopping_cart_data']['selected_goods_count']; |
776 | $result['isAllSelected'] = ($data['shopping_cart_data']['goods_count'] === $data['shopping_cart_data']['selected_goods_count']) && ($data['shopping_cart_data']['selected_goods_count'] >0); | 791 | $result['isAllSelected'] = ($data['shopping_cart_data']['goods_count'] === $data['shopping_cart_data']['selected_goods_count']) && ($data['shopping_cart_data']['selected_goods_count'] >0); |
777 | - $result['sumPrice'] = Helpers::transPrice($data['shopping_cart_data']['order_amount']); | 792 | + $result['sumPrice'] = Helpers::transPrice($data['shopping_cart_data']['last_order_amount']); |
778 | }while(0); | 793 | }while(0); |
779 | 794 | ||
780 | return $result; | 795 | return $result; |
-
Please register or login to post a comment