Authored by 梁志锋

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

@@ -947,18 +947,20 @@ @@ -947,18 +947,20 @@
947 order: { 947 order: {
948 orders: [ 948 orders: [
949 ... 949 ...
950 - ] 950 + ],
  951 + //没有订单的情况不传orders
  952 + walkWayUrl: '' //随便逛逛url
951 } 953 }
952 } 954 }
953 955
954 956
955 //订单 957 //订单
956 { 958 {
  959 + detailUrl: '',
957 orderNum: '', 960 orderNum: '',
958 orderStatus: '', 961 orderStatus: '',
959 goods: [ 962 goods: [
960 { 963 {
961 - id: '',  
962 thumb: '', 964 thumb: '',
963 gift: true, //是否赠品 965 gift: true, //是否赠品
964 advanceBuy: true, //是否加价购 966 advanceBuy: true, //是否加价购
@@ -13,7 +13,7 @@ var $navLi = $('#order-nav > li'), @@ -13,7 +13,7 @@ var $navLi = $('#order-nav > li'),
13 13
14 var $curContainer = $orderContainer.children('.orders').first();//保存当前显示的order-container 14 var $curContainer = $orderContainer.children('.orders').first();//保存当前显示的order-container
15 15
16 -var navHammer; 16 +var navHammer, orderHammer;
17 17
18 lazyLoad(); 18 lazyLoad();
19 19
@@ -33,4 +33,20 @@ navHammer.on('tap', function(e) { @@ -33,4 +33,20 @@ navHammer.on('tap', function(e) {
33 33
34 $curContainer.addClass('hide'); 34 $curContainer.addClass('hide');
35 $curContainer = $orderContainer.children(':eq(' + index + ')').removeClass('hide'); 35 $curContainer = $orderContainer.children(':eq(' + index + ')').removeClass('hide');
  36 +});
  37 +
  38 +orderHammer = new Hammer(document.getElementById('order-container'));
  39 +orderHammer.on('tap', function(e) {
  40 + var $cur = $(e.target),
  41 + $order,
  42 + url;
  43 +
  44 + if ($cur.closest('.locHref').length > 0) {
  45 + return;
  46 + }
  47 +
  48 + $order = $cur.closest('.order');
  49 + url = $order.data('href');
  50 +
  51 + location.href = url;
36 }); 52 });
@@ -2,11 +2,16 @@ @@ -2,11 +2,16 @@
2 background: #f0f0f0; 2 background: #f0f0f0;
3 3
4 .order { 4 .order {
  5 + display: block;
5 background: #fff; 6 background: #fff;
6 margin: 30rem / $pxConvertRem 0; 7 margin: 30rem / $pxConvertRem 0;
7 border-top: 1px solid #e0e0e0; 8 border-top: 1px solid #e0e0e0;
8 border-bottom: 1px solid #e0e0e0; 9 border-bottom: 1px solid #e0e0e0;
9 10
  11 + &:last-child {
  12 + margin-bottom: 0;
  13 + }
  14 +
10 .header, .footer { 15 .header, .footer {
11 height: 90rem / $pxConvertRem; 16 height: 90rem / $pxConvertRem;
12 line-height: 90rem / $pxConvertRem; 17 line-height: 90rem / $pxConvertRem;
@@ -37,7 +42,7 @@ @@ -37,7 +42,7 @@
37 border-top: 1px solid #e0e0e0; 42 border-top: 1px solid #e0e0e0;
38 text-align: right; 43 text-align: right;
39 44
40 - > .btn { 45 + .btn {
41 display: inline-block; 46 display: inline-block;
42 box-sizing: border-box; 47 box-sizing: border-box;
43 height: 60rem / $pxConvertRem; 48 height: 60rem / $pxConvertRem;
@@ -46,6 +51,7 @@ @@ -46,6 +51,7 @@
46 font-size: 24rem / $pxConvertRem; 51 font-size: 24rem / $pxConvertRem;
47 text-align: center; 52 text-align: center;
48 border: 1px solid #000; 53 border: 1px solid #000;
  54 + @include border-radius(5px);
49 } 55 }
50 56
51 .pay { 57 .pay {
@@ -56,6 +62,22 @@ @@ -56,6 +62,22 @@
56 } 62 }
57 } 63 }
58 } 64 }
  65 +
  66 + .no-order {
  67 + text-align: center;
  68 + color: #f0f0f0;
  69 +
  70 + .iconfont {
  71 + font-size: 50px;
  72 + }
  73 +
  74 + .walk-way {
  75 + display: block;
  76 + color: #fff;
  77 + background: #fff;
  78 + @include border-radius(5px);
  79 + }
  80 + }
59 } 81 }
60 82
61 .order-nav { 83 .order-nav {
@@ -18,9 +18,7 @@ @@ -18,9 +18,7 @@
18 18
19 <div id="order-container" class="order-container"> 19 <div id="order-container" class="order-container">
20 <div class="all orders"> 20 <div class="all orders">
21 - {{#each orders}}  
22 - {{> me/order/order}}  
23 - {{/each}} 21 + {{> me/order/orders}}
24 </div> 22 </div>
25 <div class="unpaid orders hide"></div> 23 <div class="unpaid orders hide"></div>
26 <div class="unshipped orders hide"></div> 24 <div class="unshipped orders hide"></div>
1 -<div class="order" data-id="{{orderNum}}"> 1 +<div class="order" data-id="{{orderNum}}" data-href="{{detailUrl}}">
2 <header class="header"> 2 <header class="header">
3 订单编号:{{orderNum}} 3 订单编号:{{orderNum}}
4 <span class="order-status">{{orderStatus}}</span> 4 <span class="order-status">{{orderStatus}}</span>
@@ -15,24 +15,24 @@ @@ -15,24 +15,24 @@
15 {{!-- 对应订单状态的操作逻辑 --}} 15 {{!-- 对应订单状态的操作逻辑 --}}
16 16
17 {{!-- 完成和取消订单显示删除按钮 --}} 17 {{!-- 完成和取消订单显示删除按钮 --}}
18 - {{#unless unpaid}}  
19 - {{#unless unreceived}}  
20 - <div class="order-opt"> 18 + <div class="order-opt">
  19 + {{#unless unpaid}}
  20 + {{#unless unreceived}}
21 <span class="btn del">删除订单</span> 21 <span class="btn del">删除订单</span>
22 - </div> 22 + {{/unless}}
23 {{/unless}} 23 {{/unless}}
24 - {{/unless}}  
25 24
26 - {{#if unpaid}}  
27 - <div class="order-opt"> 25 + {{#if unpaid}}
28 <span class="btn cancel">取消订单</span> 26 <span class="btn cancel">取消订单</span>
29 - <span class="btn pay">立即付款</span>  
30 - </div>  
31 - {{/if}} 27 + <a class="locHref" href="{{payUrl}}">
  28 + <span class="btn pay">立即付款</span>
  29 + </a>
  30 + {{/if}}
32 31
33 - {{#if unreceived}}  
34 - <div class="order-opt">  
35 - <a class="check-logistics" href="{{logisticsUrl}}">查看物流</a>  
36 - </div>  
37 - {{/if}} 32 + {{#if unreceived}}
  33 + <a class="locHref" href="{{logisticsUrl}}">
  34 + <span class="btn check-logistics">查看物流</span>
  35 + </a>
  36 + {{/if}}
  37 + </div>
38 </div> 38 </div>
  1 +{{#if walkwayUrl}}
  2 + <div class="no-order">
  3 + <span class="iconfont">&#xe632;</span>
  4 + <span>你还没有订单</span>
  5 + <a class="walk-way" href="{{walkwayUrl}}">随便逛逛</a>
  6 + </div>
  7 +{{^}}
  8 + {{#each orders}}
  9 + {{> me/order/order}}
  10 + {{/each}}
  11 +{{/if}}
@@ -420,10 +420,10 @@ class HomeController extends AbstractAction @@ -420,10 +420,10 @@ class HomeController extends AbstractAction
420 } else { 420 } else {
421 $order['walkwayUrl'] = 'http://www.baidu.com'; 421 $order['walkwayUrl'] = 'http://www.baidu.com';
422 } 422 }
423 -  
424 //渲染模板 423 //渲染模板
425 $this->_view->display('order', array( 424 $this->_view->display('order', array(
426 - 'order' => $order 425 + 'order' => $order,
  426 + 'orderPage' => true
427 )); 427 ));
428 } 428 }
429 429