Authored by 毕凯

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

@@ -23,16 +23,17 @@ class Yohobuy @@ -23,16 +23,17 @@ class Yohobuy
23 // const SERVICE_URL = 'http://service.api.yohobuy.com/'; 23 // const SERVICE_URL = 'http://service.api.yohobuy.com/';
24 // const YOHOBUY_URL = 'http://www.yohobuy.com/'; 24 // const YOHOBUY_URL = 'http://www.yohobuy.com/';
25 25
26 -// const API_URL = 'http://apih5.yoho.cn/'; 26 + // const API_URL = 'http://apih5.yoho.cn/';
27 // const API_URL2 = 'http://apih5.yoho.cn/'; 27 // const API_URL2 = 'http://apih5.yoho.cn/';
28 // const SERVICE_URL = 'http://serviceh5.yoho.cn/'; 28 // const SERVICE_URL = 'http://serviceh5.yoho.cn/';
29 // const YOHOBUY_URL = 'http://www.yohobuy.com/'; 29 // const YOHOBUY_URL = 'http://www.yohobuy.com/';
30 30
31 /* 测试环境 */ 31 /* 测试环境 */
32 - const API_URL = 'http://testapi.yoho.cn:28078/'; 32 + const API_URL = 'http://testapi.yoho.cn:28078/';
33 const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; 33 const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
34 const YOHOBUY_URL = 'http://www.yohobuy.com/'; 34 const YOHOBUY_URL = 'http://www.yohobuy.com/';
35 35
  36 +
36 /** 37 /**
37 * 私钥列表 38 * 私钥列表
38 * 39 *
@@ -16,7 +16,7 @@ var $cartContent = $('.cart-content'); @@ -16,7 +16,7 @@ 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; //是否有选中商品 19 +var hasChecked = $('.cart-content:not(.hide) .icon-cb-checked').length > 0 ? true : false; //是否有选中商品
20 20
21 require('./good'); 21 require('./good');
22 22
@@ -206,6 +206,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() { @@ -206,6 +206,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
206 // 当前颜色块 切换勾选样式 206 // 当前颜色块 切换勾选样式
207 $this.toggleClass('chosed'); 207 $this.toggleClass('chosed');
208 curColorIndex = index; 208 curColorIndex = index;
  209 + $('#good-num').val(1);
209 210
210 // 设置按钮的样式和文字 211 // 设置按钮的样式和文字
211 updateConformButtonClassAndText(); 212 updateConformButtonClassAndText();
@@ -257,6 +258,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() { @@ -257,6 +258,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
257 $this.toggleClass('chosed'); 258 $this.toggleClass('chosed');
258 curSizeIndex = index; 259 curSizeIndex = index;
259 $curSizeBlock = $this; 260 $curSizeBlock = $this;
  261 + $('#good-num').val(1);
260 262
261 // 设置按钮的样式和文字 263 // 设置按钮的样式和文字
262 updateConformButtonClassAndText(); 264 updateConformButtonClassAndText();
@@ -275,10 +277,11 @@ $yohoPage.on('touchstart', '.btn-minus', function() { @@ -275,10 +277,11 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
275 } 277 }
276 278
277 if (num === 1 || 0 === leftNum - 0) { 279 if (num === 1 || 0 === leftNum - 0) {
  280 + tip.show('您选择的数量不能为零~');
278 return; 281 return;
279 } 282 }
280 - if (num < 1) {  
281 - $num.val(1); 283 + if (num < 0) {
  284 + tip.show('您选择的数量不能为零~');
282 return; 285 return;
283 } 286 }
284 287
@@ -299,7 +302,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() { @@ -299,7 +302,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
299 302
300 //TODO:库存数验证 303 //TODO:库存数验证
301 if (num > leftNum - 1) { 304 if (num > leftNum - 1) {
302 - $num.val(leftNum); 305 + tip.show('您选择的数量超过了最大库存量~');
303 return; 306 return;
304 } 307 }
305 $num.val(num + 1); 308 $num.val(num + 1);
@@ -316,10 +319,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() { @@ -316,10 +319,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
316 if (!checkColorSizeNum()) { 319 if (!checkColorSizeNum()) {
317 return; 320 return;
318 } 321 }
319 - if (isNaN(num)) {  
320 - tip.show('您选择的数量不是一个数字~');  
321 - return;  
322 - }  
323 322
324 //TODO status change 323 //TODO status change
325 if ($('#chose-btn-sure').html() === '已售罄') { 324 if ($('#chose-btn-sure').html() === '已售罄') {
@@ -41,25 +41,14 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { @@ -41,25 +41,14 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
41 id = $good.data('id'); 41 id = $good.data('id');
42 42
43 var goodsList = [], 43 var goodsList = [],
44 - goodInfo = {},  
45 - isSelected = true;  
46 -  
47 - if ($this.hasClass('icon-cb-checked')) {  
48 - isSelected = true;  
49 - } else {  
50 - isSelected = false;  
51 - }  
52 -  
53 - 44 + goodInfo = {};
54 45
55 goodInfo.goods_type = cartType; 46 goodInfo.goods_type = cartType;
56 - goodInfo.selected = isSelected ? 'N' : 'Y'; 47 + goodInfo.selected = $this.hasClass('icon-cb-checked') ? 'N' : 'Y';
57 goodInfo.product_sku = id; 48 goodInfo.product_sku = id;
58 goodInfo.buy_number = $good.find('.count').eq(0).text().trim().replace('×', ''); 49 goodInfo.buy_number = $good.find('.count').eq(0).text().trim().replace('×', '');
59 -  
60 goodsList.push(new GoodInfo(goodInfo)); 50 goodsList.push(new GoodInfo(goodInfo));
61 51
62 -  
63 $.ajax({ 52 $.ajax({
64 type: 'post', 53 type: 'post',
65 url: 'select', 54 url: 'select',
@@ -92,8 +81,8 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { @@ -92,8 +81,8 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
92 rightBtnText: '确定' 81 rightBtnText: '确定'
93 } 82 }
94 }, function() { 83 }, function() {
95 - var id = $this.closest('.shopping-cart-good').data('id');  
96 - var count = $this.data('count'); 84 + var id = $this.closest('.shopping-cart-good').data('id'),
  85 + count = $this.data('count');
97 86
98 $.ajax({ 87 $.ajax({
99 method: 'post', 88 method: 'post',
@@ -119,7 +108,6 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { @@ -119,7 +108,6 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
119 tip.show('网络异常'); 108 tip.show('网络异常');
120 }); 109 });
121 }); 110 });
122 -  
123 }); 111 });
124 112
125 function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) { 113 function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) {
@@ -140,7 +128,7 @@ function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) { @@ -140,7 +128,7 @@ function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) {
140 tip.show(res.message); 128 tip.show(res.message);
141 } 129 }
142 }, 130 },
143 - error: function(err) { 131 + error: function() {
144 tip.show('网络异常'); 132 tip.show('网络异常');
145 }, 133 },
146 complete: function() { 134 complete: function() {
@@ -196,26 +184,9 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) { @@ -196,26 +184,9 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) {
196 requestUpdateAllGoodsCheckStatus(goodsList, handlerAfterTouch); 184 requestUpdateAllGoodsCheckStatus(goodsList, handlerAfterTouch);
197 } 185 }
198 186
199 -  
200 -  
201 -//是否要全选  
202 -function willBeSelected($this) {  
203 - var isSelected = true;  
204 -  
205 - if ($this.hasClass('icon-cb-checked')) {  
206 - isSelected = true;  
207 - } else {  
208 - isSelected = false;  
209 - }  
210 -  
211 - return isSelected;  
212 -}  
213 -  
214 //全选按钮点击事件 187 //全选按钮点击事件
215 $selectAllBtn.on('touchend', function() { 188 $selectAllBtn.on('touchend', function() {
216 - var $this = $(this);  
217 -  
218 - bottomCheckBoxHandeler(willBeSelected($this), cartType, didUpdateAllGoodsCheckStatus); 189 + bottomCheckBoxHandeler($(this).hasClass('icon-cb-checked'), cartType, didUpdateAllGoodsCheckStatus);
219 }); 190 });
220 191
221 $('.down').on('touchend', function() { 192 $('.down').on('touchend', function() {
@@ -9,11 +9,14 @@ @@ -9,11 +9,14 @@
9 margin-top: -14rem / $pxConvertRem; 9 margin-top: -14rem / $pxConvertRem;
10 margin-left: 20rem / $pxConvertRem; 10 margin-left: 20rem / $pxConvertRem;
11 font-size: 28rem / $pxConvertRem; 11 font-size: 28rem / $pxConvertRem;
12 - color: #f0f0f0;  
13 12
14 &.icon-cb-checked { 13 &.icon-cb-checked {
15 color: #000; 14 color: #000;
16 } 15 }
  16 +
  17 + &.disabled {
  18 + color: #f0f0f0;
  19 + }
17 } 20 }
18 21
19 .few-tag{ 22 .few-tag{
@@ -54,6 +57,10 @@ @@ -54,6 +57,10 @@
54 padding-right: 20rem / $pxConvertRem; 57 padding-right: 20rem / $pxConvertRem;
55 } 58 }
56 59
  60 + .fixed-height {
  61 + height: 2.7rem;
  62 + }
  63 +
57 .thumb { 64 .thumb {
58 float: left; 65 float: left;
59 width: 180rem / $pxConvertRem; 66 width: 180rem / $pxConvertRem;
@@ -65,54 +72,49 @@ @@ -65,54 +72,49 @@
65 .deps { 72 .deps {
66 position: relative; 73 position: relative;
67 width: 380rem / $pxConvertRem; 74 width: 380rem / $pxConvertRem;
68 - height: 5.3rem;  
69 margin-left: 4.7rem; 75 margin-left: 4.7rem;
70 border-bottom: 1px solid #e0e0e0; 76 border-bottom: 1px solid #e0e0e0;
71 - padding-top: 0.5rem; 77 + padding: 0.5rem 0;
72 } 78 }
73 79
74 .name { 80 .name {
75 - font-size: 18px;  
76 - color: #5a5a5a;  
77 - width: 80%;  
78 display: inline-block; 81 display: inline-block;
  82 + width: 80%;
  83 + color: #5a5a5a;
  84 + font-size: 0.6rem;
79 } 85 }
80 86
81 - .color-size-row {  
82 - margin: 0.2rem 0;  
83 -  
84 - > span {  
85 - margin-right: 15rem / $pxConvertRem;  
86 - } 87 + .color-size-row > span {
  88 + margin-right: 15rem / $pxConvertRem;
87 } 89 }
88 90
89 .color, .size { 91 .color, .size {
90 - font-size: 16px; 92 + font-size: 0.6rem;
91 color: #b6b6b6; 93 color: #b6b6b6;
92 } 94 }
93 95
94 .appear-date { 96 .appear-date {
  97 + float: left;
95 color: $cartRed; 98 color: $cartRed;
96 display: block; 99 display: block;
97 - margin-top: 4rem / $pxConvertRem; 100 + font-size: 0.5rem;
98 } 101 }
99 102
100 .price { 103 .price {
101 - font-size: 16px; 104 + font-size: 0.6rem;
102 color: $cartRed; 105 color: $cartRed;
103 } 106 }
104 107
105 .count { 108 .count {
106 font-size: 32rem / $pxConvertRem; 109 font-size: 32rem / $pxConvertRem;
107 color: #999; 110 color: #999;
108 - //margin-left: 22rem / $pxConvertRem;  
109 display: inline-block; 111 display: inline-block;
110 width: 19%; 112 width: 19%;
111 position: absolute; 113 position: absolute;
112 text-align: center; 114 text-align: center;
113 } 115 }
114 116
115 - .sold-out, .low-stocks { 117 + .low-stocks {
116 display: inline-block; 118 display: inline-block;
117 width: 100rem / $pxConvertRem; 119 width: 100rem / $pxConvertRem;
118 height: 30rem / $pxConvertRem; 120 height: 30rem / $pxConvertRem;
@@ -122,20 +124,31 @@ @@ -122,20 +124,31 @@
122 color: #fff; 124 color: #fff;
123 text-align: center; 125 text-align: center;
124 float: right; 126 float: right;
125 - margin-top: 20rem / $pxConvertRem;  
126 margin-right: 16rem / $pxConvertRem; 127 margin-right: 16rem / $pxConvertRem;
127 - border-radius: 20rem / $pxConvertRem;  
128 padding: 4rem / $pxConvertRem; 128 padding: 4rem / $pxConvertRem;
129 - }  
130 129
131 - .sold-out {  
132 - background: #999; 130 + border-radius: 20rem / $pxConvertRem;
133 } 131 }
134 132
135 .low-stocks { 133 .low-stocks {
136 background: #7f7f7f; 134 background: #7f7f7f;
137 } 135 }
138 136
  137 + .vip {
  138 + display: inline-block;
  139 + color: #fff;
  140 + background: #d1021c;
  141 + border: 1px solid #9d0000;
  142 + @include border-radius(0.5rem);
  143 + padding: 4rem / $pxConvertRem 0.5rem;
  144 + margin-left: 0.2rem;
  145 + }
  146 +
  147 + .la-tag {
  148 + margin-top: 0.3rem;
  149 + min-height: 1rem;
  150 + }
  151 +
139 .icon-del, 152 .icon-del,
140 .icon-edit { 153 .icon-edit {
141 position: absolute; 154 position: absolute;
@@ -7,6 +7,15 @@ @@ -7,6 +7,15 @@
7 .shopping-cart-page { 7 .shopping-cart-page {
8 padding-bottom: 120rem / $pxConvertRem; 8 padding-bottom: 120rem / $pxConvertRem;
9 overflow-x: hidden; 9 overflow-x: hidden;
  10 + background: #f0f0f0;
  11 +
  12 + .yoho-tip {
  13 + z-index: 4;
  14 + }
  15 +
  16 + .cart-content > * {
  17 + background: #fff;
  18 + }
10 19
11 .cart-nav { 20 .cart-nav {
12 color: #c6c6c6; 21 color: #c6c6c6;
@@ -111,23 +120,29 @@ @@ -111,23 +120,29 @@
111 120
112 .cart-goods { 121 .cart-goods {
113 border-bottom: 1px solid #e0e0e0; 122 border-bottom: 1px solid #e0e0e0;
  123 + margin-bottom: 0.75rem;
114 124
115 .shopping-cart-good:last-child .info { 125 .shopping-cart-good:last-child .info {
116 border-bottom: none; 126 border-bottom: none;
117 } 127 }
118 } 128 }
119 129
  130 + .invalid-goods {
  131 + border-top: 1px solid #e0e0e0;
  132 + border-bottom: 1px solid #e0e0e0;
  133 + margin: 0.75rem 0;
  134 + }
  135 +
120 .freebie-and-advance-buy { 136 .freebie-and-advance-buy {
121 padding: 20rem / $pxConvertRem; 137 padding: 20rem / $pxConvertRem;
122 font-size: 24rem / $pxConvertRem; 138 font-size: 24rem / $pxConvertRem;
123 - //border-bottom: 1px solid #e0e0e0; 139 + border-top: 1px solid #e0e0e0;
124 140
125 > li { 141 > li {
126 box-sizing: border-box; 142 box-sizing: border-box;
127 height: 90rem / $pxConvertRem; 143 height: 90rem / $pxConvertRem;
128 line-height: 90rem / $pxConvertRem; 144 line-height: 90rem / $pxConvertRem;
129 margin-bottom: 10rem / $pxConvertRem; 145 margin-bottom: 10rem / $pxConvertRem;
130 - background: #f8f8f8;  
131 padding: 0 20rem / $pxConvertRem; 146 padding: 0 20rem / $pxConvertRem;
132 147
133 &:last-child { 148 &:last-child {
@@ -2,13 +2,16 @@ @@ -2,13 +2,16 @@
2 {{# goods}} 2 {{# goods}}
3 {{> cart/good}} 3 {{> cart/good}}
4 {{/ goods}} 4 {{/ goods}}
5 -  
6 - {{# notValidGoods}}  
7 - {{> cart/good}}  
8 - {{/ notValidGoods}}  
9 -  
10 </div> 5 </div>
11 6
  7 +{{#if notValidGoods}}
  8 + <div class="invalid-goods">
  9 + {{# notValidGoods}}
  10 + {{> cart/good}}
  11 + {{/ notValidGoods}}
  12 + </div>
  13 +{{/if}}
  14 +
12 {{#if freebieOrAdvanceBuy}} 15 {{#if freebieOrAdvanceBuy}}
13 <ul class="freebie-and-advance-buy"> 16 <ul class="freebie-and-advance-buy">
14 {{# freebie}} 17 {{# freebie}}
@@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
52 <a class="btn btn-minus" href="javascript:void(0);"> 52 <a class="btn btn-minus" href="javascript:void(0);">
53 <span class="iconfont {{#if promotionId}}disabled{{/if}}">&#xe625;</span> 53 <span class="iconfont {{#if promotionId}}disabled{{/if}}">&#xe625;</span>
54 </a> 54 </a>
55 - <input id="good-num" class="good-num {{#if promotionId}}disabled{{/if}}" type="text" value="1" {{#if promotionId}}disabled="true"{{/if}}> 55 + <input id="good-num" class="good-num disabled" type="text" value="1" disabled="true">
56 <a class="btn btn-plus" href="javascript:void(0);"> 56 <a class="btn btn-plus" href="javascript:void(0);">
57 <span class="iconfont {{#if promotionId}}disabled{{/if}}">&#xe624;</span> 57 <span class="iconfont {{#if promotionId}}disabled{{/if}}">&#xe624;</span>
58 </a> 58 </a>
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 {{/if}} 4 {{/if}}
5 5
6 {{#if showCheckbox}} 6 {{#if showCheckbox}}
7 - <span class="checkbox{{#if checked}} icon-cb-checked{{^}} icon-checkbox{{/if}} iconfont"></span> 7 + <span class="checkbox{{#if checked}} icon-cb-checked{{^}} icon-checkbox {{#if lowStocks}}disabled{{/if}}{{/if}} iconfont"></span>
8 {{/if}} 8 {{/if}}
9 9
10 <div class="info"> 10 <div class="info">
@@ -19,51 +19,51 @@ @@ -19,51 +19,51 @@
19 {{/if}} 19 {{/if}}
20 20
21 <div class="deps show"> 21 <div class="deps show">
22 - <a href="{{link}}" class="name row">{{name}}</a>  
23 - <span class="count">  
24 - ×{{count}}  
25 - </span>  
26 - <p class="row color-size-row">  
27 - {{#if color}}  
28 - <span class="color">  
29 - 颜色:{{color}}  
30 - </span>  
31 - {{/if}} 22 + <div class="fixed-height">
  23 + <a href="{{link}}" class="name row">{{name}}</a>
  24 + <span class="count">
  25 + ×{{count}}
  26 + </span>
  27 + <p class="row color-size-row">
  28 + {{#if color}}
  29 + <span class="color">
  30 + 颜色:{{color}}
  31 + </span>
  32 + {{/if}}
32 33
33 - {{#if size}}  
34 - <span class="size">  
35 - 尺码:{{size}}  
36 - </span>  
37 - {{/if}} 34 + {{#if size}}
  35 + <span class="size">
  36 + 尺码:{{size}}
  37 + </span>
  38 + {{/if}}
38 39
39 - </p> 40 + </p>
  41 + </div>
40 <p class="row"> 42 <p class="row">
41 <span class="price"> 43 <span class="price">
42 ¥{{price}} 44 ¥{{price}}
43 </span> 45 </span>
44 46
45 - {{#if soldOut}}  
46 - <span class="sold-out">  
47 - 已售罄 47 + {{#if vip}}
  48 + <span class="vip">
  49 + VIP
48 </span> 50 </span>
49 {{/if}} 51 {{/if}}
50 52
51 <span class="iconfont icon-del" data-count="{{count}}">&#xe621;</span> 53 <span class="iconfont icon-del" data-count="{{count}}">&#xe621;</span>
52 </p> 54 </p>
53 - {{#if lowStocks}}  
54 - <p class="row"> 55 + <p class="la-tag row clearfix">
  56 + {{#if lowStocks}}
55 <span class="low-stocks"> 57 <span class="low-stocks">
56 库存不足 58 库存不足
57 </span> 59 </span>
58 - </p>  
59 - {{/if}}  
60 - {{#if appearDate}}  
61 - <p class="row"> 60 + {{/if}}
  61 + {{#if appearDate}}
62 <span class="appear-date"> 62 <span class="appear-date">
63 上市期:{{appearDate}} 63 上市期:{{appearDate}}
64 </span> 64 </span>
65 - </p>  
66 - {{/if}} 65 + {{/if}}
  66 + </p>
67 </div> 67 </div>
68 </div> 68 </div>
69 </div> 69 </div>
@@ -227,8 +227,7 @@ class LoginController extends AbstractAction @@ -227,8 +227,7 @@ class LoginController extends AbstractAction
227 } 227 }
228 228
229 //判定是否需要绑定手机号 229 //判定是否需要绑定手机号
230 - $isBind = $result['data']['is_bind'];  
231 - if ($isBind == 'N') { 230 + if (isset($result['data']['is_bind']) && $result['data']['is_bind'] == 'N') {
232 $this->go(Helpers::url('/passport/bind/index', array('openId' => $access['openid'], 'sourceType' => 'qq', 'nickname' => $partnerInfo['nickname']))); 231 $this->go(Helpers::url('/passport/bind/index', array('openId' => $access['openid'], 'sourceType' => 'qq', 'nickname' => $partnerInfo['nickname'])));
233 } 232 }
234 233
@@ -264,8 +263,7 @@ class LoginController extends AbstractAction @@ -264,8 +263,7 @@ class LoginController extends AbstractAction
264 $result = LoginData::signinByOpenID($partnerInfo['screen_name'], $access['uid'], 'sina'); 263 $result = LoginData::signinByOpenID($partnerInfo['screen_name'], $access['uid'], 'sina');
265 } 264 }
266 //判定是否需要绑定手机号 265 //判定是否需要绑定手机号
267 - $isBind = $result['data']['is_bind'];  
268 - if ($isBind == 'N') { 266 + if (isset($result['data']['is_bind']) && $result['data']['is_bind'] == 'N') {
269 $this->go(Helpers::url('/passport/bind/index', array('openId' => $access['uid'], 'sourceType' => 'sina', 'nickname' => $partnerInfo['screen_name']))); 267 $this->go(Helpers::url('/passport/bind/index', array('openId' => $access['uid'], 'sourceType' => 'sina', 'nickname' => $partnerInfo['screen_name'])));
270 } 268 }
271 269