Authored by Rock Zhang

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

@@ -943,7 +943,8 @@ @@ -943,7 +943,8 @@
943 { 943 {
944 name: '', 944 name: '',
945 active: true, 945 active: true,
946 - typeId: 1 946 + typeId: 1,
  947 + url: ''
947 }, 948 },
948 ... 949 ...
949 ] 950 ]
@@ -18,17 +18,18 @@ class Yohobuy @@ -18,17 +18,18 @@ class Yohobuy
18 { 18 {
19 19
20 // /* 正式环境 */ 20 // /* 正式环境 */
21 -// const API_URL = 'http://api2.open.yohobuy.com/';  
22 -// const API_URL2 = 'http://api.open.yohobuy.com/';  
23 -// const SERVICE_URL = 'http://service.api.yohobuy.com/';  
24 -// const YOHOBUY_URL = 'http://www.yohobuy.com/'; 21 + const API_URL = 'http://api2.open.yohobuy.com/';
  22 + const API_URL2 = 'http://api.open.yohobuy.com/';
  23 + const SERVICE_URL = 'http://service.api.yohobuy.com/';
  24 + const YOHOBUY_URL = 'http://www.yohobuy.com/';
25 25
26 /* 测试环境 */ 26 /* 测试环境 */
27 - const API_URL = 'http://test2.open.yohobuy.com/';  
28 - const SERVICE_URL = 'http://test.service.api.yohobuy.com/';  
29 - const YOHOBUY_URL = 'http://www.yohobuy.com/';  
30 - const API_URL_MYCENTER = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的个人中心接口URL  
31 - const API_URL_SHOPINGCART = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的购物车接口URL 27 + // const API_URL = 'http://test2.open.yohobuy.com/';
  28 + // const SERVICE_URL = 'http://test.service.api.yohobuy.com/';
  29 + // const YOHOBUY_URL = 'http://www.yohobuy.com/';
  30 + // const API_URL_MYCENTER = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的个人中心接口URL
  31 + // const API_URL_SHOPINGCART = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的购物车接口URL
  32 +
32 33
33 /** 34 /**
34 * 私钥列表 35 * 私钥列表
@@ -27,7 +27,9 @@ function editAddress(data) { @@ -27,7 +27,9 @@ function editAddress(data) {
27 $addressForm.find('[name="area"]').val(data.area || ''); 27 $addressForm.find('[name="area"]').val(data.area || '');
28 $addressForm.find('[name="address"]').val(data.address || ''); 28 $addressForm.find('[name="address"]').val(data.address || '');
29 $editAddressPage.show(); 29 $editAddressPage.show();
30 - $addressForm.find('[name="consignee"]').focus(); 30 +
  31 + // $addressForm.find('[name="address"]').blur();
  32 + // $addressForm.find('[name="consignee"]').focus();
31 } 33 }
32 34
33 function deleteAddress(data) { 35 function deleteAddress(data) {
  1 +/**
  2 + * 我的逛
  3 + * @author xuqi<qi.xu@yoho.cn>
  4 + * @date: 2015/11/17
  5 + */
  6 +
  7 +var $ = require('jquery');
  8 +
  9 +var info = require('../guang/info');
  10 +
  11 +info.initInfoEvt($('#info-list'));
@@ -17,27 +17,32 @@ var winH = $(window).height(); @@ -17,27 +17,32 @@ var winH = $(window).height();
17 17
18 var activeType = $navLi.filter('.active').data('type'); //当前active的项的index 18 var activeType = $navLi.filter('.active').data('type'); //当前active的项的index
19 19
20 -var orderPage = {}; 20 +var order = {
  21 + page: 0,
  22 + end: false
  23 +};
21 24
22 var inAjax = false; 25 var inAjax = false;
23 26
24 var loading = require('../plugin/loading'); 27 var loading = require('../plugin/loading');
25 28
26 -var navHammer, orderHammer; 29 +var orderHammer;
27 30
28 //加载订单 31 //加载订单
29 -function getOrders() { 32 +function getOrders(option) {
30 var opt = { 33 var opt = {
31 type: activeType, 34 type: activeType,
32 - page: orderPage[activeType] ? (orderPage[activeType] + 1) : 1 35 + page: order.page + 1
33 }; 36 };
34 37
  38 + var show = option && option.showLoadingMask;
  39 +
35 if (inAjax) { 40 if (inAjax) {
36 return; 41 return;
37 } 42 }
38 43
39 inAjax = true; 44 inAjax = true;
40 - loading.showLoadingMask(); 45 + show && loading.showLoadingMask();
41 46
42 $.ajax({ 47 $.ajax({
43 type: 'GET', 48 type: 'GET',
@@ -46,23 +51,27 @@ function getOrders() { @@ -46,23 +51,27 @@ function getOrders() {
46 success: function(data) { 51 success: function(data) {
47 var num; 52 var num;
48 53
49 - if (data.code === 200) {  
50 - orderPage[opt.type] = opt.page; 54 + if (data !== ' ') {
  55 + order.page = opt.page;
51 56
52 if (opt.page === 1) { 57 if (opt.page === 1) {
53 - $curContainer.html(data.data); 58 + $curContainer.html(data);
54 lazyLoad($curContainer.find('.lazy')); 59 lazyLoad($curContainer.find('.lazy'));
55 } else { 60 } else {
56 num = $curContainer.children('.order').length; 61 num = $curContainer.children('.order').length;
57 - $curContainer.append(data.data); 62 + $curContainer.append(data);
58 63
59 //lazyload 64 //lazyload
60 - lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ') .lazy')); 65 + lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ')').find('.lazy'));
61 } 66 }
  67 +
  68 + window.rePosFooter(); //重新计算底部位置
  69 + } else {
  70 + order.end = true;
62 } 71 }
63 72
64 inAjax = false; 73 inAjax = false;
65 - loading.hideLoadingMask(); 74 + show && loading.hideLoadingMask();
66 } 75 }
67 }); 76 });
68 } 77 }
@@ -83,33 +92,6 @@ lazyLoad(); @@ -83,33 +92,6 @@ lazyLoad();
83 92
84 loading.init($('body')); //满屏loading 93 loading.init($('body')); //满屏loading
85 94
86 -//导航切换  
87 -navHammer = new Hammer(document.getElementById('order-nav'));  
88 -navHammer.on('tap', function(e) {  
89 - var $cur = $(e.target).closest('li'),  
90 - index;  
91 -  
92 - if ($cur.length === 0 || $cur.hasClass('active')) {  
93 - return;  
94 - }  
95 -  
96 - index = $cur.index();  
97 -  
98 - $navLi.filter('.active').removeClass('active');  
99 - $cur.addClass('active');  
100 -  
101 - $curContainer.addClass('hide');  
102 - $curContainer = $orderContainer.children(':eq(' + index + ')').removeClass('hide');  
103 -  
104 - activeType = $cur.data('type');  
105 -  
106 - if (orderPage[activeType]) {  
107 - return;  
108 - } else {  
109 - getOrders();  
110 - }  
111 -});  
112 -  
113 //点击订单区域跳转订单详情页 95 //点击订单区域跳转订单详情页
114 orderHammer = new Hammer(document.getElementById('order-container')); 96 orderHammer = new Hammer(document.getElementById('order-container'));
115 orderHammer.on('tap', function(e) { 97 orderHammer.on('tap', function(e) {
@@ -168,9 +150,13 @@ orderHammer.on('tap', function(e) { @@ -168,9 +150,13 @@ orderHammer.on('tap', function(e) {
168 }); 150 });
169 151
170 $(window).scroll(function() { 152 $(window).scroll(function() {
171 - if ($(window).scrollTop() + winH > 153 + if (order.end === false && $(window).scrollTop() + winH >
172 $(document).height() - 0.25 * $orderContainer.height()) { 154 $(document).height() - 0.25 * $orderContainer.height()) {
173 - getOrders(); 155 +
  156 + //下拉请求时不显示mask
  157 + getOrders({
  158 + noLoadingMask: true
  159 + });
174 } 160 }
175 }); 161 });
176 162
@@ -11,7 +11,8 @@ var page = 1, @@ -11,7 +11,8 @@ var page = 1,
11 navSwiper, 11 navSwiper,
12 notab = 0, 12 notab = 0,
13 sort = '', 13 sort = '',
14 - id = ''; 14 + id = '',
  15 + noResult = '<p class="no-result">未找到相关搜索结果</p>';
15 16
16 function hotrank(page, sort, tabId, notab) { 17 function hotrank(page, sort, tabId, notab) {
17 loading.showLoadingMask(); 18 loading.showLoadingMask();
@@ -28,7 +29,11 @@ function hotrank(page, sort, tabId, notab) { @@ -28,7 +29,11 @@ function hotrank(page, sort, tabId, notab) {
28 if (page === 1) { 29 if (page === 1) {
29 $('.rank-main').remove(); 30 $('.rank-main').remove();
30 } 31 }
  32 + if (data === ' ') {
  33 + $('#hotRank').html(noResult);
  34 + } else {
31 $('#hotRank').append(data); 35 $('#hotRank').append(data);
  36 + }
32 lazyLoad($('img.lazy')); 37 lazyLoad($('img.lazy'));
33 $('.rank-main ul li:gt(2)').find('.item-content i').removeClass('top'); 38 $('.rank-main ul li:gt(2)').find('.item-content i').removeClass('top');
34 winH = $(window).height(); 39 winH = $(window).height();
@@ -142,8 +142,8 @@ @@ -142,8 +142,8 @@
142 input, textarea { 142 input, textarea {
143 position: absolute; 143 position: absolute;
144 top: 0; 144 top: 0;
145 - right: 0;  
146 - width: pxToRem(400px); 145 + right: pxToRem(40px);
  146 + width: pxToRem(360px);
147 height: pxToRem(88px); 147 height: pxToRem(88px);
148 color: #444; 148 color: #444;
149 padding: 0; 149 padding: 0;
@@ -156,6 +156,8 @@ @@ -156,6 +156,8 @@
156 } 156 }
157 157
158 textarea { 158 textarea {
  159 + right: 0;
  160 + width: pxToRem(400px);
159 height: pxToRem(58px) * 2; 161 height: pxToRem(58px) * 2;
160 padding: pxToRem(20px) 0; 162 padding: pxToRem(20px) 0;
161 } 163 }
@@ -45,9 +45,8 @@ @@ -45,9 +45,8 @@
45 p{ 45 p{
46 width: 55.517241%; 46 width: 55.517241%;
47 height: auto; 47 height: auto;
48 - padding: 0 5% 10em / $pxConvertRem;; 48 + padding: 0 5% 18em / $pxConvertRem;;
49 float: left; 49 float: left;
50 - font-size: 44em / $pxConvertRem;  
51 &:first-of-type{ 50 &:first-of-type{
52 padding-top:30em / $pxConvertRem; 51 padding-top:30em / $pxConvertRem;
53 font-size: 60em / $pxConvertRem; 52 font-size: 60em / $pxConvertRem;
@@ -78,7 +78,7 @@ @@ -78,7 +78,7 @@
78 font-size: pxToRem(32px); 78 font-size: pxToRem(32px);
79 line-height: pxToRem(88px); 79 line-height: pxToRem(88px);
80 80
81 - span { 81 + a {
82 color: #e0e0e0; 82 color: #e0e0e0;
83 float: right; 83 float: right;
84 } 84 }
@@ -110,6 +110,7 @@ @@ -110,6 +110,7 @@
110 background: #fff; 110 background: #fff;
111 111
112 .list-item { 112 .list-item {
  113 + display: block;
113 position: relative; 114 position: relative;
114 padding: 0 pxToRem(30px); 115 padding: 0 pxToRem(30px);
115 font-size: pxToRem(32px); 116 font-size: pxToRem(32px);
@@ -106,7 +106,14 @@ @@ -106,7 +106,14 @@
106 border-bottom: 1px solid #e0e0e0; 106 border-bottom: 1px solid #e0e0e0;
107 background: #fff; 107 background: #fff;
108 108
109 - > li{ 109 + a {
  110 + display: block;
  111 + height: 100%;
  112 + width: 100%;
  113 + color: #b0b0b0;
  114 + }
  115 +
  116 + > li {
110 float: left; 117 float: left;
111 height: 90rem / $pxConvertRem; 118 height: 90rem / $pxConvertRem;
112 width: 25%; 119 width: 25%;
@@ -115,7 +122,7 @@ @@ -115,7 +122,7 @@
115 font-size: 26rem / $pxConvertRem; 122 font-size: 26rem / $pxConvertRem;
116 text-align: center; 123 text-align: center;
117 124
118 - &.active { 125 + &.active a {
119 color: #000; 126 color: #000;
120 } 127 }
121 } 128 }
@@ -3,18 +3,25 @@ @@ -3,18 +3,25 @@
3 <span class="active">未使用</span> 3 <span class="active">未使用</span>
4 <span>已使用</span> 4 <span>已使用</span>
5 </div> 5 </div>
  6 +{{# couponsUrl}}
6 <div class="employ-list"> 7 <div class="employ-list">
  8 +
  9 +{{# unused}}
7 <div class="employ-main"> 10 <div class="employ-main">
8 <span>50</span> 11 <span>50</span>
9 <p>【summer sale】下装满¥399减¥50券</p> 12 <p>【summer sale】下装满¥399减¥50券</p>
10 <p>有效期:2014.07.28 - 2014.09.15</p> 13 <p>有效期:2014.07.28 - 2014.09.15</p>
11 </div> 14 </div>
  15 +{{/ unused}}
12 </div> 16 </div>
13 <div class="employ-list not none"> 17 <div class="employ-list not none">
  18 +{{# used}}
14 <div class="employ-main"> 19 <div class="employ-main">
15 - <span>60</span>  
16 - <p>【summer sale】下装满¥399减¥60券</p>  
17 - <p>有效期:2014.07.28 - 2014.09.15</p> 20 + <span>{{ money }}</span>
  21 + <p>{{ coupon_name }}</p>
  22 + <p>{{ couponValidity }}</p>
18 </div> 23 </div>
  24 +{{/ used}}
19 </div> 25 </div>
  26 +{{/ couponsUrl}}
20 {{> layout/footer}} 27 {{> layout/footer}}
@@ -11,15 +11,15 @@ @@ -11,15 +11,15 @@
11 </div> 11 </div>
12 </div> 12 </div>
13 <div class="my-link clearfix"> 13 <div class="my-link clearfix">
14 - <a class="link-item" href="/home"> 14 + <a class="link-item" href="/home/">
15 {{product_favorite_total}} 15 {{product_favorite_total}}
16 <p>收藏的商品</p> 16 <p>收藏的商品</p>
17 </a> 17 </a>
18 - <a class="link-item" href="/home"> 18 + <a class="link-item" href="/home/">
19 {{brand_favorite_total}} 19 {{brand_favorite_total}}
20 <p>收藏的品牌</p> 20 <p>收藏的品牌</p>
21 </a> 21 </a>
22 - <a class="link-item" href="/home"> 22 + <a class="link-item" href="/home/">
23 {{product_browse}} 23 {{product_browse}}
24 <p>浏览记录</p> 24 <p>浏览记录</p>
25 </a> 25 </a>
@@ -27,9 +27,9 @@ @@ -27,9 +27,9 @@
27 <div class="my-order"> 27 <div class="my-order">
28 <div class="order-title"> 28 <div class="order-title">
29 我的订单 29 我的订单
30 - <span class="iconfont"> 30 + <a class="iconfont" href="/home/order">
31 查看全部订单 &#xe604; 31 查看全部订单 &#xe604;
32 - </span> 32 + </a>
33 </div> 33 </div>
34 <div class="order-type clearfix"> 34 <div class="order-type clearfix">
35 <a class="type-item" href="/home/order"> 35 <a class="type-item" href="/home/order">
@@ -47,44 +47,44 @@ @@ -47,44 +47,44 @@
47 </div> 47 </div>
48 </div> 48 </div>
49 <div class="group-list"> 49 <div class="group-list">
50 - <div class="list-item"> 50 + <a class="list-item" href="/home/address">
51 <span class="iconfont icon">&#xe637;</span> 51 <span class="iconfont icon">&#xe637;</span>
52 地址管理 52 地址管理
53 <span class="iconfont num">3 &#xe604;</span> 53 <span class="iconfont num">3 &#xe604;</span>
54 - </div> 54 + </a>
55 </div> 55 </div>
56 <div class="group-list"> 56 <div class="group-list">
57 - <div class="list-item"> 57 + <a class="list-item" href="/home/">
58 <span class="iconfont icon">&#xe63a;</span> 58 <span class="iconfont icon">&#xe63a;</span>
59 优惠券 59 优惠券
60 <span class="iconfont num">{{coupon_num}} &#xe604;</span> 60 <span class="iconfont num">{{coupon_num}} &#xe604;</span>
61 - </div>  
62 - <div class="list-item"> 61 + </a>
  62 + <a class="list-item" href="/home/">
63 <span class="iconfont icon">&#xe635;</span> 63 <span class="iconfont icon">&#xe635;</span>
64 YOHO 64 YOHO
65 <span class="iconfont num">{{yoho_coin_num}} &#xe604;</span> 65 <span class="iconfont num">{{yoho_coin_num}} &#xe604;</span>
66 - </div> 66 + </a>
67 </div> 67 </div>
68 <div class="group-list"> 68 <div class="group-list">
69 - <div class="list-item"> 69 + <a class="list-item" href="/home/">
70 <span class="iconfont icon">&#xe636;</span> 70 <span class="iconfont icon">&#xe636;</span>
71 消息 71 消息
72 <span class="iconfont num">{{inbox_total}} &#xe604;</span> 72 <span class="iconfont num">{{inbox_total}} &#xe604;</span>
73 - </div> 73 + </a>
74 </div> 74 </div>
75 <div class="group-list"> 75 <div class="group-list">
76 - <div class="list-item"> 76 + <a class="list-item" href="/home/">
77 <span class="iconfont icon">&#xe63c;</span> 77 <span class="iconfont icon">&#xe63c;</span>
78 在线客服 78 在线客服
79 <span class="iconfont num">&#xe604;</span> 79 <span class="iconfont num">&#xe604;</span>
80 - </div> 80 + </a>
81 </div> 81 </div>
82 <div class="group-list"> 82 <div class="group-list">
83 - <div class="list-item"> 83 + <a class="list-item" href="/home/">
84 <span class="iconfont icon">&#xe639;</span> 84 <span class="iconfont icon">&#xe639;</span>
85 帮助 85 帮助
86 <span class="iconfont num">&#xe604;</span> 86 <span class="iconfont num">&#xe604;</span>
87 - </div> 87 + </a>
88 </div> 88 </div>
89 89
90 {{> product/recommend-for-you}} 90 {{> product/recommend-for-you}}
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <ul id="order-nav" class="order-nav clearfix"> 4 <ul id="order-nav" class="order-nav clearfix">
5 {{#each navs}} 5 {{#each navs}}
6 <li {{#if active}}class="active"{{/if}} data-type="{{typeId}}"> 6 <li {{#if active}}class="active"{{/if}} data-type="{{typeId}}">
7 - {{name}} 7 + <a href="{{url}}">{{name}}</a>
8 </li> 8 </li>
9 {{/each}} 9 {{/each}}
10 </ul> 10 </ul>
@@ -212,8 +212,6 @@ class HomeController extends AbstractAction @@ -212,8 +212,6 @@ class HomeController extends AbstractAction
212 'couponsUrl' => \Index\UserModel::getCouponData($uid, $status), 212 'couponsUrl' => \Index\UserModel::getCouponData($uid, $status),
213 'couponsPage' => true 213 'couponsPage' => true
214 ); 214 );
215 - print_r($coupons);  
216 -  
217 $this->_view->display('coupons', $coupons); 215 $this->_view->display('coupons', $coupons);
218 } 216 }
219 217
@@ -449,19 +447,19 @@ class HomeController extends AbstractAction @@ -449,19 +447,19 @@ class HomeController extends AbstractAction
449 $data = OrderModel::getNavs($type); 447 $data = OrderModel::getNavs($type);
450 if (!empty($data)) { 448 if (!empty($data)) {
451 $order['navs'] = $data; 449 $order['navs'] = $data;
452 - $order['orderPage'] = true;  
453 } else { 450 } else {
454 $this->error(); 451 $this->error();
455 } 452 }
456 453
457 $this->_view->display('order', array( 454 $this->_view->display('order', array(
458 'order' => $order, 455 'order' => $order,
459 - 'pageFooter' => true 456 + 'pageFooter' => true,
  457 + 'orderPage' => true
460 )); 458 ));
461 } 459 }
462 460
463 //ajax请求订单页面 461 //ajax请求订单页面
464 - public function getOrderAction() { 462 + public function getOrdersAction() {
465 //判断是不是ajax请求 463 //判断是不是ajax请求
466 if (!$this->isAjax()) { 464 if (!$this->isAjax()) {
467 $this->error(); 465 $this->error();
@@ -481,8 +479,12 @@ class HomeController extends AbstractAction @@ -481,8 +479,12 @@ class HomeController extends AbstractAction
481 if (!empty($data)) { 479 if (!empty($data)) {
482 $order['orders'] = $data; 480 $order['orders'] = $data;
483 } else { 481 } else {
  482 + if ($page > 1) {
  483 + echo " ";
  484 + } else {
484 $order['walkwayUrl'] = 'http://www.baidu.com'; 485 $order['walkwayUrl'] = 'http://www.baidu.com';
485 } 486 }
  487 + }
486 //渲染模板 488 //渲染模板
487 $this->_view->display('order-content', $order); 489 $this->_view->display('order-content', $order);
488 } 490 }
@@ -123,44 +123,48 @@ class OrderModel @@ -123,44 +123,48 @@ class OrderModel
123 } 123 }
124 124
125 //根据type值设置nav属性 125 //根据type值设置nav属性
126 - public function getNavs($type){ 126 + public function getNavs($type) {
127 $nav = array( 127 $nav = array(
128 array( 128 array(
129 'name' => '全部', 129 'name' => '全部',
130 - 'typeId' => '1' 130 + 'typeId' => '1',
  131 + 'url' => '/home/order?type=1'
131 ), 132 ),
132 array( 133 array(
133 'name' => '待付款', 134 'name' => '待付款',
134 - 'typeId' => '2' 135 + 'typeId' => '2',
  136 + 'url' => '/home/order?type=2'
135 ), 137 ),
136 array( 138 array(
137 'name' => '待发货', 139 'name' => '待发货',
138 - 'typeId' => '3' 140 + 'typeId' => '3',
  141 + 'url' => '/home/order?type=3'
139 ), 142 ),
140 array( 143 array(
141 'name' => '待收货', 144 'name' => '待收货',
142 - 'typeId' => '4' 145 + 'typeId' => '4',
  146 + 'url' => '/home/order?type=4'
143 ) 147 )
144 ); 148 );
145 - foreach($nav as $key => $vo){ 149 + foreach ($nav as $key => $vo) {
146 switch ($type) { 150 switch ($type) {
147 case 1: 151 case 1:
148 - if($vo['typeId'] == 1){ 152 + if ($vo['typeId'] == 1) {
149 $nav[$key]['active'] = true; 153 $nav[$key]['active'] = true;
150 } 154 }
151 break; 155 break;
152 case 2: 156 case 2:
153 - if($vo['typeId'] == 2){ 157 + if ($vo['typeId'] == 2) {
154 $nav[$key]['active'] = true; 158 $nav[$key]['active'] = true;
155 } 159 }
156 break; 160 break;
157 case 3: 161 case 3:
158 - if($vo['typeId'] == 3){ 162 + if ($vo['typeId'] == 3) {
159 $nav[$key]['active'] = true; 163 $nav[$key]['active'] = true;
160 } 164 }
161 break; 165 break;
162 case 4: 166 case 4:
163 - if($vo['typeId'] == 4){ 167 + if ($vo['typeId'] == 4) {
164 $nav[$key]['active'] = true; 168 $nav[$key]['active'] = true;
165 } 169 }
166 break; 170 break;
@@ -169,7 +173,6 @@ class OrderModel @@ -169,7 +173,6 @@ class OrderModel
169 } 173 }
170 } 174 }
171 return $nav; 175 return $nav;
172 -  
173 } 176 }
174 177
175 } 178 }