Authored by Rock Zhang

Merge branch 'feature/wap325' into develop

@@ -60,6 +60,8 @@ class CacheConfig @@ -60,6 +60,8 @@ class CacheConfig
60 60
61 const KEY_CODE_YOHOCOIN_BANNER = 'key_code_yohocoin_banner';// 有货币banner数据 61 const KEY_CODE_YOHOCOIN_BANNER = 'key_code_yohocoin_banner';// 有货币banner数据
62 62
  63 + const KEY_CODE_LOGISTIC_BANNER = 'key_code_logistic_banner';// 物流详情banner数据
  64 +
63 const KEY_WEB_HOME_NAVBAR_DATA = 'key_web_home_navbar_data';//web的导航数据 65 const KEY_WEB_HOME_NAVBAR_DATA = 'key_web_home_navbar_data';//web的导航数据
64 const KEY_WEB_HOME_CHANNEL_DATA = 'key_web_home_channel_data';//web首页频道数据[boys, girls, kids, lifestyle] 66 const KEY_WEB_HOME_CHANNEL_DATA = 'key_web_home_channel_data';//web首页频道数据[boys, girls, kids, lifestyle]
65 const KEY_WEB_HOME_CHANNEL_NEWARRIVAL_DATA = 'key_web_home_newarrival_data';//web频道最新上架数据[boys, girls, kids, lifestyle] 67 const KEY_WEB_HOME_CHANNEL_NEWARRIVAL_DATA = 'key_web_home_newarrival_data';//web频道最新上架数据[boys, girls, kids, lifestyle]
@@ -18,7 +18,7 @@ class SideData @@ -18,7 +18,7 @@ class SideData
18 { 18 {
19 19
20 const URI_LEFTNAV_ENTRANCE = 'operations/api/v5/entrance/getEntrance'; 20 const URI_LEFTNAV_ENTRANCE = 'operations/api/v5/entrance/getEntrance';
21 - const URI_LEFTNAV_CATEGORY = 'operations/api/v5/category/getCategory'; 21 + const URI_LEFTNAV_CATEGORY = 'operations/api/v6/category/getCategory';
22 22
23 /** 23 /**
24 * 左侧边栏的分类和图标数据 24 * 左侧边栏的分类和图标数据
@@ -40,6 +40,7 @@ class SideData @@ -40,6 +40,7 @@ class SideData
40 40
41 $param = Yohobuy::param(); 41 $param = Yohobuy::param();
42 $param['client_type'] = 'h5'; // 调用H5手机网站的 42 $param['client_type'] = 'h5'; // 调用H5手机网站的
  43 + $param['private_key'] = 'fd4ad5fcfa0de589ef238c0e7331b585'; // 调用Android的private_key不然会有参数验证错误的bug
43 $param['client_secret'] = Sign::getSign($param); 44 $param['client_secret'] = Sign::getSign($param);
44 45
45 return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_LEFTNAV_CATEGORY, $param); 46 return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_LEFTNAV_CATEGORY, $param);
@@ -52,13 +52,20 @@ class DetailData @@ -52,13 +52,20 @@ class DetailData
52 * 商品尺码信息 52 * 商品尺码信息
53 * 53 *
54 * @param int $productSkn 商品SKN号 54 * @param int $productSkn 商品SKN号
  55 + * @param int $uid 用户ID
  56 + * @param int $udid 客户端唯一标识
55 * @return array 57 * @return array
56 */ 58 */
57 - public static function sizeInfo($productSkn) 59 + public static function sizeInfo($productSkn, $uid, $udid)
58 { 60 {
59 $param = Yohobuy::param(); 61 $param = Yohobuy::param();
60 $param['method'] = 'h5.product.intro'; 62 $param['method'] = 'h5.product.intro';
61 $param['productskn'] = $productSkn; 63 $param['productskn'] = $productSkn;
  64 + if (!empty($uid)) {
  65 + $param['uid'] = $uid;
  66 + }
  67 + $param['udid'] = $udid;
  68 +
62 $param['client_secret'] = Sign::getSign($param); 69 $param['client_secret'] = Sign::getSign($param);
63 70
64 return Yohobuy::get(Yohobuy::API_URL, $param); 71 return Yohobuy::get(Yohobuy::API_URL, $param);
@@ -4,8 +4,7 @@ @@ -4,8 +4,7 @@
4 * @date: 2015/10/10 4 * @date: 2015/10/10
5 */ 5 */
6 6
7 -var $ = require('jquery'),  
8 - Swiper = require('yoho.iswiper'); 7 +var $ = require('jquery');
9 8
10 var info = require('./info'), 9 var info = require('./info'),
11 loadMore = info.loadMore; 10 loadMore = info.loadMore;
@@ -24,18 +23,12 @@ var $infoList = $('#info-list'), @@ -24,18 +23,12 @@ var $infoList = $('#info-list'),
24 23
25 var state = {}; 24 var state = {};
26 25
27 -var mySwiper;  
28 -  
29 if ($loadMoreInfo.length > 0) { 26 if ($loadMoreInfo.length > 0) {
30 $loading = $loadMoreInfo.children('.loading'); 27 $loading = $loadMoreInfo.children('.loading');
31 $noMore = $loadMoreInfo.children('.no-more'); 28 $noMore = $loadMoreInfo.children('.no-more');
32 } 29 }
33 30
34 -mySwiper = new Swiper('.swiper-container', {  
35 - lazyLoading: true,  
36 - pagination: '.swiper-pagination',  
37 - autoplay: 3000  
38 -}); 31 +info.initSwiper(curType);
39 32
40 info.initInfosEvt($infoList); 33 info.initInfosEvt($infoList);
41 34
@@ -86,6 +79,7 @@ $nav.on('touchend touchcancel', function(e) { @@ -86,6 +79,7 @@ $nav.on('touchend touchcancel', function(e) {
86 $loading.addClass('hide'); 79 $loading.addClass('hide');
87 $noMore.addClass('hide'); 80 $noMore.addClass('hide');
88 81
  82 + state[curType].isTab = true;
89 loadMore($content, state[curType]); 83 loadMore($content, state[curType]);
90 } else { 84 } else {
91 85
@@ -7,16 +7,19 @@ @@ -7,16 +7,19 @@
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 Hammer = require('yoho.hammer'), 8 Hammer = require('yoho.hammer'),
9 ellipsis = require('mlellipsis'), 9 ellipsis = require('mlellipsis'),
10 - lazyLoad = require('yoho.lazyload'); 10 + lazyLoad = require('yoho.lazyload'),
  11 + Swiper = require('yoho.iswiper');
11 12
12 var tip = require('../plugin/tip'); 13 var tip = require('../plugin/tip');
13 var loading = require('../plugin/loading'); 14 var loading = require('../plugin/loading');
14 15
15 var $loadMoreInfo = $('#load-more-info'); 16 var $loadMoreInfo = $('#load-more-info');
16 var $loading = $(''), 17 var $loading = $(''),
17 - $noMore = $(''); 18 + $noMore = $(''),
  19 + $swiper = $('');
18 20
19 var searching = false; 21 var searching = false;
  22 +var mySwiper = {};
20 23
21 ellipsis.init(); 24 ellipsis.init();
22 25
@@ -25,6 +28,19 @@ if ($loadMoreInfo.length > 0) { @@ -25,6 +28,19 @@ if ($loadMoreInfo.length > 0) {
25 $noMore = $loadMoreInfo.children('.no-more'); 28 $noMore = $loadMoreInfo.children('.no-more');
26 } 29 }
27 30
  31 +//初始化swiper
  32 +function initSwiper(typeId) {
  33 + if (typeof typeId === undefined) {
  34 + return;
  35 + }
  36 + mySwiper[typeId] = new Swiper('.swiper-cont-' + typeId, {
  37 + lazyLoading: true,
  38 + wrapperClass: 'swiper-wrap-' + typeId,
  39 + pagination: '.swiper-pagi-' + typeId,
  40 + autoplay: 3000
  41 + });
  42 +}
  43 +
28 /** 44 /**
29 * 设置指定资讯项的Lazyload和文字截取 45 * 设置指定资讯项的Lazyload和文字截取
30 * @params $infos 资讯项 46 * @params $infos 资讯项
@@ -175,6 +191,14 @@ function loadMore($container, opt, url) { @@ -175,6 +191,14 @@ function loadMore($container, opt, url) {
175 191
176 $container.append(data); 192 $container.append(data);
177 193
  194 + $swiper = $container.find('.swiper-container');
  195 + if ($swiper.length) {
  196 + $swiper.addClass('swiper-cont-' + opt.type);
  197 + $swiper.children('.swiper-wrapper').addClass('swiper-wrap-' + opt.type);
  198 + $swiper.children('.swiper-pagination').addClass('swiper-pagi-' + opt.type);
  199 + initSwiper(opt.type);
  200 + }
  201 +
178 if (num > 0) { 202 if (num > 0) {
179 $newItems = $container.find('.guang-info:gt(' + (num - 1) + ')'); 203 $newItems = $container.find('.guang-info:gt(' + (num - 1) + ')');
180 } else { 204 } else {
@@ -194,14 +218,19 @@ function loadMore($container, opt, url) { @@ -194,14 +218,19 @@ function loadMore($container, opt, url) {
194 opt.page++; 218 opt.page++;
195 219
196 searching = false; 220 searching = false;
  221 + delete opt.isTab;
197 }, 222 },
198 error: function() { 223 error: function() {
199 tip.show('网络断开连接了~'); 224 tip.show('网络断开连接了~');
200 searching = false; 225 searching = false;
  226 + delete opt.isTab;
201 } 227 }
202 }); 228 });
203 } 229 }
204 230
  231 +
  232 +exports.mySwiper = mySwiper;
  233 +exports.initSwiper = initSwiper;
205 exports.initInfosEvt = initInfosEvt; 234 exports.initInfosEvt = initInfosEvt;
206 exports.setLazyLoadAndMellipsis = setLazyLoadAndMellipsis; 235 exports.setLazyLoadAndMellipsis = setLazyLoadAndMellipsis;
207 exports.loadMore = loadMore; 236 exports.loadMore = loadMore;
@@ -7,20 +7,40 @@ @@ -7,20 +7,40 @@
7 left: 0; 7 left: 0;
8 right: 100rem / $pxConvertRem; 8 right: 100rem / $pxConvertRem;
9 width: 540rem / $pxConvertRem; 9 width: 540rem / $pxConvertRem;
  10 + background: #f0f0f0;
10 overflow: hidden; 11 overflow: hidden;
  12 + overflow-y: auto;
11 @include transition(all .3s); 13 @include transition(all .3s);
12 14
13 - ul {  
14 - background: #f0f0f0; 15 + > ul {
  16 + margin-bottom: 20rem / $pxConvertRem;
  17 + background: #fff;
  18 + border-top: 1px solid #e0e0e0;
  19 + border-bottom: 1px solid #e0e0e0;
15 } 20 }
16 21
17 li { 22 li {
18 position: relative; 23 position: relative;
19 - height: 128rem / $pxConvertRem;  
20 - line-height: 128rem / $pxConvertRem;  
21 - border-bottom: 1px solid #e0e0e0; 24 + height: 80rem / $pxConvertRem;
  25 + line-height: 80rem / $pxConvertRem;
22 background: #fff; 26 background: #fff;
23 27
  28 + &:after {
  29 + content: '';
  30 + position: absolute;
  31 + right: 0;
  32 + bottom: 0;
  33 + width: 430rem / $pxConvertRem;
  34 + height: 0;
  35 + border-top: 1px solid #e0e0e0;
  36 + }
  37 +
  38 + &:last-child {
  39 + &:after {
  40 + content: none;
  41 + }
  42 + }
  43 +
24 a { 44 a {
25 display: block; 45 display: block;
26 height: 100%; 46 height: 100%;
@@ -29,6 +49,15 @@ @@ -29,6 +49,15 @@
29 font-size: 24rem / $pxConvertRem; 49 font-size: 24rem / $pxConvertRem;
30 } 50 }
31 51
  52 + .title {
  53 + display: inline-block;
  54 + padding-left: 10rem / $pxConvertRem;
  55 + font-size: 30rem / $pxConvertRem;
  56 + vertical-align: baseline;
  57 + // 此处字体小于 12px, 先扩大,再scale缩小
  58 + @include transform(scale(0.75));
  59 + }
  60 +
32 .nav-icon, .nav-img { 61 .nav-icon, .nav-img {
33 position: absolute; 62 position: absolute;
34 width: 60rem / $pxConvertRem; 63 width: 60rem / $pxConvertRem;
@@ -51,9 +80,38 @@ @@ -51,9 +80,38 @@
51 } 80 }
52 81
53 em { 82 em {
54 - margin-right: 10rem / $pxConvertRem;  
55 font-weight: bold; 83 font-weight: bold;
56 - font-size: 34rem / $pxConvertRem; 84 + font-size: 30rem / $pxConvertRem;
  85 + }
  86 + }
  87 +
  88 + .first {
  89 +
  90 + li {
  91 + height: 100rem / $pxConvertRem;
  92 + line-height: 100rem / $pxConvertRem;
  93 + border-bottom: 1px solid #e0e0e0;
  94 +
  95 + &:last-child {
  96 + border-bottom: none;
  97 + }
  98 +
  99 + &:after {
  100 + content: none;
  101 + }
  102 +
  103 + a {
  104 + font-size: 40rem / $pxConvertRem;
  105 + }
  106 +
  107 + em {
  108 + font-size: 40rem / $pxConvertRem;
  109 + }
  110 +
  111 + .title {
  112 + font-size: 24rem / $pxConvertRem;
  113 + @include transform(scale(1));
  114 + }
57 } 115 }
58 } 116 }
59 117
@@ -85,17 +143,17 @@ @@ -85,17 +143,17 @@
85 } 143 }
86 } 144 }
87 145
88 - li.new {  
89 - margin: (19rem / $pxConvertRem) 0 0;  
90 - border-top: 1px solid #e0e0e0;  
91 -  
92 - a {}  
93 -  
94 - i {  
95 - background: image-url("side-nav/new.png") no-repeat left center;  
96 - background-size: 100% 100%;  
97 - }  
98 - } 146 + // li.new {
  147 + // margin: (19rem / $pxConvertRem) 0 0;
  148 + // border-top: 1px solid #e0e0e0;
  149 + //
  150 + // a {}
  151 + //
  152 + // i {
  153 + // background: image-url("side-nav/new.png") no-repeat left center;
  154 + // background-size: 100% 100%;
  155 + // }
  156 + // }
99 157
100 li.guang, li.trendfinder { 158 li.guang, li.trendfinder {
101 .nav-icon { 159 .nav-icon {
@@ -123,16 +181,20 @@ @@ -123,16 +181,20 @@
123 @include transition(transform 0.3s); 181 @include transition(transform 0.3s);
124 182
125 li { 183 li {
126 - height: 109rem / $pxConvertRem;  
127 - line-height: 109rem / $pxConvertRem; 184 + height: 80rem / $pxConvertRem;
  185 + line-height: 80rem / $pxConvertRem;
128 border: none; 186 border: none;
  187 + border-bottom: 1px solid #e0e0e0;
  188 +
  189 + &:after {
  190 + content: none;
  191 + }
129 192
130 a { 193 a {
131 position: relative; 194 position: relative;
132 display: block; 195 display: block;
133 margin: 0 0 0 (30rem / $pxConvertRem); 196 margin: 0 0 0 (30rem / $pxConvertRem);
134 padding-left: 50rem / $pxConvertRem; 197 padding-left: 50rem / $pxConvertRem;
135 - border-bottom: 1px solid #e0e0e0;  
136 font-size: 36rem / $pxConvertRem; 198 font-size: 36rem / $pxConvertRem;
137 z-index: 2; 199 z-index: 2;
138 } 200 }
@@ -173,7 +235,7 @@ @@ -173,7 +235,7 @@
173 a { 235 a {
174 color: #fff; 236 color: #fff;
175 border-bottom: none; 237 border-bottom: none;
176 - padding-left: 110rem / $pxConvertRem; 238 + padding-left: 70rem / $pxConvertRem;
177 } 239 }
178 240
179 .nav-back { 241 .nav-back {
@@ -185,6 +247,7 @@ @@ -185,6 +247,7 @@
185 247
186 .sub-nav.show { 248 .sub-nav.show {
187 display: block; 249 display: block;
  250 + z-index: 1;
188 @include transform(translateX(0)); 251 @include transform(translateX(0));
189 @include transition(transform 0.3s); 252 @include transition(transform 0.3s);
190 } 253 }
1 .browse-record-good { 1 .browse-record-good {
2 position: relative; 2 position: relative;
3 padding: 0.5rem 0 0.5rem 0.75rem; 3 padding: 0.5rem 0 0.5rem 0.75rem;
  4 + display: block;
4 5
5 .thumb { 6 .thumb {
6 float: left; 7 float: left;
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="guang-list-page guang-page yoho-page"> 2 <div class="guang-list-page guang-page yoho-page">
3 {{# guang}} 3 {{# guang}}
4 - {{#if swiper}}  
5 - <div class="swiper-container">  
6 - <div class="swiper-wrapper">  
7 - {{# swiper}}  
8 - <div class="swiper-slide">  
9 - <a href="{{url}}">  
10 - <img class="swiper-lazy" data-src="{{img}}">  
11 - </a>  
12 - <div class="swiper-lazy-preloader"></div>  
13 - </div>  
14 - {{/ swiper}}  
15 - </div>  
16 - <div class="swiper-pagination"></div>  
17 - </div>  
18 - {{/if}}  
19 4
20 <ul id="guang-nav" class="guang-nav clearfix"> 5 <ul id="guang-nav" class="guang-nav clearfix">
21 {{# navs}} 6 {{# navs}}
@@ -28,6 +13,23 @@ @@ -28,6 +13,23 @@
28 <div id="info-list" class="info-list-container"> 13 <div id="info-list" class="info-list-container">
29 {{# infos}} 14 {{# infos}}
30 <div class="info-list{{^show}} hide{{/show}}"> 15 <div class="info-list{{^show}} hide{{/show}}">
  16 + {{#if show}}
  17 + {{#if ../swiper}}
  18 + <div class="swiper-container swiper-cont-{{@index}}">
  19 + <div class="swiper-wrapper swiper-wrap-{{@index}}">
  20 + {{# swiper}}
  21 + <div class="swiper-slide">
  22 + <a href="{{url}}">
  23 + <img class="swiper-lazy" data-src="{{img}}">
  24 + </a>
  25 + <div class="swiper-lazy-preloader"></div>
  26 + </div>
  27 + {{/ swiper}}
  28 + </div>
  29 + <div class="swiper-pagination swiper-pagi-{{@index}}"></div>
  30 + </div>
  31 + {{/if}}
  32 + {{/if}}
31 {{# info}} 33 {{# info}}
32 {{> guang/info}} 34 {{> guang/info}}
33 {{/ info}} 35 {{/ info}}
  1 +{{#if swiper}}
  2 + <div class="swiper-container">
  3 + <div class="swiper-wrapper">
  4 + {{# swiper}}
  5 + <div class="swiper-slide">
  6 + <a href="{{url}}">
  7 + <img class="swiper-lazy" data-src="{{img}}">
  8 + </a>
  9 + <div class="swiper-lazy-preloader"></div>
  10 + </div>
  11 + {{/ swiper}}
  12 + </div>
  13 + <div class="swiper-pagination"></div>
  14 + </div>
  15 +{{/if}}
  16 +
1 {{# infos}} 17 {{# infos}}
2 {{> guang/info}} 18 {{> guang/info}}
3 {{/ infos}} 19 {{/ infos}}
1 {{# browseRecord}} 1 {{# browseRecord}}
2 - <div class="browse-record-good clearfix" data-skn="{{product_skn}}"> 2 + <a class="browse-record-good clearfix" data-skn="{{product_skn}}" href="{{link}}">
3 <img class="thumb lazy" data-original="{{image}}"> 3 <img class="thumb lazy" data-original="{{image}}">
4 <div class="deps clearfix"> 4 <div class="deps clearfix">
5 <p class="name row">{{product_name}}</p> 5 <p class="name row">{{product_name}}</p>
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 </p> 17 </p>
18 <span class="iconfont del-icon">&#xe621;</span> 18 <span class="iconfont del-icon">&#xe621;</span>
19 </div> 19 </div>
20 - </div> 20 + </a>
21 {{/ browseRecord}} 21 {{/ browseRecord}}
22 22
23 {{#if noRecord}} 23 {{#if noRecord}}
@@ -60,6 +60,12 @@ @@ -60,6 +60,12 @@
60 运费 60 运费
61 <span>{{freight}}</span> 61 <span>{{freight}}</span>
62 </li> 62 </li>
  63 + {{#if promo_code_amount}}
  64 + <li>
  65 + 优惠码
  66 + <span>{{promo_code_amount}}</span>
  67 + </li>
  68 + {{/if}}
63 {{#if coupon}} 69 {{#if coupon}}
64 <li> 70 <li>
65 优惠券 71 优惠券
1 -<div class="shopping-cart-good clearfix" data-id="{{id}}"> 1 +<div class="shopping-cart-good clearfix" data-id="{{id}}" data-skn="{{skn}}">
2 {{#if inValid}} 2 {{#if inValid}}
3 <span class="few-tag-expire">失效</span> 3 <span class="few-tag-expire">失效</span>
4 {{/if}} 4 {{/if}}
1 <div class="side-nav"> 1 <div class="side-nav">
2 - <ul>  
3 {{# sideNav}} 2 {{# sideNav}}
  3 + <ul {{#if @first}}class="first"{{/if}}>
  4 + {{# this}}
4 <li class="{{styleClass}}"> 5 <li class="{{styleClass}}">
5 - {{# url}}  
6 - <a href="{{.}}">  
7 - {{/ url}}  
8 - {{^ url}}  
9 - <a href="javascript:;">  
10 - {{/ url}} 6 + {{#if url}}
  7 + <a href="{{url}}" style="{{#if color}}color:{{color}};{{/if}}">
  8 + {{else}}
  9 + <a href="javascript:;" style="{{#if color}}color:{{color}};{{/if}}">
  10 + {{/if}}
11 {{# img}} 11 {{# img}}
12 <span class="nav-img" style="background-image: url({{.}})"></span> 12 <span class="nav-img" style="background-image: url({{.}})"></span>
13 {{/ img}} 13 {{/ img}}
14 {{^ img}} 14 {{^ img}}
15 <i class="nav-icon"></i> 15 <i class="nav-icon"></i>
16 {{/ img}} 16 {{/ img}}
17 - <em>{{textCn}}</em>{{textEn}} 17 + <em>{{textCn}}</em>
  18 + <span class="title">{{textEn}}</span>
18 {{# subNav}} 19 {{# subNav}}
19 <span class="enter-subnav iconfont">&#xe614;</span> 20 <span class="enter-subnav iconfont">&#xe614;</span>
20 {{/ subNav}} 21 {{/ subNav}}
@@ -22,13 +23,12 @@ @@ -22,13 +23,12 @@
22 {{# subNav}} 23 {{# subNav}}
23 <ul class="sub-nav"> 24 <ul class="sub-nav">
24 {{# list}} 25 {{# list}}
25 - <li class="{{# isSelect}}current{{/ isSelect}}" style="background-color:{{bgColor}}">  
26 - {{# url}}  
27 - <a href="{{.}}">  
28 - {{/ url}}  
29 - {{^ url}}  
30 - <a href="javascript:;">  
31 - {{/ url}} 26 + <li class="{{# isSelect}}current{{/ isSelect}}" style="background-color:{{bgColor}};">
  27 + {{#if url}}
  28 + <a href="{{url}}" style="{{#if color}}color:{{color}};{{/if}}">
  29 + {{else}}
  30 + <a href="javascript:;" style="{{#if color}}color:{{color}};{{/if}}">
  31 + {{/if}}
32 {{^ back}} 32 {{^ back}}
33 <span class="nav-point iconfont">&#xe60c;</span> 33 <span class="nav-point iconfont">&#xe60c;</span>
34 {{/ back}} 34 {{/ back}}
@@ -36,13 +36,14 @@ @@ -36,13 +36,14 @@
36 <i class="nav-back iconfont">&#xe610;</i> 36 <i class="nav-back iconfont">&#xe610;</i>
37 {{/ back}} 37 {{/ back}}
38 <em>{{textCn}}</em> 38 <em>{{textCn}}</em>
39 - {{textEn}} 39 + <span class="title">{{textEn}}</span>
40 </a> 40 </a>
41 </li> 41 </li>
42 {{/ list}} 42 {{/ list}}
43 </ul> 43 </ul>
44 {{/ subNav}} 44 {{/ subNav}}
45 </li> 45 </li>
46 - {{/ sideNav}} 46 + {{/ this}}
47 </ul> 47 </ul>
  48 + {{/sideNav}}
48 </div> 49 </div>
@@ -315,6 +315,52 @@ class IndexModel @@ -315,6 +315,52 @@ class IndexModel
315 } 315 }
316 316
317 /** 317 /**
  318 + * 获取切换逛类别或者分页时的文章数据
  319 + *
  320 + * @param string $gender "1,3"表示男, "2,3"表示女
  321 + * @param int $sortId 分类ID
  322 + * @param int $uid 用户ID
  323 + * @param string $udid 客户端唯一标识
  324 + * @param int $page 分页第几页, 默认第1页
  325 + * @param string $tag 标签
  326 + * @param string $authorId 作者ID
  327 + * @param boolean $isApp 是否是APP
  328 + * @param boolean $showAuthor 是否显示作者
  329 + * @param boolean $isTab 是否为tab切换操作
  330 + * @return array
  331 + */
  332 + public static function getPageData($gender, $sortId, $uid, $udid, $page, $tag, $authorId, $isApp, $showAuthor, $isTab)
  333 + {
  334 + $result = array();
  335 +
  336 + do {
  337 + $article = ListData::article($gender, $sortId, $uid, $udid, $page, $tag, $authorId);
  338 + if (empty($article['data']['list']['artList'])) {
  339 + break;
  340 + }
  341 +
  342 + // 广告列表
  343 + if ($isTab && !empty($article['data']['list']['adlist'])) {
  344 + foreach ($article['data']['list']['adlist'] as $value) {
  345 + $build = array();
  346 + $build['url'] = Helpers::getFilterUrl($value['url']);
  347 + $build['img'] = Helpers::getImageUrl($value['src'], 830, 327);
  348 + $result['swiper'][] = $build;
  349 + }
  350 + }
  351 +
  352 + /* 构建资讯文章内容 */
  353 + $build = array();
  354 + foreach ($article['data']['list']['artList'] as $article) {
  355 + $build[] = Helpers::formatArticle($article, true, $isApp, $showAuthor, $uid);
  356 + }
  357 + $result['infos'] = $build;
  358 + } while (false);
  359 +
  360 + return $result;
  361 + }
  362 +
  363 + /**
318 * 构建信息内容 364 * 构建信息内容
319 * 365 *
320 * @param array $data 366 * @param array $data
@@ -2,6 +2,8 @@ @@ -2,6 +2,8 @@
2 2
3 namespace Home; 3 namespace Home;
4 4
  5 +use Configs\CacheConfig;
  6 +use LibModels\Wap\Home\IndexData;
5 use LibModels\Wap\Home\OrderData; 7 use LibModels\Wap\Home\OrderData;
6 use Plugin\Helpers; 8 use Plugin\Helpers;
7 9
@@ -14,6 +16,7 @@ class OrderModel @@ -14,6 +16,7 @@ class OrderModel
14 16
15 const CODE_PAYMENT = '04cf5abaa7c20178325a07c4a833782c'; //支付订单资源码 17 const CODE_PAYMENT = '04cf5abaa7c20178325a07c4a833782c'; //支付订单资源码
16 const CODE_STROLL = 'a7989369aa86681c678bc40f171b8f1d'; //随便逛逛url地址资源码 18 const CODE_STROLL = 'a7989369aa86681c678bc40f171b8f1d'; //随便逛逛url地址资源码
  19 + const CODE_LOGISTIC_BANNER = '1fc9b2484fcd559049f2f7e0db313f20'; // 物流详情banner资源码
17 20
18 /** 21 /**
19 * 订单相关数据处理 22 * 订单相关数据处理
@@ -99,9 +102,16 @@ class OrderModel @@ -99,9 +102,16 @@ class OrderModel
99 { 102 {
100 $result = array(); 103 $result = array();
101 104
102 - if (isset($orderCode) && is_numeric($uid)) { 105 + do {
  106 + if (!isset($orderCode) || !is_numeric($uid)) {
  107 + break;
  108 + }
  109 +
103 $logistics = OrderData::LogisticsData($orderCode, $uid); 110 $logistics = OrderData::LogisticsData($orderCode, $uid);
104 - if (!empty($logistics['data'])) { 111 + if (empty($logistics['data'])) {
  112 + break;
  113 + }
  114 +
105 $result['logisticUrl'] = $logistics['data']['url']; 115 $result['logisticUrl'] = $logistics['data']['url'];
106 $result['logisticImg'] = $logistics['data']['logo']; 116 $result['logisticImg'] = $logistics['data']['logo'];
107 $result['logisticCompany'] = $logistics['data']['caption']; 117 $result['logisticCompany'] = $logistics['data']['caption'];
@@ -113,6 +123,56 @@ class OrderModel @@ -113,6 +123,56 @@ class OrderModel
113 $build['date'] = $value['acceptTime']; 123 $build['date'] = $value['acceptTime'];
114 $result['logisticDetail'][] = $build; 124 $result['logisticDetail'][] = $build;
115 } 125 }
  126 +
  127 + // 获取物流详情页banner
  128 + $banner = self::getLogisterBanner();
  129 + if ($banner) {
  130 + $result['banner'] = $banner;
  131 + }
  132 +
  133 + } while (false);
  134 +
  135 + return $result;
  136 + }
  137 +
  138 + /**
  139 + * 获取物流详情页banner
  140 + *
  141 + * @return array|bool
  142 + */
  143 + private static function getLogisterBanner()
  144 + {
  145 + $result = false;
  146 +
  147 + if (USE_CACHE) {
  148 + // 先尝试获取一级缓存(master), 有数据则直接返回.
  149 + $result = Cache::get(CacheConfig::KEY_CODE_LOGISTIC_BANNER, 'master');
  150 + if (!empty($result)) {
  151 + return $result;
  152 + }
  153 + }
  154 +
  155 + // 调用接口获取数据
  156 + $banner = IndexData::getBannerStart(self::CODE_LOGISTIC_BANNER);
  157 + if (isset($banner['code']) && $banner['code'] == 200 && !empty($banner['data'])) {
  158 + $result = array();
  159 + // 处理数据
  160 + foreach ($banner['data'] as $val) {
  161 + foreach ($val['data'] as $single) {
  162 + $result['url'] = Helpers::getFilterUrl($single['url']);
  163 + $result['img'] = Helpers::getImageUrl($single['src'], 640, 200);
  164 + }
  165 + }
  166 + }
  167 +
  168 + if (USE_CACHE) {
  169 + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
  170 + if (empty($result)) {
  171 + $result = Cache::get(CacheConfig::KEY_CODE_LOGISTIC_BANNER, 'slave');
  172 + }
  173 + // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
  174 + else {
  175 + Cache::set(CacheConfig::KEY_CODE_LOGISTIC_BANNER, $result);
116 } 176 }
117 } 177 }
118 178
@@ -148,6 +208,10 @@ class OrderModel @@ -148,6 +208,10 @@ class OrderModel
148 $result['salePrice'] = self::filterOrderPrice($orderDetail['data']['promotion_amount']); // 活动金额 208 $result['salePrice'] = self::filterOrderPrice($orderDetail['data']['promotion_amount']); // 活动金额
149 $result['freight'] = $orderDetail['data']['shipping_cost']; // 运费 209 $result['freight'] = $orderDetail['data']['shipping_cost']; // 运费
150 $result['coupon'] = self::filterOrderPrice($orderDetail['data']['coupons_amount']); // 优惠券 210 $result['coupon'] = self::filterOrderPrice($orderDetail['data']['coupons_amount']); // 优惠券
  211 + if (isset($orderDetail['data']['promo_code_amount'])) {
  212 + $result['promo_code_amount'] = self::filterOrderPrice($orderDetail['data']['promo_code_amount']); // 优惠码
  213 + }
  214 +
151 $result['yohoCoin'] = self::filterOrderPrice($orderDetail['data']['yoho_coin_num']); // YOHO币 215 $result['yohoCoin'] = self::filterOrderPrice($orderDetail['data']['yoho_coin_num']); // YOHO币
152 $result['price'] = $orderDetail['data']['amount']; // 实付金额 216 $result['price'] = $orderDetail['data']['amount']; // 实付金额
153 $result['goodsAmount'] = $orderDetail['data']['payment_amount']; // 商品总金额没有人民币符号 217 $result['goodsAmount'] = $orderDetail['data']['payment_amount']; // 商品总金额没有人民币符号
@@ -224,8 +224,7 @@ class CartModel @@ -224,8 +224,7 @@ class CartModel
224 224
225 $product = CartData::cartProductData($uid, $skn); 225 $product = CartData::cartProductData($uid, $skn);
226 if (isset($product['code']) && $product['code'] === 200) { 226 if (isset($product['code']) && $product['code'] === 200) {
227 - $result['code'] = 200;  
228 - $result['data'] = self::procGoodsDetail($product['data'], $num); 227 + $result = self::procGoodsDetail($product['data'], $num);
229 } 228 }
230 229
231 return $result; 230 return $result;
@@ -244,7 +243,7 @@ class CartModel @@ -244,7 +243,7 @@ class CartModel
244 243
245 $product = CartData::giftProductData($skn, $promotionId); 244 $product = CartData::giftProductData($skn, $promotionId);
246 if (isset($product['code']) && $product['code'] === 200) { 245 if (isset($product['code']) && $product['code'] === 200) {
247 - $result['data'] = self::procGoodsDetail($product['data']); 246 + $result = self::procGoodsDetail($product['data']);
248 } 247 }
249 248
250 return $result; 249 return $result;
@@ -39,16 +39,47 @@ class SideModel @@ -39,16 +39,47 @@ class SideModel
39 // 调用接口获取后台配置的侧边栏数据 39 // 调用接口获取后台配置的侧边栏数据
40 $side = SideData::leftNav(); 40 $side = SideData::leftNav();
41 if (!empty($side['data'])) { 41 if (!empty($side['data'])) {
  42 + $group = array();
  43 + $num = 0;
  44 + $groupKey = 0;
  45 + $count = count(($side['data']));
42 foreach ($side['data'] as $key => $value) { 46 foreach ($side['data'] as $key => $value) {
  47 + if ($value['separative_sign'] === 'Y') {
  48 + $result[$num] = $group;
  49 + $num++;
  50 + $groupKey = 0;
  51 + $group = array();
  52 + }
  53 +
43 // 逛的按照原来的做法,使用配置 54 // 逛的按照原来的做法,使用配置
44 if ($value['sort_name_en'] === 'TRENDFINDER') { 55 if ($value['sort_name_en'] === 'TRENDFINDER') {
45 continue; 56 continue;
46 } 57 }
47 - $result[$key]['textCn'] = $value['sort_name'];  
48 - $result[$key]['textEn'] = $value['sort_name_en'];  
49 - $result[$key]['styleClass'] = strtolower($value['sort_name_en']);  
50 - $result[$key]['url'] = Helpers::getFilterUrl($value['sort_url']);  
51 - $result[$key]['img'] = Helpers::getImageUrl($value['sort_ico'], 60, 60, 1); 58 + $group[$groupKey] = self::formatSideItem($value);
  59 +
  60 + // 如果存在子菜单,就输出子菜单
  61 + if (isset($value['sub']) && !empty($value['sub'])) {
  62 + $subs = array(
  63 + array(
  64 + 'textCn' => $group[$groupKey]['textCn'],
  65 + 'textEn' => $group[$groupKey]['textEn'],
  66 + 'back' => true,
  67 + 'isSelect' => false,
  68 + 'bgColor' => self::getSideTopColor($guangChoosed)
  69 + )
  70 + );
  71 + foreach ($value['sub'] as $oneSub) {
  72 + $subs[] = self::formatSideItem($oneSub);
  73 + }
  74 +
  75 + $group[$groupKey]['styleClass'] = 'guang';
  76 + $group[$groupKey]['subNav']['list'] = $subs;
  77 + }
  78 + $groupKey++;
  79 +
  80 + if ($count === $key + 1) {
  81 + $result[$num] = $group;
  82 + }
52 } 83 }
53 } 84 }
54 85
@@ -78,16 +109,11 @@ class SideModel @@ -78,16 +109,11 @@ class SideModel
78 private static function genLeftNavGuang($guangChoosed = 'all') 109 private static function genLeftNavGuang($guangChoosed = 'all')
79 { 110 {
80 // 判断逛的背景色 111 // 判断逛的背景色
81 - $color = false;  
82 - if ($guangChoosed === 'girls') {  
83 - $color = '#FF88AE';  
84 - } else if ($guangChoosed === 'kids') {  
85 - $color = '#7ad9f9';  
86 - } else if ($guangChoosed === 'lifestyle') {  
87 - $color = '#4f4138';  
88 - } 112 + $color = self::getSideTopColor($guangChoosed);
89 113
90 - return array( 114 + return
  115 + array(
  116 + array(
91 'textCn' => '逛', 117 'textCn' => '逛',
92 'textEn' => 'TRENDFINDER', 118 'textEn' => 'TRENDFINDER',
93 'styleClass' => 'guang', 119 'styleClass' => 'guang',
@@ -123,7 +149,51 @@ class SideModel @@ -123,7 +149,51 @@ class SideModel
123 ), 149 ),
124 ) 150 )
125 ) 151 )
  152 + )
126 ); 153 );
127 } 154 }
128 155
  156 + /**
  157 + * 根据选择的频道获取逛的背景色
  158 + * @param string $guangChoosed 逛默认选中项 "all"表示全部,"boys":只看男生,"girls":只看女生
  159 + * @return string color值
  160 + */
  161 + private static function getSideTopColor($guangChoosed)
  162 + {
  163 + // 判断逛的背景色
  164 + $color = false;
  165 + if ($guangChoosed === 'girls') {
  166 + $color = '#FF88AE';
  167 + } else if ($guangChoosed === 'kids') {
  168 + $color = '#7ad9f9';
  169 + } else if ($guangChoosed === 'lifestyle') {
  170 + $color = '#4f4138';
  171 + }
  172 +
  173 + return $color;
  174 + }
  175 +
  176 +
  177 + /**
  178 + * 格式化侧边栏数据
  179 + *
  180 + * @param array $data 要格式化的侧边栏数据
  181 + * @return array
  182 + */
  183 + private static function formatSideItem($data)
  184 + {
  185 + $result = array();
  186 +
  187 + $result['textCn'] = $data['sort_name'];
  188 + $result['textEn'] = $data['sort_name_en'];
  189 + $result['styleClass'] = strtolower($data['sort_name_en']);
  190 + $result['url'] = Helpers::getFilterUrl($data['sort_url']);
  191 + $result['img'] = Helpers::getImageUrl($data['sort_ico'], 60, 60, 1);
  192 + if (isset($data['sort_name_color'])) {
  193 + $result['color'] = $data['sort_name_color'];
  194 + }
  195 +
  196 + return $result;
  197 + }
  198 +
129 } 199 }
@@ -378,6 +378,11 @@ class UserModel @@ -378,6 +378,11 @@ class UserModel
378 return $result; 378 return $result;
379 } 379 }
380 380
  381 + /**
  382 + * 获取有货币页面的banner数据
  383 + *
  384 + * @return array|bool|mixed
  385 + */
381 public static function getYohoCoinBanner() 386 public static function getYohoCoinBanner()
382 { 387 {
383 $result = false; 388 $result = false;
@@ -335,15 +335,17 @@ class DetailModel @@ -335,15 +335,17 @@ class DetailModel
335 * 商品尺码信息 335 * 商品尺码信息
336 * 336 *
337 * @param int $productSkn 337 * @param int $productSkn
  338 + * @param int $uid 用户ID
  339 + * @param int $udid 客户端唯一标识
338 * @return array 340 * @return array
339 */ 341 */
340 - public static function getSizeInfo($productSkn) 342 + public static function getSizeInfo($productSkn, $uid, $udid)
341 { 343 {
342 $result = array(); 344 $result = array();
343 345
344 if (is_numeric($productSkn)) { 346 if (is_numeric($productSkn)) {
345 // 调用服务 347 // 调用服务
346 - $sizeInfo = DetailData::sizeInfo($productSkn); 348 + $sizeInfo = DetailData::sizeInfo($productSkn, $uid, $udid);
347 349
348 // 商品信息 350 // 商品信息
349 if (isset($sizeInfo['productDescBo']['erpProductId'])) { 351 if (isset($sizeInfo['productDescBo']['erpProductId'])) {
@@ -195,7 +195,9 @@ class IndexController extends AbstractAction @@ -195,7 +195,9 @@ class IndexController extends AbstractAction
195 $result['num'] = $num; 195 $result['num'] = $num;
196 } 196 }
197 197
198 - $this->echoJson($result); 198 + $this->_view->display('gift-info', array(
  199 + 'cartInfo' => $result
  200 + ));
199 } 201 }
200 202
201 // /* 203 // /*
@@ -223,7 +225,7 @@ class IndexController extends AbstractAction @@ -223,7 +225,7 @@ class IndexController extends AbstractAction
223 225
224 $this->_view->display('gift-info', array( 226 $this->_view->display('gift-info', array(
225 'promotionId' => $promotionId, 227 'promotionId' => $promotionId,
226 - 'cartInfo' => $result['data'] 228 + 'cartInfo' => $result
227 )); 229 ));
228 } 230 }
229 231
1 <?php 1 <?php
2 2
3 use Action\AbstractAction; 3 use Action\AbstractAction;
  4 +use Guang\IndexModel;
4 use LibModels\Wap\Guang\ListData; 5 use LibModels\Wap\Guang\ListData;
5 use Plugin\Helpers; 6 use Plugin\Helpers;
6 use Plugin\Cache; 7 use Plugin\Cache;
@@ -42,7 +43,7 @@ class IndexController extends AbstractAction @@ -42,7 +43,7 @@ class IndexController extends AbstractAction
42 // $this->setNavSide(); 43 // $this->setNavSide();
43 // } 44 // }
44 45
45 - $this->_view->display('index', Guang\IndexModel::getArticle($gender, $type, $uid, $udid)); 46 + $this->_view->display('index', IndexModel::getArticle($gender, $type, $uid, $udid));
46 } 47 }
47 48
48 /** 49 /**
@@ -91,7 +92,7 @@ class IndexController extends AbstractAction @@ -91,7 +92,7 @@ class IndexController extends AbstractAction
91 92
92 // 标签聚合内容列表 93 // 标签聚合内容列表
93 //$article = ListData::article($gender, 0, $uid, $udid, 1, $tag); 94 //$article = ListData::article($gender, 0, $uid, $udid, 1, $tag);
94 - $article = Guang\IndexModel::getArticleByTagOrEditor($gender, 0, $uid, $udid, 1, $tag); 95 + $article = IndexModel::getArticleByTagOrEditor($gender, 0, $uid, $udid, 1, $tag);
95 // 标签聚合内容不存在, 跳到错误页面 96 // 标签聚合内容不存在, 跳到错误页面
96 if (empty($article['data']['list']['artList'])) { 97 if (empty($article['data']['list']['artList'])) {
97 $this->error(); 98 $this->error();
@@ -184,7 +185,7 @@ class IndexController extends AbstractAction @@ -184,7 +185,7 @@ class IndexController extends AbstractAction
184 185
185 // 标签聚合内容列表 186 // 标签聚合内容列表
186 //$article = ListData::article($gender, 0, $uid, $udid, 1, null, $id); 187 //$article = ListData::article($gender, 0, $uid, $udid, 1, null, $id);
187 - $article = Guang\IndexModel::getArticleByTagOrEditor($gender, 0, $uid, $udid, 1, null, $id); 188 + $article = IndexModel::getArticleByTagOrEditor($gender, 0, $uid, $udid, 1, null, $id);
188 // 构建资讯文章内容 189 // 构建资讯文章内容
189 if (!empty($article['data']['list']['artList'])) { 190 if (!empty($article['data']['list']['artList'])) {
190 $build = array(); 191 $build = array();
@@ -227,6 +228,7 @@ class IndexController extends AbstractAction @@ -227,6 +228,7 @@ class IndexController extends AbstractAction
227 $gender = $this->get('gender'); 228 $gender = $this->get('gender');
228 $authorId = $this->get('authorId'); 229 $authorId = $this->get('authorId');
229 $isApp = $this->get('isApp', false); 230 $isApp = $this->get('isApp', false);
  231 + $isTab = $this->get('isTab', false); // 是否为tab切换操作
230 $showAuthor = true; 232 $showAuthor = true;
231 if (!empty($sortId) && !is_numeric($sortId)) { 233 if (!empty($sortId) && !is_numeric($sortId)) {
232 break; 234 break;
@@ -247,18 +249,7 @@ class IndexController extends AbstractAction @@ -247,18 +249,7 @@ class IndexController extends AbstractAction
247 $udid = $this->getUdid(); 249 $udid = $this->getUdid();
248 } 250 }
249 //$page = intval($page) + 1; 251 //$page = intval($page) + 1;
250 - $article = ListData::article($gender, $sortId, $uid, $udid, $page, $tag, $authorId);  
251 - if (empty($article['data']['list']['artList'])) {  
252 - break;  
253 - }  
254 -  
255 - /* 构建资讯文章内容 */  
256 - $data = array();  
257 - $build = array();  
258 - foreach ($article['data']['list']['artList'] as $article) {  
259 - $build[] = Helpers::formatArticle($article, true, $isApp, $showAuthor, $uid);  
260 - }  
261 - $data['infos'] = $build; 252 + $data = IndexModel::getPageData($gender, $sortId, $uid, $udid, $page, $tag, $authorId, $isApp, $showAuthor, $isTab);
262 } while (false); 253 } while (false);
263 254
264 if (isset($data)) { 255 if (isset($data)) {
@@ -90,7 +90,11 @@ class DetailController extends AbstractAction @@ -90,7 +90,11 @@ class DetailController extends AbstractAction
90 if (!is_numeric($productSkn)) { 90 if (!is_numeric($productSkn)) {
91 echo ' '; 91 echo ' ';
92 } 92 }
93 - $data = \Product\DetailModel::getSizeInfo($productSkn); 93 +
  94 + // 加入uid和udid参数,为了实现记录浏览记录的功能
  95 + $uid = $this->getUid();
  96 + $udid = $this->getUdid();
  97 + $data = \Product\DetailModel::getSizeInfo($productSkn, $uid, $udid);
94 if (array() === $data) { 98 if (array() === $data) {
95 echo ' '; 99 echo ' ';
96 exit(); 100 exit();