Authored by hf

do feature 3.1 3.2 my center and detail page

@@ -19,6 +19,7 @@ class DetailData @@ -19,6 +19,7 @@ class DetailData
19 19
20 const PRODUCT_BASE_INFO = 'product/queryProductDetailByProductId'; 20 const PRODUCT_BASE_INFO = 'product/queryProductDetailByProductId';
21 const PRODUCT_SIZE_INFO = 'product/queryProductIntroBySkn'; 21 const PRODUCT_SIZE_INFO = 'product/queryProductIntroBySkn';
  22 + const PRODUCT_CONSULT_LIST = 'consult/queryConsults';
22 23
23 /** 24 /**
24 * 商品基本信息 25 * 商品基本信息
@@ -29,7 +30,9 @@ class DetailData @@ -29,7 +30,9 @@ class DetailData
29 */ 30 */
30 public static function baseInfo($productId, $uid) 31 public static function baseInfo($productId, $uid)
31 { 32 {
32 - return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_BASE_INFO, array('param' => intval($productId), 'userId' => intval($uid)) ); 33 + return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_BASE_INFO, array(
  34 + 'param' => intval($productId), 'userId' => intval($uid)
  35 + ) );
33 } 36 }
34 37
35 /** 38 /**
@@ -43,4 +46,21 @@ class DetailData @@ -43,4 +46,21 @@ class DetailData
43 return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_SIZE_INFO, array('param' => intval($productSkn) ) ); 46 return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_SIZE_INFO, array('param' => intval($productSkn) ) );
44 } 47 }
45 48
  49 + /**
  50 + * 咨询内容列表
  51 + *
  52 + * @param int $productId 产品ID
  53 + * @param int $pageNum 页码数
  54 + * @param int $pageSize 每页显示个数
  55 + * @return array
  56 + */
  57 + public static function consultList($productId, $pageNum, $pageSize)
  58 + {
  59 + return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_CONSULT_LIST, array(
  60 + 'productId' => intval($productId),
  61 + 'pageNum' => intval($pageNum),
  62 + 'pageSize' => intval($pageSize),
  63 + ) );
  64 + }
  65 +
46 } 66 }
@@ -3,76 +3,74 @@ @@ -3,76 +3,74 @@
3 <div class="banner-container"> 3 <div class="banner-container">
4 <h1 class="is-new-lable">NEW</h1> 4 <h1 class="is-new-lable">NEW</h1>
5 {{# bannerTop}} 5 {{# bannerTop}}
6 - {{> product/banner_swiper_arrow}} 6 + {{> product/banner-swiper-arrow}}
7 {{/ bannerTop}} 7 {{/ bannerTop}}
8 </div> 8 </div>
9 -  
10 {{# goodsName}} 9 {{# goodsName}}
11 <h2 class="goodsName"><span>{{.}}</span></h2> 10 <h2 class="goodsName"><span>{{.}}</span></h2>
12 {{/ goodsName}} 11 {{/ goodsName}}
13 - 12 +
14 {{# goodsSubtitle}} 13 {{# goodsSubtitle}}
15 <h1 class="goodsSubtitle"><span>{{.}}</span></h1> 14 <h1 class="goodsSubtitle"><span>{{.}}</span></h1>
16 {{/ goodsSubtitle}} 15 {{/ goodsSubtitle}}
17 16
18 <div class="price-date"> 17 <div class="price-date">
19 - {{#goodsPrice}}  
20 - <div class="goodsPrice">  
21 - <h1 class="currentPrice">{{currentPrice}}</h1>  
22 - <h1 class="previousPrice">{{previousPrice}}</h1>  
23 - </div>  
24 - {{/goodsPrice}} 18 + {{# goodsPrice}}
  19 + <div class="goodsPrice">
  20 + <h1 class="currentPrice">{{currentPrice}}</h1>
  21 + <h1 class="previousPrice">{{previousPrice}}</h1>
  22 + </div>
  23 + {{/ goodsPrice}}
25 24
26 - {{#periodOfMarket}}  
27 - <div class="periodOfMarket">  
28 - <h1>上市期:</h1>  
29 - <h1 >{{.}}</h1> 25 + {{# periodOfMarket}}
  26 + <div class="periodOfMarket">
  27 + <h1>上市期:</h1>
  28 + <h1 >{{.}}</h1>
  29 + </div>
  30 + {{/ periodOfMarket}}
30 </div> 31 </div>
31 - {{/periodOfMarket}}  
32 -</div>  
33 32
34 -{{# vipLevel}}  
35 -<div class="vipLevel">  
36 - {{# list}}  
37 -<span class="vip-img">  
38 - <div class="img" alt="" style="background-size:cover;"></div>  
39 -</span>  
40 - <span class="vip-price">{{text}}</span>  
41 - {{/ list}}  
42 -</div>  
43 -{{/ vipLevel}} 33 + {{# vipLevel}}
  34 + <div class="vipLevel">
  35 + {{# list}}
  36 + <span class="vip-img">
  37 + <div class="img" alt="" style="background-size:cover;"></div>
  38 + </span>
  39 + <span class="vip-price">{{text}}</span>
  40 + {{/ list}}
  41 + </div>
  42 + {{/ vipLevel}}
44 43
45 - {{#goodsDiscount}} 44 + {{# goodsDiscount}}
46 <div class="goodsDiscount"> 45 <div class="goodsDiscount">
47 - {{#list}}  
48 - {{#if @first}}  
49 - <h1 class="first-item">{{text}}<span class="icon-down iconfont dropdown">&#xe609;</span></h1>  
50 - <div class="discount-folder">  
51 - {{else}}  
52 - <h1 class="folder-item">{{text}}</h1>  
53 - {{/if}}  
54 - {{/list}} 46 + {{# list}}
  47 + {{#if @first}}
  48 + <h1 class="first-item">{{text}}<span class="icon-down iconfont dropdown">&#xe609;</span></h1>
  49 + <div class="discount-folder">
  50 + {{else}}
  51 + <h1 class="folder-item">{{text}}</h1>
  52 + {{/if}}
  53 + {{/ list}}
55 </div> 54 </div>
56 </div> 55 </div>
57 - {{/goodsDiscount}} 56 + {{/ goodsDiscount}}
58 57
59 <div class="feedback-list "> 58 <div class="feedback-list ">
60 - {{# feedbacks}}  
61 - {{#if commentsNum}}  
62 - {{> product/feedback-tab}}  
63 - {{else}}  
64 - {{#if consultsNum}}  
65 - {{> product/feedback-tab}}  
66 - {{else}}  
67 - <div class="nodata">  
68 - <span>暂无商品评价和咨询</span>  
69 - <a class="go-consult">我要咨询<span class="iconfont">&#xe604;</span></a>  
70 - </div>  
71 - {{/if}} 59 + {{# feedbacks}}
  60 + {{#if commentsNum}}
  61 + {{> product/feedback-tab}}
  62 + {{else}}
  63 + {{#if consultsNum}}
  64 + {{> product/feedback-tab}}
  65 + {{else}}
  66 + <div class="nodata">
  67 + <span>暂无商品评价和咨询</span>
  68 + <a class="go-consult">我要咨询<span class="iconfont">&#xe604;</span></a>
  69 + </div>
72 {{/if}} 70 {{/if}}
73 - {{/ feedbacks}} 71 + {{/if}}
  72 + {{/ feedbacks}}
74 </div> 73 </div>
75 -  
76 <div class="gap-block"></div> 74 <div class="gap-block"></div>
77 75
78 {{# enterStore}} 76 {{# enterStore}}
@@ -86,19 +84,16 @@ @@ -86,19 +84,16 @@
86 {{/ enterStore}} 84 {{/ enterStore}}
87 85
88 <div class="gap-block"></div> 86 <div class="gap-block"></div>
89 -  
90 -  
91 <div id="productDesc"></div> 87 <div id="productDesc"></div>
92 -  
93 - 88 +
94 {{#cartInfo}} 89 {{#cartInfo}}
95 <div class="cart-bar"> 90 <div class="cart-bar">
96 <span class="num-tag">{{numInCart}}</span> 91 <span class="num-tag">{{numInCart}}</span>
97 <a href="" class="num-incart iconfont">&#xe62c;</a> 92 <a href="" class="num-incart iconfont">&#xe62c;</a>
98 {{#if goodsInstore}} 93 {{#if goodsInstore}}
99 <a href="" class="addto-cart ">加入购物车</a> 94 <a href="" class="addto-cart ">加入购物车</a>
100 - {{else}}  
101 - <a href="" class="sold-out">已售罄</a> 95 + {{else}}
  96 + <a href="" class="sold-out">已售罄</a>
102 {{/if}} 97 {{/if}}
103 <a href="" class="favorite iconfont">&#xe605;</a> 98 <a href="" class="favorite iconfont">&#xe605;</a>
104 </div> 99 </div>
@@ -107,6 +102,6 @@ @@ -107,6 +102,6 @@
107 {{#if introUrl}} 102 {{#if introUrl}}
108 <input id="introUrl" type="hidden" value={{introUrl}}> 103 <input id="introUrl" type="hidden" value={{introUrl}}>
109 {{/if}} 104 {{/if}}
110 - 105 +
111 </div> 106 </div>
112 {{> layout/footer}} 107 {{> layout/footer}}
1 -{{> product/product_description}}  
  1 +{{> product/product-description}}
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 {{^}} 20 {{^}}
21 <div class="banner-top-single"> 21 <div class="banner-top-single">
22 <a href={{url}}> 22 <a href={{url}}>
23 - <img class="img" src={{img}}> 23 + <img class="img" src="{{img}}">
24 </a> 24 </a>
25 </div> 25 </div>
26 {{/if}} 26 {{/if}}
@@ -73,10 +73,12 @@ class DetailModel @@ -73,10 +73,12 @@ class DetailModel
73 } 73 }
74 } 74 }
75 75
76 - // 商品咨询和商品评价  
77 $result['feedbacks'] = array(); 76 $result['feedbacks'] = array();
  77 +
  78 + // 商品咨询
  79 + $result['feedbacks']['consultsNum'] = 0;
78 if (!empty($baseInfo['consultBoWrapper'])) { 80 if (!empty($baseInfo['consultBoWrapper'])) {
79 - $result['feedbacks']['consultsNum'] = '0';//empty($baseInfo['consultBoWrapper']['consultTotal']) ? '0' : $baseInfo['consultBoWrapper']['consultTotal']; 81 + $result['feedbacks']['consultsNum'] = $baseInfo['consultBoWrapper']['consultTotal'];
80 $result['feedbacks']['consults'] = array(); 82 $result['feedbacks']['consults'] = array();
81 $build = array(); 83 $build = array();
82 foreach ($baseInfo['consultBoWrapper']['consultBoList'] as $value) { 84 foreach ($baseInfo['consultBoWrapper']['consultBoList'] as $value) {
@@ -86,8 +88,11 @@ class DetailModel @@ -86,8 +88,11 @@ class DetailModel
86 $result['feedbacks']['consults'][] = $build; 88 $result['feedbacks']['consults'][] = $build;
87 } 89 }
88 } 90 }
  91 +
  92 + // 商品评价
  93 + $result['feedbacks']['commentsNum'] = 0;
89 if (!empty($baseInfo['commentBoWrapper'])) { 94 if (!empty($baseInfo['commentBoWrapper'])) {
90 - $result['feedbacks']['commentsNum'] = '0';//empty($baseInfo['commentBoWrapper']['commentTotal']) ? '0' : $baseInfo['commentBoWrapper']['commentTotal']; 95 + $result['feedbacks']['commentsNum'] = $baseInfo['commentBoWrapper']['commentTotal'];
91 $result['feedbacks']['comments'] = array(); 96 $result['feedbacks']['comments'] = array();
92 $build = array(); 97 $build = array();
93 foreach ($baseInfo['commentBoWrapper']['commentBoList'] as $value) { 98 foreach ($baseInfo['commentBoWrapper']['commentBoList'] as $value) {
@@ -323,10 +328,31 @@ class DetailModel @@ -323,10 +328,31 @@ class DetailModel
323 328
324 /** 329 /**
325 * 获取咨询列表 330 * 获取咨询列表
  331 + *
  332 + * @param int $productId 产品ID
  333 + * @param int $pageNum 页码数
  334 + * @param int $pageSize 每页显示个数
  335 + * @return array
326 */ 336 */
327 - public static function getConsults() 337 + public static function getConsults($productId, $pageNum = 1, $pageSize = 100)
328 { 338 {
  339 + $result = array();
  340 +
  341 + if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
  342 + $consultList = DetailData::consultList($productId, $pageNum, $pageSize);
  343 + if (!empty($consultList)) {
  344 + $build = array();
  345 + foreach ($consultList as $value) {
  346 + $build['question'] = $value['ask'];
  347 + $build['time'] = $value['askTime'];
  348 + $build['answer'] = $value['answer'];
  349 + $result[] = $build;
  350 + }
  351 + }
  352 + $consultList = array();
  353 + }
329 354
  355 + return $result;
330 } 356 }
331 357
332 } 358 }
@@ -42,34 +42,45 @@ class DetailController extends AbstractAction @@ -42,34 +42,45 @@ class DetailController extends AbstractAction
42 // 渲染模板 42 // 渲染模板
43 $this->_view->display('index', $data); 43 $this->_view->display('index', $data);
44 } 44 }
45 - 45 +
46 /** 46 /**
47 * 尺码描述信息 47 * 尺码描述信息
48 */ 48 */
49 public function introAction() 49 public function introAction()
50 { 50 {
51 - $productSkn = $this->param('productSkn'); 51 + $productSkn = $this->param('productSkn');
52 if (!is_numeric($productSkn)) { 52 if (!is_numeric($productSkn)) {
53 $this->error(); 53 $this->error();
54 } 54 }
55 $data = \Product\DetailModel::getSizeInfo($productSkn); 55 $data = \Product\DetailModel::getSizeInfo($productSkn);
56 if (array() === $data) { 56 if (array() === $data) {
57 - echo ' '; 57 + echo ' ';
58 exit(); 58 exit();
59 } 59 }
60 $this->_view->display('intro', $data); 60 $this->_view->display('intro', $data);
61 } 61 }
62 -  
63 62
  63 + /**
  64 + * 购买评价列表
  65 + *
  66 + * @param int productId
  67 + * @param int total
  68 + */
64 public function commentsAction() 69 public function commentsAction()
65 { 70 {
  71 + $total = $this->get('total');
  72 + if (!is_numeric($total)) {
  73 + $total = 0;
  74 + }
  75 + if ($total) {
  76 + $this->setNavHeader('购买评价(' . $total . ')');
  77 + } else {
  78 + $this->setNavHeader('购买评价');
  79 + }
  80 + $this->setTitle('购买评价');
  81 +
66 $data = array( 82 $data = array(
67 'goodsCommentsPage' => true, 83 'goodsCommentsPage' => true,
68 - 'pageHeader' => array(  
69 - 'navBack' => 'sss ',  
70 - // 'navHome' => 'sss ',  
71 - 'navTitle' => '购买评价(6)'  
72 - ),  
73 'pageFooter' => true, 84 'pageFooter' => true,
74 'comments' => array( 85 'comments' => array(
75 'list' => array( 86 'list' => array(
@@ -98,49 +109,45 @@ class DetailController extends AbstractAction @@ -98,49 +109,45 @@ class DetailController extends AbstractAction
98 ), 109 ),
99 ); 110 );
100 111
101 - $this->_view->assign('title', '购买评价');  
102 - //$this->_view->display('brand', compact('brands'));  
103 // 渲染模板 112 // 渲染模板
104 $this->_view->display('comments', $data); 113 $this->_view->display('comments', $data);
105 } 114 }
106 115
  116 + /**
  117 + * 购买咨询列表
  118 + *
  119 + * @param int productId
  120 + * @param int total
  121 + */
107 public function consultsAction() 122 public function consultsAction()
108 { 123 {
  124 + $productId = $this->get('product_id', 0);
  125 + $total = $this->get('total', 0);
  126 + if (!is_numeric($total)) {
  127 + $total = 0;
  128 + }
  129 + if ($total) {
  130 + $this->setNavHeader('购买咨询(' . $total . ')');
  131 + } else {
  132 + $this->setNavHeader('购买咨询');
  133 + }
  134 + $this->setTitle('购买咨询');
  135 +
109 $data = array( 136 $data = array(
110 'goodsConsultsPage' => true, 137 'goodsConsultsPage' => true,
111 - 'pageHeader' => array(  
112 - 'navBack' => 'sss ',  
113 - // 'navHome' => 'sss ',  
114 - 'navTitle' => '购买咨询(6)'  
115 - ),  
116 'pageFooter' => true, 138 'pageFooter' => true,
117 'consults' => array( 139 'consults' => array(
118 - 'list' => array(  
119 - array(  
120 - 'question' => '您好 我一米七七 140斤 穿M的行吗',  
121 - 'time' => '2014-08-12 10:24:26',  
122 - 'answer' => '您好,建议您参考XL的款式,由于版型和个人穿衣风格不同,需要'  
123 - ),  
124 - array(  
125 - 'question' => '您好 我一米七七 140斤 穿M的行吗',  
126 - 'time' => '2014-08-12 10:24:26',  
127 - 'answer' => '您好,建议您参考XL的款式,由于版型和个人穿衣风格不同,需要'  
128 - ),  
129 - array(  
130 - 'question' => '您好 我一米七七 140斤 穿M的行吗',  
131 - 'time' => '2014-08-12 10:24:26',  
132 - 'answer' => '您好,建议您参考XL的款式,由于版型和个人穿衣风格不同,需要'  
133 - )  
134 - )  
135 - ), 140 + 'list' => \Product\DetailModel::getConsults($productId),
  141 + )
136 ); 142 );
137 143
138 - $this->_view->assign('title', '购买咨询');  
139 - //$this->_view->display('brand', compact('brands'));  
140 // 渲染模板 144 // 渲染模板
141 $this->_view->display('consults', $data); 145 $this->_view->display('consults', $data);
142 } 146 }
143 147
  148 + /**
  149 + * 我要咨询
  150 + */
144 public function consultformAction() 151 public function consultformAction()
145 { 152 {
146 $data = array( 153 $data = array(