Authored by Lynnic

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

... ... @@ -20,6 +20,7 @@ class DetailData
const PRODUCT_BASE_INFO = 'product/queryProductDetailByProductId';
const PRODUCT_SIZE_INFO = 'product/queryProductIntroBySkn';
const PRODUCT_CONSULT_LIST = 'consult/queryConsults';
const PRODUCT_COMMENT_LIST = 'sns/comments/commentList';
/**
* 商品基本信息
... ... @@ -63,6 +64,23 @@ class DetailData
) );
}
/**
* 评论内容列表
*
* @param int $productId 产品ID
* @param int $pageNum 页码数
* @param int $pageSize 每页显示个数
* @return array
*/
public static function commentList($productId, $pageNum, $pageSize)
{
return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_COMMENT_LIST, array(
'productId' => intval($productId),
'pageNum' => intval($pageNum),
'pageSize' => intval($pageSize),
) );
}
/**
* 为你优选的商品列表
*
... ...
... ... @@ -68,7 +68,7 @@ $channelLink.on('touchstart', function() {
borderColor: '#fff'
});
});
var removeAppFloatLayerFixed = (function() {
var updateLayerPosition = (function() {
var init = false;
return function() {
var winHeight = window.innerHeight;
... ... @@ -92,11 +92,7 @@ var removeAppFloatLayerFixed = (function() {
})();
$win.scroll(function() {
clearTimeout($.data(this, 'scrollTimer'));
$.data(this, 'scrollTimer', setTimeout(function() {
removeAppFloatLayerFixed();
}, 2));
updateLayerPosition();
});
$win.on('resize', function(){
... ... @@ -107,4 +103,4 @@ $win.on('scrollstop', function(){
console.log('stop');
});
$doc.on('ready', removeAppFloatLayerFixed);
$doc.on('ready', updateLayerPosition);
... ...
... ... @@ -83,6 +83,7 @@ function loadData($parent, url, page) {
}
if (data === ' ') {
$parent.closest('.fav-type').find('.fav-content-loading').addClass('hide');
$parent.closest('.fav-type').find('.fav-null-box').removeClass('hide');
} else if (data === 'end') {
$parent.closest('.fav-type').find('.fav-load-background')
... ...
... ... @@ -3,7 +3,7 @@
<div class="goto-consult">
<i class="iconfont consult-logo">&#xe639;</i>
<span>我要咨询</span>
<a href="/consultform" class="iconfont enter-consult-page">&#xe604;</a>
<a href="{{consultUrl}}" class="iconfont enter-consult-page">&#xe604;</a>
</div>
{{# consults}}
<div class="goods-consults" id="goods-consults">
... ...
... ... @@ -122,9 +122,9 @@
{{#if numInCart}}
<span class="num-tag">{{numInCart}}</span>
{{/if}}
<a href="/shoppingCart" class="num-incart iconfont">&#xe62c;</a>
<a href="{{cartUrl}}" class="num-incart iconfont">&#xe62c;</a>
{{#if goodsInstore}}
<a href="/shoppingCart" id="addtoCart" class="addto-cart">加入购物车</a>
<a href="{{cartUrl}}" id="addtoCart" class="addto-cart">加入购物车</a>
{{else}}
<a href="javascript:;" class="sold-out">已售罄</a>
{{/if}}
... ...
... ... @@ -199,6 +199,7 @@ class DetailModel
// 悬浮的购物车信息
$result['cartInfo'] = array(
'cartUrl' => Helpers::url('/shoppingCart'),
'numInCart' => 0,
'goodsInstore' => $baseInfo['storage'],
);
... ... @@ -361,9 +362,25 @@ class DetailModel
/**
* 获取评价列表
*/
public static function getComments()
public static function getComments($productId, $pageNum = 1, $pageSize = 100)
{
$result = array();
if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
$commentList = DetailData::commentList($productId, $pageNum, $pageSize);
if (!empty($commentList)) {
$build = array();
foreach ($commentList as $value) {
$build['userName'] = '';
$build['desc'] = '';
$build['content'] = '';
$build['time'] = '';
$result[] = $build;
}
}
}
return $result;
}
/**
... ... @@ -406,7 +423,7 @@ class DetailModel
$result = array();
if (is_numeric($productSkn)) {
$preference = DetailData::preference($productSkn); var_dump($preference); exit;
$preference = DetailData::preference($productSkn);
if (!empty($preference['data'])) {
foreach ($preference['data'] as $value) {
$result['recommendList'][] = Helpers::formatProduct($value, false, true, true, 299, 388, false, false);
... ...
<?php
use Action\AbstractAction;
use Plugin\Helpers;
/**
* 商品详情的控制器
... ... @@ -31,6 +32,7 @@ class DetailController extends AbstractAction
$this->error();
}
$data['goodsDetailPage'] = true;
$data['pageFooter'] = true;
if (isset($data['goodsName'])) {
$this->setTitle($data['goodsName']);
... ... @@ -66,6 +68,7 @@ class DetailController extends AbstractAction
*/
public function commentsAction()
{
$productId = $this->get('product_id', 0);
$total = $this->get('total');
if (!is_numeric($total)) {
$total = 0;
... ... @@ -81,29 +84,7 @@ class DetailController extends AbstractAction
'goodsCommentsPage' => true,
'pageFooter' => true,
'comments' => array(
'list' => array(
array(
'userName' => 'Lynnic',
'desc' => '购买了白色Mate7',
'content' => '活动时买的,挺超值。上身效果也不错。质量
很好,买送人的,很满意。而且物流相当给...',
'time' => '2014-08-12 10:24:26'
),
array(
'userName' => 'Lynnic',
'desc' => '购买了白色Mate7',
'content' => '活动时买的,挺超值。上身效果也不错。质量
很好,买送人的,很满意。而且物流相当给...',
'time' => '2014-08-12 10:24:26'
),
array(
'userName' => 'Lynnic',
'desc' => '购买了白色Mate7',
'content' => '活动时买的,挺超值。上身效果也不错。质量
很好,买送人的,很满意。而且物流相当给...',
'time' => '2014-08-12 10:24:26'
)
)
'list' => \Product\DetailModel::getConsults($productId),
),
);
... ... @@ -136,7 +117,8 @@ class DetailController extends AbstractAction
'pageFooter' => true,
'consults' => array(
'list' => \Product\DetailModel::getConsults($productId),
)
),
'consultUrl' => Helpers::url('/product/detail/consultform'),
);
// 渲染模板
... ... @@ -148,19 +130,11 @@ class DetailController extends AbstractAction
*/
public function consultformAction()
{
$data = array(
'consultform' => true,
'pageHeader' => array(
'navBack' => 'sss ',
// 'navHome' => 'sss ',
'navTitle' => '我要咨询'
)
);
$this->setTitle('我要咨询');
$this->setNavHeader('我要咨询');
$this->_view->assign('title', '我要咨询');
//$this->_view->display('brand', compact('brands'));
// 渲染模板
$this->_view->display('consultform', $data);
$this->_view->display('consultform', array('consultform' => true));
}
/**
... ... @@ -173,10 +147,10 @@ class DetailController extends AbstractAction
{
$result = array();
//if ($this->isAjax()) {
$productSkn = $this->get('productSkn', 50000058);
$result = \Product\DetailModel::getPreference($productSkn); var_dump($result);
//}
if ($this->isAjax()) {
$productSkn = $this->get('productSkn'); // 50000058
$result = \Product\DetailModel::getPreference($productSkn);
}
if (empty($result)) {
echo ' ';
... ...