Authored by hf

do feature 3.1 3.2 my center and detail page

... ... @@ -19,6 +19,7 @@ class DetailData
const PRODUCT_BASE_INFO = 'product/queryProductDetailByProductId';
const PRODUCT_SIZE_INFO = 'product/queryProductIntroBySkn';
const PRODUCT_CONSULT_LIST = 'consult/queryConsults';
/**
* 商品基本信息
... ... @@ -29,7 +30,9 @@ class DetailData
*/
public static function baseInfo($productId, $uid)
{
return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_BASE_INFO, array('param' => intval($productId), 'userId' => intval($uid)) );
return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_BASE_INFO, array(
'param' => intval($productId), 'userId' => intval($uid)
) );
}
/**
... ... @@ -43,4 +46,21 @@ class DetailData
return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_SIZE_INFO, array('param' => intval($productSkn) ) );
}
/**
* 咨询内容列表
*
* @param int $productId 产品ID
* @param int $pageNum 页码数
* @param int $pageSize 每页显示个数
* @return array
*/
public static function consultList($productId, $pageNum, $pageSize)
{
return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_CONSULT_LIST, array(
'productId' => intval($productId),
'pageNum' => intval($pageNum),
'pageSize' => intval($pageSize),
) );
}
}
... ...
... ... @@ -3,76 +3,74 @@
<div class="banner-container">
<h1 class="is-new-lable">NEW</h1>
{{# bannerTop}}
{{> product/banner_swiper_arrow}}
{{> product/banner-swiper-arrow}}
{{/ bannerTop}}
</div>
{{# goodsName}}
<h2 class="goodsName"><span>{{.}}</span></h2>
{{/ goodsName}}
{{# goodsSubtitle}}
<h1 class="goodsSubtitle"><span>{{.}}</span></h1>
{{/ goodsSubtitle}}
<div class="price-date">
{{#goodsPrice}}
<div class="goodsPrice">
<h1 class="currentPrice">{{currentPrice}}</h1>
<h1 class="previousPrice">{{previousPrice}}</h1>
</div>
{{/goodsPrice}}
{{# goodsPrice}}
<div class="goodsPrice">
<h1 class="currentPrice">{{currentPrice}}</h1>
<h1 class="previousPrice">{{previousPrice}}</h1>
</div>
{{/ goodsPrice}}
{{#periodOfMarket}}
<div class="periodOfMarket">
<h1>上市期:</h1>
<h1 >{{.}}</h1>
{{# periodOfMarket}}
<div class="periodOfMarket">
<h1>上市期:</h1>
<h1 >{{.}}</h1>
</div>
{{/ periodOfMarket}}
</div>
{{/periodOfMarket}}
</div>
{{# vipLevel}}
<div class="vipLevel">
{{# list}}
<span class="vip-img">
<div class="img" alt="" style="background-size:cover;"></div>
</span>
<span class="vip-price">{{text}}</span>
{{/ list}}
</div>
{{/ vipLevel}}
{{# vipLevel}}
<div class="vipLevel">
{{# list}}
<span class="vip-img">
<div class="img" alt="" style="background-size:cover;"></div>
</span>
<span class="vip-price">{{text}}</span>
{{/ list}}
</div>
{{/ vipLevel}}
{{#goodsDiscount}}
{{# goodsDiscount}}
<div class="goodsDiscount">
{{#list}}
{{#if @first}}
<h1 class="first-item">{{text}}<span class="icon-down iconfont dropdown">&#xe609;</span></h1>
<div class="discount-folder">
{{else}}
<h1 class="folder-item">{{text}}</h1>
{{/if}}
{{/list}}
{{# list}}
{{#if @first}}
<h1 class="first-item">{{text}}<span class="icon-down iconfont dropdown">&#xe609;</span></h1>
<div class="discount-folder">
{{else}}
<h1 class="folder-item">{{text}}</h1>
{{/if}}
{{/ list}}
</div>
</div>
{{/goodsDiscount}}
{{/ goodsDiscount}}
<div class="feedback-list ">
{{# feedbacks}}
{{#if commentsNum}}
{{> product/feedback-tab}}
{{else}}
{{#if consultsNum}}
{{> product/feedback-tab}}
{{else}}
<div class="nodata">
<span>暂无商品评价和咨询</span>
<a class="go-consult">我要咨询<span class="iconfont">&#xe604;</span></a>
</div>
{{/if}}
{{# feedbacks}}
{{#if commentsNum}}
{{> product/feedback-tab}}
{{else}}
{{#if consultsNum}}
{{> product/feedback-tab}}
{{else}}
<div class="nodata">
<span>暂无商品评价和咨询</span>
<a class="go-consult">我要咨询<span class="iconfont">&#xe604;</span></a>
</div>
{{/if}}
{{/ feedbacks}}
{{/if}}
{{/ feedbacks}}
</div>
<div class="gap-block"></div>
{{# enterStore}}
... ... @@ -86,19 +84,16 @@
{{/ enterStore}}
<div class="gap-block"></div>
<div id="productDesc"></div>
{{#cartInfo}}
<div class="cart-bar">
<span class="num-tag">{{numInCart}}</span>
<a href="" class="num-incart iconfont">&#xe62c;</a>
{{#if goodsInstore}}
<a href="" class="addto-cart ">加入购物车</a>
{{else}}
<a href="" class="sold-out">已售罄</a>
{{else}}
<a href="" class="sold-out">已售罄</a>
{{/if}}
<a href="" class="favorite iconfont">&#xe605;</a>
</div>
... ... @@ -107,6 +102,6 @@
{{#if introUrl}}
<input id="introUrl" type="hidden" value={{introUrl}}>
{{/if}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
{{> product/product_description}}
\ No newline at end of file
{{> product/product-description}}
\ No newline at end of file
... ...
... ... @@ -20,7 +20,7 @@
{{^}}
<div class="banner-top-single">
<a href={{url}}>
<img class="img" src={{img}}>
<img class="img" src="{{img}}">
</a>
</div>
{{/if}}
... ...
... ... @@ -73,10 +73,12 @@ class DetailModel
}
}
// 商品咨询和商品评价
$result['feedbacks'] = array();
// 商品咨询
$result['feedbacks']['consultsNum'] = 0;
if (!empty($baseInfo['consultBoWrapper'])) {
$result['feedbacks']['consultsNum'] = '0';//empty($baseInfo['consultBoWrapper']['consultTotal']) ? '0' : $baseInfo['consultBoWrapper']['consultTotal'];
$result['feedbacks']['consultsNum'] = $baseInfo['consultBoWrapper']['consultTotal'];
$result['feedbacks']['consults'] = array();
$build = array();
foreach ($baseInfo['consultBoWrapper']['consultBoList'] as $value) {
... ... @@ -86,8 +88,11 @@ class DetailModel
$result['feedbacks']['consults'][] = $build;
}
}
// 商品评价
$result['feedbacks']['commentsNum'] = 0;
if (!empty($baseInfo['commentBoWrapper'])) {
$result['feedbacks']['commentsNum'] = '0';//empty($baseInfo['commentBoWrapper']['commentTotal']) ? '0' : $baseInfo['commentBoWrapper']['commentTotal'];
$result['feedbacks']['commentsNum'] = $baseInfo['commentBoWrapper']['commentTotal'];
$result['feedbacks']['comments'] = array();
$build = array();
foreach ($baseInfo['commentBoWrapper']['commentBoList'] as $value) {
... ... @@ -323,10 +328,31 @@ class DetailModel
/**
* 获取咨询列表
*
* @param int $productId 产品ID
* @param int $pageNum 页码数
* @param int $pageSize 每页显示个数
* @return array
*/
public static function getConsults()
public static function getConsults($productId, $pageNum = 1, $pageSize = 100)
{
$result = array();
if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
$consultList = DetailData::consultList($productId, $pageNum, $pageSize);
if (!empty($consultList)) {
$build = array();
foreach ($consultList as $value) {
$build['question'] = $value['ask'];
$build['time'] = $value['askTime'];
$build['answer'] = $value['answer'];
$result[] = $build;
}
}
$consultList = array();
}
return $result;
}
}
... ...
... ... @@ -42,34 +42,45 @@ class DetailController extends AbstractAction
// 渲染模板
$this->_view->display('index', $data);
}
/**
* 尺码描述信息
*/
public function introAction()
{
$productSkn = $this->param('productSkn');
$productSkn = $this->param('productSkn');
if (!is_numeric($productSkn)) {
$this->error();
}
$data = \Product\DetailModel::getSizeInfo($productSkn);
if (array() === $data) {
echo ' ';
echo ' ';
exit();
}
$this->_view->display('intro', $data);
}
/**
* 购买评价列表
*
* @param int productId
* @param int total
*/
public function commentsAction()
{
$total = $this->get('total');
if (!is_numeric($total)) {
$total = 0;
}
if ($total) {
$this->setNavHeader('购买评价(' . $total . ')');
} else {
$this->setNavHeader('购买评价');
}
$this->setTitle('购买评价');
$data = array(
'goodsCommentsPage' => true,
'pageHeader' => array(
'navBack' => 'sss ',
// 'navHome' => 'sss ',
'navTitle' => '购买评价(6)'
),
'pageFooter' => true,
'comments' => array(
'list' => array(
... ... @@ -98,49 +109,45 @@ class DetailController extends AbstractAction
),
);
$this->_view->assign('title', '购买评价');
//$this->_view->display('brand', compact('brands'));
// 渲染模板
$this->_view->display('comments', $data);
}
/**
* 购买咨询列表
*
* @param int productId
* @param int total
*/
public function consultsAction()
{
$productId = $this->get('product_id', 0);
$total = $this->get('total', 0);
if (!is_numeric($total)) {
$total = 0;
}
if ($total) {
$this->setNavHeader('购买咨询(' . $total . ')');
} else {
$this->setNavHeader('购买咨询');
}
$this->setTitle('购买咨询');
$data = array(
'goodsConsultsPage' => true,
'pageHeader' => array(
'navBack' => 'sss ',
// 'navHome' => 'sss ',
'navTitle' => '购买咨询(6)'
),
'pageFooter' => true,
'consults' => array(
'list' => array(
array(
'question' => '您好 我一米七七 140斤 穿M的行吗',
'time' => '2014-08-12 10:24:26',
'answer' => '您好,建议您参考XL的款式,由于版型和个人穿衣风格不同,需要'
),
array(
'question' => '您好 我一米七七 140斤 穿M的行吗',
'time' => '2014-08-12 10:24:26',
'answer' => '您好,建议您参考XL的款式,由于版型和个人穿衣风格不同,需要'
),
array(
'question' => '您好 我一米七七 140斤 穿M的行吗',
'time' => '2014-08-12 10:24:26',
'answer' => '您好,建议您参考XL的款式,由于版型和个人穿衣风格不同,需要'
)
)
),
'list' => \Product\DetailModel::getConsults($productId),
)
);
$this->_view->assign('title', '购买咨询');
//$this->_view->display('brand', compact('brands'));
// 渲染模板
$this->_view->display('consults', $data);
}
/**
* 我要咨询
*/
public function consultformAction()
{
$data = array(
... ...