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 *
@@ -583,8 +583,11 @@ class Helpers @@ -583,8 +583,11 @@ class Helpers
583 $oneGoods['isVipPrice'] = $value['sales_price'] !== $value['last_vip_price']; 583 $oneGoods['isVipPrice'] = $value['sales_price'] !== $value['last_vip_price'];
584 $oneGoods['count'] = $value['buy_number']; 584 $oneGoods['count'] = $value['buy_number'];
585 585
586 - if ($isValid) { // 库存不足 586 + if ($isValid) {
  587 + // 库存不足
587 $oneGoods['lowStocks'] = ($value['buy_number'] > $value['storage_number']); 588 $oneGoods['lowStocks'] = ($value['buy_number'] > $value['storage_number']);
  589 + } else { // 失效商品
  590 + $oneGoods['inValid'] = true;
588 } 591 }
589 592
590 //gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品; 593 //gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品;
@@ -286,10 +286,11 @@ $yohoPage.on('touchstart', '.btn-minus', function() { @@ -286,10 +286,11 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
286 } 286 }
287 287
288 if (num === 1 || 0 === leftNum - 0) { 288 if (num === 1 || 0 === leftNum - 0) {
  289 + tip.show('您选择的数量不能为零~');
289 return; 290 return;
290 } 291 }
291 - if (num < 1) {  
292 - $num.val(1); 292 + if (num < 0) {
  293 + tip.show('您选择的数量不能为零~');
293 return; 294 return;
294 } 295 }
295 296
@@ -310,7 +311,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() { @@ -310,7 +311,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
310 311
311 //TODO:库存数验证 312 //TODO:库存数验证
312 if (num > leftNum - 1) { 313 if (num > leftNum - 1) {
313 - $num.val(leftNum); 314 + tip.show('您选择的数量超过了最大库存量~');
314 return; 315 return;
315 } 316 }
316 $num.val(num + 1); 317 $num.val(num + 1);
@@ -327,10 +328,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() { @@ -327,10 +328,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
327 if (!checkColorSizeNum()) { 328 if (!checkColorSizeNum()) {
328 return; 329 return;
329 } 330 }
330 - if (isNaN(num)) {  
331 - tip.show('您选择的数量不是一个数字~');  
332 - return;  
333 - }  
334 331
335 //TODO status change 332 //TODO status change
336 if ($('#chose-btn-sure').html() === '已售罄') { 333 if ($('#chose-btn-sure').html() === '已售罄') {
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 lazyLoad = require('yoho.lazyload'), 8 lazyLoad = require('yoho.lazyload'),
  9 + Hammer = require('yoho.hammer'),
9 tip = require('../plugin/tip'), 10 tip = require('../plugin/tip'),
10 loading = require('../plugin/loading'), 11 loading = require('../plugin/loading'),
11 chosePanel = require('./chose-panel'); 12 chosePanel = require('./chose-panel');
@@ -35,10 +36,22 @@ function getProductInfo(skn, promotionId) { @@ -35,10 +36,22 @@ function getProductInfo(skn, promotionId) {
35 }); 36 });
36 } 37 }
37 38
38 -$page.on('touchend', '.chose', function() {  
39 - var $this = $(this),  
40 - id = $this.closest('.gift-advance-good').data('id'),  
41 - promotionId = $this.closest('.advance-block').data('promotion-id'); 39 +$page.find('.chose').each(function(i, elem) {
  40 + var choseHammer = new Hammer(elem);
42 41
43 - getProductInfo(id, promotionId); 42 + choseHammer.on('tap', function(e) {
  43 + var $this = $(e.target),
  44 + id = $this.closest('.gift-advance-good').data('id'),
  45 + promotionId = $this.closest('.advance-block').data('promotion-id');
  46 +
  47 + getProductInfo(id, promotionId);
  48 + });
44 }); 49 });
  50 +
  51 +// $page.on('touchend', '.chose', function() {
  52 +// var $this = $(this),
  53 +// id = $this.closest('.gift-advance-good').data('id'),
  54 +// promotionId = $this.closest('.advance-block').data('promotion-id');
  55 +//
  56 +// getProductInfo(id, promotionId);
  57 +// });
@@ -9,7 +9,6 @@ @@ -9,7 +9,6 @@
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;
@@ -54,6 +53,10 @@ @@ -54,6 +53,10 @@
54 padding-right: 20rem / $pxConvertRem; 53 padding-right: 20rem / $pxConvertRem;
55 } 54 }
56 55
  56 + .fixed-height {
  57 + height: 2.7rem;
  58 + }
  59 +
57 .thumb { 60 .thumb {
58 float: left; 61 float: left;
59 width: 180rem / $pxConvertRem; 62 width: 180rem / $pxConvertRem;
@@ -65,54 +68,49 @@ @@ -65,54 +68,49 @@
65 .deps { 68 .deps {
66 position: relative; 69 position: relative;
67 width: 380rem / $pxConvertRem; 70 width: 380rem / $pxConvertRem;
68 - height: 5.3rem;  
69 margin-left: 4.7rem; 71 margin-left: 4.7rem;
70 border-bottom: 1px solid #e0e0e0; 72 border-bottom: 1px solid #e0e0e0;
71 - padding-top: 0.5rem; 73 + padding: 0.5rem 0;
72 } 74 }
73 75
74 .name { 76 .name {
75 - font-size: 18px;  
76 - color: #5a5a5a;  
77 - width: 80%;  
78 display: inline-block; 77 display: inline-block;
  78 + width: 80%;
  79 + color: #5a5a5a;
  80 + font-size: 0.6rem;
79 } 81 }
80 82
81 - .color-size-row {  
82 - margin: 0.2rem 0;  
83 -  
84 - > span {  
85 - margin-right: 15rem / $pxConvertRem;  
86 - } 83 + .color-size-row > span {
  84 + margin-right: 15rem / $pxConvertRem;
87 } 85 }
88 86
89 .color, .size { 87 .color, .size {
90 - font-size: 16px; 88 + font-size: 0.6rem;
91 color: #b6b6b6; 89 color: #b6b6b6;
92 } 90 }
93 91
94 .appear-date { 92 .appear-date {
  93 + float: left;
95 color: $cartRed; 94 color: $cartRed;
96 display: block; 95 display: block;
97 - margin-top: 4rem / $pxConvertRem; 96 + font-size: 0.5rem;
98 } 97 }
99 98
100 .price { 99 .price {
101 - font-size: 16px; 100 + font-size: 0.6rem;
102 color: $cartRed; 101 color: $cartRed;
103 } 102 }
104 103
105 .count { 104 .count {
106 font-size: 32rem / $pxConvertRem; 105 font-size: 32rem / $pxConvertRem;
107 color: #999; 106 color: #999;
108 - //margin-left: 22rem / $pxConvertRem;  
109 display: inline-block; 107 display: inline-block;
110 width: 19%; 108 width: 19%;
111 position: absolute; 109 position: absolute;
112 text-align: center; 110 text-align: center;
113 } 111 }
114 112
115 - .sold-out, .low-stocks { 113 + .low-stocks {
116 display: inline-block; 114 display: inline-block;
117 width: 100rem / $pxConvertRem; 115 width: 100rem / $pxConvertRem;
118 height: 30rem / $pxConvertRem; 116 height: 30rem / $pxConvertRem;
@@ -122,20 +120,31 @@ @@ -122,20 +120,31 @@
122 color: #fff; 120 color: #fff;
123 text-align: center; 121 text-align: center;
124 float: right; 122 float: right;
125 - margin-top: 20rem / $pxConvertRem;  
126 margin-right: 16rem / $pxConvertRem; 123 margin-right: 16rem / $pxConvertRem;
127 - border-radius: 20rem / $pxConvertRem;  
128 padding: 4rem / $pxConvertRem; 124 padding: 4rem / $pxConvertRem;
129 - }  
130 125
131 - .sold-out {  
132 - background: #999; 126 + border-radius: 20rem / $pxConvertRem;
133 } 127 }
134 128
135 .low-stocks { 129 .low-stocks {
136 background: #7f7f7f; 130 background: #7f7f7f;
137 } 131 }
138 132
  133 + .vip {
  134 + display: inline-block;
  135 + color: #fff;
  136 + background: #d1021c;
  137 + border: 1px solid #9d0000;
  138 + @include border-radius(0.5rem);
  139 + padding: 4rem / $pxConvertRem 0.5rem;
  140 + margin-left: 0.2rem;
  141 + }
  142 +
  143 + .la-tag {
  144 + margin-top: 0.3rem;
  145 + min-height: 1rem;
  146 + }
  147 +
139 .icon-del, 148 .icon-del,
140 .icon-edit { 149 .icon-edit {
141 position: absolute; 150 position: absolute;
@@ -7,6 +7,11 @@ @@ -7,6 +7,11 @@
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 + .cart-content > * {
  13 + background: #fff;
  14 + }
10 15
11 .cart-nav { 16 .cart-nav {
12 color: #c6c6c6; 17 color: #c6c6c6;
@@ -111,23 +116,29 @@ @@ -111,23 +116,29 @@
111 116
112 .cart-goods { 117 .cart-goods {
113 border-bottom: 1px solid #e0e0e0; 118 border-bottom: 1px solid #e0e0e0;
  119 + margin-bottom: 0.75rem;
114 120
115 .shopping-cart-good:last-child .info { 121 .shopping-cart-good:last-child .info {
116 border-bottom: none; 122 border-bottom: none;
117 } 123 }
118 } 124 }
119 125
  126 + .invalid-goods {
  127 + border-top: 1px solid #e0e0e0;
  128 + border-bottom: 1px solid #e0e0e0;
  129 + margin: 0.75rem 0;
  130 + }
  131 +
120 .freebie-and-advance-buy { 132 .freebie-and-advance-buy {
121 padding: 20rem / $pxConvertRem; 133 padding: 20rem / $pxConvertRem;
122 font-size: 24rem / $pxConvertRem; 134 font-size: 24rem / $pxConvertRem;
123 - //border-bottom: 1px solid #e0e0e0; 135 + border-top: 1px solid #e0e0e0;
124 136
125 > li { 137 > li {
126 box-sizing: border-box; 138 box-sizing: border-box;
127 height: 90rem / $pxConvertRem; 139 height: 90rem / $pxConvertRem;
128 line-height: 90rem / $pxConvertRem; 140 line-height: 90rem / $pxConvertRem;
129 margin-bottom: 10rem / $pxConvertRem; 141 margin-bottom: 10rem / $pxConvertRem;
130 - background: #f8f8f8;  
131 padding: 0 20rem / $pxConvertRem; 142 padding: 0 20rem / $pxConvertRem;
132 143
133 &:last-child { 144 &: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>
@@ -10,9 +10,6 @@ @@ -10,9 +10,6 @@
10 {{#if price}} 10 {{#if price}}
11 <span class="price market-price">&yen;{{marketPrice}}</span> 11 <span class="price market-price">&yen;{{marketPrice}}</span>
12 {{/if}} 12 {{/if}}
13 - <span class="count">  
14 - ×{{count}}  
15 - </span>  
16 </p> 13 </p>
17 <button class="chose">选择</button> 14 <button class="chose">选择</button>
18 </div> 15 </div>
@@ -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>