Authored by 梁志锋

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

@@ -583,7 +583,7 @@ class Helpers @@ -583,7 +583,7 @@ class Helpers
583 583
584 foreach ($orderGoods as $key => $vo) { 584 foreach ($orderGoods as $key => $vo) {
585 $arr[$key]['thumb'] = Helpers::getImageUrl($vo['goods_image'], 90, 120); 585 $arr[$key]['thumb'] = Helpers::getImageUrl($vo['goods_image'], 90, 120);
586 - $arr[$key]['name'] = $vo['product_name']; 586 + $arr[$key]['name'] = isset($vo['product_name']) ? $vo['product_name'] : '';
587 $arr[$key]['color'] = $vo['color_name']; 587 $arr[$key]['color'] = $vo['color_name'];
588 $arr[$key]['size'] = $vo['size_name']; 588 $arr[$key]['size'] = $vo['size_name'];
589 $arr[$key]['price'] = $vo['goods_price']; 589 $arr[$key]['price'] = $vo['goods_price'];
@@ -49,18 +49,13 @@ $('.overlay').on('touchstart', function(e) { @@ -49,18 +49,13 @@ $('.overlay').on('touchstart', function(e) {
49 return false; 49 return false;
50 }); 50 });
51 51
52 -//禁止在侧边栏可以上下滚动  
53 -$('.side-nav').on('touchmove', function() {  
54 - return false;  
55 -});  
56 -  
57 //点击一级导航,弹出二级导航 52 //点击一级导航,弹出二级导航
58 $sideNav.on('touchstart', 'li', function(e) { 53 $sideNav.on('touchstart', 'li', function(e) {
59 if ($(this).find('.sub-nav').size() > 0) { 54 if ($(this).find('.sub-nav').size() > 0) {
60 $('.sub-nav').removeClass('show'); 55 $('.sub-nav').removeClass('show');
61 $(this).find('.sub-nav').addClass('show'); 56 $(this).find('.sub-nav').addClass('show');
62 } 57 }
63 - e.stopPropagation(); 58 +
64 if (e.target.pathname === location.pathname) { 59 if (e.target.pathname === location.pathname) {
65 hideSideBar(); 60 hideSideBar();
66 return false; 61 return false;
@@ -69,9 +64,8 @@ $sideNav.on('touchstart', 'li', function(e) { @@ -69,9 +64,8 @@ $sideNav.on('touchstart', 'li', function(e) {
69 64
70 //返回一级导航,收起二级导航 65 //返回一级导航,收起二级导航
71 $subNav.each(function() { 66 $subNav.each(function() {
72 - $(this).find('li').eq(0).on('touchstart', function(e) { 67 + $(this).find('li').eq(0).on('touchstart', function() {
73 $('.sub-nav').removeClass('show'); 68 $('.sub-nav').removeClass('show');
74 - e.stopPropagation();  
75 return false; 69 return false;
76 }); 70 });
77 }).on('touchstart', function(e) { 71 }).on('touchstart', function(e) {
@@ -81,12 +75,16 @@ $subNav.each(function() { @@ -81,12 +75,16 @@ $subNav.each(function() {
81 }); 75 });
82 76
83 // 侧边栏点击背景色变化 77 // 侧边栏点击背景色变化
84 -$sideNav.children('ul').children('li').on('touchstart', function() {  
85 - $sideNav.children('ul').children('li').css('background', '#fff');  
86 - $(this).css('background', '#eee');  
87 -}).on('touchend touchcancel', function() {  
88 - $(this).css('background', '#fff');  
89 -}); 78 +function highlight($elem) {
  79 + $elem.find('li').on('touchstart', function() {
  80 + $(this).addClass('highlight');
  81 + }).on('touchend touchcancel', function() {
  82 + $(this).removeClass('highlight');
  83 + });
  84 +}
  85 +highlight($sideNav);
  86 +highlight($subNav);
  87 +
90 88
91 //头部banner轮播 89 //头部banner轮播
92 if ($('.banner-swiper').find('li').size() > 1) { 90 if ($('.banner-swiper').find('li').size() > 1) {
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 right: 100rem / $pxConvertRem; 8 right: 100rem / $pxConvertRem;
9 width: 540rem / $pxConvertRem; 9 width: 540rem / $pxConvertRem;
10 background: #f0f0f0; 10 background: #f0f0f0;
  11 + z-index: 4;
11 overflow: hidden; 12 overflow: hidden;
12 overflow-y: auto; 13 overflow-y: auto;
13 @include transition(all .3s); 14 @include transition(all .3s);
@@ -46,25 +47,28 @@ @@ -46,25 +47,28 @@
46 height: 100%; 47 height: 100%;
47 padding-left: 110rem / $pxConvertRem; 48 padding-left: 110rem / $pxConvertRem;
48 color: #444; 49 color: #444;
49 - font-size: 24rem / $pxConvertRem; 50 + }
  51 +
  52 + em {
  53 + font-weight: bold;
  54 + font-size: 26rem / $pxConvertRem;
50 } 55 }
51 56
52 .title { 57 .title {
53 display: inline-block; 58 display: inline-block;
54 - padding-left: 10rem / $pxConvertRem;  
55 - font-size: 30rem / $pxConvertRem;  
56 - vertical-align: baseline; 59 + font-size: 36rem / $pxConvertRem;
  60 + vertical-align: bottom;
57 // 此处字体小于 12px, 先扩大,再scale缩小 61 // 此处字体小于 12px, 先扩大,再scale缩小
58 - @include transform(scale(0.75)); 62 + @include transform(scale(0.5));
59 } 63 }
60 64
61 .nav-icon, .nav-img { 65 .nav-icon, .nav-img {
62 position: absolute; 66 position: absolute;
63 - width: 60rem / $pxConvertRem;  
64 - height: 60rem / $pxConvertRem; 67 + width: 48rem / $pxConvertRem;
  68 + height: 48rem / $pxConvertRem;
65 top: 50%; 69 top: 50%;
66 - margin-top: -30rem / $pxConvertRem;  
67 - left: 24rem / $pxConvertRem; 70 + margin-top: -24rem / $pxConvertRem;
  71 + left: 30rem / $pxConvertRem;
68 background: no-repeat left center; 72 background: no-repeat left center;
69 background-size: 100% 100%; 73 background-size: 100% 100%;
70 } 74 }
@@ -79,10 +83,10 @@ @@ -79,10 +83,10 @@
79 font-weight: lighter; 83 font-weight: lighter;
80 } 84 }
81 85
82 - em {  
83 - font-weight: bold;  
84 - font-size: 30rem / $pxConvertRem; 86 + &.highlight {
  87 + background: #eee;
85 } 88 }
  89 +
86 } 90 }
87 91
88 .first { 92 .first {
@@ -100,17 +104,15 @@ @@ -100,17 +104,15 @@
100 content: none; 104 content: none;
101 } 105 }
102 106
103 - a {  
104 - font-size: 40rem / $pxConvertRem;  
105 - }  
106 -  
107 em { 107 em {
108 - font-size: 40rem / $pxConvertRem; 108 + font-size: 36rem / $pxConvertRem;
109 } 109 }
110 110
111 - .title {  
112 - font-size: 24rem / $pxConvertRem;  
113 - @include transform(scale(1)); 111 + }
  112 +
  113 + .sub-nav {
  114 + li {
  115 + border-bottom: 1px solid #e0e0e0;
114 } 116 }
115 } 117 }
116 } 118 }
@@ -181,8 +183,8 @@ @@ -181,8 +183,8 @@
181 @include transition(transform 0.3s); 183 @include transition(transform 0.3s);
182 184
183 li { 185 li {
184 - height: 80rem / $pxConvertRem;  
185 - line-height: 80rem / $pxConvertRem; 186 + height: 80rem / $pxConvertRem !important;
  187 + line-height: 80rem / $pxConvertRem !important;
186 border: none; 188 border: none;
187 border-bottom: 1px solid #e0e0e0; 189 border-bottom: 1px solid #e0e0e0;
188 190
@@ -215,9 +217,13 @@ @@ -215,9 +217,13 @@
215 color: #f0f0f0; 217 color: #f0f0f0;
216 } 218 }
217 219
  220 + &.highlight {
  221 + background: #eee;
  222 + }
  223 +
218 em { 224 em {
219 font-weight: normal; 225 font-weight: normal;
220 - font-size: 30rem / $pxConvertRem; 226 + font-size: 30rem / $pxConvertRem !important;
221 } 227 }
222 } 228 }
223 229
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 </section> 10 </section>
11 <footer class="footer"> 11 <footer class="footer">
12 共{{count}}件商品 实付<span class="sum-cost">¥{{sumCost}}</span> 12 共{{count}}件商品 实付<span class="sum-cost">¥{{sumCost}}</span>
  13 + {{#shippingCost}}(含运费¥{{.}}){{/shippingCost}}
13 </footer> 14 </footer>
14 15
15 {{!-- 对应订单状态的操作逻辑 --}} 16 {{!-- 对应订单状态的操作逻辑 --}}
@@ -82,6 +82,10 @@ class OrderModel @@ -82,6 +82,10 @@ class OrderModel
82 $result[$key]['orderNum'] = $vo['order_code']; 82 $result[$key]['orderNum'] = $vo['order_code'];
83 $result[$key]['orderStatus'] = $vo['status_str']; 83 $result[$key]['orderStatus'] = $vo['status_str'];
84 $result[$key]['sumCost'] = $vo['amount']; 84 $result[$key]['sumCost'] = $vo['amount'];
  85 + // 如果运费大于0,会显示运费
  86 + if (floatval($vo['shipping_cost']) > 0) {
  87 + $result[$key]['shippingCost'] = $vo['shipping_cost'];
  88 + }
85 //类内调用格式化订单商品数据方法 89 //类内调用格式化订单商品数据方法
86 $result[$key]['goods'] = Helpers::formatOrderGoods($vo['order_goods'], $count); 90 $result[$key]['goods'] = Helpers::formatOrderGoods($vo['order_goods'], $count);
87 $result[$key]['detailUrl'] = Helpers::url('/home/orderdetail', array('order_code' => $vo['order_code'])); 91 $result[$key]['detailUrl'] = Helpers::url('/home/orderdetail', array('order_code' => $vo['order_code']));
@@ -327,13 +331,19 @@ class OrderModel @@ -327,13 +331,19 @@ class OrderModel
327 return $result; 331 return $result;
328 } 332 }
329 333
  334 + /**
  335 + * 获取快递有关信息
  336 + * @param boolean $showLogistics 是否显示
  337 + * @param array $order 订单信息
  338 + * @param array $result
  339 + */
330 private static function assignExpressInfo($showLogistics, $order, &$result) 340 private static function assignExpressInfo($showLogistics, $order, &$result)
331 { 341 {
332 $result['logisticsUrl'] = Helpers::url('/home/logistic', array('order_code' => $order['order_code'])); 342 $result['logisticsUrl'] = Helpers::url('/home/logistic', array('order_code' => $order['order_code']));
333 343
334 if ($showLogistics && isset($order['express_company']['caption'])) { 344 if ($showLogistics && isset($order['express_company']['caption'])) {
335 $result['logisticsCompany'] = $order['express_company']['caption']; 345 $result['logisticsCompany'] = $order['express_company']['caption'];
336 - $result['logisticsNum'] = $order['express_number']; 346 + $result['logisticsNum'] = isset($order['express_number']) ? $order['express_number'] : '';
337 } 347 }
338 } 348 }
339 349
@@ -447,7 +447,7 @@ class CartModel @@ -447,7 +447,7 @@ class CartModel
447 } 447 }
448 448
449 // 有货币 449 // 有货币
450 - $result['yohoCoin'] = $payReturn['yoho_coin']; 450 + $result['yohoCoin'] = Helpers::transPrice($payReturn['yoho_coin']);
451 /* 451 /*
452 * 默认使用有货币 452 * 默认使用有货币
453 * $result['useYohoCoin'] = isset($orderCompute['use_yoho_coin']) ? $orderCompute['use_yoho_coin'] : $payReturn['use_yoho_coin']; 453 * $result['useYohoCoin'] = isset($orderCompute['use_yoho_coin']) ? $orderCompute['use_yoho_coin'] : $payReturn['use_yoho_coin'];
@@ -511,6 +511,8 @@ class CartModel @@ -511,6 +511,8 @@ class CartModel
511 511
512 $compute = CartData::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin); 512 $compute = CartData::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin);
513 if ($compute && isset($compute['code']) && $compute['code'] === 200) { 513 if ($compute && isset($compute['code']) && $compute['code'] === 200) {
  514 + // 有货币添加.00后缀
  515 + $compute['data']['use_yoho_coin'] = Helpers::transPrice($compute['data']['use_yoho_coin']);
514 $result = $compute['data']; 516 $result = $compute['data'];
515 } 517 }
516 518
@@ -631,8 +633,15 @@ class CartModel @@ -631,8 +633,15 @@ class CartModel
631 $data = array(); 633 $data = array();
632 634
633 $data['name'] = $productData['product_name']; 635 $data['name'] = $productData['product_name'];
634 - $data['price'] = $productData['format_market_price'];  
635 - $data['salePrice'] = $productData['format_sales_price']; 636 + if (isset($productData['special_price'])) { // 加价购或者赠品的销售价字段
  637 + $data['price'] = $productData['format_market_price'];
  638 + $data['salePrice'] = $productData['format_sales_price'];
  639 +
  640 + } else { // 购物车商品的销售价字段
  641 + $data['price'] = $productData['market_price'] > $productData['sales_price'] ? $productData['format_market_price'] : false;
  642 + $data['salePrice'] = '¥' . Helpers::transPrice($productData['sales_price']);
  643 + }
  644 +
636 645
637 if (isset($productData['storage_sum'])) { 646 if (isset($productData['storage_sum'])) {
638 $data['storage'] = $productData['storage_sum']; 647 $data['storage'] = $productData['storage_sum'];
@@ -188,7 +188,7 @@ class UserModel @@ -188,7 +188,7 @@ class UserModel
188 $favProduct = UserData::favoriteProductData($uid, $page, $limit); 188 $favProduct = UserData::favoriteProductData($uid, $page, $limit);
189 189
190 // 处理用户收藏的商品数据 190 // 处理用户收藏的商品数据
191 - if (isset($favProduct['data']) && !empty($favProduct['data']['product_list'])) { 191 + if (isset($favProduct['data']) && $page <= $favProduct['data']['page_total']) {
192 $datas = array(); 192 $datas = array();
193 $product = array(); 193 $product = array();
194 foreach ($favProduct['data']['product_list'] as $val) { 194 foreach ($favProduct['data']['product_list'] as $val) {
@@ -210,7 +210,7 @@ class UserModel @@ -210,7 +210,7 @@ class UserModel
210 $datas[] = $product; 210 $datas[] = $product;
211 } 211 }
212 !empty($datas) && $result['hasFavProduct'] = $datas; 212 !empty($datas) && $result['hasFavProduct'] = $datas;
213 - } else if ($page > 1 && !isset($favProduct['data']['product_list'])) { 213 + } else if (($page > 1 && !$favProduct) || $page > $favProduct['data']['page_total']) {
214 $result['end'] = true; 214 $result['end'] = true;
215 } 215 }
216 216
@@ -234,7 +234,7 @@ class UserModel @@ -234,7 +234,7 @@ class UserModel
234 $favBrand = UserData::favoriteBrandData($uid, $gender, $page, $limit); 234 $favBrand = UserData::favoriteBrandData($uid, $gender, $page, $limit);
235 235
236 // 处理用户收藏的品牌数据 236 // 处理用户收藏的品牌数据
237 - if (isset($favBrand['data']) && !empty($favBrand['data']['brand_list'])) { 237 + if (isset($favBrand['data']) && $page <= $favBrand['data']['page_total']) {
238 $datas = array(); 238 $datas = array();
239 $brand = array(); 239 $brand = array();
240 foreach ($favBrand['data']['brand_list'] as $val) { 240 foreach ($favBrand['data']['brand_list'] as $val) {
@@ -265,7 +265,7 @@ class UserModel @@ -265,7 +265,7 @@ class UserModel
265 $datas[] = $brand; 265 $datas[] = $brand;
266 } 266 }
267 !empty($datas) && $result['hasFavBrand'] = $datas; 267 !empty($datas) && $result['hasFavBrand'] = $datas;
268 - } else if ($page > 1 && !isset($favBrand['code']['brand_list'])) { 268 + } else if (($page > 1 && !$favBrand) || $page > $favBrand['data']['page_total']) {
269 $result['end'] = true; 269 $result['end'] = true;
270 } 270 }
271 271