Authored by Rock Zhang

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

@@ -72,21 +72,7 @@ @@ -72,21 +72,7 @@
72 72
73 //footer已登录 73 //footer已登录
74 { 74 {
75 - pageFooter: {  
76 - user: {  
77 - name: '',  
78 - url: '',  
79 - signoutUrl: ''  
80 - }  
81 - }  
82 - }  
83 -  
84 - //footer未登录  
85 - {  
86 - pageFooter: {  
87 - loginUrl: '',  
88 - signupUrl: ''  
89 - } 75 + pageFooter: true
90 } 76 }
91 77
92 ### 筛选 78 ### 筛选
@@ -737,4 +723,29 @@ @@ -737,4 +723,29 @@
737 ... 723 ...
738 ] 724 ]
739 725
  726 + }
  727 +
  728 +## 商品列表页
  729 + {
  730 + goodList: {
  731 + search: '', //是否显示搜索栏并指定初始值
  732 + brandWay: { //品牌入口
  733 + url: '',
  734 + thumb: '',
  735 + name: ''
  736 + },
  737 + brand: {
  738 + id: 0,
  739 + intro: '...'
  740 + },
  741 + new: [
  742 + {
  743 + ... //商品信息
  744 + },
  745 + ...
  746 + ],
  747 + filter: {
  748 + .. //筛选数据结构
  749 + }
  750 + }
740 } 751 }
framework @ 75bbc3b0
1 -Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05 1 +Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
No preview for this file type
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > 2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3 <svg xmlns="http://www.w3.org/2000/svg"> 3 <svg xmlns="http://www.w3.org/2000/svg">
4 <metadata> 4 <metadata>
5 -Created by FontForge 20120731 at Mon Oct 19 17:33:26 2015 5 +Created by FontForge 20120731 at Wed Oct 21 13:32:56 2015
6 By Ads 6 By Ads
7 </metadata> 7 </metadata>
8 <defs> 8 <defs>
@@ -16,10 +16,10 @@ Created by FontForge 20120731 at Mon Oct 19 17:33:26 2015 @@ -16,10 +16,10 @@ Created by FontForge 20120731 at Mon Oct 19 17:33:26 2015
16 ascent="812" 16 ascent="812"
17 descent="-212" 17 descent="-212"
18 x-height="792" 18 x-height="792"
19 - bbox="0 -224 3943 812" 19 + bbox="0 -224 3943 812.871"
20 underline-thickness="50" 20 underline-thickness="50"
21 underline-position="-100" 21 underline-position="-100"
22 - unicode-range="U+0078-E61A" 22 + unicode-range="U+0078-E622"
23 /> 23 />
24 <missing-glyph horiz-adv-x="374" 24 <missing-glyph horiz-adv-x="374"
25 d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" /> 25 d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" />
@@ -117,5 +117,28 @@ q16 -8 34 -8zM899.5 225q30.5 0 51 21.5t20.5 52.5q0 9 -2 18t-5.5 16.5t-8 14t-11 1 @@ -117,5 +117,28 @@ q16 -8 34 -8zM899.5 225q30.5 0 51 21.5t20.5 52.5q0 9 -2 18t-5.5 16.5t-8 14t-11 1
117 <glyph glyph-name="uniE61A" unicode="&#xe61a;" 117 <glyph glyph-name="uniE61A" unicode="&#xe61a;"
118 d="M511 -84q-102 0 -188.5 50t-137 137t-50.5 189t50.5 188.5t137 137t188.5 50.5t189 -50.5t137 -137t50 -188.5t-50 -189t-137 -137t-189 -50zM676 421q7 6 0 12l-6 7q-2 2 -5.5 2t-6.5 -2l-138 -139l-137 137q-6 6 -12 0l-6 -6q-6 -6 0 -12l136 -137l-138 -138 118 d="M511 -84q-102 0 -188.5 50t-137 137t-50.5 189t50.5 188.5t137 137t188.5 50.5t189 -50.5t137 -137t50 -188.5t-50 -189t-137 -137t-189 -50zM676 421q7 6 0 12l-6 7q-2 2 -5.5 2t-6.5 -2l-138 -139l-137 137q-6 6 -12 0l-6 -6q-6 -6 0 -12l136 -137l-138 -138
119 q-6 -6 0 -12l6 -6q7 -7 13 0l138 138l138 -139q6 -6 13 0l6 6q6 6 0 13l-139 138zM676 421z" /> 119 q-6 -6 0 -12l6 -6q7 -7 13 0l138 138l138 -139q6 -6 13 0l6 6q6 6 0 13l-139 138zM676 421z" />
  120 + <glyph glyph-name="uniE61B" unicode="&#xe61b;"
  121 +d="M437 41h-193q-27 2 -41.5 22.5t-17.5 45.5q3 25 17.5 41t41.5 18h193v63l-193 1q-27 2 -41.5 19t-17.5 43q3 25 17.5 41t41.5 18h144l-134 236q-10 12 -19 30.5t-8 40.5q5 28 20 45.5t56 22.5q24 -2 43 -16.5t31 -31.5l152 -278l167 280q12 17 31 30t43 16q15 -1 27.5 -4
  122 +t22 -10t16 -20t9.5 -34q0 -29 -20 -55l-155 -252h147q26 -2 41 -18t17 -41q-2 -26 -17.5 -44t-41.5 -20l-191 -1v-61h192q26 -2 41 -20t17 -43q-2 -26 -17 -43.5t-41 -19.5l-192 1v-106q-4 -85 -93 -85q-44 0 -68.5 21t-26.5 64v104z" />
  123 + <glyph glyph-name="uniE61C" unicode="&#xe61c;"
  124 +d="M946 -196h-868q-26 0 -44 18t-18 44v868q0 26 18 44t44 18h868q26 0 44 -18t18 -44v-868q0 -26 -18 -44t-44 -18zM946 703q0 13 -9 22t-22 9h-806q-13 0 -22 -9t-9 -22v-806q0 -13 9 -22t22 -9h806q13 0 22 9t9 22v806z" />
  125 + <glyph glyph-name="uniE61D" unicode="&#xe61d;"
  126 +d="M939 -202h-876q-17 0 -31.5 8.5t-23 23t-8.5 31.5v876q0 26 18.5 44.5t44.5 18.5h876q26 0 44.5 -18.5t18.5 -44.5v-876q0 -39 -35 -57q-14 -6 -28 -6zM814 612l-376 -438l-250 188l-63 -126l313 -250l439 501z" />
  127 + <glyph glyph-name="uniE61E" unicode="&#xe61e;"
  128 +d="M224 211l416 410l179 -179l-416 -410zM659 525l-19 19l-333 -333l19 -19zM698 486l-20 20l-332 -333l19 -19zM736 448l-19 19l-333 -333l19 -19zM717 704q14 14 38 14t39 -14l102 -102q6 -6 9.5 -14t4.5 -16.5t0 -17t-4.5 -16.5t-9.5 -13l-64 -58l-173 173zM211 186
  129 +l167 -167l-148 -51l-70 70zM205 -45l-83 -32l32 83z" />
  130 + <glyph glyph-name="uniE61F" unicode="&#xe61f;"
  131 +d="M512 812q-138 0 -256 -69t-187 -187t-69 -256t69 -256t187 -187t256 -69t256 69t187 187t69 256t-69 256t-187 187t-256 69zM563 44h-102v307h102v-307zM563 454h-102v102h102v-102z" />
  132 + <glyph glyph-name="uniE620" unicode="&#xe620;"
  133 +d="M938 276h-400v274h-50v-274h-399q-15 0 -29 5.5t-24 15.5t-16 24t-6 29v175q0 31 22 53t53 22h90q-18 21 -29 46t-11 54q0 27 10 47.5t25 30t29.5 15t24.5 6.5l11 1q53 0 100 -15.5t81 -42t56 -50t39 -50.5q17 27 39.5 51t56 50t79.5 41.5t98 15.5h4q2 0 8.5 -1.5
  134 +t13.5 -3t16 -5.5t16.5 -9t15.5 -13t13.5 -17.5t9 -23.5t3.5 -30q0 -28 -9.5 -52t-25.5 -45h85q31 0 53 -22t22 -53v-175q0 -44 -39 -65q-17 -9 -36 -9zM264 725q-15 0 -26 -2.5t-15.5 -6t-6.5 -7.5t-2 -6v-3q0 -49 66 -100h173q-14 30 -30 52.5t-34 35.5t-33 21t-34.5 11.5
  135 +t-30 4t-27.5 0.5zM763 723q-13 0 -20 -0.5t-21.5 -1.5t-24.5 -4.5t-24 -9t-25.5 -14.5t-24 -21.5t-24.5 -30.5t-22 -41h177q59 50 59 97v3q0 2 -2 6.5t-7 7.5t-15.5 6t-25.5 3zM488 -224h-349q-15 0 -29 6t-24 16t-16 24t-6 29v375h424v-450zM538 226h400v-375
  136 +q0 -31 -22 -53t-53 -22h-325v450z" />
  137 + <glyph glyph-name="uniE621" unicode="&#xe621;"
  138 +d="M160 492v-640q0 -26 19 -45t45 -19h576q26 0 45 19t19 45v640h-704zM352 -84h-64v448h64v-448zM480 -84h-64v448h64v-448zM608 -84h-64v448h64v-448zM736 -84h-64v448h64v-448zM880 684h-208v80q0 20 -14 34t-34 14h-224q-8 0 -15 -2.5t-13 -7t-10.5 -10.5t-7 -13
  139 +t-2.5 -15v-80h-208q-20 0 -34 -14t-14 -34v-80h832v80q0 6 -1.5 11t-3.5 10t-5.5 9t-7.5 7.5t-9 5.5t-10 3.5t-11 1.5zM608 684h-192v63h192v-63z" />
  140 + <glyph glyph-name="uniE622" unicode="&#xe622;" horiz-adv-x="1173"
  141 +d="M586 588q-64 150 -188 203q-114 47 -222 -7q-112 -56 -155 -192q-20 -67 -21 -144q0 -41 9 -78.5t24 -66.5t39 -57.5t47 -48.5t55.5 -43t56.5 -38t58.5 -35.5t53.5 -33.5q63 -42 118 -94.5t86.5 -95t39.5 -69.5q4 19 25.5 50t53.5 66t75 74t88 71q21 15 53.5 35.5t58 36
  142 +t57 38t55 43t47 48t39 56.5t25 66.5t8.5 78.5q0 75 -19.5 138t-52.5 105.5t-76.5 70.5t-91 37.5t-98 1t-96 -34.5t-85.5 -72.5t-67 -108.5z" />
120 </font> 143 </font>
121 </defs></svg> 144 </defs></svg>
No preview for this file type
No preview for this file type
1 var yohobuy; 1 var yohobuy;
2 2
  3 +require('./js/common');
  4 +
3 require('./js/passport/index'); 5 require('./js/passport/index');
4 require('./js/guang/index'); 6 require('./js/guang/index');
5 require('./js/home/index'); 7 require('./js/home/index');
  1 +/**
  2 + * 页面公共逻辑
  3 + * @author: xuqi<qi.xu@yoho.cn>
  4 + * @date: 2015/10/21
  5 + */
  6 +var $ = require('yoho.zepto');
  7 +
  8 +function cookie(name) {
  9 + var cookies = document.cookie,
  10 + cookieVal,
  11 + offset;
  12 +
  13 + if (document.cookie && document.cookie !== '') {
  14 + offset = cookies.indexOf(name + '=');
  15 + if (offset > -1) {
  16 + offset += name.length + 1;
  17 +
  18 + cookieVal = decodeURIComponent($.trim(cookies.substring(offset, cookies.indexOf(';', offset))));
  19 + }
  20 + }
  21 +
  22 + return cookieVal;
  23 +}
  24 +
  25 +function getUser() {
  26 + var c = cookie('_UID'),
  27 + user;
  28 +
  29 + if (typeof c === 'undefined') {
  30 + return 0;
  31 + }
  32 +
  33 + user = c.split('::');
  34 +
  35 + if (typeof user === 'undefined' || user.length < 4) {
  36 + return 0;
  37 + }
  38 +
  39 + return user;
  40 +}
  41 +
  42 +function getUid() {
  43 + var user = getUser();
  44 +
  45 + if (user === 0) {
  46 + return 0;
  47 + }
  48 +
  49 + return user[1];
  50 +}
  51 +
  52 +function getShoppingKey() {
  53 + var c = cookie('_g');
  54 +
  55 + if (typeof c === 'undefined') {
  56 + return '';
  57 + }
  58 +
  59 + return JSON.parse(c).k;
  60 +}
  61 +
  62 +//页面通用底部位置及status设置
  63 +(function() {
  64 + var $footer = $('#yoho-footer'),
  65 + $op = $footer.children('.op-row');
  66 +
  67 + var user = getUser();
  68 +
  69 + if ($('body').height() < $(window).height()) {
  70 + $footer.addClass('bottom');
  71 + }
  72 +
  73 + if (user === 0) {
  74 +
  75 + //未登录
  76 + $op.prepend(
  77 + '<a href="http://m.yohobuy.com/signin.html">登录</a>' +
  78 + '<span class="sep-line">|</span>' +
  79 + '<a href="http://m.yohobuy.com/reg.html">注册</a>'
  80 + );
  81 + } else {
  82 +
  83 + //已登录
  84 + $op.prepend(
  85 + 'Hi,' +
  86 + '<a class="user-name" href="http://m.yohobuy.com/home?tmp=' + Math.random() + '">' + user[0] + '</a>' +
  87 + '<a href="http://m.yohobuy.com/passport/signout/index?token=' + user[3] + '">退出</a>'
  88 + );
  89 + }
  90 +
  91 + $footer.removeClass('hide');
  92 +}());
  93 +
  94 +//暴露公共接口
  95 +window.cookie = cookie;
  96 +
  97 +window.getUser = getUser;
  98 +
  99 +window.getUid = getUid;
  100 +
  101 +window.getShoppingKey = getShoppingKey;
@@ -12,8 +12,6 @@ var $clear = $('#search-input > .clear-input'); @@ -12,8 +12,6 @@ var $clear = $('#search-input > .clear-input');
12 12
13 var $history = $('.history'); 13 var $history = $('.history');
14 14
15 -require('../plugin/pos-footer');  
16 -  
17 $('#clear-history').bind('touchstart', function() { 15 $('#clear-history').bind('touchstart', function() {
18 $.ajax({ 16 $.ajax({
19 type: 'POST', 17 type: 'POST',
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 7
8 var $ = require('yoho.zepto'); 8 var $ = require('yoho.zepto');
9 9
10 -var $filter = $('#yoho-filter'); 10 +var $filter = $('.filter-mask, .filter-body');
11 11
12 var $classify = $filter.find('.classify'), 12 var $classify = $filter.find('.classify'),
13 $subClassify = $filter.find('.sub-classify'); 13 $subClassify = $filter.find('.sub-classify');
@@ -29,9 +29,6 @@ function registerCbFn(cb) { @@ -29,9 +29,6 @@ function registerCbFn(cb) {
29 cbFn = cb; 29 cbFn = cb;
30 } 30 }
31 31
32 -//初始化sub高度与classify高度一致  
33 -$subClassify.height($classify.height());  
34 -  
35 //设置完高度后显示sub并设置选中 32 //设置完高度后显示sub并设置选中
36 $classify.children(':first-child').addClass('active'); //T:不在HTML中使用{{#if @first}}active{{/if}}来初始化active为避免sub设置高度时的闪烁 33 $classify.children(':first-child').addClass('active'); //T:不在HTML中使用{{#if @first}}active{{/if}}来初始化active为避免sub设置高度时的闪烁
37 34
@@ -49,7 +46,7 @@ $classify.delegate('.classify-item', 'touchstart', function() { @@ -49,7 +46,7 @@ $classify.delegate('.classify-item', 'touchstart', function() {
49 }); 46 });
50 47
51 //点击Mask隐藏筛选界面 48 //点击Mask隐藏筛选界面
52 -$filter.children('.filter-mask').click(function() { 49 +$filter.filter('.filter-mask').click(function() {
53 hideFilter(); 50 hideFilter();
54 }); 51 });
55 52
1 -/**  
2 - * 共用底部<解决某些页面过短导致底部悬空的问题>  
3 - * @author: xuqi<qi.xu@yoho.cn  
4 - * @date: 2015/10/19  
5 - */  
6 -var $ = require('yoho.zepto');  
7 -  
8 -var $footer = $('#yoho-footer');  
9 -  
10 -if ($('body').height() < $(window).height()) {  
11 - $footer.addClass('bottom');  
12 -}  
13 -  
14 -$footer.removeClass('hide');  
@@ -5,4 +5,5 @@ @@ -5,4 +5,5 @@
5 */ 5 */
6 6
7 require('./newsale/newarrival'); 7 require('./newsale/newarrival');
8 -require('./newsale/discount');  
  8 +require('./newsale/discount');
  9 +require('./list');
  1 +/**
  2 + * 商品列表页
  3 + * @author: xuqi<qi.xu@yoho.cn>
  4 + * @date: 2015/10/20
  5 + */
  6 +
  7 +var $ = require('yoho.zepto'),
  8 + lazyLoad = require('yoho.zeptolazyload');
  9 +
  10 +var filter = require('../plugin/filter');
  11 +
  12 +var $goodsContainer = $('#goods-container'),
  13 + $ngc = $goodsContainer.children('.new-goods'),
  14 + $pgc = $goodsContainer.children('.price-goods'),
  15 + $dgc = $goodsContainer.children('.discount-goods');
  16 +
  17 +var winH = $(window).height();
  18 +
  19 +//默认筛选条件
  20 +var defaultOpt = {
  21 + gender: $('#gender').val(),
  22 + brand: $('#brand').val(),
  23 + msort: $('#msort').val(),
  24 + color: $('#color').val(),
  25 + size: $('#size').val(),
  26 + price: $('#price').val(),
  27 + discount: $('#discount').val()
  28 +};
  29 +
  30 +var $listNav = $('#list-nav'),
  31 +
  32 + //导航数据信息
  33 + navInfo = {
  34 + newest: {
  35 + order: 1,
  36 + reload: true,
  37 + page: 0,
  38 + end: false
  39 + },
  40 + price: {
  41 + order: 0,
  42 + reload: true,
  43 + page: 0,
  44 + end: false
  45 + },
  46 + discount: {
  47 + order: 0,
  48 + reload: true,
  49 + page: 0,
  50 + end: false
  51 + }
  52 + },
  53 + $pre, //纪录进入筛选前的active项
  54 + searching;
  55 +
  56 +/**
  57 + * 筛选注册的回调,筛选子项点击后逻辑
  58 + * 需要执行search的场景:1.点选筛选项;2.relaod为true时切换导航;3.下拉加载
  59 + * @param opt {type, id}
  60 + */
  61 +function search(opt) {
  62 + var setting = {},
  63 + ext,
  64 + att,
  65 + nav, navType,
  66 + page;
  67 +
  68 + if (opt) {
  69 +
  70 + //筛选项变更则重置reload为true
  71 + for (att in navInfo) {
  72 + if (navInfo.hasOwnProperty(att)) {
  73 + navInfo[att].reload = true;
  74 + }
  75 + }
  76 +
  77 + switch (opt.type) {
  78 + case 'gender':
  79 + ext = {
  80 + gender: opt.id
  81 + };
  82 + break;
  83 + case 'brand':
  84 + ext = {
  85 + brand: opt.id
  86 + };
  87 + break;
  88 + case 'msort':
  89 + ext = {
  90 + msort: opt.id
  91 + };
  92 + break;
  93 + case 'color':
  94 + ext = {
  95 + color: opt.id
  96 + };
  97 + break;
  98 + case 'size':
  99 + ext = {
  100 + size: opt.id
  101 + };
  102 + break;
  103 + case 'price':
  104 + ext = {
  105 + price: opt.id
  106 + };
  107 + break;
  108 + case 'discount':
  109 + ext = {
  110 + discount: opt.id
  111 + };
  112 + break;
  113 + }
  114 +
  115 + $.extend(defaultOpt, ext); //扩展筛选项
  116 + }
  117 +
  118 + if (searching) {
  119 + return;
  120 + }
  121 +
  122 + //导航类别
  123 + if ($pre.hasClass('new')) {
  124 + navType = 'newest';
  125 + } else if ($pre.hasClass('price')) {
  126 + navType = 'price';
  127 + } else if ($pre.hasClass('discount')) {
  128 + navType = 'discount';
  129 + }
  130 +
  131 + nav = navInfo[navType];
  132 +
  133 + page = nav.page + 1;
  134 + if (nav.reload) {
  135 + page = 1;
  136 + } else if (nav.end) {
  137 +
  138 + //不需要重新加载并且数据请求结束
  139 + return;
  140 + }
  141 +
  142 + $.extend(setting, defaultOpt, {
  143 + type: navType,
  144 + order: nav.order,
  145 + page: page
  146 + });
  147 +
  148 + searching = true;
  149 +
  150 + $.ajax({
  151 + type: 'GET',
  152 + url: '/product/list/search',
  153 + data: setting,
  154 + success: function(data) {
  155 + var noResult = '<p class="no-result">未找到相关搜索结果</p>',
  156 + $container;
  157 +
  158 + switch (navType) {
  159 + case 'newest':
  160 + $container = $ngc;
  161 + break;
  162 + case 'price':
  163 + $container = $pgc;
  164 + break;
  165 + case 'discount':
  166 + $container = $dgc;
  167 + break;
  168 + }
  169 +
  170 + if (data.data === ' ') {
  171 + nav.end = true;
  172 +
  173 + if (nav.reload) {
  174 + $container.html(noResult);
  175 + }
  176 + } else {
  177 + if (nav.reload) {
  178 + $container.html(data.data);
  179 + } else {
  180 + $container.append(data.data);
  181 + }
  182 +
  183 + lazyLoad($container.find('.lazy'));
  184 + }
  185 +
  186 + nav.reload = true;
  187 + nav.page = page;
  188 +
  189 + searching = false;
  190 + }
  191 + });
  192 +
  193 +}
  194 +
  195 +lazyLoad($('.lazy'));
  196 +
  197 +filter.registerCbFn(search);
  198 +
  199 +//导航栏点击逻辑说明:
  200 +//1.点击非active项时切换active状态
  201 +//2.价格和折扣active状态时继续点击切换排序
  202 +//3.筛选无active时点击展开筛选面板
  203 +//4.筛选有active时点击隐藏筛选面板并恢复点击筛选前active项的active状态
  204 +//5.当前active为筛选并且点击其他项时,隐藏筛选面板
  205 +$listNav.delegate('li', 'touchstart', function() {
  206 + var $this = $(this),
  207 + navType,
  208 + $active;
  209 +
  210 + if ($this.hasClass('filter')) {
  211 +
  212 + //筛选面板切换状态
  213 + if ($this.hasClass('active')) {
  214 + filter.hideFilter();
  215 +
  216 + //点击筛选钱的active项回复active
  217 + $pre.addClass('active');
  218 + $this.removeClass('active');
  219 + } else {
  220 + $pre = $this.siblings('.active');
  221 +
  222 + $pre.removeClass('active');
  223 + $this.addClass('active');
  224 +
  225 + filter.showFilter();
  226 + }
  227 + } else {
  228 + if ($this.hasClass('active')) {
  229 +
  230 + //最新无排序切换
  231 + if ($this.hasClass('new')) {
  232 + return;
  233 + }
  234 +
  235 + if ($this.hasClass('price') || $this.hasClass('discount')) {
  236 +
  237 + // 价格/折扣切换排序状态
  238 + $this.find('.icon > .iconfont').toggleClass('cur');
  239 + }
  240 + } else {
  241 +
  242 + $active = $this.siblings('.active');
  243 + if ($active.hasClass('filter')) {
  244 + $pre = $this; //$pre为除筛选导航的其他导航项,若当前active的为筛选,则把$pre置为当前点击项
  245 +
  246 + //若之前active项为筛选,则隐藏筛选面板
  247 + filter.hideFilter();
  248 + } else {
  249 + $pre = $active;
  250 + }
  251 +
  252 + $active.removeClass('active');
  253 + $this.addClass('active');
  254 +
  255 + $pre = $active;
  256 + }
  257 +
  258 + if ($this.hasClass('new')) {
  259 + navType = 'newest';
  260 + } else if ($this.hasClass('price')) {
  261 + navType = 'price';
  262 + } else if ($this.hasClass('discount')) {
  263 + navType = 'discount';
  264 + }
  265 +
  266 + if (navInfo[navType].reload) {
  267 + search();
  268 + }
  269 + }
  270 +});
  271 +
  272 +$(window).scroll(function() {
  273 +
  274 + //当scroll到1/4$goodsContainer高度后继续请求下一页数据
  275 + if ($(window).scrollTop() + winH >
  276 + $(document).height() - 0.25 * $goodsContainer.height()) {
  277 + search();
  278 + }
  279 +});
  1 +/**
  2 + * 购物车商品
  3 + * @author: xuqi<qi.xu@yoho.cn>
  4 + * @date: 2015/10/20
  5 + */
  6 +
  7 +var $ = require('yoho.zepto'),
  8 + ellipsis = require('mlellipsis'),
  9 + lazyLoad = require('yoho.zeptolazyload');
  10 +
  11 +ellipsis.init();
  12 +
  13 +lazyLoad($('.lazy'));
  14 +
  15 +$('.name')[0].mlellipsis(2);
  16 +
  17 +//checkbox toggle status
  18 +$('.checkbox').bind('touchstart', function() {
  19 + var $this = $(this);
  20 +
  21 + if ($this.hasClass('icon-cb-checked')) {
  22 + $this.removeClass('icon-cb-checked').addClass('icon-checkbox');
  23 + } else {
  24 + $this.removeClass('icon-checkbox').addClass('icon-cb-checked');
  25 + }
  26 +});
  1 +/**
  2 + * 购物车Logic
  3 + * @author: xuqi<qi.xu@yoho.cn>
  4 + * @date: 2015/10/20
  5 + */
  6 +
  7 +var $ = require('yoho.zepto');
  8 +
  9 +require('./good');
  10 +
  11 +$('.cart-nav').delegate('li', 'touchstart', function() {
  12 + var $this = $(this);
  13 +
  14 + if ($this.hasClass('active')) {
  15 + return;
  16 + }
  17 +
  18 + $this.siblings('.active').removeClass('active');
  19 + $this.addClass('active');
  20 +});
@@ -11,17 +11,18 @@ @@ -11,17 +11,18 @@
11 } 11 }
12 12
13 .filter-body { 13 .filter-body {
14 - position: relative;  
15 background: #fff; 14 background: #fff;
16 color: #000; 15 color: #000;
17 cursor: pointer; 16 cursor: pointer;
18 font-size: 14px; 17 font-size: 14px;
  18 + height: 440px;
19 19
20 .classify { 20 .classify {
21 width: 50%; 21 width: 50%;
  22 + height: 100%;
  23 + background: #f8f8f8;
22 24
23 > li { 25 > li {
24 - background: #f8f8f8;  
25 height: 60px; 26 height: 60px;
26 line-height: 60px; 27 line-height: 60px;
27 28
@@ -56,6 +57,7 @@ @@ -56,6 +57,7 @@
56 position: absolute; 57 position: absolute;
57 display: none; 58 display: none;
58 width: 50%; 59 width: 50%;
  60 + height: 440px;
59 padding-left: 15px; 61 padding-left: 15px;
60 left: 50%; 62 left: 50%;
61 top: 0; 63 top: 0;
@@ -68,10 +70,6 @@ @@ -68,10 +70,6 @@
68 overflow: hidden; 70 overflow: hidden;
69 white-space: nowrap; 71 white-space: nowrap;
70 text-overflow: ellipsis; 72 text-overflow: ellipsis;
71 -  
72 - &:last-child {  
73 - border-bottom: none;  
74 - }  
75 } 73 }
76 74
77 .chosed-icon { 75 .chosed-icon {
@@ -92,4 +92,5 @@ a { @@ -92,4 +92,5 @@ a {
92 @include border-radius(10px); 92 @include border-radius(10px);
93 } 93 }
94 94
95 -@import "layout/header", "layout/footer", "good", "filter", "passport/index", "guang/index", "home/index", "category/index","category/brand", "product/index", "index/index";  
  95 +
  96 +@import "layout/header", "layout/footer", "good", "filter", "passport/index", "guang/index", "home/index", "category/index", "product/index", "index/index", "shopping-cart/index";
@@ -10,12 +10,18 @@ @@ -10,12 +10,18 @@
10 10
11 .user-name { 11 .user-name {
12 text-decoration: underline; 12 text-decoration: underline;
  13 + margin-left: .3em;
  14 + margin-right: 1em;
13 } 15 }
14 16
15 .back-to-top { 17 .back-to-top {
16 position: absolute; 18 position: absolute;
17 right: 20px; 19 right: 20px;
18 } 20 }
  21 +
  22 + .sep-line {
  23 + margin: 0 0.3em;
  24 + }
19 } 25 }
20 26
21 .copyright { 27 .copyright {
1 -@import "new-arrival", "discount";  
  1 +@import "new-arrival", "discount", "list";
  1 +.good-list-page {
  2 + .search-input {
  3 + position: relative;
  4 + padding: 7px 46px 7px 15px;
  5 + background: #f8f8f8;
  6 +
  7 + .search-icon {
  8 + position: absolute;
  9 + font-size: 12px;
  10 + top: 16px;
  11 + left: 24px;
  12 + }
  13 +
  14 + input {
  15 + height: 30px;
  16 + width: 100%;
  17 + border-radius: 15px;
  18 + text-indent: 26px;
  19 + background: #fff;
  20 + border: none;
  21 + }
  22 +
  23 + .clear-input {
  24 + position: absolute;
  25 + top: 12px;
  26 + right: 50px;
  27 + }
  28 +
  29 + .search {
  30 + position: absolute;
  31 + top: 12px;
  32 + right: 0;
  33 + border: none;
  34 + background: transparent;
  35 + font-size: 16px;
  36 + }
  37 + }
  38 +
  39 + .brand-way {
  40 + padding-bottom: 10px;
  41 + background: #f4f4f4;
  42 +
  43 + > a {
  44 + display: block;
  45 + height: 40px;
  46 + line-height: 40px;
  47 + padding: 0 10px;
  48 + border-bottom: 1px solid #e6e6e6;
  49 + border-top: 1px solid #e6e6e6;
  50 + font-size: 17px;
  51 + background: #fff;
  52 + }
  53 +
  54 + .brand-thumb {
  55 + display: block;
  56 + float: left;
  57 + width: 75px;
  58 + height: 40px;
  59 + margin: 0;
  60 + }
  61 +
  62 + .entry {
  63 + color: #999;
  64 + font-size: 14px;
  65 + float: right;
  66 + }
  67 + }
  68 +
  69 + .brand-header {
  70 + position: relative;
  71 + height: 150rem / $pxConvertRem;
  72 +
  73 + > img {
  74 + display: block;
  75 + height: 100%;
  76 + }
  77 + }
  78 +
  79 + .btn-intro, .btn-col {
  80 + position: absolute;
  81 + display: block;
  82 + width: 62px;
  83 + height: 24px;
  84 + line-height: 24px;
  85 + text-align: center;
  86 + border: 1px solid #fff;
  87 + color: #fff;
  88 +
  89 + top: 50%;
  90 + margin-top: -12px;
  91 + }
  92 +
  93 + .btn-intro {
  94 + right: 90px;
  95 + }
  96 +
  97 + .btn-col {
  98 + right: 15px;
  99 + }
  100 +
  101 + .brand-intro-box {
  102 + display: none;
  103 + }
  104 +
  105 + .list-nav {
  106 + > li {
  107 + float: left;
  108 + width: 25%;
  109 + height: 33px;
  110 + line-height: 33px;
  111 + text-align: center;
  112 + font-size: 14px;
  113 + }
  114 +
  115 + a {
  116 + display: block;
  117 + box-sizing: border-box;
  118 + width: 100%;
  119 + height: 100%;
  120 + color: #999;
  121 + }
  122 +
  123 + .active > a {
  124 + border-bottom: 2px solid #000;
  125 + color: #000;
  126 +
  127 + .iconfont {
  128 + color: #999;
  129 +
  130 + &.cur {
  131 + color: #000;
  132 + }
  133 + }
  134 + }
  135 +
  136 + .new .iconfont {
  137 + @include scale(0.8);
  138 + font-weight: bold;
  139 + }
  140 +
  141 + .filter .iconfont {
  142 + font-size: 12px;
  143 + @include transition(transform 0.1 ease-in);
  144 + }
  145 +
  146 + .filter.active .iconfont {
  147 + @include rotate(-180deg);
  148 + }
  149 +
  150 + .icon {
  151 + position: relative;
  152 +
  153 + i {
  154 + position: absolute;
  155 + @include scale(0.8);
  156 + font-weight: bold;
  157 + }
  158 +
  159 + .up {
  160 + top: -11px;
  161 + }
  162 +
  163 + .down {
  164 + top: -4px;
  165 + }
  166 + }
  167 + }
  168 +
  169 + .no-result {
  170 + text-align: center;
  171 + vertical-align: middle;
  172 + color: #ccc;
  173 + font-size: 1.2em;
  174 + margin-top: 220px;
  175 + }
  176 +
  177 + .goods-container {
  178 + position: relative;
  179 + min-height: 440px;
  180 + }
  181 +}
  1 +.shopping-cart-good {
  2 + position: relative;
  3 + padding-left: 16rem / $pxConvertRem;
  4 +
  5 + .checkbox {
  6 + position: absolute;
  7 + top: 50%;
  8 + margin-top: -14rem / $pxConvertRem;
  9 + font-size: 28rem / $pxConvertRem;
  10 + color: #f0f0f0;
  11 +
  12 + &.icon-cb-checked {
  13 + color: #000;
  14 + }
  15 + }
  16 +
  17 + .info {
  18 + float: left;
  19 + margin-left: 50rem / $pxConvertRem;
  20 + padding: 16rem / $pxConvertRem 0;
  21 + border-bottom: 1px solid #e0e0e0;
  22 + }
  23 +
  24 + .thumb {
  25 + float: left;
  26 + width: 120rem / $pxConvertRem;
  27 + height: 160rem / $pxConvertRem;
  28 + }
  29 +
  30 + .deps {
  31 + margin-left: 135rem / $pxConvertRem;
  32 + padding-right: 20rem / $pxConvertRem;
  33 + }
  34 +
  35 + .name {
  36 + font-size: 28rem / $pxConvertRem;
  37 + }
  38 +
  39 + .row:nth-child(2) {
  40 + font-size: 22rem / $pxConvertRem;
  41 + height: 45rem / $pxConvertRem;
  42 + line-height: 45rem / $pxConvertRem;
  43 +
  44 + > span {
  45 + margin-right: 15rem / $pxConvertRem;
  46 + }
  47 + }
  48 +
  49 + .row:nth-child(3) {
  50 + position: relative;
  51 + }
  52 +
  53 + .color, .size {
  54 + color: #b6b6b6;
  55 + }
  56 +
  57 + .appear-date {
  58 + color: #e01;
  59 + }
  60 +
  61 + .price {
  62 + font-size: 24rem / $pxConvertRem;
  63 + color: #000;
  64 + }
  65 +
  66 + .count {
  67 + font-size: 20rem / $pxConvertRem;
  68 + color: #999;
  69 + margin-left: 22rem / $pxConvertRem;
  70 + }
  71 +
  72 + .sold-out, .low-stocks {
  73 + display: inline-block;
  74 + width: 100rem / $pxConvertRem;
  75 + height: 30rem / $pxConvertRem;
  76 + line-height: 30rem / $pxConvertRem;
  77 + font-size: 22rem / $pxConvertRem;
  78 + border: none;
  79 + color: #fff;
  80 + text-align: center;
  81 + margin-left: 16rem / $pxConvertRem;
  82 + }
  83 +
  84 + .sold-out {
  85 + background: #999;
  86 + }
  87 +
  88 + .low-stocks {
  89 + background: #e01;
  90 + }
  91 +
  92 + .icon-del,
  93 + .icon-edit {
  94 + position: absolute;
  95 + color: #ccc;
  96 + font-size: 30rem / $pxConvertRem;
  97 + }
  98 +
  99 + .icon-del {
  100 + right: 14rem / $pxConvertRem;
  101 + }
  102 +
  103 + .icon-edit {
  104 + right: 72rem / $pxConvertRem;
  105 + }
  106 +
  107 + .opt-panel {
  108 + display: none;
  109 +
  110 + width: 220rem / $pxConvertRem;
  111 + height: 190rem / $pxConvertRem;
  112 +
  113 + color: #fff;
  114 +
  115 + .put-in-favorite {
  116 + background: #bbb;
  117 + }
  118 +
  119 + .del {
  120 + background: #999;
  121 + }
  122 + }
  123 +}
  1 +@import "good";
  2 +
  3 +
  4 +.icon-checkbox:before { content: "\e61c"; }
  5 +.icon-cb-checked:before { content: "\e61d"; }
  6 +
  7 +.cart-nav {
  8 + height: 30rem / $pxConvertRem;
  9 + color: #c6c6c6;
  10 + border-bottom: 1px solid #e0e0e0;
  11 + padding: 30rem / $pxConvertRem 0;
  12 +
  13 + li {
  14 + float: left;
  15 + width: 50%;
  16 + }
  17 +
  18 + li.active {
  19 + color: #000;
  20 + }
  21 +
  22 + span {
  23 + display: block;
  24 + box-sizing: border-box;
  25 + width: 100%;
  26 + height: 30rem / $pxConvertRem;
  27 + line-height: 30rem / $pxConvertRem;
  28 + font-size: 30rem / $pxConvertRem;
  29 + text-align: center;
  30 + }
  31 +
  32 + li:first-child span {
  33 + border-right: 1px solid #e0e0e0;
  34 + }
  35 +}
  36 +
  37 +.cart-goods {
  38 + border-bottom: 1px solid #e0e0e0;
  39 +
  40 + .shopping-cart-good:last-child .info {
  41 + border-bottom: none;
  42 + }
  43 +}
  44 +
  45 +.freebie-and-advance-buy {
  46 + padding: 20rem / $pxConvertRem;
  47 + font-size: 24rem / $pxConvertRem;
  48 + border-bottom: 1px solid #e0e0e0;
  49 +
  50 + > li {
  51 + box-sizing: border-box;
  52 + height: 90rem / $pxConvertRem;
  53 + line-height: 90rem / $pxConvertRem;
  54 + margin-bottom: 10rem / $pxConvertRem;
  55 + background: #f8f8f8;
  56 + padding: 0 20rem / $pxConvertRem;
  57 +
  58 + &:last-child {
  59 + margin-bottom: 0;
  60 + }
  61 +
  62 + a {
  63 + float: right;
  64 + }
  65 + }
  66 +
  67 + .count {
  68 + color: #f00;
  69 + }
  70 +
  71 + .icon-right-arrow {
  72 + color: #8f8f8f;
  73 + }
  74 +}
  75 +
  76 +.price-compute {
  77 + padding: 20rem / $pxConvertRem;
  78 + border-bottom: 1px solid #e0e0e0;
  79 + font-size: 26rem / $pxConvertRem;
  80 +
  81 + .title {
  82 + display: inline-block;
  83 + width: 175rem / $pxConvertRem;
  84 + }
  85 +
  86 + .minus {
  87 + float: right;
  88 + }
  89 +}
  90 +
  91 +.balance {
  92 + position: fixed;
  93 + box-sizing: border-box;
  94 + bottom: 0;
  95 + width: 100%;
  96 + padding: 20rem / $pxConvertRem;
  97 + height: 120rem / $pxConvertRem;
  98 + border-top: 1px solid #e0e0e0;
  99 +
  100 + .iconfont {
  101 + position: absolute;
  102 + top: 50%;
  103 + margin-top: -14rem / $pxConvertRem;
  104 + font-size: 28rem / $pxConvertRem;
  105 + }
  106 +
  107 + p {
  108 + float: left;
  109 + margin-left: 50rem / $pxConvertRem;
  110 + font-size: 26rem / $pxConvertRem;
  111 +
  112 + span {
  113 + display: block;
  114 + height: 40rem / $pxConvertRem;
  115 + line-height: 40rem / $pxConvertRem;
  116 + }
  117 +
  118 + .tip {
  119 + color: #666;
  120 + font-size: 22rem / $pxConvertRem;
  121 + }
  122 + }
  123 +
  124 + .btn-balance {
  125 + float: right;
  126 + width: 140rem / $pxConvertRem;
  127 + height: 80rem / $pxConvertRem;
  128 + line-height: 80rem / $pxConvertRem;
  129 + text-align: center;
  130 + background: #e01;
  131 + color: #fff;
  132 + border: none;
  133 + font-size: 28rem / $pxConvertRem;
  134 + }
  135 +}
  1 +{{> layout/header}}
  2 +<div class="shopping-cart-page yoho-page">
  3 + {{# shoppingCart}}
  4 + {{#if cartNav}}
  5 + <ul class="cart-nav">
  6 + <li class="active">
  7 + <span>
  8 + 普通商品({{commonGoodsCount}})
  9 + </span>
  10 + </li>
  11 + <li>
  12 + <span>
  13 + 预售商品({{presellGoodsCount}})
  14 + </span>
  15 + </li>
  16 + </ul>
  17 + {{/if}}
  18 +
  19 + <div class="cart-goods">
  20 + {{# goods}}
  21 + {{> shopping-cart/good}}
  22 + {{/ goods}}
  23 + </div>
  24 +
  25 + {{#if freebieOrAdvanceBuy}}
  26 + <ul class="freebie-and-advance-buy">
  27 + {{# freebie}}
  28 + <li class="freebie">
  29 + <span class="iconfont">&#xe620;</span>
  30 + 赠品
  31 + <a href={{url}}>
  32 + <span class="count">{{count}}</span>
  33 + <span class="iconfont icon-right-arrow">&#xe614;</span>
  34 + </a>
  35 + </li>
  36 + {{/ freebie}}
  37 + {{# advanceBuy}}
  38 + <li class="advance-buy">
  39 + <span class="iconfont">&#xe61b;</span>
  40 + 加价购
  41 + <a href={{url}}>
  42 + <span class="count">{{count}}</span>
  43 + <span class="iconfont icon-right-arrow">&#xe614;</span>
  44 + </a>
  45 + </li>
  46 + {{/ advanceBuy}}
  47 + </ul>
  48 + {{/if}}
  49 +
  50 + <div class="price-compute">
  51 + <p class="sum-price">
  52 + <span class="title">总价</span>
  53 + {{price}}
  54 + </p>
  55 + <p class="activity-price">
  56 + <span class="title">
  57 + 活动价
  58 + <i class="minus">-</i>
  59 + </span>
  60 + {{activityPrice}}
  61 + </p>
  62 + </div>
  63 +
  64 + <div class="balance">
  65 + <span class="iconfont icon-cb-checked"></span>
  66 + <p>
  67 + <span>
  68 + {{count}}件总计:¥{{sumPrice}}
  69 + </span>
  70 + <span class="tip">(不含运费)</span>
  71 + </p>
  72 + <button class="btn-balance">
  73 + 结算
  74 + </button>
  75 + </div>
  76 + {{/ shoppingCart}}
  77 +</div>
  78 +{{> layout/footer}}
  1 +{{> layout/header}}
  2 +<div class="good-list-page yoho-page">
  3 + {{# goodList}}
  4 + {{# search}}
  5 + <div id="search-input" class="search-input">
  6 + <i class="search-icon iconfont">&#xe60f;</i>
  7 + <input type="text" value={{default}}>
  8 + <i class="clear-input iconfont hide">&#xe61a;</i>
  9 + <button id="search" class="search">搜索</button>
  10 + </div>
  11 + {{/ search}}
  12 +
  13 + {{# brandWay}}
  14 + <div class="brand-way">
  15 + <a href={{url}}>
  16 + <img class="brand-thumb" src={{thumb}}>
  17 + <span>{{name}}</span>
  18 + <span class="entry">
  19 + 进入品牌
  20 + <i class="iconfont">&#xe614;</i>
  21 + </span>
  22 + </a>
  23 + </div>
  24 + {{/ brandWay}}
  25 +
  26 + {{# brand}}
  27 + <div class="brand-header" data-id={{id}}>
  28 + <img class="lazy" data-original={{banner}}>
  29 + <a class="btn-intro" href="javascript:void(0);">
  30 + 品牌介绍
  31 + </a>
  32 + <a class="btn-col" href="javascript:void(0);">
  33 + <span class="iconfont">&#xe622;</span>
  34 + 收藏
  35 + </a>
  36 + </div>
  37 + <div class="brand-intro-box">
  38 + <div id="brand-intro" class="brand-intro">{{intro}}</div>
  39 + </div>
  40 + {{/ brand}}
  41 +
  42 + <ul id="list-nav" class="list-nav clearfix">
  43 + <li class="new active">
  44 + <a href="javascript:void(0);">
  45 + 最新
  46 + <span class="iconfont cur">&#xe616;</span>
  47 + </a>
  48 + </li>
  49 + <li class="price">
  50 + <a href="javascript:void(0);">
  51 + 价格
  52 + <span class="icon">
  53 + <i class="iconfont up">&#xe615;</i>
  54 + <i class="iconfont down cur">&#xe616;</i>
  55 + </span>
  56 + </a>
  57 + </li>
  58 + <li class="discount">
  59 + <a href="javascript:void(0);">
  60 + 折扣
  61 + <span class="icon">
  62 + <i class="iconfont up">&#xe615;</i>
  63 + <i class="iconfont down cur">&#xe616;</i>
  64 + </span>
  65 + </a>
  66 + </li>
  67 + <li class="filter">
  68 + <a href="javascript:void(0);">
  69 + 筛选
  70 + <span class="iconfont">&#xe613;</span>
  71 + </a>
  72 + </li>
  73 + </ul>
  74 + <div id="goods-container" class="goods-container">
  75 + <div class="new-goods">
  76 + {{# new}}
  77 + {{> good}}
  78 + {{/ new}}
  79 + </div>
  80 + <div class="price-goods hide"></div>
  81 + <div class="discount-goods hide"></div>
  82 +
  83 + {{> filter}}
  84 + </div>
  85 +
  86 + {{/ goodList}}
  87 +</div>
  88 +{{> layout/footer}}
1 {{# filter}} 1 {{# filter}}
2 - <div id="yoho-filter">  
3 - <div class="filter-mask"></div>  
4 - <div class="filter-body">  
5 - <ul class="classify">  
6 - {{#each classify}}  
7 - <li class="classify-item">  
8 - <p class="shower{{#if default}} default{{/if}}">  
9 - <span class="title">{{title}}:</span>  
10 - {{name}}  
11 - </p>  
12 - <ul class="sub-classify" data-type={{dataType}}>  
13 - {{# subs}}  
14 - <li {{#if chosed}}class=chosed{{/if}} data-id={{dataId}}>  
15 - {{name}}  
16 - <i class="iconfont chosed-icon">&#xe617;</i>  
17 - </li>  
18 - {{/ subs}}  
19 - </ul>  
20 - </li>  
21 - {{/each}}  
22 - </ul>  
23 - </div> 2 + <div class="filter-mask hide"></div>
  3 + <div class="filter-body hide">
  4 + <ul class="classify">
  5 + {{#each classify}}
  6 + <li class="classify-item">
  7 + <p class="shower{{#if default}} default{{/if}}">
  8 + <span class="title">{{title}}:</span>
  9 + {{name}}
  10 + </p>
  11 + <ul class="sub-classify" data-type={{dataType}}>
  12 + {{# subs}}
  13 + <li {{#if chosed}}class=chosed{{/if}} data-id={{dataId}}>
  14 + {{name}}
  15 + <i class="iconfont chosed-icon">&#xe617;</i>
  16 + </li>
  17 + {{/ subs}}
  18 + </ul>
  19 + </li>
  20 + {{/each}}
  21 + </ul>
24 </div> 22 </div>
25 {{/ filter}} 23 {{/ filter}}
1 {{#pageFooter}} 1 {{#pageFooter}}
2 <footer id="yoho-footer" class="yoho-footer hide"> 2 <footer id="yoho-footer" class="yoho-footer hide">
3 <p class="op-row"> 3 <p class="op-row">
4 - {{# user}}  
5 - Hi,  
6 - <a class="user-name" href="{{url}}">{{name}}</a>  
7 - <a href="{{signoutUrl}}">退出</a>  
8 - {{^}}  
9 - <a href="{{loginUrl}}">登录</a>  
10 - <span class="sep-line">|</span>  
11 - <a href="{{signupUrl}}">注册</a>  
12 - {{/ user}}  
13 <span class="back-to-top"> 4 <span class="back-to-top">
14 Back to top 5 Back to top
15 <i class="iconfont">&#xe608;</i> 6 <i class="iconfont">&#xe608;</i>
  1 +<script>
  2 + seajs.use('js/common');
  3 +</script>
1 4
2 {{!-- 逛(PLUS+STAR) --}} 5 {{!-- 逛(PLUS+STAR) --}}
3 {{#if psList}} 6 {{#if psList}}
@@ -117,6 +120,13 @@ @@ -117,6 +120,13 @@
117 </script> 120 </script>
118 {{/if}} 121 {{/if}}
119 122
  123 +{{!-- 商品列表 --}}
  124 +{{#if goodListPage}}
  125 + <script>
  126 + seajs.use('js/product/list');
  127 + </script>
  128 +{{/if}}
  129 +
120 {{!-- 品类 --}} 130 {{!-- 品类 --}}
121 {{#if categoryPage}} 131 {{#if categoryPage}}
122 <script> 132 <script>
@@ -135,4 +145,11 @@ @@ -135,4 +145,11 @@
135 <script> 145 <script>
136 seajs.use('js/index/search'); 146 seajs.use('js/index/search');
137 </script> 147 </script>
  148 +{{/if}}
  149 +
  150 +{{!-- 购物车 --}}
  151 +{{#if shoppingCartPage}}
  152 + <script>
  153 + seajs.use('js/shopping-cart/index');
  154 + </script>
138 {{/if}} 155 {{/if}}
  1 +<div class="shopping-cart-good clearfix">
  2 + <span class="checkbox icon-cb-checked iconfont"></span>
  3 + <div class="info">
  4 + <img class="thumb lazy" data-original={{thumb}}>
  5 + <div class="deps">
  6 + <p class="name row">{{name}}</p>
  7 + <p class="row">
  8 + {{#if color}}
  9 + <span class="color">
  10 + 颜色:{{color}}
  11 + </span>
  12 + {{/if}}
  13 +
  14 + {{#if size}}
  15 + <span class="size">
  16 + 尺码:{{size}}
  17 + </span>
  18 + {{/if}}
  19 +
  20 + {{#if appearDate}}
  21 + <span class="appear-date">
  22 + 上市期:{{appearDate}}
  23 + </span>
  24 + {{/if}}
  25 + </p>
  26 + <p class="row">
  27 + <span class="price">
  28 + ¥{{price}}
  29 + </span>
  30 + <span class="count">
  31 + ×{{count}}
  32 + </span>
  33 + {{#if soldOut}}
  34 + <span class="sold-out">
  35 + 已售罄
  36 + </span>
  37 + {{/if}}
  38 +
  39 + {{#if lowStocks}}
  40 + <span class="low-stocks">
  41 + 库存不足
  42 + </span>
  43 + {{/if}}
  44 +
  45 + <span class="iconfont icon-edit">&#xe61e;</span>
  46 + <span class="iconfont icon-del">&#xe621;</span>
  47 + </p>
  48 + </div>
  49 + </div>
  50 + <div class="opt-panel">
  51 + <div class="put-in-favorite">
  52 + <span class="iconfont">&#xe622;</span>
  53 + 移入收藏夹
  54 + </div>
  55 + <div class="del">
  56 + <span class="iconfont">&#xe61a;</span>
  57 + 删除
  58 + </div>
  59 + </div>
  60 +</div>
  1 +<?php
  2 +
  3 +use Action\AbstractAction;
  4 +
  5 +/**
  6 + * 购物车
  7 + */
  8 +class ShoppingCartController extends AbstractAction
  9 +{
  10 + public function indexAction()
  11 + {
  12 + $data = array(
  13 + 'cartNav' => true,
  14 + 'commonGoodsCount' => 2,
  15 + 'presellGoodsCount' => 2,
  16 + 'goods' => array(
  17 + array(
  18 + 'name' => '黄伟文Wyman X y yohood 联名商品YYYOHOOD圆领卫衣',
  19 + 'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/09/17/03/014cacfa5c458b9732c68adf1af15d7a45.jpg?imageMogr2/thumbnail/120x120/extent/120x120/background/d2hpdGU=/position/center/quality/90',
  20 + 'color' => '黄色',
  21 + 'size' => 'F',
  22 + 'appearDate' => '12月',
  23 + 'price' => 399.00,
  24 + 'count' => 8,
  25 + 'lowStocks' => true
  26 + ),
  27 + array(
  28 + 'name' => 'TYAKSHA圣诞树凭借三角领蓝色白条毛衣',
  29 + 'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/10/03/10/01bc1878f9154e77ac4f7a6003c954f1b8.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
  30 + 'color' => '黄色',
  31 + 'size' => 'F',
  32 + 'price' => 553.00,
  33 + 'count' => 1,
  34 + 'soldOut' => true
  35 + )
  36 + ),
  37 + 'freebieOrAdvanceBuy' => true,
  38 + 'freebie' => array(
  39 + 'url' => '',
  40 + 'count' => 2
  41 + ),
  42 + 'advanceBuy' => array(
  43 + 'url' => '',
  44 + 'count' => 3
  45 + ),
  46 + 'price' => 3192,
  47 + 'activityPrice' => 0,
  48 + 'count' => 8,
  49 + 'sumPrice' => 3192
  50 + );
  51 + // 渲染模板
  52 + $this->_view->display('index', array('shoppingCartPage' => true, 'pageHeader' => array(
  53 + 'navBack' => 'http://m.yohobuy.com', 'navTitle' => '购物车'), 'shoppingCart' => $data));
  54 + }
  55 +}
1 <?php 1 <?php
2 2
3 -/*  
4 - * To change this license header, choose License Headers in Project Properties.  
5 - * To change this template file, choose Tools | Templates  
6 - * and open the template in the editor. 3 +use Action\AbstractAction;
  4 +
  5 +/**
  6 + * 商品列表页
7 */ 7 */
8 8
  9 +class ListController extends AbstractAction
  10 +{
  11 + public function indexAction()
  12 + {
  13 + $data = array(
  14 + 'goodListPage' => true,
  15 + 'goodList' => array(
  16 + 'search' => 'Aape',
  17 + 'brandWay' => array(
  18 + 'url' => 'http://aape.m.yohobuy.com/',
  19 + 'name' => 'Aape',
  20 + 'thumb' => 'http://img13.static.yhbimg.com/brandLogo/2015/08/26/15/02261f64c198cb4b181c5ef9e61f38f4b9.jpg?imageMogr2/thumbnail/150x70/extent/150x70/background/d2hpdGU=/position/center/quality/90'
  21 + ),
  22 + 'new' => array(
  23 + array(
  24 + 'id' => 1,
  25 + 'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/09/15/03/02e50b1037b45b90aa8f33ee328b18facf.jpg?imageMogr2/thumbnail/290x388/extent/290x388/background/d2hpdGU=/position/center/quality/90',
  26 + 'url' => '',
  27 + 'name' => 'Aape X YO’HOOD moon face YOH',
  28 + 'salePrice' => 599,
  29 + 'tags' => array(
  30 + 'is_new' => true,
  31 + 'is_discount' => true
  32 + ),
  33 + 'is_soon_sold_out' => true
  34 + ),
  35 + array(
  36 + 'id' => 2,
  37 + 'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/09/15/03/0101b0c3998752d02724a5512c6efcb241.jpg?imageMogr2/thumbnail/290x388/extent/290x388/background/d2hpdGU=/position/center/quality/90',
  38 + 'url' => '',
  39 + 'name' => 'Aape X YO’HOOD moon face YOH',
  40 + 'salePrice' => 99,
  41 + 'tags' => array(
  42 + 'is_yohoood' => true
  43 + ),
  44 + 'is_soon_sold_out' => true
  45 + )
  46 + ),
  47 + 'filter' => array(
  48 + array(
  49 + 'classify' => array(
  50 + array(
  51 + 'title' => '性别',
  52 + 'name' => '全部性别',
  53 + 'default' => true,
  54 + 'subs' => array(
  55 + array(
  56 + 'chosed' => true,
  57 + 'dataId' => 0,
  58 + 'name' => '全部性别'
  59 + ),
  60 + array(
  61 + 'dataId' => 1,
  62 + 'name' => '男'
  63 + ),
  64 + array(
  65 + 'dataId' => 3,
  66 + 'name' => '女'
  67 + )
  68 + )
  69 + ),
  70 + array(
  71 + 'title' => '尺寸',
  72 + 'name' => 'XL',
  73 + 'subs' => array(
  74 + array(
  75 + 'dataId' => 0,
  76 + 'name' => '全部尺寸'
  77 + ),
  78 + array(
  79 + 'dataId' => 1,
  80 + 'name' => 'S'
  81 + ),
  82 + array(
  83 + 'dataId' => 2,
  84 + 'name' => 'M'
  85 + ),
  86 + array(
  87 + 'dataId' => 3,
  88 + 'name' => 'L'
  89 + ),
  90 + array(
  91 + 'chosed' => true,
  92 + 'dataId' => 4,
  93 + 'name' => 'XL'
  94 + ),
  95 + array(
  96 + 'dataId' => 5,
  97 + 'name' => 'XXL'
  98 + )
  99 + )
  100 + )
  101 + )
  102 + )
  103 + )
  104 + )
  105 + );
  106 +
  107 + $this->_view->display('index', $data);
  108 + }
  109 +}