Authored by uedxwg

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

@@ -1243,6 +1243,6 @@ @@ -1243,6 +1243,6 @@
1243 'cartInfo' : { 1243 'cartInfo' : {
1244 'numInCart' : 3, 1244 'numInCart' : 3,
1245 'goodsInstore' : 0, 1245 'goodsInstore' : 0,
1246 - 'isCollect':true 1246 + 'isCollect':true//
1247 } 1247 }
1248 } 1248 }
@@ -51,17 +51,17 @@ class CartData @@ -51,17 +51,17 @@ class CartData
51 } 51 }
52 52
53 /** 53 /**
54 - * 修改购物车商品数据 54 + * 移入收藏夹
55 * 55 *
56 * @param int $uid 用户ID 56 * @param int $uid 用户ID
57 - * @param string $swapData 商品数据 57 + * @param string $sku 商品sku列表
58 * @return array 接口返回的数据 58 * @return array 接口返回的数据
59 */ 59 */
60 - public static function modifyCartProduct($uid, $swapData) 60 + public static function addToFav($uid, $sku)
61 { 61 {
62 $param = Yohobuy::param(); 62 $param = Yohobuy::param();
63 - $param['method'] = 'app.Shopping.swap';  
64 - $param['swap_data'] = $swapData; 63 + $param['method'] = 'app.Shopping.addfavorite';
  64 + $param['product_sku_list'] = $sku;
65 $param['uid'] = $uid; 65 $param['uid'] = $uid;
66 $param['client_secret'] = Sign::getSign($param); 66 $param['client_secret'] = Sign::getSign($param);
67 67
@@ -69,17 +69,35 @@ class CartData @@ -69,17 +69,35 @@ class CartData
69 } 69 }
70 70
71 /** 71 /**
72 - * 移入收藏夹 72 + * 获取购物车商品数据
73 * 73 *
74 * @param int $uid 用户ID 74 * @param int $uid 用户ID
75 - * @param string $sku 商品sku列表 75 + * @param int $skn 商品skn
76 * @return array 接口返回的数据 76 * @return array 接口返回的数据
77 */ 77 */
78 - public static function addToFav($uid, $sku) 78 + public static function cartProductData($uid, $skn)
79 { 79 {
80 $param = Yohobuy::param(); 80 $param = Yohobuy::param();
81 - $param['method'] = 'app.Shopping.addfavorite';  
82 - $param['product_sku_list'] = $sku; 81 + $param['method'] = 'app.product.data';
  82 + $param['product_skn'] = $skn;
  83 + $param['uid'] = $uid;
  84 + $param['client_secret'] = Sign::getSign($param);
  85 +
  86 + return Yohobuy::get(Yohobuy::API_URL, $param);
  87 + }
  88 +
  89 + /**
  90 + * 修改购物车商品数据
  91 + *
  92 + * @param int $uid 用户ID
  93 + * @param string $swapData 商品数据
  94 + * @return array 接口返回的数据
  95 + */
  96 + public static function modifyCartProduct($uid, $swapData)
  97 + {
  98 + $param = Yohobuy::param();
  99 + $param['method'] = 'app.Shopping.swap';
  100 + $param['swap_data'] = $swapData;
83 $param['uid'] = $uid; 101 $param['uid'] = $uid;
84 $param['client_secret'] = Sign::getSign($param); 102 $param['client_secret'] = Sign::getSign($param);
85 103
@@ -9,6 +9,8 @@ var $userAvatar = $('.user-avatar'), @@ -9,6 +9,8 @@ var $userAvatar = $('.user-avatar'),
9 var myImage = new Image(); 9 var myImage = new Image();
10 10
11 require('../product/recommend-for-you.js'); 11 require('../product/recommend-for-you.js');
  12 +require('../product/suspend-cart.js');
  13 +
12 myImage.src = $userAvatar.attr('src'); 14 myImage.src = $userAvatar.attr('src');
13 myImage.onerror = function() { 15 myImage.onerror = function() {
14 $userAvatar.attr('src', 'http://static.dev.yohobuy.com/img/me/index/user-avatar.png'); 16 $userAvatar.attr('src', 'http://static.dev.yohobuy.com/img/me/index/user-avatar.png');
@@ -12,6 +12,7 @@ var likeHammer = new Hammer(document.getElementById('likeBtn')); @@ -12,6 +12,7 @@ var likeHammer = new Hammer(document.getElementById('likeBtn'));
12 likeHammer.on('tap', function(e) { 12 likeHammer.on('tap', function(e) {
13 var productId = $('#productId').val(), 13 var productId = $('#productId').val(),
14 opt; 14 opt;
  15 +
15 var $this = $(this); 16 var $this = $(this);
16 17
17 if ($this.hasClass('liked')) { 18 if ($this.hasClass('liked')) {
@@ -17,7 +17,7 @@ $.get('/home/preference').then(function(html) { @@ -17,7 +17,7 @@ $.get('/home/preference').then(function(html) {
17 recommendSwiper = new Swiper('#swiper-recommend', { 17 recommendSwiper = new Swiper('#swiper-recommend', {
18 slidesPerView: 'auto', 18 slidesPerView: 'auto',
19 grabCursor: true, 19 grabCursor: true,
20 - slideElement: 'li', 20 + slideElement: 'a',
21 lazyLoading: true, 21 lazyLoading: true,
22 watchSlidesVisibility: true 22 watchSlidesVisibility: true
23 }); 23 });
@@ -102,6 +102,7 @@ a { @@ -102,6 +102,7 @@ a {
102 color: #fff; 102 color: #fff;
103 font-size: 18px; 103 font-size: 18px;
104 border: none; 104 border: none;
  105 + z-index:2;
105 @include border-radius(10px); 106 @include border-radius(10px);
106 } 107 }
107 108
@@ -28,7 +28,12 @@ @@ -28,7 +28,12 @@
28 } 28 }
29 29
30 .username { 30 .username {
  31 + float: left;
31 padding: 0 pxToRem(16px); 32 padding: 0 pxToRem(16px);
  33 + text-overflow: ellipsis;
  34 + overflow: hidden;
  35 + white-space: nowrap;
  36 + max-width: pxToRem(290px);
32 } 37 }
33 38
34 .vip-icon { 39 .vip-icon {
1 .goods-comments-page { 1 .goods-comments-page {
2 .goods-comments { 2 .goods-comments {
3 .comment-item { 3 .comment-item {
4 - border: 1px solid $borderC; 4 + border-bottom: 1px solid $borderC;
5 padding: 0 pxToRem(28px); 5 padding: 0 pxToRem(28px);
6 .user-name { 6 .user-name {
7 font-size: pxToRem(24px); 7 font-size: pxToRem(24px);
@@ -44,7 +44,8 @@ @@ -44,7 +44,8 @@
44 height: pxToRem(120px); 44 height: pxToRem(120px);
45 background-color: #ffffff; 45 background-color: #ffffff;
46 i, 46 i,
47 - span { 47 + span,
  48 + a {
48 line-height: pxToRem(120px); 49 line-height: pxToRem(120px);
49 font-size: pxToRem(28px); 50 font-size: pxToRem(28px);
50 color: $mainFontC; 51 color: $mainFontC;
@@ -30,7 +30,8 @@ $basicBtnC:#eb0313; @@ -30,7 +30,8 @@ $basicBtnC:#eb0313;
30 left: pxToRem(30px); 30 left: pxToRem(30px);
31 right: auto; 31 right: auto;
32 } 32 }
33 -.tag-container{ 33 +
  34 +.tag-container {
34 position: absolute; 35 position: absolute;
35 left: pxToRem(108px); 36 left: pxToRem(108px);
36 top: pxToRem(40px); 37 top: pxToRem(40px);
@@ -40,14 +41,14 @@ $basicBtnC:#eb0313; @@ -40,14 +41,14 @@ $basicBtnC:#eb0313;
40 font-size: pxToRem(20px); 41 font-size: pxToRem(20px);
41 line-height: pxToRem(35px); 42 line-height: pxToRem(35px);
42 z-index: 2; 43 z-index: 2;
43 - .good-tag{ 44 + .good-tag {
44 display: inline-block; 45 display: inline-block;
45 box-sizing: border-box; 46 box-sizing: border-box;
46 margin-left: .5px; 47 margin-left: .5px;
47 font-size: pxToRem(23px); 48 font-size: pxToRem(23px);
48 text-align: center; 49 text-align: center;
49 line-height: pxToRem(35px); 50 line-height: pxToRem(35px);
50 - padding:0 8px; 51 + padding: 0 8px;
51 } 52 }
52 .new-tag { 53 .new-tag {
53 background-color: #78dc7e; 54 background-color: #78dc7e;
@@ -69,11 +70,12 @@ $basicBtnC:#eb0313; @@ -69,11 +70,12 @@ $basicBtnC:#eb0313;
69 border: 1px solid #000; 70 border: 1px solid #000;
70 color: #000; 71 color: #000;
71 } 72 }
72 - .soonSoldOut-tag{  
73 - background-color:#ffac5b;  
74 - color:#fff; 73 + .soonSoldOut-tag {
  74 + background-color: #ffac5b;
  75 + color: #fff;
75 } 76 }
76 } 77 }
  78 +
77 .good-detail-page { 79 .good-detail-page {
78 overflow: hidden; 80 overflow: hidden;
79 background-color: #f0f0f0; 81 background-color: #f0f0f0;
@@ -105,14 +107,14 @@ $basicBtnC:#eb0313; @@ -105,14 +107,14 @@ $basicBtnC:#eb0313;
105 // .row { 107 // .row {
106 // display: table-row; 108 // display: table-row;
107 .column { 109 .column {
108 - box-sizing:border-box; 110 + box-sizing: border-box;
109 display: table-cell; 111 display: table-cell;
110 padding: pxToRem(16px) pxToRem(12px); 112 padding: pxToRem(16px) pxToRem(12px);
111 width: 50%; 113 width: 50%;
112 border: 1px solid #fff; 114 border: 1px solid #fff;
113 font-size: pxToRem(24px); 115 font-size: pxToRem(24px);
114 background-color: $tableCellC; 116 background-color: $tableCellC;
115 - float:left; 117 + float: left;
116 } 118 }
117 // } 119 // }
118 } 120 }
@@ -136,15 +138,15 @@ $basicBtnC:#eb0313; @@ -136,15 +138,15 @@ $basicBtnC:#eb0313;
136 position: absolute; 138 position: absolute;
137 z-index: 2; 139 z-index: 2;
138 bottom: pxToRem(40px); 140 bottom: pxToRem(40px);
139 - .pagination-inner{  
140 - span{ 141 + .pagination-inner {
  142 + span {
141 background-color: #b0b0b0; 143 background-color: #b0b0b0;
142 } 144 }
143 .swiper-pagination-bullet { 145 .swiper-pagination-bullet {
144 margin-right: 2px; 146 margin-right: 2px;
145 } 147 }
146 .swiper-pagination-bullet-active { 148 .swiper-pagination-bullet-active {
147 - background-color: #000 ; 149 + background-color: #000;
148 } 150 }
149 } 151 }
150 } 152 }
@@ -227,8 +229,45 @@ $basicBtnC:#eb0313; @@ -227,8 +229,45 @@ $basicBtnC:#eb0313;
227 vertical-align: middle; 229 vertical-align: middle;
228 } 230 }
229 } 231 }
  232 + .vip-level {
  233 + box-sizing: box-border;
  234 + padding-left: pxToRem(28px);
  235 + padding-right: pxToRem(28px);
  236 + min-height: pxToRem(88px);
  237 + background-color: #fff;
  238 + .icons-item {
  239 + float: left;
  240 + width: 33.3%;
  241 + height: pxToRem(88px);
  242 + span {
  243 + display: inline-block;
  244 + line-height: pxToRem(88px);
  245 + }
  246 + .vip-img {
  247 + padding-right: pxToRem(22px);
  248 + .img {
  249 + width: pxToRem(53px);
  250 + height: pxToRem(32px);
  251 + }
  252 + &:nth-child(3n-3) .img {
  253 + background: image-url('product/silver.png') no-repeat;
  254 + }
  255 + &:nth-child(3n-2) .img {
  256 + background: image-url('product/golden.png') no-repeat;
  257 + }
  258 + &:nth-child(3n-1) .img {
  259 + background: image-url('product/platinum.png') no-repeat;
  260 + }
  261 + }
  262 + &:first-child {
  263 + float: left;
  264 + }
  265 + &:last-child {
  266 + float: right;
  267 + }
  268 + }
  269 + }
230 .vipLevel { 270 .vipLevel {
231 - width: 100%;  
232 box-sizing: border-box; 271 box-sizing: border-box;
233 background-color: #fff; 272 background-color: #fff;
234 display: table; 273 display: table;
@@ -242,25 +281,24 @@ $basicBtnC:#eb0313; @@ -242,25 +281,24 @@ $basicBtnC:#eb0313;
242 display: table-cell; 281 display: table-cell;
243 vertical-align: middle; 282 vertical-align: middle;
244 } 283 }
245 - .vip-img{ 284 + .vip-img {
246 padding-right: pxToRem(22px); 285 padding-right: pxToRem(22px);
247 - .img{  
248 - width: pxToRem(52px);  
249 - height: pxToRem(32px); 286 + .img {
  287 + width: pxToRem(53px);
  288 + height: pxToRem(33px);
250 } 289 }
251 - &:nth-child(3n-3) .img{ 290 + &:nth-child(3n-3) .img {
252 background: image-url('product/silver.png') no-repeat; 291 background: image-url('product/silver.png') no-repeat;
253 } 292 }
254 - &:nth-child(3n-2) .img{ 293 + &:nth-child(3n-2) .img {
255 background: image-url('product/golden.png') no-repeat; 294 background: image-url('product/golden.png') no-repeat;
256 } 295 }
257 - &:nth-child(3n-1) .img{ 296 + &:nth-child(3n-1) .img {
258 background: image-url('product/platinum.png') no-repeat; 297 background: image-url('product/platinum.png') no-repeat;
259 } 298 }
260 -  
261 } 299 }
262 .vip-price { 300 .vip-price {
263 - padding-right: pxToRem(55px); 301 + padding-right: pxToRem(52px);
264 } 302 }
265 .vip-price:last-child { 303 .vip-price:last-child {
266 padding-right: 0; 304 padding-right: 0;
@@ -295,7 +333,6 @@ $basicBtnC:#eb0313; @@ -295,7 +333,6 @@ $basicBtnC:#eb0313;
295 .goodsDiscount { 333 .goodsDiscount {
296 text-indent: pxToRem(-14px); 334 text-indent: pxToRem(-14px);
297 } 335 }
298 -  
299 .enter-store { 336 .enter-store {
300 min-height: pxToRem(100px); 337 min-height: pxToRem(100px);
301 display: table; 338 display: table;
@@ -327,7 +364,6 @@ $basicBtnC:#eb0313; @@ -327,7 +364,6 @@ $basicBtnC:#eb0313;
327 } 364 }
328 } 365 }
329 } 366 }
330 -  
331 //底部固定栏 367 //底部固定栏
332 .cart-bar { 368 .cart-bar {
333 position: relative; 369 position: relative;
@@ -350,10 +386,10 @@ $basicBtnC:#eb0313; @@ -350,10 +386,10 @@ $basicBtnC:#eb0313;
350 font-size: pxToRem(34px); 386 font-size: pxToRem(34px);
351 color: #ccc 387 color: #ccc
352 } 388 }
353 - &.favorite.liked{  
354 - color:$basicBtnC;; 389 + &.favorite.liked {
  390 + color: $basicBtnC;
  391 + ;
355 } 392 }
356 -  
357 &.addto-cart, 393 &.addto-cart,
358 &.sold-out { 394 &.sold-out {
359 height: pxToRem(80px); 395 height: pxToRem(80px);
@@ -382,10 +418,10 @@ $basicBtnC:#eb0313; @@ -382,10 +418,10 @@ $basicBtnC:#eb0313;
382 font-size: pxToRem(24px); 418 font-size: pxToRem(24px);
383 } 419 }
384 } 420 }
385 -  
386 - .recommend-for-you{ 421 + .recommend-for-you {
387 margin-bottom: pxToRem(120px); 422 margin-bottom: pxToRem(120px);
388 } 423 }
389 } 424 }
  425 +
390 @import "comments-consults"; 426 @import "comments-consults";
391 @import "product-description"; 427 @import "product-description";
1 .good-detail-page{ 1 .good-detail-page{
2 .goods-desc { 2 .goods-desc {
3 .service { 3 .service {
4 - width: pxToRem(489px); 4 + width: pxToRem(494px);
5 height: pxToRem(28px); 5 height: pxToRem(28px);
6 margin-top: pxToRem(22px); 6 margin-top: pxToRem(22px);
  7 + margin-left: pxToRem(40px);
  8 + background: image-url('product/service.png') no-repeat;
  9 + background-size: cover;
7 } 10 }
8 .detail{ 11 .detail{
9 background-color: $tableCellC; 12 background-color: $tableCellC;
@@ -58,7 +58,7 @@ @@ -58,7 +58,7 @@
58 .old-price { 58 .old-price {
59 position: absolute; 59 position: absolute;
60 top: 0; 60 top: 0;
61 - right: pxToRem(-6px); 61 + right: pxToRem(-4px);
62 color: #b0b0b0; 62 color: #b0b0b0;
63 text-decoration: line-through; 63 text-decoration: line-through;
64 } 64 }
@@ -101,8 +101,9 @@ @@ -101,8 +101,9 @@
101 </a> 101 </a>
102 </div> 102 </div>
103 103
104 - {{#isLogin}}  
105 {{> product/recommend-for-you}} 104 {{> product/recommend-for-you}}
106 - {{/isLogin}} 105 + {{> product/suspend-cart}}
107 </div> 106 </div>
  107 +
  108 +{{> layout/download_app}}
108 {{> layout/footer}} 109 {{> layout/footer}}
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <div class="goto-consult"> 3 <div class="goto-consult">
4 <i class="iconfont consult-logo">&#xe639;</i> 4 <i class="iconfont consult-logo">&#xe639;</i>
5 <span>我要咨询</span> 5 <span>我要咨询</span>
6 - <i class="iconfont enter-consult-page">&#xe604;</i> 6 + <a href="/product/detail/consultform" class="iconfont enter-consult-page">&#xe604;</a>
7 </div> 7 </div>
8 {{# consults}} 8 {{# consults}}
9 <div class="goods-consults"> 9 <div class="goods-consults">
@@ -52,6 +52,19 @@ @@ -52,6 +52,19 @@
52 {{/ periodOfMarket}} 52 {{/ periodOfMarket}}
53 </div> 53 </div>
54 54
  55 + <!-- {{# vipLevel}}
  56 + <ul class="vip-level clearfix">
  57 + {{# list}}
  58 + <li class="icons-item">
  59 + <span class="vip-img">
  60 + <div class="img" alt="" style="background-size:cover;"></div>
  61 + </span>
  62 + <span class="vip-price">{{text}}</span>
  63 + </li>
  64 + {{/ list}}
  65 + </ul>
  66 + {{/vipLevel}} -->
  67 +
55 {{# vipLevel}} 68 {{# vipLevel}}
56 <div class="vipLevel"> 69 <div class="vipLevel">
57 {{# list}} 70 {{# list}}
@@ -112,17 +125,14 @@ @@ -112,17 +125,14 @@
112 {{#if numInCart}} 125 {{#if numInCart}}
113 <span class="num-tag">{{numInCart}}</span> 126 <span class="num-tag">{{numInCart}}</span>
114 {{/if}} 127 {{/if}}
115 - <a href="" class="num-incart iconfont">&#xe62c;</a> 128 + <a href="/shoppingCart" class="num-incart iconfont">&#xe62c;</a>
116 {{#if goodsInstore}} 129 {{#if goodsInstore}}
117 - <a href="" class="addto-cart ">加入购物车</a> 130 + <a href="/shoppingCart" class="addto-cart ">加入购物车</a>
118 {{else}} 131 {{else}}
119 - <a href="" class="sold-out">已售罄</a>  
120 - {{/if}}  
121 - {{#if isCollect}}  
122 - <a href="#" id="likeBtn" class="favorite iconfont liked">&#xe605;</a>  
123 - {{else}}  
124 - <a href="" id="likeBtn" class="favorite iconfont">&#xe605;</a> 132 + <a href="javascript:;" class="sold-out">已售罄</a>
125 {{/if}} 133 {{/if}}
  134 +
  135 + <a href="#" id="likeBtn" class="favorite iconfont {{#isCollect}}liked{{/isCollect}}">&#xe605;</a>
126 </div> 136 </div>
127 {{/cartInfo}} 137 {{/cartInfo}}
128 138
@@ -166,7 +166,13 @@ @@ -166,7 +166,13 @@
166 {{!-- 商品详情评论 --}} 166 {{!-- 商品详情评论 --}}
167 {{#if goodsCommentsPage}} 167 {{#if goodsCommentsPage}}
168 <script> 168 <script>
169 - seajs.use('js/product/detail/comments-consults'); 169 + seajs.use('js/product/detail/loadmore');
  170 +</script>
  171 +{{/if}}
  172 +{{!-- 商品详情咨询 --}}
  173 +{{#if goodsConsultsPage}}
  174 +<script>
  175 + seajs.use('js/product/detail/loadmore');
170 </script> 176 </script>
171 {{/if}} 177 {{/if}}
172 {{!-- 品类 --}} 178 {{!-- 品类 --}}
@@ -210,6 +216,7 @@ @@ -210,6 +216,7 @@
210 {{#if myIndexPage}} 216 {{#if myIndexPage}}
211 <script> 217 <script>
212 seajs.use('js/me/index'); 218 seajs.use('js/me/index');
  219 + seajs.use('js/index/footer');
213 </script> 220 </script>
214 {{/if}} 221 {{/if}}
215 {{#if orderPage}} 222 {{#if orderPage}}
@@ -59,7 +59,7 @@ @@ -59,7 +59,7 @@
59 <span class="iconfont">&#xe63c;</span>暂无咨询 59 <span class="iconfont">&#xe63c;</span>暂无咨询
60 </div> 60 </div>
61 <div class="consult-content-footer"> 61 <div class="consult-content-footer">
62 - <a href="{{link}}"> 62 + <a href="/consultform">
63 我要咨询 63 我要咨询
64 <span class="iconfont">&#xe604;</span></a> 64 <span class="iconfont">&#xe604;</span></a>
65 </div> 65 </div>
1 {{#goodsDescription}} 1 {{#goodsDescription}}
2 <div class="goods-desc page-block"> 2 <div class="goods-desc page-block">
3 - <img class="service lazy" data-original="http://static.dev.yohobuy.com/img/product/service.png" alt=""> 3 + <div class="service"></div>
4 <h1 class="title"> 4 <h1 class="title">
5 {{title}} 5 {{title}}
6 <span class="en-title">{{enTitle}}</span> 6 <span class="en-title">{{enTitle}}</span>
1 <div class="title">为您优选新品</div> 1 <div class="title">为您优选新品</div>
2 <div id="swiper-recommend" class="swiper-container"> 2 <div id="swiper-recommend" class="swiper-container">
3 - <ul class="swiper-wrapper swiper-wrapper-recommend"> 3 + <div class="swiper-wrapper swiper-wrapper-recommend">
4 {{#recommendList}} 4 {{#recommendList}}
5 - <li class="swiper-slide"> 5 + <a class="swiper-slide" href="{{url}}">
6 <img class="swiper-lazy img-box" data-src="{{thumb}}"> 6 <img class="swiper-lazy img-box" data-src="{{thumb}}">
7 <div class="price"> 7 <div class="price">
8 <span class="sale-price {{^price}}no-price{{/price}}">¥{{salePrice}}</span> 8 <span class="sale-price {{^price}}no-price{{/price}}">¥{{salePrice}}</span>
9 {{#price}}<span class="old-price">¥{{.}}</span>{{/price}} 9 {{#price}}<span class="old-price">¥{{.}}</span>{{/price}}
10 </div> 10 </div>
11 <div class="swiper-lazy-preloader"></div> 11 <div class="swiper-lazy-preloader"></div>
12 - </li> 12 + </a>
13 {{/recommendList}} 13 {{/recommendList}}
14 - </ul> 14 + </div>
15 </div> 15 </div>
@@ -51,6 +51,7 @@ class HomeController extends AbstractAction @@ -51,6 +51,7 @@ class HomeController extends AbstractAction
51 51
52 $data = array( 52 $data = array(
53 'myIndexPage' => true, 53 'myIndexPage' => true,
  54 + 'showDownloadApp' => true,
54 'pageFooter' => true 55 'pageFooter' => true
55 ); 56 );
56 $uid = $this->getUid(); 57 $uid = $this->getUid();
@@ -323,7 +324,7 @@ class HomeController extends AbstractAction @@ -323,7 +324,7 @@ class HomeController extends AbstractAction
323 324
324 $this->_view->display('online-service', array( 325 $this->_view->display('online-service', array(
325 'onlineServicePage' => true, 326 'onlineServicePage' => true,
326 - // 'pageFooter' => true, 327 + 'pageFooter' => true,
327 'service' => $service 328 'service' => $service
328 )); 329 ));
329 } 330 }
@@ -231,54 +231,19 @@ class ShoppingCartController extends AbstractAction @@ -231,54 +231,19 @@ class ShoppingCartController extends AbstractAction
231 231
232 public function goodinfoAction() 232 public function goodinfoAction()
233 { 233 {
  234 + $result = array();
  235 +
234 if ($this->isAjax()) { 236 if ($this->isAjax()) {
235 - $data = array(  
236 - 'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/09/17/03/014cacfa5c458b9732c68adf1af15d7a45.jpg?imageMogr2/thumbnail/120x120/extent/120x120/background/d2hpdGU=/position/center/quality/90',  
237 - 'name' => '黄伟文Wyman X y yohood 联名商品YYYOHOOD圆领卫衣',  
238 - 'price' => 289,  
239 - 'salePrice' => 241,  
240 - 'colors' => array(  
241 - array(  
242 - 'id' => 1,  
243 - 'name' => '黄色'  
244 - ),  
245 - array(  
246 - 'id' => 2,  
247 - 'chosed' => true,  
248 - 'name' => '白色'  
249 - )  
250 - ),  
251 - 'sizes' => array(  
252 - array(  
253 - 'id' => 1,  
254 - 'name' => 'XS'  
255 - ),  
256 - array(  
257 - 'id' => 2,  
258 - 'name' => 'S'  
259 - ),  
260 - array(  
261 - 'id' => 3,  
262 - 'chosed' => true,  
263 - 'name' => 'M'  
264 - ),  
265 - array(  
266 - 'id' => 4,  
267 - 'name' => 'L'  
268 - ),  
269 - array(  
270 - 'id' => 5,  
271 - 'name' => 'XL'  
272 - ),  
273 - array(  
274 - 'id' => 6,  
275 - 'name' => 'XXL'  
276 - )  
277 - ),  
278 - 'num' => 1  
279 - ); 237 + $num = $this->get('buy_num', 1);
  238 + $skn = $this->get('id', 1);
  239 + $result = CartModel::cartProductData($this->_uid, $skn, $num); // 测试skn的ID为51172055
  240 + $result['num'] = $num;
  241 + }
280 242
281 - $this->echoJson(array('code' => 200, 'data' => $data)); 243 + if (empty($result)) {
  244 + echo ' ';
  245 + } else {
  246 + $this->echoJson($result);
282 } 247 }
283 } 248 }
284 } 249 }
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace Index; 3 namespace Index;
4 4
5 use LibModels\Wap\Home\CartData; 5 use LibModels\Wap\Home\CartData;
  6 +use Plugin\Helpers;
6 use Plugin\Images; 7 use Plugin\Images;
7 8
8 /** 9 /**
@@ -98,6 +99,70 @@ class CartModel @@ -98,6 +99,70 @@ class CartModel
98 } 99 }
99 100
100 /** 101 /**
  102 + * 处理购物车商品数据
  103 + *
  104 + * @param int $uid 用户ID
  105 + * @param int $skn 商品skn
  106 + * @param int $num 购买数目
  107 + * @return array 接口返回的数据
  108 + */
  109 + public static function cartProductData($uid, $skn, $num)
  110 + {
  111 + $result = array('code' => 400, 'message' => '出错啦~');
  112 +
  113 + $product = CartData::cartProductData($uid, $skn);
  114 + if (isset($product['code']) && $product['code'] === 200) {
  115 + $result['code'] = 200;
  116 + $data = array();
  117 + $productData = $product['data'];
  118 +
  119 + // 品牌信息
  120 + if (isset($productData['brand_info']) && !empty($productData['brand_info'])) {
  121 + $data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120);
  122 + }
  123 +
  124 + $data['name'] = $productData['product_name'];
  125 + $data['price'] = $productData['market_price'];
  126 + $data['salePrice'] = $productData['sales_price'];
  127 + $data['storage'] = $productData['storage_sum'];
  128 + $data['num'] = $num;
  129 +
  130 + // 商品选择
  131 + if (isset($productData['goods_list'])) {
  132 + $goodsList = $productData['goods_list'];
  133 +
  134 + $colors = array();
  135 + $oneColor = array();
  136 + $sizes = array();
  137 + $oneSize = array();
  138 + foreach ($goodsList as $val) {
  139 + // 颜色
  140 + $oneColor = array();
  141 + $oneColor['id'] = $val['color_id'];
  142 + $oneColor['name'] = $val['color_name'];
  143 +
  144 + // 尺码
  145 + foreach ($val['size_list'] as $one) {
  146 + $oneSize = array();
  147 + $oneSize['id'] = $one['size_id'];
  148 + $oneSize['name'] = $one['size_name'];
  149 + }
  150 + $sizes[] = $oneSize;
  151 +
  152 + $oneColor['sizes'] = $sizes;
  153 + $colors[] = $oneColor;
  154 + }
  155 +
  156 + $data['colors'] = $colors;
  157 + }
  158 +
  159 + $result['data'] = $data;
  160 + }
  161 +
  162 + return $result;
  163 + }
  164 +
  165 + /**
101 * 修改购物车商品数据 166 * 修改购物车商品数据
102 * 167 *
103 * @param int $uid 用户ID 168 * @param int $uid 用户ID
@@ -135,6 +200,7 @@ class CartModel @@ -135,6 +200,7 @@ class CartModel
135 // 购买的商品列表 200 // 购买的商品列表
136 foreach ($data['goods_list'] as $value) { 201 foreach ($data['goods_list'] as $value) {
137 $oneGoods['id'] = $value['product_sku']; 202 $oneGoods['id'] = $value['product_sku'];
  203 + $oneGoods['skn'] = $value['product_skn'];
138 $oneGoods['name'] = $value['product_name']; 204 $oneGoods['name'] = $value['product_name'];
139 $oneGoods['thumb'] = Images::getImageUrl($value['goods_images'], 120, 120); 205 $oneGoods['thumb'] = Images::getImageUrl($value['goods_images'], 120, 120);
140 $oneGoods['color'] = $value['color_name']; 206 $oneGoods['color'] = $value['color_name'];