Merge branch 'feature/cart' of git.dev.yoho.cn:web/yohobuy into feature/cart
Showing
30 changed files
with
296 additions
and
253 deletions
@@ -10,9 +10,9 @@ class Helpers | @@ -10,9 +10,9 @@ class Helpers | ||
10 | 10 | ||
11 | /** | 11 | /** |
12 | * 构建网站的URL | 12 | * 构建网站的URL |
13 | - * | 13 | + * |
14 | * 备注:所有的URL构建都尽量使用该方法,便于以后维护. | 14 | * 备注:所有的URL构建都尽量使用该方法,便于以后维护. |
15 | - * | 15 | + * |
16 | * @param string $uri 如 "/passport/reg/index" | 16 | * @param string $uri 如 "/passport/reg/index" |
17 | * @param array $param 参数项 array(key1 => value1, key2 => value2,),默认为array() | 17 | * @param array $param 参数项 array(key1 => value1, key2 => value2,),默认为array() |
18 | * @param string $module 模块名 如"index"表示默认, "guang"表示逛,"list"表示商品列表,"search"表示搜索 | 18 | * @param string $module 模块名 如"index"表示默认, "guang"表示逛,"list"表示商品列表,"search"表示搜索 |
@@ -53,7 +53,7 @@ class Helpers | @@ -53,7 +53,7 @@ class Helpers | ||
53 | 53 | ||
54 | /** | 54 | /** |
55 | * 根据尺寸获得图片url | 55 | * 根据尺寸获得图片url |
56 | - * | 56 | + * |
57 | * @param string $url 路径 | 57 | * @param string $url 路径 |
58 | * @param integer $width 图片宽度 | 58 | * @param integer $width 图片宽度 |
59 | * @param integer $height 图片高度 | 59 | * @param integer $height 图片高度 |
@@ -67,7 +67,7 @@ class Helpers | @@ -67,7 +67,7 @@ class Helpers | ||
67 | 67 | ||
68 | /** | 68 | /** |
69 | * 获取过滤APP里附加参数后的URL链接 | 69 | * 获取过滤APP里附加参数后的URL链接 |
70 | - * | 70 | + * |
71 | * @param string $url 路径 | 71 | * @param string $url 路径 |
72 | * @return string 去除掉如&openby:yohobuy={"action":"go.brand"}这样的APP附加参数 | 72 | * @return string 去除掉如&openby:yohobuy={"action":"go.brand"}这样的APP附加参数 |
73 | */ | 73 | */ |
@@ -84,7 +84,7 @@ class Helpers | @@ -84,7 +84,7 @@ class Helpers | ||
84 | 84 | ||
85 | /** | 85 | /** |
86 | * 根据用户访问的COOKIE判断出性别 | 86 | * 根据用户访问的COOKIE判断出性别 |
87 | - * | 87 | + * |
88 | * @return string | 88 | * @return string |
89 | */ | 89 | */ |
90 | public static function getGenderByCookie() | 90 | public static function getGenderByCookie() |
@@ -102,7 +102,7 @@ class Helpers | @@ -102,7 +102,7 @@ class Helpers | ||
102 | 102 | ||
103 | /** | 103 | /** |
104 | * 根据用户访问的COOKIE判断出频道 | 104 | * 根据用户访问的COOKIE判断出频道 |
105 | - * | 105 | + * |
106 | * @return int | 106 | * @return int |
107 | */ | 107 | */ |
108 | public static function getChannelByCookie() | 108 | public static function getChannelByCookie() |
@@ -124,7 +124,7 @@ class Helpers | @@ -124,7 +124,7 @@ class Helpers | ||
124 | 124 | ||
125 | /** | 125 | /** |
126 | * 从用户加入购物车的COOKIE取出购物车凭证 | 126 | * 从用户加入购物车的COOKIE取出购物车凭证 |
127 | - * | 127 | + * |
128 | * @return string | 128 | * @return string |
129 | */ | 129 | */ |
130 | public static function getShoppingKeyByCookie() | 130 | public static function getShoppingKeyByCookie() |
@@ -135,7 +135,7 @@ class Helpers | @@ -135,7 +135,7 @@ class Helpers | ||
135 | 135 | ||
136 | /** | 136 | /** |
137 | * 获取商品的ICON | 137 | * 获取商品的ICON |
138 | - * | 138 | + * |
139 | * @param int $type | 139 | * @param int $type |
140 | * @return array | 140 | * @return array |
141 | */ | 141 | */ |
@@ -195,7 +195,7 @@ class Helpers | @@ -195,7 +195,7 @@ class Helpers | ||
195 | 195 | ||
196 | /** | 196 | /** |
197 | * 格式化商品信息 | 197 | * 格式化商品信息 |
198 | - * | 198 | + * |
199 | * @param array $productData 需要格式化的商品数据 | 199 | * @param array $productData 需要格式化的商品数据 |
200 | * @param bool $showTags 控制是否显示标签 | 200 | * @param bool $showTags 控制是否显示标签 |
201 | * @param bool $showNew 控制是否显示NEW图标 | 201 | * @param bool $showNew 控制是否显示NEW图标 |
@@ -273,7 +273,7 @@ class Helpers | @@ -273,7 +273,7 @@ class Helpers | ||
273 | 273 | ||
274 | /** | 274 | /** |
275 | * 格式化资讯文章 | 275 | * 格式化资讯文章 |
276 | - * | 276 | + * |
277 | * @param array $articleData 需要格式化的资讯数据 | 277 | * @param array $articleData 需要格式化的资讯数据 |
278 | * @param bool $showTag 是否显示左上角标签 | 278 | * @param bool $showTag 是否显示左上角标签 |
279 | * @param mixed $isApp 是否显示分享,在APP客户端里嵌入需要传url链接 | 279 | * @param mixed $isApp 是否显示分享,在APP客户端里嵌入需要传url链接 |
@@ -348,7 +348,7 @@ class Helpers | @@ -348,7 +348,7 @@ class Helpers | ||
348 | 348 | ||
349 | /** | 349 | /** |
350 | * 格式化广告焦点图数据 | 350 | * 格式化广告焦点图数据 |
351 | - * | 351 | + * |
352 | * @param array $bannerData 需要格式化的广告图数据 | 352 | * @param array $bannerData 需要格式化的广告图数据 |
353 | * @param int $width 图片的宽度 | 353 | * @param int $width 图片的宽度 |
354 | * @param int $height 图片的高度 | 354 | * @param int $height 图片的高度 |
@@ -370,7 +370,7 @@ class Helpers | @@ -370,7 +370,7 @@ class Helpers | ||
370 | 370 | ||
371 | /** | 371 | /** |
372 | * 生成公开的TOKEN凭证 | 372 | * 生成公开的TOKEN凭证 |
373 | - * | 373 | + * |
374 | * @param string $string 字符串 | 374 | * @param string $string 字符串 |
375 | * @return string | 375 | * @return string |
376 | */ | 376 | */ |
@@ -381,7 +381,7 @@ class Helpers | @@ -381,7 +381,7 @@ class Helpers | ||
381 | 381 | ||
382 | /** | 382 | /** |
383 | * 验证TOKEN凭证 | 383 | * 验证TOKEN凭证 |
384 | - * | 384 | + * |
385 | * @param string $string 字符串 | 385 | * @param string $string 字符串 |
386 | * @param string $token 公开访问TOKEN | 386 | * @param string $token 公开访问TOKEN |
387 | * @return bool | 387 | * @return bool |
@@ -397,7 +397,7 @@ class Helpers | @@ -397,7 +397,7 @@ class Helpers | ||
397 | 397 | ||
398 | /** | 398 | /** |
399 | * 验证手机是否合法 | 399 | * 验证手机是否合法 |
400 | - * | 400 | + * |
401 | * @param int $mobile | 401 | * @param int $mobile |
402 | * @return boolean | 402 | * @return boolean |
403 | */ | 403 | */ |
@@ -411,7 +411,7 @@ class Helpers | @@ -411,7 +411,7 @@ class Helpers | ||
411 | 411 | ||
412 | /** | 412 | /** |
413 | * 验证密码是否合法 | 413 | * 验证密码是否合法 |
414 | - * | 414 | + * |
415 | * @param int $password | 415 | * @param int $password |
416 | * @return boolean | 416 | * @return boolean |
417 | */ | 417 | */ |
@@ -425,7 +425,7 @@ class Helpers | @@ -425,7 +425,7 @@ class Helpers | ||
425 | 425 | ||
426 | /** | 426 | /** |
427 | * 验证邮箱是否合法 | 427 | * 验证邮箱是否合法 |
428 | - * | 428 | + * |
429 | * @param string $email | 429 | * @param string $email |
430 | * @return boolean | 430 | * @return boolean |
431 | */ | 431 | */ |
@@ -438,8 +438,8 @@ class Helpers | @@ -438,8 +438,8 @@ class Helpers | ||
438 | } | 438 | } |
439 | 439 | ||
440 | /** | 440 | /** |
441 | - * 验证国际手机号是否合法 | ||
442 | - * | 441 | + * 验证国际手机号是否合法 |
442 | + * | ||
443 | * @param string $areaMobile | 443 | * @param string $areaMobile |
444 | * @return boolean | 444 | * @return boolean |
445 | */ | 445 | */ |
@@ -518,7 +518,7 @@ class Helpers | @@ -518,7 +518,7 @@ class Helpers | ||
518 | 518 | ||
519 | /** | 519 | /** |
520 | * 格式化订单商品 | 520 | * 格式化订单商品 |
521 | - * | 521 | + * |
522 | * @param array $orderGoods 订单 | 522 | * @param array $orderGoods 订单 |
523 | * @param int $count 计订单件数 | 523 | * @param int $count 计订单件数 |
524 | * @param bool $haveLink 控制是否需要商品链接 | 524 | * @param bool $haveLink 控制是否需要商品链接 |
@@ -601,7 +601,7 @@ class Helpers | @@ -601,7 +601,7 @@ class Helpers | ||
601 | } | 601 | } |
602 | 602 | ||
603 | /** | 603 | /** |
604 | - * 格式化加价购商品 | 604 | + * 格式化加价购和赠品商品 |
605 | * | 605 | * |
606 | * @param array $advanceGoods 加价购商品列表 | 606 | * @param array $advanceGoods 加价购商品列表 |
607 | * @param int $count 计商品件数 | 607 | * @param int $count 计商品件数 |
@@ -615,12 +615,13 @@ class Helpers | @@ -615,12 +615,13 @@ class Helpers | ||
615 | $oneGoods = array(); | 615 | $oneGoods = array(); |
616 | foreach ($advanceGoods as $value) { | 616 | foreach ($advanceGoods as $value) { |
617 | $gift = array(); | 617 | $gift = array(); |
618 | + $gift['promotionId'] = $value['promotion_id']; | ||
618 | $gift['promotionTitle'] = $value['promotion_title']; | 619 | $gift['promotionTitle'] = $value['promotion_title']; |
619 | 620 | ||
620 | foreach ($value['goods_list'] as $single) { | 621 | foreach ($value['goods_list'] as $single) { |
621 | $oneGoods['id'] = $single['product_skn']; | 622 | $oneGoods['id'] = $single['product_skn']; |
622 | $oneGoods['name'] = $single['product_name']; | 623 | $oneGoods['name'] = $single['product_name']; |
623 | - $oneGoods['thumb'] = !empty($single['goods_images']) ? Images::getImageUrl($single['goods_images'], 120, 120) : ''; | 624 | + $oneGoods['thumb'] = !empty($single['goods_images']) ? Images::getImageUrl($single['goods_images'], 120, 160) : ''; |
624 | $oneGoods['appearDate'] = '12月'; // 目前app接口没有返回该数据 | 625 | $oneGoods['appearDate'] = '12月'; // 目前app接口没有返回该数据 |
625 | $oneGoods['price'] = $single['last_price']; | 626 | $oneGoods['price'] = $single['last_price']; |
626 | $oneGoods['marketPrice'] = $single['market_price']; | 627 | $oneGoods['marketPrice'] = $single['market_price']; |
@@ -686,7 +687,7 @@ class Helpers | @@ -686,7 +687,7 @@ class Helpers | ||
686 | 687 | ||
687 | /** | 688 | /** |
688 | * 获取会员的级别 | 689 | * 获取会员的级别 |
689 | - * | 690 | + * |
690 | * @param string $vipInfo | 691 | * @param string $vipInfo |
691 | * @return int | 692 | * @return int |
692 | */ | 693 | */ |
@@ -714,9 +715,9 @@ class Helpers | @@ -714,9 +715,9 @@ class Helpers | ||
714 | 715 | ||
715 | /** | 716 | /** |
716 | * 同步用户的会话 | 717 | * 同步用户的会话 |
717 | - * | 718 | + * |
718 | * 转向老的PHP服务器上处理, 因购物车相关的操作会依赖SESSION | 719 | * 转向老的PHP服务器上处理, 因购物车相关的操作会依赖SESSION |
719 | - * | 720 | + * |
720 | * @param int $uid 用户ID | 721 | * @param int $uid 用户ID |
721 | * @param string $refer 访问来源 | 722 | * @param string $refer 访问来源 |
722 | * @param string $callback 回调方法名 | 723 | * @param string $callback 回调方法名 |
@@ -730,9 +731,9 @@ class Helpers | @@ -730,9 +731,9 @@ class Helpers | ||
730 | 731 | ||
731 | /** | 732 | /** |
732 | * 退出清除用户的会话 | 733 | * 退出清除用户的会话 |
733 | - * | 734 | + * |
734 | * 转向老的PHP服务器上处理, 因购物车相关的操作会依赖SESSION | 735 | * 转向老的PHP服务器上处理, 因购物车相关的操作会依赖SESSION |
735 | - * | 736 | + * |
736 | * @param int $uid 用户ID | 737 | * @param int $uid 用户ID |
737 | * @param string $refer 访问来源 | 738 | * @param string $refer 访问来源 |
738 | * @param string $callback 回调方法名 | 739 | * @param string $callback 回调方法名 |
@@ -8,13 +8,13 @@ var $ = require('jquery'), | @@ -8,13 +8,13 @@ var $ = require('jquery'), | ||
8 | lazyLoad = require('yoho.lazyload'), | 8 | lazyLoad = require('yoho.lazyload'), |
9 | Hammer = require('yoho.hammer'); | 9 | Hammer = require('yoho.hammer'); |
10 | 10 | ||
11 | -var chosePanel = require('./chose-panel'), | ||
12 | - cartInfo = require('./cart-info').cartInfo; | 11 | +var chosePanel = require('./chose-panel'); |
13 | 12 | ||
14 | var $cartContent = $('.cart-content'); | 13 | var $cartContent = $('.cart-content'); |
15 | 14 | ||
16 | var navHammer, | 15 | var navHammer, |
17 | - cartType = 'ordinary'; | 16 | + cartType = 'ordinary', |
17 | + cartInfo; | ||
18 | 18 | ||
19 | require('./good'); | 19 | require('./good'); |
20 | 20 | ||
@@ -28,6 +28,12 @@ navHammer.on('tap', function(e) { | @@ -28,6 +28,12 @@ navHammer.on('tap', function(e) { | ||
28 | return; | 28 | return; |
29 | } | 29 | } |
30 | 30 | ||
31 | + if (cartType === 'ordinary') { | ||
32 | + cartType = 'advance'; | ||
33 | + } else { | ||
34 | + cartType = 'ordinary'; | ||
35 | + } | ||
36 | + | ||
31 | $this.siblings('.active').removeClass('active'); | 37 | $this.siblings('.active').removeClass('active'); |
32 | $this.addClass('active'); | 38 | $this.addClass('active'); |
33 | 39 | ||
@@ -41,7 +47,7 @@ navHammer.on('tap', function(e) { | @@ -41,7 +47,7 @@ navHammer.on('tap', function(e) { | ||
41 | 47 | ||
42 | 48 | ||
43 | $('.btn-balance').on('touchend', function() { | 49 | $('.btn-balance').on('touchend', function() { |
44 | - window.location.href = '/shoppingCart/orderEnsure?cartType=' + cartType; | 50 | + window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; |
45 | }); | 51 | }); |
46 | 52 | ||
47 | //$('.advance-buy').on('touchend', function() { | 53 | //$('.advance-buy').on('touchend', function() { |
@@ -66,4 +72,4 @@ $('.chose').on('touchend', function() { | @@ -66,4 +72,4 @@ $('.chose').on('touchend', function() { | ||
66 | 72 | ||
67 | 73 | ||
68 | 74 | ||
69 | -cartInfo = 0; | ||
75 | +cartInfo = 0; |
static/js/cart/gift-advance.js
0 → 100644
1 | +/** | ||
2 | + * 赠品/加价购 | ||
3 | + * @author: xuqi<qi.xu@yoho.cn> | ||
4 | + * @date: 2015/10/23 | ||
5 | + */ | ||
6 | + | ||
7 | +var $ = require('jquery'), | ||
8 | + lazyLoad = require('yoho.lazyload'), | ||
9 | + Handlebars = require('yoho.handlebars'), | ||
10 | + tip = require('../plugin/tip'), | ||
11 | + chosePanel = require('./chose-panel'); | ||
12 | + | ||
13 | +var panelTmpl, | ||
14 | + $page = $('.gift-advance-page'), | ||
15 | + $chosePanel = $('#chose-panel'); | ||
16 | + | ||
17 | +lazyLoad($('.lazy')); | ||
18 | + | ||
19 | +$.get('/cart/index/giftinfoTpl', function(html) { | ||
20 | + if (!html) { | ||
21 | + tip.show('网络错误'); | ||
22 | + return; | ||
23 | + } | ||
24 | + panelTmpl = Handlebars.compile(html); | ||
25 | +}).fail(function() { | ||
26 | + tip.show('网络错误'); | ||
27 | +}); | ||
28 | + | ||
29 | +function getProductInfo(skn, promotionId) { | ||
30 | + $.get('/cart/index/giftinfo', { | ||
31 | + skn: skn, | ||
32 | + promotionId: promotionId | ||
33 | + }).then(function(res) { | ||
34 | + if (!res) { | ||
35 | + tip.show('网络错误'); | ||
36 | + return; | ||
37 | + } | ||
38 | + console.log(res); | ||
39 | + if (res.code === 200) { | ||
40 | + $chosePanel.html(panelTmpl(res.data)); | ||
41 | + chosePanel.show(); | ||
42 | + } else { | ||
43 | + tip.show(res.message || '网络错误'); | ||
44 | + } | ||
45 | + }).fail(function() { | ||
46 | + tip.show('网络错误'); | ||
47 | + }); | ||
48 | +} | ||
49 | + | ||
50 | +$page.on('touchend', '.chose', function() { | ||
51 | + var $this = $(this), | ||
52 | + id = $this.closest('.gift-advance-good').data('id'), | ||
53 | + promotionId = $this.closest('.advance-block').data('promotion-id'); | ||
54 | + | ||
55 | + getProductInfo(id, promotionId); | ||
56 | +}); |
@@ -44,7 +44,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -44,7 +44,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
44 | 44 | ||
45 | $.ajax({ | 45 | $.ajax({ |
46 | type: 'GET', | 46 | type: 'GET', |
47 | - url: '/shoppingCart/select', | 47 | + url: '/cart/index/select', |
48 | data: { | 48 | data: { |
49 | id: id | 49 | id: id |
50 | } | 50 | } |
@@ -58,7 +58,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -58,7 +58,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
58 | } | 58 | } |
59 | $.ajax({ | 59 | $.ajax({ |
60 | type: 'GET', | 60 | type: 'GET', |
61 | - url: '/shoppingCart/getCartData', | 61 | + url: '/cart/index/getCartData', |
62 | data: { | 62 | data: { |
63 | id: id | 63 | id: id |
64 | }, | 64 | }, |
@@ -120,7 +120,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -120,7 +120,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
120 | 120 | ||
121 | $.ajax({ | 121 | $.ajax({ |
122 | method: 'post', | 122 | method: 'post', |
123 | - url: '/shoppingCart/del', | 123 | + url: '/cart/index/del', |
124 | data: { | 124 | data: { |
125 | id: id | 125 | id: id |
126 | } | 126 | } |
@@ -167,11 +167,6 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -167,11 +167,6 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
167 | // }); | 167 | // }); |
168 | //}) | 168 | //}) |
169 | 169 | ||
170 | - | ||
171 | -$('.btn-balance').on('touchend', function() { | ||
172 | - window.location.href = '/shoppingCart/orderEnsure?cartType=' + 'ordinary'; | ||
173 | -}); | ||
174 | - | ||
175 | $('.down').on('touchend', function() { | 170 | $('.down').on('touchend', function() { |
176 | chosePanel.show(); | 171 | chosePanel.show(); |
177 | }); | 172 | }); |
@@ -180,7 +175,7 @@ $('.cut').on('touchend', function() { | @@ -180,7 +175,7 @@ $('.cut').on('touchend', function() { | ||
180 | 175 | ||
181 | $.ajax({ | 176 | $.ajax({ |
182 | type: 'GET', | 177 | type: 'GET', |
183 | - url: '/shoppingCart/modify', | 178 | + url: '/cart/index/modify', |
184 | data: { | 179 | data: { |
185 | old_product_sku: id, | 180 | old_product_sku: id, |
186 | new_product_sku: id, | 181 | new_product_sku: id, |
@@ -17,7 +17,8 @@ var dispatchModeHammer, | @@ -17,7 +17,8 @@ var dispatchModeHammer, | ||
17 | $invoice = $('.invoice'), | 17 | $invoice = $('.invoice'), |
18 | $price = $('.price-cal'), | 18 | $price = $('.price-cal'), |
19 | payType, | 19 | payType, |
20 | - priceTmpl = Handlebars.compile($('#tmpl-price').html()); | 20 | + priceTmpl = Handlebars.compile($('#tmpl-price').html()), |
21 | + queryString = $.queryString(); | ||
21 | 22 | ||
22 | lazyLoad(); | 23 | lazyLoad(); |
23 | 24 | ||
@@ -101,7 +102,7 @@ function submitOrder() { | @@ -101,7 +102,7 @@ function submitOrder() { | ||
101 | url: '/cart/index/orderSub', | 102 | url: '/cart/index/orderSub', |
102 | data: { | 103 | data: { |
103 | addressId: orderInfo('addressId'), | 104 | addressId: orderInfo('addressId'), |
104 | - cartType: orderInfo('cartType'), | 105 | + cartType: queryString.cartType || queryString.carttype || 'ordinary', |
105 | deliveryId: orderInfo('deliveryId'), | 106 | deliveryId: orderInfo('deliveryId'), |
106 | deliveryTimeId: orderInfo('deliveryTimeId'), | 107 | deliveryTimeId: orderInfo('deliveryTimeId'), |
107 | invoiceText: $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'), | 108 | invoiceText: $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'), |
@@ -132,7 +133,7 @@ function submitOrder() { | @@ -132,7 +133,7 @@ function submitOrder() { | ||
132 | window.location.href = url; | 133 | window.location.href = url; |
133 | } else { | 134 | } else { |
134 | loading.hideLoadingMask(); | 135 | loading.hideLoadingMask(); |
135 | - tip.show(res.messege || '网络出错'); | 136 | + tip.show(res.message || '网络出错'); |
136 | } | 137 | } |
137 | }).fail(function() { | 138 | }).fail(function() { |
138 | loading.hideLoadingMask(); | 139 | loading.hideLoadingMask(); |
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | var $ = require('jquery'), | 8 | var $ = require('jquery'), |
9 | Hammer = require('yoho.hammer'), | 9 | Hammer = require('yoho.hammer'), |
10 | tip = require('../../plugin/tip'), | 10 | tip = require('../../plugin/tip'), |
11 | - chosePanel = require('../../shopping-cart/chose-panel'); | 11 | + chosePanel = require('../../cart/chose-panel'); |
12 | 12 | ||
13 | var likeEle = document.getElementById('likeBtn'), | 13 | var likeEle = document.getElementById('likeBtn'), |
14 | likeHammer = likeEle && new Hammer(likeEle); | 14 | likeHammer = likeEle && new Hammer(likeEle); |
@@ -83,6 +83,3 @@ if (addToCartHammer) { | @@ -83,6 +83,3 @@ if (addToCartHammer) { | ||
83 | 83 | ||
84 | }); | 84 | }); |
85 | } | 85 | } |
86 | - | ||
87 | - | ||
88 | - |
1 | -/** | ||
2 | - * 赠品/加价购 | ||
3 | - * @author: xuqi<qi.xu@yoho.cn> | ||
4 | - * @date: 2015/10/23 | ||
5 | - */ | ||
6 | - | ||
7 | -var $ = require('jquery'), | ||
8 | - lazyLoad = require('yoho.lazyload'); | ||
9 | - | ||
10 | -//var chosePanel = require('./chose-panel'); | ||
11 | - | ||
12 | -lazyLoad($('.lazy')); | ||
13 | - | ||
14 | -//$('.gift-advance-page').on('touchstart', '.chose', function() { | ||
15 | -// var id = $(this).closest('.gift-advance-good').data('id'); | ||
16 | -// | ||
17 | -// $.ajax({ | ||
18 | -// type: 'GET', | ||
19 | -// url: '/shoppingCart/goodinfo', | ||
20 | -// data: { | ||
21 | -// id: id | ||
22 | -// }, | ||
23 | -// success: function(data) { | ||
24 | -// if (data.code === 200) { | ||
25 | -// chosePanel.show(data.data); | ||
26 | -// } | ||
27 | -// } | ||
28 | -// }); | ||
29 | -//}); |
@@ -44,6 +44,10 @@ | @@ -44,6 +44,10 @@ | ||
44 | 44 | ||
45 | &:before { | 45 | &:before { |
46 | content: '赠品'; | 46 | content: '赠品'; |
47 | + display: block; | ||
48 | + font-size: 12px; | ||
49 | + line-height: 25rem / $pxConvertRem; | ||
50 | + transform: scale(0.833); | ||
47 | } | 51 | } |
48 | } | 52 | } |
49 | 53 | ||
@@ -52,6 +56,7 @@ | @@ -52,6 +56,7 @@ | ||
52 | } | 56 | } |
53 | 57 | ||
54 | .name { | 58 | .name { |
59 | + width: 440rem / $pxConvertRem; | ||
55 | font-size: 28rem / $pxConvertRem; | 60 | font-size: 28rem / $pxConvertRem; |
56 | } | 61 | } |
57 | 62 | ||
@@ -74,8 +79,14 @@ | @@ -74,8 +79,14 @@ | ||
74 | } | 79 | } |
75 | 80 | ||
76 | .price { | 81 | .price { |
82 | + margin-left: 10rem / $pxConvertRem; | ||
77 | font-size: 24rem / $pxConvertRem; | 83 | font-size: 24rem / $pxConvertRem; |
78 | - color: #000; | 84 | + color: #f1545b; |
85 | + | ||
86 | + &.market-price { | ||
87 | + color: #999; | ||
88 | + text-decoration: line-through; | ||
89 | + } | ||
79 | } | 90 | } |
80 | 91 | ||
81 | .count { | 92 | .count { |
@@ -96,9 +107,9 @@ | @@ -96,9 +107,9 @@ | ||
96 | } | 107 | } |
97 | 108 | ||
98 | .title { | 109 | .title { |
99 | - height: 50rem / $pxConvertRem; | ||
100 | - line-height: 50rem / $pxConvertRem; | ||
101 | - padding-left: 20rem / $pxConvertRem; | 110 | + height: 60rem / $pxConvertRem; |
111 | + line-height: 60rem / $pxConvertRem; | ||
112 | + padding: 0 20rem / $pxConvertRem; | ||
102 | font-size: 24rem / $pxConvertRem; | 113 | font-size: 24rem / $pxConvertRem; |
103 | background: #f8f8f8; | 114 | background: #f8f8f8; |
104 | } | 115 | } |
@@ -109,4 +120,4 @@ | @@ -109,4 +120,4 @@ | ||
109 | content: '加价购'; | 120 | content: '加价购'; |
110 | } | 121 | } |
111 | } | 122 | } |
112 | -} | ||
123 | +} |
@@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
7 | position: absolute; | 7 | position: absolute; |
8 | top: 50%; | 8 | top: 50%; |
9 | margin-top: -14rem / $pxConvertRem; | 9 | margin-top: -14rem / $pxConvertRem; |
10 | + margin-left: 20rem / $pxConvertRem; | ||
10 | font-size: 28rem / $pxConvertRem; | 11 | font-size: 28rem / $pxConvertRem; |
11 | color: #f0f0f0; | 12 | color: #f0f0f0; |
12 | 13 | ||
@@ -15,9 +16,40 @@ | @@ -15,9 +16,40 @@ | ||
15 | } | 16 | } |
16 | } | 17 | } |
17 | 18 | ||
19 | + .few-tag{ | ||
20 | + width: 132rem / $pxConvertRem; | ||
21 | + position: absolute; | ||
22 | + left: 100rem / $pxConvertRem; | ||
23 | + text-align: center; | ||
24 | + top: 75%; | ||
25 | + color: #fff; | ||
26 | + } | ||
27 | + | ||
28 | + .gift-tag { | ||
29 | + background-color: #88BE51; | ||
30 | + } | ||
31 | + | ||
32 | + .plus-tag { | ||
33 | + background-color: #FC1264; | ||
34 | + } | ||
35 | + | ||
36 | + .few-tag-expire { | ||
37 | + position: absolute; | ||
38 | + top: 40%; | ||
39 | + left: 20rem / $pxConvertRem; | ||
40 | + background-color: #7f7f7f; | ||
41 | + display: inline-block; | ||
42 | + color: #fff; | ||
43 | + border-radius: 12rem / $pxConvertRem; | ||
44 | + padding: 4rem / $pxConvertRem; | ||
45 | + font-size: 20rem / $pxConvertRem; | ||
46 | + width: 48rem / $pxConvertRem; | ||
47 | + text-align: center; | ||
48 | + } | ||
49 | + | ||
18 | .info { | 50 | .info { |
19 | float: left; | 51 | float: left; |
20 | - margin-left: 30rem / $pxConvertRem; | 52 | + margin-left: 60rem / $pxConvertRem; |
21 | padding: 16rem / $pxConvertRem 0; | 53 | padding: 16rem / $pxConvertRem 0; |
22 | padding-right: 20rem / $pxConvertRem; | 54 | padding-right: 20rem / $pxConvertRem; |
23 | } | 55 | } |
@@ -32,13 +64,18 @@ | @@ -32,13 +64,18 @@ | ||
32 | 64 | ||
33 | .deps { | 65 | .deps { |
34 | margin-left: 173rem / $pxConvertRem; | 66 | margin-left: 173rem / $pxConvertRem; |
35 | - padding-bottom: 60rem / $pxConvertRem; | 67 | + padding-bottom: 72rem / $pxConvertRem; |
36 | border-bottom: 1px solid #e0e0e0; | 68 | border-bottom: 1px solid #e0e0e0; |
69 | + width: 380rem / $pxConvertRem; | ||
70 | + position: relative; | ||
71 | + min-height: 140rem / $pxConvertRem; | ||
37 | } | 72 | } |
38 | 73 | ||
39 | .name { | 74 | .name { |
40 | font-size: 28rem / $pxConvertRem; | 75 | font-size: 28rem / $pxConvertRem; |
41 | color: #5a5a5a; | 76 | color: #5a5a5a; |
77 | + width: 80%; | ||
78 | + display: inline-block; | ||
42 | } | 79 | } |
43 | 80 | ||
44 | .row:nth-child(2) { | 81 | .row:nth-child(2) { |
@@ -71,9 +108,13 @@ | @@ -71,9 +108,13 @@ | ||
71 | } | 108 | } |
72 | 109 | ||
73 | .count { | 110 | .count { |
74 | - font-size: 20rem / $pxConvertRem; | 111 | + font-size: 32rem / $pxConvertRem; |
75 | color: #999; | 112 | color: #999; |
76 | - margin-left: 22rem / $pxConvertRem; | 113 | + //margin-left: 22rem / $pxConvertRem; |
114 | + display: inline-block; | ||
115 | + width: 19%; | ||
116 | + position: absolute; | ||
117 | + text-align: center; | ||
77 | } | 118 | } |
78 | 119 | ||
79 | .sold-out, .low-stocks { | 120 | .sold-out, .low-stocks { |
@@ -181,15 +222,15 @@ | @@ -181,15 +222,15 @@ | ||
181 | font-size: 40rem / $pxConvertRem; | 222 | font-size: 40rem / $pxConvertRem; |
182 | line-height: 60rem / $pxConvertRem; | 223 | line-height: 60rem / $pxConvertRem; |
183 | text-align: center; | 224 | text-align: center; |
184 | - | 225 | + |
185 | } | 226 | } |
186 | &:last-child { | 227 | &:last-child { |
187 | span{ | 228 | span{ |
188 | width: 168rem / $pxConvertRem; | 229 | width: 168rem / $pxConvertRem; |
189 | overflow: hidden; | 230 | overflow: hidden; |
190 | font-size: 48em / $pxConvertRem; | 231 | font-size: 48em / $pxConvertRem; |
191 | - text-overflow:ellipsis; | ||
192 | - white-space:nowrap; | 232 | + text-overflow:ellipsis; |
233 | + white-space:nowrap; | ||
193 | } | 234 | } |
194 | } | 235 | } |
195 | } | 236 | } |
@@ -205,7 +246,6 @@ | @@ -205,7 +246,6 @@ | ||
205 | top: 20rem / $pxConvertRem;; | 246 | top: 20rem / $pxConvertRem;; |
206 | font-size: 52em / $pxConvertRem; | 247 | font-size: 52em / $pxConvertRem; |
207 | } | 248 | } |
208 | - | ||
209 | } | 249 | } |
210 | } | 250 | } |
211 | 251 |
@@ -158,5 +158,5 @@ a { | @@ -158,5 +158,5 @@ a { | ||
158 | @import "category/index"; | 158 | @import "category/index"; |
159 | @import "product/index"; | 159 | @import "product/index"; |
160 | @import "index/index"; | 160 | @import "index/index"; |
161 | -@import "shopping-cart/index"; | 161 | +@import "cart/index"; |
162 | @import "me/index"; //个人中心 | 162 | @import "me/index"; //个人中心 |
1 | {{> layout/header}} | 1 | {{> layout/header}} |
2 | <div class="gift-advance-page yoho-page"> | 2 | <div class="gift-advance-page yoho-page"> |
3 | - {{# shoppingCart}} | ||
4 | - {{#if gift}} | ||
5 | - {{# gift}} | ||
6 | - {{> shopping-cart/gift-advance-good}} | ||
7 | - {{/ gift}} | ||
8 | - {{^}} | ||
9 | - {{# advance}} | ||
10 | - <div class="advance-block"> | ||
11 | - <p class="title">{{title}}</p> | ||
12 | - {{# goods}} | ||
13 | - {{> shopping-cart/gift-advance-good}} | ||
14 | - {{/ goods}} | ||
15 | - </div> | ||
16 | - {{/ advance}} | ||
17 | - {{/if}} | ||
18 | - {{/ shoppingCart}} | 3 | + {{#if advanceBuyPage}} |
4 | + {{# advanceBuy}} | ||
5 | + <div class="advance-block" data-promotion-id="{{promotionId}}"> | ||
6 | + <p class="title">{{title}}</p> | ||
7 | + {{#goods}} | ||
8 | + {{> cart/gift-advance-good}} | ||
9 | + {{/goods}} | ||
10 | + </div> | ||
11 | + {{/ advanceBuy}} | ||
12 | + {{else}} | ||
13 | + {{# freebie}} | ||
14 | + {{> cart/gift-advance-good}} | ||
15 | + {{/ freebie}} | ||
16 | + {{/if}} | ||
17 | + | ||
18 | +<div id="chose-panel"></div> | ||
19 | </div> | 19 | </div> |
20 | -{{> layout/footer}} | ||
20 | +{{> layout/footer}} |
@@ -27,7 +27,7 @@ | @@ -27,7 +27,7 @@ | ||
27 | 27 | ||
28 | {{# commonCart}} | 28 | {{# commonCart}} |
29 | <div class="cart-content common"> | 29 | <div class="cart-content common"> |
30 | - {{> shopping-cart/cart-content}} | 30 | + {{> cart/cart-content}} |
31 | </div> | 31 | </div> |
32 | {{/ commonCart}} | 32 | {{/ commonCart}} |
33 | 33 | ||
@@ -38,7 +38,7 @@ | @@ -38,7 +38,7 @@ | ||
38 | <span class="txt">预售商品全场包邮,到货后立即发货</span> | 38 | <span class="txt">预售商品全场包邮,到货后立即发货</span> |
39 | <span class="txt">预售商品不参加活动,不可使用优惠券</span> | 39 | <span class="txt">预售商品不参加活动,不可使用优惠券</span> |
40 | </p> | 40 | </p> |
41 | - {{> shopping-cart/cart-content}} | 41 | + {{> cart/cart-content}} |
42 | </div> | 42 | </div> |
43 | {{/ preSellCart}} | 43 | {{/ preSellCart}} |
44 | {{/ shoppingCart}} | 44 | {{/ shoppingCart}} |
@@ -52,5 +52,5 @@ | @@ -52,5 +52,5 @@ | ||
52 | </div> | 52 | </div> |
53 | {{> product/recommend-for-you}} | 53 | {{> product/recommend-for-you}} |
54 | </div> | 54 | </div> |
55 | -{{> shopping-cart/chose-panel}} | 55 | + {{> cart/chose-panel}} |
56 | {{> layout/footer}} | 56 | {{> layout/footer}} |
1 | <div class="cart-goods"> | 1 | <div class="cart-goods"> |
2 | {{# goods}} | 2 | {{# goods}} |
3 | - {{> shopping-cart/good}} | 3 | + {{> cart/good}} |
4 | {{/ goods}} | 4 | {{/ goods}} |
5 | 5 | ||
6 | {{# $notValidGoods}} | 6 | {{# $notValidGoods}} |
7 | - {{> shopping-cart/good}} | 7 | + {{> cart/good}} |
8 | {{/ $notValidGoods}} | 8 | {{/ $notValidGoods}} |
9 | 9 | ||
10 | </div> | 10 | </div> |
@@ -6,24 +6,11 @@ | @@ -6,24 +6,11 @@ | ||
6 | <div class="deps"> | 6 | <div class="deps"> |
7 | <p class="name row">{{name}}</p> | 7 | <p class="name row">{{name}}</p> |
8 | <p class="row"> | 8 | <p class="row"> |
9 | - {{#if color}} | ||
10 | - <span class="color"> | ||
11 | - 颜色:{{color}} | ||
12 | - </span> | ||
13 | - {{/if}} | ||
14 | - | ||
15 | - {{#if size}} | ||
16 | - <span class="size"> | ||
17 | - 尺码:{{size}} | ||
18 | - </span> | ||
19 | - {{/if}} | ||
20 | - </p> | ||
21 | - <p class="row"> | ||
22 | <span class="price"> | 9 | <span class="price"> |
23 | ¥{{price}} | 10 | ¥{{price}} |
24 | </span> | 11 | </span> |
25 | - <span class="price"> | ||
26 | - ¥{{salePrice}} | 12 | + <span class="price market-price"> |
13 | + ¥{{marketPrice}} | ||
27 | </span> | 14 | </span> |
28 | <span class="count"> | 15 | <span class="count"> |
29 | ×{{count}} | 16 | ×{{count}} |
@@ -33,4 +20,4 @@ | @@ -33,4 +20,4 @@ | ||
33 | </div> | 20 | </div> |
34 | 21 | ||
35 | 22 | ||
36 | -</div> | ||
23 | +</div> |
1 | <div class="shopping-cart-good clearfix" data-id={{id}}> | 1 | <div class="shopping-cart-good clearfix" data-id={{id}}> |
2 | - <span class="checkbox icon-cb-checked iconfont"></span> | ||
3 | - <!-- {{#if isSoldOut}} | ||
4 | -<p class="">失效</p> | ||
5 | - {{^}} | ||
6 | - {{#if isGift}} | ||
7 | - {{^}} | ||
8 | -<span class="checkbox icon-cb-checked iconfont"></span> | ||
9 | - {{/if}} | 2 | + {{#if isSoldOut}} |
3 | + <span class="few-tag-expire">失效</span> | ||
4 | + {{^}} | ||
5 | + <span class="checkbox icon-cb-checked iconfont"></span> | ||
6 | + {{/if}} | ||
10 | 7 | ||
11 | - {{/if}}--> | ||
12 | <div class="info"> | 8 | <div class="info"> |
13 | <img class="thumb lazy" data-original={{thumb}}> | 9 | <img class="thumb lazy" data-original={{thumb}}> |
14 | - <!-- | ||
15 | - <a class="" href="{{url}}"> | ||
16 | - <img class="thumb lazy" data-original="{{thumb}}"> | ||
17 | - </a> | ||
18 | {{#if isAdvanceBuy}} | 10 | {{#if isAdvanceBuy}} |
19 | - <p class="few-tag">加价购</p> | 11 | + <p class="few-tag plus-tag">加价购</p> |
20 | {{^}} | 12 | {{^}} |
21 | {{#if isGift}} | 13 | {{#if isGift}} |
22 | - <p class="few-tag">赠品</p> | 14 | + <p class="few-tag gift-tag">赠品</p> |
23 | {{/if}} | 15 | {{/if}} |
24 | {{/if}} | 16 | {{/if}} |
25 | - {{#if isSoldOut}} | ||
26 | - <p class="few-tag">失效</p> | ||
27 | - {{/if}} | ||
28 | - | ||
29 | - --> | 17 | + </a> |
30 | 18 | ||
31 | <div class="deps show"> | 19 | <div class="deps show"> |
32 | <p class="name row">{{name}}</p> | 20 | <p class="name row">{{name}}</p> |
21 | + <span class="count"> | ||
22 | + ×{{count}} | ||
23 | + </span> | ||
33 | <p class="row"> | 24 | <p class="row"> |
34 | {{#if color}} | 25 | {{#if color}} |
35 | <span class="color"> | 26 | <span class="color"> |
@@ -48,9 +39,7 @@ | @@ -48,9 +39,7 @@ | ||
48 | <span class="price"> | 39 | <span class="price"> |
49 | ¥{{price}} | 40 | ¥{{price}} |
50 | </span> | 41 | </span> |
51 | - <span class="count"> | ||
52 | - ×{{count}} | ||
53 | - </span> | 42 | + |
54 | {{#if soldOut}} | 43 | {{#if soldOut}} |
55 | <span class="sold-out"> | 44 | <span class="sold-out"> |
56 | 已售罄 | 45 | 已售罄 |
@@ -221,29 +221,34 @@ | @@ -221,29 +221,34 @@ | ||
221 | {{!-- 购物车 --}} | 221 | {{!-- 购物车 --}} |
222 | {{#if shoppingCartPage}} | 222 | {{#if shoppingCartPage}} |
223 | <script> | 223 | <script> |
224 | - seajs.use('js/shopping-cart/cart'); | 224 | + seajs.use('js/cart/cart'); |
225 | seajs.use('js/product/recommend-for-you'); | 225 | seajs.use('js/product/recommend-for-you'); |
226 | </script> | 226 | </script> |
227 | {{/if}} | 227 | {{/if}} |
228 | -{{#if giftAdvancePage}} | 228 | +{{#if giftPage}} |
229 | <script> | 229 | <script> |
230 | - seajs.use('js/shopping-cart/gift-advance'); | 230 | + seajs.use('js/cart/gift-advance'); |
231 | +</script> | ||
232 | +{{/if}} | ||
233 | +{{#if advanceBuyPage}} | ||
234 | +<script> | ||
235 | + seajs.use('js/cart/gift-advance'); | ||
231 | </script> | 236 | </script> |
232 | {{/if}} | 237 | {{/if}} |
233 | {{#if orderEnsurePage}} | 238 | {{#if orderEnsurePage}} |
234 | <script> | 239 | <script> |
235 | - seajs.use('js/shopping-cart/order-ensure'); | 240 | + seajs.use('js/cart/order-ensure'); |
236 | </script> | 241 | </script> |
237 | {{/if}} | 242 | {{/if}} |
238 | {{#if selectAddressPage}} | 243 | {{#if selectAddressPage}} |
239 | <script> | 244 | <script> |
240 | seajs.use('js/me/address'); | 245 | seajs.use('js/me/address'); |
241 | - seajs.use('js/shopping-cart/select-address'); | 246 | + seajs.use('js/cart/select-address'); |
242 | </script> | 247 | </script> |
243 | {{/if}} | 248 | {{/if}} |
244 | {{#if selectCouponPage}} | 249 | {{#if selectCouponPage}} |
245 | <script> | 250 | <script> |
246 | - seajs.use('js/shopping-cart/select-coupon'); | 251 | + seajs.use('js/cart/select-coupon'); |
247 | </script> | 252 | </script> |
248 | {{/if}} | 253 | {{/if}} |
249 | {{!-- 个人中心 --}} | 254 | {{!-- 个人中心 --}} |
@@ -189,50 +189,7 @@ class CartModel | @@ -189,50 +189,7 @@ class CartModel | ||
189 | $product = CartData::cartProductData($uid, $skn); | 189 | $product = CartData::cartProductData($uid, $skn); |
190 | if (isset($product['code']) && $product['code'] === 200) { | 190 | if (isset($product['code']) && $product['code'] === 200) { |
191 | $result['code'] = 200; | 191 | $result['code'] = 200; |
192 | - $data = array(); | ||
193 | - $productData = $product['data']; | ||
194 | - | ||
195 | - // 品牌信息 | ||
196 | - if (isset($productData['brand_info']) && !empty($productData['brand_info'])) { | ||
197 | - $data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120); | ||
198 | - } | ||
199 | - | ||
200 | - $data['name'] = $productData['product_name']; | ||
201 | - $data['price'] = $productData['market_price']; | ||
202 | - $data['salePrice'] = $productData['sales_price']; | ||
203 | - $data['storage'] = $productData['storage_sum']; | ||
204 | - $data['num'] = $num; | ||
205 | - | ||
206 | - // 商品选择 | ||
207 | - if (isset($productData['goods_list'])) { | ||
208 | - $goodsList = $productData['goods_list']; | ||
209 | - | ||
210 | - $colors = array(); | ||
211 | - $oneColor = array(); | ||
212 | - $sizes = array(); | ||
213 | - $oneSize = array(); | ||
214 | - foreach ($goodsList as $val) { | ||
215 | - // 颜色 | ||
216 | - $oneColor = array(); | ||
217 | - $oneColor['id'] = $val['color_id']; | ||
218 | - $oneColor['name'] = $val['color_name']; | ||
219 | - | ||
220 | - // 尺码 | ||
221 | - foreach ($val['size_list'] as $one) { | ||
222 | - $oneSize = array(); | ||
223 | - $oneSize['id'] = $one['size_id']; | ||
224 | - $oneSize['name'] = $one['size_name']; | ||
225 | - } | ||
226 | - $sizes[] = $oneSize; | ||
227 | - | ||
228 | - $oneColor['sizes'] = $sizes; | ||
229 | - $colors[] = $oneColor; | ||
230 | - } | ||
231 | - | ||
232 | - $data['colors'] = $colors; | ||
233 | - } | ||
234 | - | ||
235 | - $result['data'] = $data; | 192 | + $result['data'] = self::procGoodsDetail($product['data'], $num); |
236 | } | 193 | } |
237 | 194 | ||
238 | return $result; | 195 | return $result; |
@@ -252,49 +209,7 @@ class CartModel | @@ -252,49 +209,7 @@ class CartModel | ||
252 | $product = CartData::giftProductData($skn, $promotionId); | 209 | $product = CartData::giftProductData($skn, $promotionId); |
253 | if (isset($product['code']) && $product['code'] === 200) { | 210 | if (isset($product['code']) && $product['code'] === 200) { |
254 | $result['code'] = 200; | 211 | $result['code'] = 200; |
255 | - $data = array(); | ||
256 | - $productData = $product['data']; | ||
257 | - | ||
258 | - // 品牌信息 | ||
259 | - if (isset($productData['brand_info']) && !empty($productData['brand_info'])) { | ||
260 | - $data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120); | ||
261 | - } | ||
262 | - | ||
263 | - $data['name'] = $productData['product_name']; | ||
264 | - $data['price'] = $productData['market_price']; | ||
265 | - $data['salePrice'] = $productData['sales_price']; | ||
266 | - $data['storage'] = $productData['storage_sum']; | ||
267 | - | ||
268 | - // 商品选择 | ||
269 | - if (isset($productData['goods_list'])) { | ||
270 | - $goodsList = $productData['goods_list']; | ||
271 | - | ||
272 | - $colors = array(); | ||
273 | - $oneColor = array(); | ||
274 | - $sizes = array(); | ||
275 | - $oneSize = array(); | ||
276 | - foreach ($goodsList as $val) { | ||
277 | - // 颜色 | ||
278 | - $oneColor = array(); | ||
279 | - $oneColor['id'] = $val['color_id']; | ||
280 | - $oneColor['name'] = $val['color_name']; | ||
281 | - | ||
282 | - // 尺码 | ||
283 | - foreach ($val['size_list'] as $one) { | ||
284 | - $oneSize = array(); | ||
285 | - $oneSize['id'] = $one['size_id']; | ||
286 | - $oneSize['name'] = $one['size_name']; | ||
287 | - } | ||
288 | - $sizes[] = $oneSize; | ||
289 | - | ||
290 | - $oneColor['sizes'] = $sizes; | ||
291 | - $colors[] = $oneColor; | ||
292 | - } | ||
293 | - | ||
294 | - $data['colors'] = $colors; | ||
295 | - } | ||
296 | - | ||
297 | - $result['data'] = $data; | 212 | + $result['data'] = self::procGoodsDetail($product['data']); |
298 | } | 213 | } |
299 | 214 | ||
300 | return $result; | 215 | return $result; |
@@ -657,6 +572,65 @@ class CartModel | @@ -657,6 +572,65 @@ class CartModel | ||
657 | 572 | ||
658 | 573 | ||
659 | /** | 574 | /** |
575 | + * 处理购物车商品、加价购商品、赠品详情数据 | ||
576 | + * | ||
577 | + * @param array $productData 要处理的商品数据 | ||
578 | + * @param int $num 购买数目 | ||
579 | + * @return array $data 处理之后的数据 | ||
580 | + */ | ||
581 | + private static function procGoodsDetail($productData, $num = null) | ||
582 | + { | ||
583 | + $data = array(); | ||
584 | + | ||
585 | + // 品牌信息 | ||
586 | + if (isset($productData['brand_info']) && !empty($productData['brand_info'])) { | ||
587 | + $data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120); | ||
588 | + } | ||
589 | + | ||
590 | + $data['name'] = $productData['product_name']; | ||
591 | + $data['price'] = $productData['market_price']; | ||
592 | + $data['salePrice'] = $productData['sales_price']; | ||
593 | + | ||
594 | + if (isset($productData['storage_sum'])) { | ||
595 | + $data['storage'] = $productData['storage_sum']; | ||
596 | + } | ||
597 | + if ($num !== null) { | ||
598 | + $data['num'] = $num; | ||
599 | + } | ||
600 | + | ||
601 | + // 商品选择 | ||
602 | + if (isset($productData['goods_list'])) { | ||
603 | + $goodsList = $productData['goods_list']; | ||
604 | + | ||
605 | + $colors = array(); | ||
606 | + $oneColor = array(); | ||
607 | + $sizes = array(); | ||
608 | + $oneSize = array(); | ||
609 | + foreach ($goodsList as $val) { | ||
610 | + // 颜色 | ||
611 | + $oneColor = array(); | ||
612 | + $oneColor['id'] = $val['color_id']; | ||
613 | + $oneColor['name'] = $val['color_name']; | ||
614 | + | ||
615 | + // 尺码 | ||
616 | + foreach ($val['size_list'] as $one) { | ||
617 | + $oneSize = array(); | ||
618 | + $oneSize['id'] = $one['size_id']; | ||
619 | + $oneSize['name'] = $one['size_name']; | ||
620 | + } | ||
621 | + $sizes[] = $oneSize; | ||
622 | + | ||
623 | + $oneColor['sizes'] = $sizes; | ||
624 | + $colors[] = $oneColor; | ||
625 | + } | ||
626 | + | ||
627 | + $data['colors'] = $colors; | ||
628 | + } | ||
629 | + | ||
630 | + return $data; | ||
631 | + } | ||
632 | + | ||
633 | + /** | ||
660 | * 处理不同类型的购物车数据 | 634 | * 处理不同类型的购物车数据 |
661 | * | 635 | * |
662 | * @param array $data 不同类型购物车数据 | 636 | * @param array $data 不同类型购物车数据 |
@@ -674,12 +648,12 @@ class CartModel | @@ -674,12 +648,12 @@ class CartModel | ||
674 | break; | 648 | break; |
675 | } | 649 | } |
676 | 650 | ||
677 | - if ($onlyAdvanceBuy) { | 651 | + if ($onlyGift) { |
678 | // 赠品 | 652 | // 赠品 |
679 | $result['freebie'] = Helpers::formatAdvanceGoods($data['gift_list']); | 653 | $result['freebie'] = Helpers::formatAdvanceGoods($data['gift_list']); |
680 | break; | 654 | break; |
681 | } | 655 | } |
682 | - if ($onlyGift) { | 656 | + if ($onlyAdvanceBuy) { |
683 | // 加价购 | 657 | // 加价购 |
684 | $result['advanceBuy'] = Helpers::formatAdvanceGoods($data['price_gift']); | 658 | $result['advanceBuy'] = Helpers::formatAdvanceGoods($data['price_gift']); |
685 | break; | 659 | break; |
@@ -143,11 +143,11 @@ class IndexController extends AbstractAction | @@ -143,11 +143,11 @@ class IndexController extends AbstractAction | ||
143 | $shoppingKey = Helpers::getShoppingKeyByCookie(); | 143 | $shoppingKey = Helpers::getShoppingKeyByCookie(); |
144 | $uid = $this->getUid(true); | 144 | $uid = $this->getUid(true); |
145 | $cartType = $this->get('cartType', 'ordinary'); | 145 | $cartType = $this->get('cartType', 'ordinary'); |
146 | - $data = array('shoppingCartPage' => true); | 146 | + $data = array('giftPage' => true); |
147 | $data += CartModel::getCartData($uid, $shoppingKey, $cartType, true); | 147 | $data += CartModel::getCartData($uid, $shoppingKey, $cartType, true); |
148 | 148 | ||
149 | // 渲染模板 | 149 | // 渲染模板 |
150 | - $this->_view->display('gift-advance-good', $data); | 150 | + $this->_view->display('gift-advance', $data); |
151 | } | 151 | } |
152 | 152 | ||
153 | /* | 153 | /* |
@@ -161,11 +161,11 @@ class IndexController extends AbstractAction | @@ -161,11 +161,11 @@ class IndexController extends AbstractAction | ||
161 | $shoppingKey = Helpers::getShoppingKeyByCookie(); | 161 | $shoppingKey = Helpers::getShoppingKeyByCookie(); |
162 | $uid = $this->getUid(true); | 162 | $uid = $this->getUid(true); |
163 | $cartType = $this->get('cartType', 'ordinary'); | 163 | $cartType = $this->get('cartType', 'ordinary'); |
164 | - $data = array('shoppingCartPage' => true); | 164 | + $data = array('advanceBuyPage' => true); |
165 | $data += CartModel::getCartData($uid, $shoppingKey, $cartType, false, true); | 165 | $data += CartModel::getCartData($uid, $shoppingKey, $cartType, false, true); |
166 | 166 | ||
167 | // 渲染模板 | 167 | // 渲染模板 |
168 | - $this->_view->display('gift-advance-good', $data); | 168 | + $this->_view->display('gift-advance', $data); |
169 | } | 169 | } |
170 | 170 | ||
171 | /* | 171 | /* |
@@ -191,6 +191,16 @@ class IndexController extends AbstractAction | @@ -191,6 +191,16 @@ class IndexController extends AbstractAction | ||
191 | } | 191 | } |
192 | 192 | ||
193 | /* | 193 | /* |
194 | + * 获取购物车加价购商品数据模板 | ||
195 | + */ | ||
196 | + public function giftinfoTplAction() | ||
197 | + { | ||
198 | + if ($this->isAjax()) { | ||
199 | + echo file_get_contents($this->_view->getScriptPath() . '/../partials/cart/chose-panel.phtml'); | ||
200 | + } | ||
201 | + } | ||
202 | + | ||
203 | + /* | ||
194 | * 获取购物车加价购商品数据 | 204 | * 获取购物车加价购商品数据 |
195 | */ | 205 | */ |
196 | public function giftinfoAction() | 206 | public function giftinfoAction() |
@@ -425,10 +435,10 @@ class IndexController extends AbstractAction | @@ -425,10 +435,10 @@ class IndexController extends AbstractAction | ||
425 | $this->echoJson($result); | 435 | $this->echoJson($result); |
426 | } | 436 | } |
427 | } | 437 | } |
428 | - | 438 | + |
429 | /** | 439 | /** |
430 | * 加入购物车 | 440 | * 加入购物车 |
431 | - * | 441 | + * |
432 | * @param string productSku 商品的SKU | 442 | * @param string productSku 商品的SKU |
433 | * @param int buyNumber 购买数量 | 443 | * @param int buyNumber 购买数量 |
434 | * @param int promotionId 促销ID, 加价购有关 | 444 | * @param int promotionId 促销ID, 加价购有关 |
@@ -460,5 +470,5 @@ class IndexController extends AbstractAction | @@ -460,5 +470,5 @@ class IndexController extends AbstractAction | ||
460 | 470 | ||
461 | $this->echoJson($result); | 471 | $this->echoJson($result); |
462 | } | 472 | } |
463 | - | 473 | + |
464 | } | 474 | } |
-
Please register or login to post a comment