Authored by hf

do merge develop to test cart feature

@@ -576,7 +576,7 @@ class Helpers @@ -576,7 +576,7 @@ class Helpers
576 $oneGoods['id'] = $value['product_sku']; 576 $oneGoods['id'] = $value['product_sku'];
577 $oneGoods['skn'] = $value['product_skn']; 577 $oneGoods['skn'] = $value['product_skn'];
578 $oneGoods['name'] = $value['product_name']; 578 $oneGoods['name'] = $value['product_name'];
579 - $oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 90, 100) : ''; 579 + $oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 120, 160) : '';
580 $oneGoods['color'] = $value['color_name']; 580 $oneGoods['color'] = $value['color_name'];
581 $oneGoods['size'] = $value['size_name']; 581 $oneGoods['size'] = $value['size_name'];
582 $oneGoods['checked'] = $value['selected'] === 'Y'; 582 $oneGoods['checked'] = $value['selected'] === 'Y';
@@ -22,9 +22,14 @@ var navHammer, @@ -22,9 +22,14 @@ var navHammer,
22 freebieHammer, 22 freebieHammer,
23 switchChose = false; 23 switchChose = false;
24 24
25 -require('../product/recommend-for-you');  
26 require('./good'); 25 require('./good');
27 26
  27 +if ($('.cart-zero').length > 0) {
  28 + require('../product/recommend-for-you');
  29 +} else {
  30 + require('./good');
  31 +}
  32 +
28 ellipsis.init(); 33 ellipsis.init();
29 34
30 function cartContentShow() { 35 function cartContentShow() {
@@ -67,11 +67,12 @@ function show(html, cb) { @@ -67,11 +67,12 @@ function show(html, cb) {
67 document.documentElement.scrollLeft || document.body.scrollLeft, 67 document.documentElement.scrollLeft || document.body.scrollLeft,
68 document.documentElement.scrollTop || document.body.scrollTop 68 document.documentElement.scrollTop || document.body.scrollTop
69 ], 69 ],
70 - $html = $('html'); // it would make more sense to apply this to body, but IE7 won't have that 70 + $html = $('html, body'); // it would make more sense to apply this to body, but IE7 won't have that
71 71
72 $html.data('scroll-position', scrollPosition); 72 $html.data('scroll-position', scrollPosition);
73 $html.data('previous-overflow', $html.css('overflow')); 73 $html.data('previous-overflow', $html.css('overflow'));
74 $html.css('overflow', 'hidden'); 74 $html.css('overflow', 'hidden');
  75 + $html.css('height', '100%');
75 window.scrollTo(scrollPosition[0], scrollPosition[1]); 76 window.scrollTo(scrollPosition[0], scrollPosition[1]);
76 77
77 if (html) { 78 if (html) {
@@ -89,11 +90,12 @@ function show(html, cb) { @@ -89,11 +90,12 @@ function show(html, cb) {
89 90
90 //隐藏当前Panel 91 //隐藏当前Panel
91 function hide() { 92 function hide() {
92 - var $html = $('html'), 93 + var $html = $('html, body'),
93 scrollPosition = $html.data('scroll-position'); 94 scrollPosition = $html.data('scroll-position');
94 95
95 // un-lock scroll position 96 // un-lock scroll position
96 $html.css('overflow', $html.data('previous-overflow')); 97 $html.css('overflow', $html.data('previous-overflow'));
  98 + $html.css('height', 'auto');
97 window.scrollTo(scrollPosition[0], scrollPosition[1]); 99 window.scrollTo(scrollPosition[0], scrollPosition[1]);
98 $('.chose-panel').hide(); 100 $('.chose-panel').hide();
99 } 101 }
@@ -104,7 +106,7 @@ function updateConformButtonClassAndText() { @@ -104,7 +106,7 @@ function updateConformButtonClassAndText() {
104 if (2 === $chosed.closest('.zero-stock').length) { 106 if (2 === $chosed.closest('.zero-stock').length) {
105 $('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄'); 107 $('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄');
106 } else { 108 } else {
107 - $('#chose-btn-sure').css('background-color', '#eb0313').html('确定'); 109 + $('#chose-btn-sure').css('background-color', '#eb0313').html('加入购物车');
108 } 110 }
109 } 111 }
110 112
@@ -19,7 +19,7 @@ var $selectAllBtn = $('.balance .checkbox'), @@ -19,7 +19,7 @@ var $selectAllBtn = $('.balance .checkbox'),
19 ellipsis.init(); 19 ellipsis.init();
20 20
21 lazyLoad({ 21 lazyLoad({
22 - try_again_css: 'good-failure' 22 + try_again_css: 'order-failure'
23 }); 23 });
24 24
25 setTimeout(function() { 25 setTimeout(function() {
@@ -75,7 +75,9 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { @@ -75,7 +75,9 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
75 }, function() { 75 }, function() {
76 tip.show('网络异常'); 76 tip.show('网络异常');
77 }); 77 });
78 -}).on('touchstart', '.icon-del', function(e) { 78 +});
  79 +
  80 +$('.icon-del').on('touchstart', function(e) {
79 var $this = $(this); 81 var $this = $(this);
80 82
81 e.stopPropagation(); 83 e.stopPropagation();
@@ -112,6 +114,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { @@ -112,6 +114,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
112 } 114 }
113 }, function() { 115 }, function() {
114 tip.show('网络异常'); 116 tip.show('网络异常');
  117 + window.location.reload();
115 }); 118 });
116 }); 119 });
117 }); 120 });
@@ -11,16 +11,26 @@ var $confim = $('.confim-mask'), @@ -11,16 +11,26 @@ var $confim = $('.confim-mask'),
11 deleteId; 11 deleteId;
12 12
13 $('.address-item').on('touchend', function() { 13 $('.address-item').on('touchend', function() {
14 - orderInfo('addressId', $(this).data('address-id')); 14 + var $this = $(this);
  15 + var addressId = $this.data('address-id');
  16 + var address = {
  17 + address_id: $this.data('address-id'),
  18 + consignee: $this.find('.name').text(),
  19 + mobile: $this.find('.tel').text(),
  20 + address_info: $this.find('.address-info').text()
  21 + };
  22 + orderInfo('addressId', addressId);
  23 + orderInfo('address', address);
15 }).on('touchend', '.edit', function() { 24 }).on('touchend', '.edit', function() {
16 window.location.href = $(this).data('href'); 25 window.location.href = $(this).data('href');
17 return false; 26 return false;
18 -}).on('touchend', '.del', function() {  
19 - deleteId = $(this).data('address-id'); 27 +}).on('touchstart', '.del', function() {
  28 + deleteId = $(this).data('id');
20 }); 29 });
21 30
22 $confim.on('touchend', '.confim', function() { 31 $confim.on('touchend', '.confim', function() {
23 if (orderInfo('addressId') === deleteId) { 32 if (orderInfo('addressId') === deleteId) {
24 orderInfo('addressId', null); 33 orderInfo('addressId', null);
  34 + orderInfo('address', null);
25 } 35 }
26 }); 36 });
@@ -67,9 +67,26 @@ $newCoupon.on('submit', function() { @@ -67,9 +67,26 @@ $newCoupon.on('submit', function() {
67 67
68 $('#coupon-list').on('touchend', '.employ-main', function() { 68 $('#coupon-list').on('touchend', '.employ-main', function() {
69 var $this = $(this); 69 var $this = $(this);
  70 + var couponCode = $this.data('coupon-code');
70 71
71 - orderInfo('couponCode', $this.data('coupon-code'));  
72 - orderInfo('couponName', $this.data('coupon-name')); 72 + $.ajax({
  73 + method: 'POST',
  74 + url: '/cart/index/couponSearch',
  75 + data: {
  76 + couponCode: couponCode
  77 + }
  78 + }).then(function(res) {
  79 + if (res.code === 200) {
  80 + //tip.show('优惠券可用');
  81 + orderInfo('couponCode', res.data.coupon_code);
  82 + orderInfo('couponName', res.data.coupon_title);
  83 + window.location.href = '/cart/index/orderEnsure';
  84 + } else {
  85 + tip.show(res.message || '网络错误');
  86 + }
  87 + }).fail(function() {
  88 + tip.show('网络错误');
  89 + });
73 }).on('touchstart', '.employ-main', function() { 90 }).on('touchstart', '.employ-main', function() {
74 var $this = $(this); 91 var $this = $(this);
75 92
@@ -179,7 +179,7 @@ function reMarginFooter(fixedElement) { @@ -179,7 +179,7 @@ function reMarginFooter(fixedElement) {
179 a.async = 1; 179 a.async = 1;
180 a.src = j; 180 a.src = j;
181 m.parentNode.insertBefore(a, m); 181 m.parentNode.insertBefore(a, m);
182 -})(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.13.6.3/yas-debug.js', '_yas'); 182 +})(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.13.6.3/yas.js', '_yas');
183 183
184 (function() { 184 (function() {
185 var uid = getUid(); 185 var uid = getUid();
@@ -17,19 +17,13 @@ var $ = require('jquery'), @@ -17,19 +17,13 @@ var $ = require('jquery'),
17 trendTopicSwiper, 17 trendTopicSwiper,
18 goodsSwiper; 18 goodsSwiper;
19 19
20 -var requestFrame,  
21 - thisFunc,  
22 - start = 0,  
23 - i, 20 +var start = 0,
24 swiperClass, 21 swiperClass,
25 - supportCss3,  
26 $logotrans = $('.home-header .logo'), 22 $logotrans = $('.home-header .logo'),
27 isen = true; 23 isen = true;
28 24
29 var navHammer; 25 var navHammer;
30 26
31 -require('./maybe-like');  
32 -  
33 lazyLoad($('img.lazy')); 27 lazyLoad($('img.lazy'));
34 28
35 navHammer = new Hammer($('.nav-btn')[0]); 29 navHammer = new Hammer($('.nav-btn')[0]);
@@ -39,13 +33,6 @@ navHammer.on('tap', function(event) { @@ -39,13 +33,6 @@ navHammer.on('tap', function(event) {
39 $overlay.show().css('opacity', 0.3); 33 $overlay.show().css('opacity', 0.3);
40 $sideNav.addClass('on'); 34 $sideNav.addClass('on');
41 35
42 - //设置boy高宽,页面不能上下滑动  
43 - $('body').css({  
44 - height: $(window).height(),  
45 - width: $(window).width(),  
46 - overflow: 'hidden'  
47 - });  
48 -  
49 event.srcEvent.stopPropagation(); 36 event.srcEvent.stopPropagation();
50 return false; 37 return false;
51 }); 38 });
@@ -56,10 +43,6 @@ function hideSideBar() { @@ -56,10 +43,6 @@ function hideSideBar() {
56 $('.overlay').hide(); 43 $('.overlay').hide();
57 $('.sub-nav').removeClass('show'); 44 $('.sub-nav').removeClass('show');
58 $sideNav.removeClass('on'); 45 $sideNav.removeClass('on');
59 - $('body').css({  
60 - height: 'auto',  
61 - overflow: 'auto'  
62 - });  
63 } 46 }
64 } 47 }
65 48
@@ -68,6 +51,11 @@ $('.overlay').on('touchstart', function(e) { @@ -68,6 +51,11 @@ $('.overlay').on('touchstart', function(e) {
68 return false; 51 return false;
69 }); 52 });
70 53
  54 +//禁止在侧边栏可以上下滚动
  55 +$('.side-nav').on('touchmove', function() {
  56 + return false;
  57 +});
  58 +
71 //点击一级导航,弹出二级导航 59 //点击一级导航,弹出二级导航
72 $sideNav.on('touchstart', 'li', function(e) { 60 $sideNav.on('touchstart', 'li', function(e) {
73 if ($(this).find('.sub-nav').size() > 0) { 61 if ($(this).find('.sub-nav').size() > 0) {
@@ -161,28 +149,6 @@ $('.category-swiper').each(function(i, index) { @@ -161,28 +149,6 @@ $('.category-swiper').each(function(i, index) {
161 }); 149 });
162 150
163 //logo动画 151 //logo动画
164 -requestFrame = (function() {  
165 - var tempFunc = null,  
166 - prefixList = ['webkit', 'moz', 'ms'];  
167 -  
168 - for (i = 0; i < prefixList.length; i++) {  
169 - thisFunc = prefixList[i] + 'RequestAnimationFrame';  
170 - if (window[thisFunc]) {  
171 - supportCss3 = true;  
172 - tempFunc = thisFunc;  
173 - }  
174 - }  
175 -  
176 - if (supportCss3) {  
177 - return function(callback) {  
178 - window[tempFunc](callback);  
179 - };  
180 - }  
181 - return function(callback) {  
182 - window.setTimeout(callback, 67);  
183 - };  
184 -})();  
185 -  
186 function tsAnimate() { 152 function tsAnimate() {
187 start = start + 10; 153 start = start + 10;
188 $logotrans.css({ 154 $logotrans.css({
@@ -205,9 +171,7 @@ function tsAnimate() { @@ -205,9 +171,7 @@ function tsAnimate() {
205 if (start % 360 === 0) { 171 if (start % 360 === 0) {
206 window.setTimeout(tsAnimate, 60 * 1000); 172 window.setTimeout(tsAnimate, 60 * 1000);
207 } else { 173 } else {
208 - requestFrame(function() {  
209 - tsAnimate();  
210 - }); 174 + window.requestAnimationFrame(tsAnimate);
211 } 175 }
212 } 176 }
213 } 177 }
@@ -230,3 +194,5 @@ exports.set = function(c) { @@ -230,3 +194,5 @@ exports.set = function(c) {
230 domain: '.m.yohobuy.com' 194 domain: '.m.yohobuy.com'
231 }); 195 });
232 }; 196 };
  197 +
  198 +require('./maybe-like');
@@ -71,7 +71,7 @@ function callpay(orderCode) { @@ -71,7 +71,7 @@ function callpay(orderCode) {
71 } else { 71 } else {
72 $.ajax({ 72 $.ajax({
73 type: 'GET', 73 type: 'GET',
74 - url: '/shopping/pay/wechatwapapi?order_code=' + orderCode, 74 + url: '/home/wechatpay?order_code=' + orderCode,
75 dataType: 'json', 75 dataType: 'json',
76 success: function(res) { 76 success: function(res) {
77 if (res.code === 200) { 77 if (res.code === 200) {
@@ -243,11 +243,11 @@ function search(opt) { @@ -243,11 +243,11 @@ function search(opt) {
243 break; 243 break;
244 case 'price': 244 case 'price':
245 window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid, 245 window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid,
246 - '', '.new-goods .good-info .good-detail-img .good-thumb'); 246 + '', '.price-goods .good-info .good-detail-img .good-thumb');
247 break; 247 break;
248 case 'discount': 248 case 'discount':
249 window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid, 249 window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid,
250 - '', '.new-goods .good-info .good-detail-img .good-thumb'); 250 + '', '.discount-goods .good-info .good-detail-img .good-thumb');
251 break; 251 break;
252 } 252 }
253 } 253 }
@@ -41,6 +41,7 @@ @@ -41,6 +41,7 @@
41 .thumb { 41 .thumb {
42 float: left; 42 float: left;
43 width: 100rem / $pxConvertRem; 43 width: 100rem / $pxConvertRem;
  44 + margin-right: 20rem / $pxConvertRem;
44 } 45 }
45 46
46 .text-info { 47 .text-info {
@@ -48,7 +49,7 @@ @@ -48,7 +49,7 @@
48 .name { 49 .name {
49 font-size: 28rem / $pxConvertRem; 50 font-size: 28rem / $pxConvertRem;
50 height: 74rem / $pxConvertRem; 51 height: 74rem / $pxConvertRem;
51 - overflow: hidden; 52 + overflow: hidden;
52 display: -webkit-box; 53 display: -webkit-box;
53 -webkit-line-clamp: 2; 54 -webkit-line-clamp: 2;
54 -webkit-box-orient: vertical; 55 -webkit-box-orient: vertical;
@@ -28,12 +28,16 @@ @@ -28,12 +28,16 @@
28 } 28 }
29 29
30 .few-tag { 30 .few-tag {
31 - width: 148rem / $pxConvertRem; 31 + width: 150rem / $pxConvertRem;
32 position: absolute; 32 position: absolute;
33 - left: 92rem / $pxConvertRem;  
34 text-align: center; 33 text-align: center;
35 - top: 75%; 34 + top: 72%;
36 color: #fff; 35 color: #fff;
  36 +
  37 + span {
  38 + display: inline-block;
  39 + @include transform(scale(0.833));
  40 + }
37 } 41 }
38 42
39 .gift-tag { 43 .gift-tag {
@@ -71,8 +75,7 @@ @@ -71,8 +75,7 @@
71 75
72 .thumb { 76 .thumb {
73 float: left; 77 float: left;
74 - width: 180rem / $pxConvertRem;  
75 - height: 200rem / $pxConvertRem; 78 + width: 150rem / $pxConvertRem;
76 background-size: 100%; 79 background-size: 100%;
77 background-repeat: no-repeat; 80 background-repeat: no-repeat;
78 } 81 }
@@ -80,7 +83,7 @@ @@ -80,7 +83,7 @@
80 .deps { 83 .deps {
81 position: relative; 84 position: relative;
82 width: 380rem / $pxConvertRem; 85 width: 380rem / $pxConvertRem;
83 - margin-left: 4.7rem; 86 + margin-left: 180rem / $pxConvertRem;
84 border-bottom: 1px solid #e0e0e0; 87 border-bottom: 1px solid #e0e0e0;
85 padding: 0.5rem 0; 88 padding: 0.5rem 0;
86 } 89 }
@@ -189,7 +189,7 @@ @@ -189,7 +189,7 @@
189 margin: pxToRem(20px) 0; 189 margin: pxToRem(20px) 0;
190 padding: 0 pxToRem(12px); 190 padding: 0 pxToRem(12px);
191 width: 100%; 191 width: 100%;
192 - height: pxToRem(60px); 192 + height: pxToRem(72px);
193 color: #444; 193 color: #444;
194 background: #efefef; 194 background: #efefef;
195 font-size: pxToRem(24px); 195 font-size: pxToRem(24px);
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 left: 0; 7 left: 0;
8 right: 100rem / $pxConvertRem; 8 right: 100rem / $pxConvertRem;
9 width: 540rem / $pxConvertRem; 9 width: 540rem / $pxConvertRem;
10 - z-index: 1; 10 + z-index: 4;
11 overflow: hidden; 11 overflow: hidden;
12 @include transition(all .3s); 12 @include transition(all .3s);
13 13
@@ -188,4 +188,4 @@ @@ -188,4 +188,4 @@
188 display: block; 188 display: block;
189 @include transform(translateX(0)); 189 @include transform(translateX(0));
190 @include transition(transform 0.3s); 190 @include transition(transform 0.3s);
191 -}  
  191 +}
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 <p class="infos"> 5 <p class="infos">
6 收货地址 6 收货地址
7 <span class="per-info">{{name}} {{phoneNum}}</span> 7 <span class="per-info">{{name}} {{phoneNum}}</span>
8 - <span class="address">{{area}} {{address}}</span> 8 + <span class="address">{{addressInfo}}</span>
9 </p> 9 </p>
10 <span class="iconfont">&#xe614;</span> 10 <span class="iconfont">&#xe614;</span>
11 </a> 11 </a>
@@ -46,9 +46,9 @@ @@ -46,9 +46,9 @@
46 <a href="/cart/index/selectCoupon"> 46 <a href="/cart/index/selectCoupon">
47 <span class="title">优惠券</span> 47 <span class="title">优惠券</span>
48 {{# coupon}} 48 {{# coupon}}
49 - <span class="coupon-count"> 49 + <!--<span class="coupon-count">
50 {{count}}张可用 50 {{count}}张可用
51 - </span> 51 + </span>-->
52 52
53 {{#if couponName}} 53 {{#if couponName}}
54 <span class="used coupon-use" data-name="{{couponName}}"> 54 <span class="used coupon-use" data-name="{{couponName}}">
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 <script id="tmpl-coupon" type="text/tmpl"> 13 <script id="tmpl-coupon" type="text/tmpl">
14 \{{#coupons}} 14 \{{#coupons}}
15 \{{^ notAvailable}} 15 \{{^ notAvailable}}
16 - <a class="employ-main" data-coupon-code="\{{ couponCode}}" data-coupon-name="\{{ couponDetailInfomation}}" href="/cart/index/orderEnsure"> 16 + <a class="employ-main" data-coupon-code="\{{ couponCode}}" data-coupon-name="\{{ couponDetailInfomation}}" href="javascript:void(0);">
17 <span>\{{ couponValue}}</span> 17 <span>\{{ couponValue}}</span>
18 <p class="coupon-name">\{{ couponDetailInfomation}}</p> 18 <p class="coupon-name">\{{ couponDetailInfomation}}</p>
19 <p>有效期:\{{ couponValidity}}</p> 19 <p>有效期:\{{ couponValidity}}</p>
@@ -56,13 +56,7 @@ @@ -56,13 +56,7 @@
56 {{/if}} 56 {{/if}}
57 57
58 <div class="price-compute"> 58 <div class="price-compute">
59 - <p>  
60 - <span>总价(¥{{price}})<i>-</i></span>  
61 - <span>活动价(¥{{activityPrice}})</span>  
62 - </p>  
63 - <p>  
64 - <span><i>=</i>商品总计金额 (¥{{sumPrice}})</span>  
65 - </p> 59 + <p>{{formulaPrice}}</p>
66 </div> 60 </div>
67 61
68 <div class="balance"> 62 <div class="balance">
@@ -63,7 +63,7 @@ @@ -63,7 +63,7 @@
63 </div> 63 </div>
64 </div> 64 </div>
65 <div class="btn-wrap"> 65 <div class="btn-wrap">
66 - <button id="chose-btn-sure" class="btn btn-sure">确定</button> 66 + <button id="chose-btn-sure" class="btn btn-sure">加入购物车</button>
67 </div> 67 </div>
68 </div> 68 </div>
69 </div> 69 </div>
@@ -13,10 +13,10 @@ @@ -13,10 +13,10 @@
13 <img class="thumb lazy" data-original="{{thumb}}"> 13 <img class="thumb lazy" data-original="{{thumb}}">
14 </a> 14 </a>
15 {{#if isAdvanceBuy}} 15 {{#if isAdvanceBuy}}
16 - <p class="few-tag plus-tag">加价购</p> 16 + <p class="few-tag plus-tag"><span>加价购</span></p>
17 {{/if}} 17 {{/if}}
18 {{#if isGift}} 18 {{#if isGift}}
19 - <p class="few-tag gift-tag">赠品</p> 19 + <p class="few-tag gift-tag"><span>赠品</span></p>
20 {{/if}} 20 {{/if}}
21 21
22 <div class="deps show"> 22 <div class="deps show">
1 <!-- Google Tag Manager --> 1 <!-- Google Tag Manager -->
2 <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-W958MG" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> 2 <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-W958MG" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
  3 +
3 <script> 4 <script>
4 - (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':  
5 - new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],  
6 - j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=  
7 - '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);  
8 - })(window,document,'script','dataLayer','GTM-W958MG'); 5 +var _hmt = _hmt || [];
  6 +(function() {
  7 + function async_load(){
  8 + (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
  9 + new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
  10 + j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
  11 + '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
  12 + })(window,document,'script','dataLayer','GTM-W958MG');
  13 +
  14 + (function() {
  15 + var hm = document.createElement("script");
  16 + hm.src = "//hm.baidu.com/hm.js?c6ee7218b8321cb65fb2e98f284d8311";
  17 + hm.async = 1;
  18 + var s = document.getElementsByTagName("script")[0];
  19 + s.parentNode.insertBefore(hm, s);
  20 + })();
  21 +
  22 + (function() {
  23 + var hm = document.createElement("script");
  24 + hm.src = "//hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841";
  25 + hm.async = 1;
  26 + var s = document.getElementsByTagName("script")[0];
  27 + s.parentNode.insertBefore(hm, s);
  28 + })();
  29 +
  30 + (function() {
  31 + var hm = document.createElement("script");
  32 + hm.src = "http://static.yohobuy.com/js/analytics/analysis.js";
  33 + var s = document.getElementsByTagName("script")[0];
  34 + s.parentNode.insertBefore(hm, s);
  35 + })();
  36 + }
  37 + window.addEventListener('load', async_load, false);
  38 +})();
9 </script> 39 </script>
  40 +<<<<<<< HEAD
10 <!-- End Google Tag Manager --> 41 <!-- End Google Tag Manager -->
11 <script type="text/javascript"> 42 <script type="text/javascript">
12 var _hmt = _hmt || []; 43 var _hmt = _hmt || [];
@@ -35,11 +66,11 @@ @@ -35,11 +66,11 @@
35 if(typeof _goodsData!='undefined') 66 if(typeof _goodsData!='undefined')
36 window._py.push(['pi',_goodsData]); 67 window._py.push(['pi',_goodsData]);
37 window._py.push(['e','']); 68 window._py.push(['e','']);
38 - function(d){ 69 + -function(d){
39 var f = 'https:' == d.location.protocol;var c = d.createElement('script');c.type='text/javascript';c.async=1; 70 var f = 'https:' == d.location.protocol;var c = d.createElement('script');c.type='text/javascript';c.async=1;
40 c.src=(f ? 'https' : 'http') + '://'+(f?'fm.ipinyou.com':'fm.p0y.cn')+'/j/t/adv.js'; 71 c.src=(f ? 'https' : 'http') + '://'+(f?'fm.ipinyou.com':'fm.p0y.cn')+'/j/t/adv.js';
41 var h = d.getElementsByTagName("script")[0];h.parentNode.insertBefore(c, h); 72 var h = d.getElementsByTagName("script")[0];h.parentNode.insertBefore(c, h);
42 }(document); 73 }(document);
43 </script> 74 </script>
44 <script src="http://static.yohobuy.com/js/analytics/analysis.js" async="async"></script> 75 <script src="http://static.yohobuy.com/js/analytics/analysis.js" async="async"></script>
45 -<script src="http://static.yohobuy.com/m/v1/js/om_code.js" async="async"></script> 76 +<script src="http://static.yohobuy.com/m/v1/js/om_code.js" async="async"></script>
@@ -55,7 +55,7 @@ class HomeController extends AbstractAction @@ -55,7 +55,7 @@ class HomeController extends AbstractAction
55 'cartUrl' => Helpers::url('/cart/index/index', null), 55 'cartUrl' => Helpers::url('/cart/index/index', null),
56 'signinUrl' => Helpers::url('/signin.html', array('refer' => Helpers::url('/home'))), 56 'signinUrl' => Helpers::url('/signin.html', array('refer' => Helpers::url('/home'))),
57 ); 57 );
58 - $uid = $this->getUid(false); 58 + $uid = $this->getUid(true);
59 if ($uid) { 59 if ($uid) {
60 $data['isLogin'] = true; 60 $data['isLogin'] = true;
61 $udid = $this->getUdid(); 61 $udid = $this->getUdid();
@@ -324,6 +324,12 @@ class CartModel @@ -324,6 +324,12 @@ class CartModel
324 324
325 $pay = CartData::cartPay($uid, $cartType); 325 $pay = CartData::cartPay($uid, $cartType);
326 326
  327 + // 商品为空返回
  328 + if (!$pay || (isset($pay['data']['goods_list']) && empty($pay['data']['goods_list']))) {
  329 + $result['cartUrl'] = Helpers::url('/cart/index/index');
  330 + return $result;
  331 + }
  332 +
327 if ($pay && isset($pay['code']) && $pay['code'] === 200) { 333 if ($pay && isset($pay['code']) && $pay['code'] === 200) {
328 $payReturn = $pay['data']; 334 $payReturn = $pay['data'];
329 $address = array(); 335 $address = array();
@@ -335,8 +341,8 @@ class CartModel @@ -335,8 +341,8 @@ class CartModel
335 } 341 }
336 342
337 // 根据地址id查询地址信息 343 // 根据地址id查询地址信息
338 - if (isset($orderInfo['addressId'])) {  
339 - $address = UserModel::getAddressDataById($uid, $orderInfo['addressId']); 344 + if (isset($orderInfo['address'])) {
  345 + $address = $orderInfo['address'];
340 } 346 }
341 347
342 // 收货人有关信息 348 // 收货人有关信息
@@ -344,8 +350,8 @@ class CartModel @@ -344,8 +350,8 @@ class CartModel
344 $result['addressId'] = isset($address['address_id']) ? $address['address_id'] : $payReturn['delivery_address']['address_id']; 350 $result['addressId'] = isset($address['address_id']) ? $address['address_id'] : $payReturn['delivery_address']['address_id'];
345 $result['name'] = isset($address['consignee']) ? $address['consignee'] : $payReturn['delivery_address']['consignee']; 351 $result['name'] = isset($address['consignee']) ? $address['consignee'] : $payReturn['delivery_address']['consignee'];
346 $result['phoneNum'] = isset($address['mobile']) ? $address['mobile'] : $payReturn['delivery_address']['mobile']; 352 $result['phoneNum'] = isset($address['mobile']) ? $address['mobile'] : $payReturn['delivery_address']['mobile'];
347 - $result['area'] = isset($address['area']) ? $address['area'] : $payReturn['delivery_address']['area'];  
348 - $result['address'] = isset($address['address']) ? $address['address'] : $payReturn['delivery_address']['address']; 353 +// $result['area'] = isset($address['area']) ? $address['area'] : $payReturn['delivery_address']['area'];
  354 + $result['addressInfo'] = isset($address['address_info']) ? $address['address_info'] : $payReturn['delivery_address']['area'] . ' ' . $payReturn['delivery_address']['address'];
349 $isSupport = isset($address['is_support']) ? $address['is_support'] : $payReturn['delivery_address']['is_support']; 355 $isSupport = isset($address['is_support']) ? $address['is_support'] : $payReturn['delivery_address']['is_support'];
350 $result['isSupport'] = $isSupport === 'Y'; 356 $result['isSupport'] = $isSupport === 'Y';
351 } 357 }
@@ -477,9 +483,10 @@ class CartModel @@ -477,9 +483,10 @@ class CartModel
477 isset($orderInfo['msg']) && $result['msg'] = $orderInfo['msg']; 483 isset($orderInfo['msg']) && $result['msg'] = $orderInfo['msg'];
478 484
479 // 优惠券数据 485 // 优惠券数据
480 - $coupons = array();  
481 - !empty($orderCompute['coupon_amount']) && $coupons['couponName'] = $orderInfo['couponName'];  
482 - $coupons += self::getCouponList($uid, true); 486 + $coupons = array('couponName' => '');
  487 + if (!empty($orderCompute['coupon_amount'])) {
  488 + $coupons['couponName'] = $orderInfo['couponName'];
  489 + }
483 $result['coupon'] = $coupons; 490 $result['coupon'] = $coupons;
484 } 491 }
485 492
@@ -553,11 +560,10 @@ class CartModel @@ -553,11 +560,10 @@ class CartModel
553 do { 560 do {
554 if (isset($coupons['data']['couponList'])) { 561 if (isset($coupons['data']['couponList'])) {
555 foreach ($coupons['data']['couponList'] as $val) { 562 foreach ($coupons['data']['couponList'] as $val) {
556 - $notAvailableRes = self::searchCoupon($uid, $val['couponCode']); 563 + // $notAvailableRes = self::searchCoupon($uid, $val['couponCode']);
557 // 处理可用的优惠券 564 // 处理可用的优惠券
558 - if ($val['isValidity'] === 'N' || (isset($notAvailableRes['code']) && $notAvailableRes['code'] !== 200)) { 565 + if ($val['isValidity'] === 'N') {
559 $val['notAvailable'] = true; 566 $val['notAvailable'] = true;
560 - // continue;  
561 } 567 }
562 $result[] = $val; 568 $result[] = $val;
563 } 569 }
@@ -788,8 +794,9 @@ class CartModel @@ -788,8 +794,9 @@ class CartModel
788 } 794 }
789 795
790 // 结算数据 796 // 结算数据
791 - $result['price'] = Helpers::transPrice($data['shopping_cart_data']['order_amount']);  
792 - $result['activityPrice'] = Helpers::transPrice($data['shopping_cart_data']['discount_amount']); 797 + $result['formulaPrice'] = $data['shopping_cart_data']['promotion_formula'];
  798 + /*$result['price'] = Helpers::transPrice($data['shopping_cart_data']['order_amount']);
  799 + $result['activityPrice'] = Helpers::transPrice($data['shopping_cart_data']['discount_amount']);*/
793 $result['count'] = $data['shopping_cart_data']['selected_goods_count']; 800 $result['count'] = $data['shopping_cart_data']['selected_goods_count'];
794 $result['isAllSelected'] = ($data['shopping_cart_data']['goods_count'] === $data['shopping_cart_data']['selected_goods_count']) && ($data['shopping_cart_data']['selected_goods_count'] >0); 801 $result['isAllSelected'] = ($data['shopping_cart_data']['goods_count'] === $data['shopping_cart_data']['selected_goods_count']) && ($data['shopping_cart_data']['selected_goods_count'] >0);
795 $result['sumPrice'] = Helpers::transPrice($data['shopping_cart_data']['last_order_amount']); 802 $result['sumPrice'] = Helpers::transPrice($data['shopping_cart_data']['last_order_amount']);
@@ -284,22 +284,17 @@ class IndexController extends AbstractAction @@ -284,22 +284,17 @@ class IndexController extends AbstractAction
284 $orderInfo = json_decode($cookieData, true); 284 $orderInfo = json_decode($cookieData, true);
285 $cartType = $orderInfo['cartType']; 285 $cartType = $orderInfo['cartType'];
286 } 286 }
287 - $cartKey = 'commonCart';  
288 - if ($cartType === 'advance') {  
289 - $cartKey = 'preSellCart';  
290 - }  
291 287
292 - $shoppingKey = Helpers::getShoppingKeyByCookie();  
293 $uid = $this->getUid(true); 288 $uid = $this->getUid(true);
294 - $cartGoods = CartModel::getCartData($uid, $shoppingKey);  
295 - if (isset($cartGoods['isEmptyCart']) || empty($cartGoods[$cartKey])) {  
296 - $this->go(Helpers::url('/cart/index/index')); 289 + $order = CartModel::cartPay($uid, $cartType, $orderInfo);
  290 + if (isset($order['cartUrl'])) {
  291 + $this->go($order['cartUrl']);
297 } 292 }
298 293
299 $data = array( 294 $data = array(
300 'orderEnsurePage' => true, 295 'orderEnsurePage' => true,
301 'isOrdinaryCart' => ($cartType !== 'advance'), 296 'isOrdinaryCart' => ($cartType !== 'advance'),
302 - 'orderEnsure' => CartModel::cartPay($uid, $cartType, $orderInfo) 297 + 'orderEnsure' => $order
303 ); 298 );
304 299
305 $this->_view->display('order-ensure', $data); 300 $this->_view->display('order-ensure', $data);
@@ -50,7 +50,7 @@ application.template.ext = ".phtml" @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
50 application.assets.path = ROOT_PATH "/assets" 50 application.assets.path = ROOT_PATH "/assets"
51 51
52 ; 应用的版本号 52 ; 应用的版本号
53 -application.version = "1.2.6" 53 +application.version = "1.2.7"
54 54
55 ; 网站SEO信息 55 ; 网站SEO信息
56 application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停" 56 application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停"
@@ -50,7 +50,7 @@ application.template.ext = ".phtml" @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
50 application.assets.path = ROOT_PATH "/assets" 50 application.assets.path = ROOT_PATH "/assets"
51 51
52 ; 应用的版本号 52 ; 应用的版本号
53 -application.version = "1.2.6" 53 +application.version = "1.2.7"
54 54
55 ; 网站SEO信息 55 ; 网站SEO信息
56 application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停" 56 application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停"
@@ -50,7 +50,7 @@ application.template.ext = ".phtml" @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
50 application.assets.path = ROOT_PATH "/assets" 50 application.assets.path = ROOT_PATH "/assets"
51 51
52 ; 应用的版本号 52 ; 应用的版本号
53 -application.version = "1.2.6" 53 +application.version = "1.2.7"
54 54
55 ; 网站SEO信息 55 ; 网站SEO信息
56 application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停" 56 application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停"
@@ -50,7 +50,7 @@ application.template.ext = ".phtml" @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
50 application.assets.path = ROOT_PATH "/assets" 50 application.assets.path = ROOT_PATH "/assets"
51 51
52 ; 应用的版本号 52 ; 应用的版本号
53 -application.version = "1.2.6" 53 +application.version = "1.2.7"
54 54
55 ; 网站SEO信息 55 ; 网站SEO信息
56 application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停" 56 application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停"