Authored by Rock Zhang

修复订单详情页快递信息的显示(现在交易成功的订单也显示物流信息)

Code Review By Rock Zhang
@@ -4,11 +4,13 @@ @@ -4,11 +4,13 @@
4 <div id="order-detail" data-id="{{orderNum}}"> 4 <div id="order-detail" data-id="{{orderNum}}">
5 <section class="owner-info block"> 5 <section class="owner-info block">
6 <span class="iconfont">&#xe631;</span> 6 <span class="iconfont">&#xe631;</span>
  7 +
7 <div class="beside-icon"> 8 <div class="beside-icon">
8 <p class="name-phone"> 9 <p class="name-phone">
9 {{name}} 10 {{name}}
10 <span>{{phoneNum}}</span> 11 <span>{{phoneNum}}</span>
11 </p> 12 </p>
  13 +
12 <p class="address"> 14 <p class="address">
13 {{address}} 15 {{address}}
14 </p> 16 </p>
@@ -18,16 +20,17 @@ @@ -18,16 +20,17 @@
18 <section class="order-status block"> 20 <section class="order-status block">
19 <div class="status sub"> 21 <div class="status sub">
20 <span class="iconfont">&#xe632;</span> 22 <span class="iconfont">&#xe632;</span>
  23 +
21 <p class="beside-icon sub-content"> 24 <p class="beside-icon sub-content">
22 <span class="sub-title">{{orderStatus}}</span> 25 <span class="sub-title">{{orderStatus}}</span>
23 <span>订单编号:{{orderNum}}</span> 26 <span>订单编号:{{orderNum}}</span>
24 <span>下单时间:{{orderTime}}</span> 27 <span>下单时间:{{orderTime}}</span>
25 </p> 28 </p>
26 </div> 29 </div>
27 - {{#if unreceived}}  
28 {{#if logisticsUrl}} 30 {{#if logisticsUrl}}
29 <a class="logistics sub" href="{{logisticsUrl}}"> 31 <a class="logistics sub" href="{{logisticsUrl}}">
30 <span class="iconfont">&#xe630;</span> 32 <span class="iconfont">&#xe630;</span>
  33 +
31 <p class="beside-icon sub-content"> 34 <p class="beside-icon sub-content">
32 <span class="sub-title">物流信息</span> 35 <span class="sub-title">物流信息</span>
33 <span>物流公司:{{logisticsCompany}}</span> 36 <span>物流公司:{{logisticsCompany}}</span>
@@ -36,7 +39,6 @@ @@ -36,7 +39,6 @@
36 <span class="iconfont icon-right">&#xe614;</span> 39 <span class="iconfont icon-right">&#xe614;</span>
37 </a> 40 </a>
38 {{/if}} 41 {{/if}}
39 - {{/if}}  
40 </section> 42 </section>
41 43
42 <section class="goods block"> 44 <section class="goods block">
@@ -109,39 +111,39 @@ @@ -109,39 +111,39 @@
109 </div> 111 </div>
110 {{/ orderDetail}} 112 {{/ orderDetail}}
111 </div> 113 </div>
112 -<script>_ozprm="orderid={{orderCode}}&ordertotal={{orderTotal}}";</script>  
113 -<script type="text/javascript" src ="http://static.yohobuy.com/m/v1/js/AG_Tracking.js"></script> 114 +<script>_ozprm = "orderid={{orderCode}}&ordertotal={{orderTotal}}";</script>
  115 +<script type="text/javascript" src="http://static.yohobuy.com/m/v1/js/AG_Tracking.js"></script>
114 <script type="text/javascript"> 116 <script type="text/javascript">
115 -var _agq = _agq || [];  
116 -_agq.push(['_cid', '415']); //生成value  
117 -_agq.push(['_eid', '102']); //生成value  
118 -_agq.push(['_orderSum',"{{orderTotal}}"]);//订单金额,客户在页面填写  
119 -_agq.push(['_orderNo',"{{orderCode}}"]);//订单号,客户在页面填写  
120 -_agq.push(['_orderNew',"{{isOldUser}}"]);//是否新客单,客户标记是为true否为false  
121 -_agq.push(['_orderCount',"{{orderCount}}"]);//订单货品数目,客户填写  
122 -ag_send(_agq); 117 + var _agq = _agq || [];
  118 + _agq.push(['_cid', '415']); //生成value
  119 + _agq.push(['_eid', '102']); //生成value
  120 + _agq.push(['_orderSum', "{{orderTotal}}"]);//订单金额,客户在页面填写
  121 + _agq.push(['_orderNo', "{{orderCode}}"]);//订单号,客户在页面填写
  122 + _agq.push(['_orderNew', "{{isOldUser}}"]);//是否新客单,客户标记是为true否为false
  123 + _agq.push(['_orderCount', "{{orderCount}}"]);//订单货品数目,客户填写
  124 + ag_send(_agq);
123 125
124 -var __order_code = "{{orderCode}}";  
125 -var __order_amount = "{{orderTotal}}";  
126 -var __order_user = "{{isOldUser}}";  
127 -var __order_goods_num = {{orderCount}};  
128 -var __order_uid = '{{uid}}'; 126 + var __order_code = "{{orderCode}}";
  127 + var __order_amount = "{{orderTotal}}";
  128 + var __order_user = "{{isOldUser}}";
  129 + var __order_goods_num = {{orderCount}};
  130 + var __order_uid = '{{uid}}';
129 131
130 -var _fxcmd=_fxcmd||[];  
131 -_fxcmd.push(['trackOrder', { 132 + var _fxcmd = _fxcmd || [];
  133 + _fxcmd.push(['trackOrder', {
132 oid: "{{orderCode}}", 134 oid: "{{orderCode}}",
133 - otp : "{{orderTotalFormat}}",  
134 - unid : "{{uid}}"  
135 -}]); 135 + otp: "{{orderTotalFormat}}",
  136 + unid: "{{uid}}"
  137 + }]);
136 </script> 138 </script>
137 <script type="text/javascript" src="//static.criteo.net/js/ld/ld.js" async="true"></script> 139 <script type="text/javascript" src="//static.criteo.net/js/ld/ld.js" async="true"></script>
138 <script type="text/javascript"> 140 <script type="text/javascript">
139 -window.criteo_q = window.criteo_q || [];  
140 -window.criteo_q.push(  
141 -{ event: "setAccount", account: [21397] },  
142 -{ event: "setHashedEmail", email: "" },  
143 -{ event: "setSiteType", type: "m" },  
144 -{ event: "trackTransaction" , id: "{{orderCode}}", currency: "CNY", item: ""}  
145 -); 141 + window.criteo_q = window.criteo_q || [];
  142 + window.criteo_q.push(
  143 + {event: "setAccount", account: [21397]},
  144 + {event: "setHashedEmail", email: ""},
  145 + {event: "setSiteType", type: "m"},
  146 + {event: "trackTransaction", id: "{{orderCode}}", currency: "CNY", item: ""}
  147 + );
146 </script> 148 </script>
147 {{> layout/footer}} 149 {{> layout/footer}}
@@ -284,14 +284,12 @@ class OrderModel @@ -284,14 +284,12 @@ class OrderModel
284 case 5: 284 case 5:
285 //已发货状态,给查看物流URL 285 //已发货状态,给查看物流URL
286 $result['unreceived'] = true; 286 $result['unreceived'] = true;
287 - $result['logisticsUrl'] = Helpers::url('/home/logistic', array('order_code' => $order['order_code']));  
288 - if ($showLogistics && isset($order['caption'])) {  
289 - $result['logisticsCompany'] = $order['caption'];  
290 - $result['logisticsNum'] = $order['express_number'];  
291 - } 287 + self::assignExpressInfo($showLogistics, $order, $result);
292 break; 288 break;
293 case 6: 289 case 6:
294 $result['completed'] = true; 290 $result['completed'] = true;
  291 + // 已成功订单,给查看物流URL
  292 + self::assignExpressInfo($showLogistics, $order, $result);
295 break; 293 break;
296 default: 294 default:
297 break; 295 break;
@@ -314,14 +312,11 @@ class OrderModel @@ -314,14 +312,11 @@ class OrderModel
314 case 5: 312 case 5:
315 //待收货状态,给查看物流url 313 //待收货状态,给查看物流url
316 $result['unreceived'] = true; 314 $result['unreceived'] = true;
317 - $result['logisticsUrl'] = Helpers::url('/home/logistic', array('order_code' => $order['order_code']));  
318 - if ($showLogistics && isset($order['caption'])) {  
319 - $result['logisticsCompany'] = $order['caption'];  
320 - $result['logisticsNum'] = $order['express_number'];  
321 - } 315 + self::assignExpressInfo($showLogistics, $order, $result);
322 break; 316 break;
323 case 6: 317 case 6:
324 $result['completed'] = true; 318 $result['completed'] = true;
  319 + self::assignExpressInfo($showLogistics, $order, $result);
325 break; 320 break;
326 default: 321 default:
327 break; 322 break;
@@ -331,6 +326,16 @@ class OrderModel @@ -331,6 +326,16 @@ class OrderModel
331 return $result; 326 return $result;
332 } 327 }
333 328
  329 + private static function assignExpressInfo($showLogistics, $order, &$result)
  330 + {
  331 + $result['logisticsUrl'] = Helpers::url('/home/logistic', array('order_code' => $order['order_code']));
  332 +
  333 + if ($showLogistics && isset($order['express_company']['caption'])) {
  334 + $result['logisticsCompany'] = $order['express_company']['caption'];
  335 + $result['logisticsNum'] = $order['express_number'];
  336 + }
  337 + }
  338 +
334 /** 339 /**
335 * 过滤掉为0的价格数据 340 * 过滤掉为0的价格数据
336 * 341 *