Authored by yyq

Merge branch 'feature/mBrandShop' of http://git.dev.yoho.cn/web/yohobuywap into feature/mBrandShop

... ... @@ -7,7 +7,7 @@
* Time: 15:55
*/
namespace LibModels\Wap\Shop;
namespace LibModels\Wap\Product;
use Api\Yohobuy;
use Api\Sign;
... ... @@ -70,6 +70,21 @@ class ShopData
}
/**
* 获取店铺下所有商品
*
* @param null $shop
* @return mixed
*/
public static function getAllProducts($shop = null)
{
$param = Yohobuy::param();
$param['method'] = 'app.search.li';
$param['shop'] = $shop;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
*
* 辅助方法 Debug 数据输出
*
... ...
@import "new-arrival", "discount", "list", "detail", "suspend-cart", "hot-rank", "_recommend-for-you.scss", "limit", "_shop-index";
@import "new-arrival", "discount", "list", "detail", "suspend-cart", "hot-rank", "_recommend-for-you.scss", "limit", "_shop-index", "product-category", "shop-prodfile";
... ...
.product-category {
font-size: 30rem / $pxConvertRem;
background-color: #fff;
.allproduct {
position: relative;
padding: 15px 0px;
background: #f8f8f8;
border-top: 15px;
border-bottom: 15px;
padding-left: 32rem / $pxConvertRem;
border-top: 1px solid #e6e6e6;
}
.margin-under-allproduct{
width: 100%;
height: 30rem / $pxConvertRem;
background-color: #f0f0f0;
}
.category-container{
border-top: 1px solid #e6e6e6;
}
.arrow-icon {
position: absolute;
font-size: 12px;
top: 15px;
right: 20px;
}
.allproductParagaraph {
font-size: 18px;
left: 20px;
}
.content {
background: #f8f8f8;
&.hide {
display: none;
}
}
.primary-level {
float: left;
box-sizing: border-box;
width: 100%;
position: absolute;
> li {
position:relative;
height: 89rem / $pxConvertRem;
line-height: 89rem / $pxConvertRem;
padding-left: 32rem / $pxConvertRem;
box-sizing: border-box;
border-bottom: 1px solid #e6e6e6;
background-color: #fff;
}
}
.primary-level-trilangle{
float:right;
margin-right:56%;
}
.trilanglefont {
font-family: "iconfont" !important;
font-size: 30px;
font-style: normal;
text-decoration: none;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
color: #f4f4f4;
}
.sub-level-container {
float: right;
box-sizing: border-box;
background: #f4f4f4;
width: 55%;
height: 100%;
position: relative;
}
.sub-level {
width: 100%;
&.hide {
display: none;
}
> li {
box-sizing: border-box;
height: 89rem / $pxConvertRem;
line-height: 89rem / $pxConvertRem;
border-bottom: 1px solid #e6e6e6;
padding-left: 2rem / $pxConvertRem;
//border-left: 50rem / $pxConvertRem;
margin-left: 30rem / $pxConvertRem;
&.highlight {
background: #dbdbdb;
}
&:last-child {
border-bottom: none;
}
}
a {
display: block;
height: 100%;
width: 100%;
color: #afafaf;
}
}
}
\ No newline at end of file
... ...
.shop-introduce{
.banner {
margin: 30px auto;
width: auto;
height: auto;
display: block;
background-size: 100%;
}
.descripition {
margin: 40px 20px 0px 20px;
font-size: 16px;
line-height: 22px;
padding: 20px 0;
border-top: 1px solid #e6e6e6;
border-bottom: 1px solid #e6e6e6;
text-indent:2em;
}
.sign-icon {
font-size: 20px;
height: 40px;
line-height: 40px;
text-align: center;
font-weight: 100;
}
.sign-icon > span {
width:auto;
}
}
.brand{
.brand-list{
margin-left: 20px;
font-size: 18px;
border-bottom: 1px solid #e6e6e6;
text-align: left;
height: 44px;
line-height: 44px;
vertical-align:middle;
display: block;
width: 100%;
}
}
\ No newline at end of file
... ...
... ... @@ -16,7 +16,7 @@
text-indent:2em;
}
.fo {
.sign-icon {
font-size: 20px;
height: 40px;
line-height: 40px;
... ... @@ -24,7 +24,7 @@
font-weight: 100;
}
.fo > span {
.sign-icon > span {
width:auto;
}
... ...
{{> layout/header}}
<div class="good-list-page yoho-page">
{{> product/list}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
{{> layout/header}}
{{# brands}}
<a class="brand-list" href="{{url}}">
{{brandname}}
</a>
{{/ brands}}
{{> layout/footer}}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="product-category yoho-page">
<div id="allproduct" class="allproduct">
<a href={{allproduct}}>
<p class="allproductParagaraph">全部商品</p>
<i class="arrow-icon iconfont">&#xe614;</i>
</a>
</div>
<div class="margin-under-allproduct">
</div>
<div class="category-container clearfix">
<div class="content">
{{# content}}
<ul class="primary-level">
{{# class}}
<li class="p-level-item">{{name}}
<div class="primary-level-trilangle trilanglefont hide">&#xe64a;</div>
</li>{{/ class}}
</ul>
<div class="sub-level-container hide">
{{# category}}
<ul class="sub-level">
{{# subcategory}}
<li>
<a href={{url}}>
{{category_name}}
</a>
</li>
{{/ subcategory}}
</ul>
{{/ category}}
</div>
{{/ content}}
</div>
</div>
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="shop-introduce">
<a class="banner">
<img src="{{content.shop_logo}}">
</a>
<div class="descripition">
{{content.shop_intro}}
</div>
<p class="sign-icon">
<span class="iconfont">&#xe649;</span>
100%品牌授权正品
</p>
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
{{> layout/header}}
{{# brands}}
<a class="brand-list" href="{{url}}">
{{brandname}}
</a>
{{/ brands}}
{{> layout/footer}}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="product-category yoho-page">
<div id="allproduct" class="allproduct">
<a href={{allproduct}}>
<p class="allproductParagaraph">全部商品</p>
<i class="arrow-icon iconfont">&#xe614;</i>
</a>
</div>
<div class="margin-under-allproduct">
</div>
<div class="category-container clearfix">
<div class="content">
{{# content}}
<ul class="primary-level">
{{# class}}
<li class="p-level-item">{{name}}
<div class="primary-level-trilangle trilanglefont hide">&#xe64a;</div>
</li>{{/ class}}
</ul>
<div class="sub-level-container hide">
{{# category}}
<ul class="sub-level">
{{# subcategory}}
<li>
<a href={{url}}>
{{category_name}}
</a>
</li>
{{/ subcategory}}
</ul>
{{/ category}}
</div>
{{/ content}}
</div>
</div>
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -20,7 +20,7 @@
</div>
</div>
<ul id="nav" class="nav">
<ul id="nav" class="nav home-nav">
<li class="active">
<a href="#" tab="home-page" class="color" >首页</a>
</li>
... ... @@ -98,11 +98,19 @@
</div>
{{> product/shop-footer}}
<ul id="pos-nav" class="nav">
<li>首页</li>
<li>上新</li>
<li>人气</li>
<li>全部商品</li>
<ul id="pos-nav" class="nav home-nav">
<li class="active">
<a href="#" tab="home-page" class="color" >首页</a>
</li>
<li>
<a href="#" tab="new-arrival">上新</a>
</li>
<li>
<a href="#" tab="popularity">人气</a>
</li>
<li>
<a href="#" target="_blank">全部商品</a>
</li>
</ul>
<ul id="pos-list" class="nav hide">
<li>最新</li>
... ...
{{> layout/header}}
<div class="shop-introduce">
<a class="banner">
<img src="{{content.shop_logo}}">
</a>
<div class="descripition">
{{content.shop_intro}}
</div>
<p class="sign-icon">
<span class="iconfont">&#xe649;</span>
100%品牌授权正品
</p>
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -8,6 +8,7 @@ use LibModels\Wap\Category\BrandData;
use Plugin\DataProcess\ListProcess;
use Plugin\Helpers;
use Plugin\Cache;
use Plugin\Images;
/**
* 商品列表相关的模板数据模型
... ... @@ -344,4 +345,33 @@ class ListModel
return $result;
}
/**
* @param $data 传入的从接口传来的数据
* @return array 返回的处理好的数据
* @author chengyao.guo
*/
public static function categoryData($data)
{
$result = array();
$result['class'] = array();
$result['category'] = array();
foreach ($data as &$item) {
array_push($result['class'], array('name' => $item['category_name']));
foreach ($item['sub'] as &$item2) {
$item2['url'] = Helpers::url(''); // tar mark 还不知道链接是啥样的
}
array_push($result['category'], array('subcategory' => $item['sub']));
}
return $result;
}
public static function brandData($data)
{
// 处理图片链接
foreach ($data as &$item) {
$item['brand_ico'] = Images::getImageUrl($item['brand_ico'], 0, 0);
}
return $data;
}
}
... ...
... ... @@ -2,6 +2,8 @@
use Action\AbstractAction;
use Plugin\Helpers;
use LibModels\Wap\Product\ShopData;
use Product\ListModel;
/**
* 商品列表相关的控制器
... ... @@ -13,13 +15,13 @@ class IndexController extends AbstractAction
/**
* 品类商品列表页
*
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param integer $brand 品牌Id
* @param integer $sort 品类查询sort参数
* @param integer $color 颜色Id
* @param integer $size 尺码Id
* @param string $price 价格
* @param string $p_d 折扣
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param integer $brand 品牌Id
* @param integer $sort 品类查询sort参数
* @param integer $color 颜色Id
* @param integer $size 尺码Id
* @param string $price 价格
* @param string $p_d 折扣
*/
public function indexAction()
{
... ... @@ -109,12 +111,12 @@ class IndexController extends AbstractAction
/**
* 品牌商品列表页
*
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param integer $sort 品类查询sort参数
* @param integer $color 颜色Id
* @param integer $size 尺码Id
* @param string $price 价格
* @param string $p_d 折扣
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param integer $sort 品类查询sort参数
* @param integer $color 颜色Id
* @param integer $size 尺码Id
* @param string $price 价格
* @param string $p_d 折扣
*/
public function brandAction()
{
... ... @@ -208,8 +210,7 @@ class IndexController extends AbstractAction
$data['goodList']['brandWay'] = $brandLogo;
$data['goodList']['search']['default'] = $query;
$data['goodList']['search']['url'] = Helpers::url('', null, 'search');
}
// 品牌一览过来的展示品牌介绍和LOGO
} // 品牌一览过来的展示品牌介绍和LOGO
elseif ($brandId !== 0) {
$data['brandHome'] = \Product\ListModel::getBrandIntro($brandId, $uid, $title);
$data['goodList'] = array();
... ... @@ -228,4 +229,193 @@ class IndexController extends AbstractAction
$this->_view->display('index', $data);
}
/**
* 店铺券全部品牌页面
* @author chengyao.guo
* @return mixed
*/
public function allBrandAction()
{
$requestData = filter_input_array(INPUT_GET, array(
'shop_id' => FILTER_DEFAULT,
));
if (empty($requestData['shop_id'])) {
$this->go(SITE_MAIN);
}
$result = array();
$resource = ShopData::getShopBrands($requestData['shop_id']);
if($resource['code'] === 200){
$result = ListModel::brandData($resource['data']);
}
return $this->_view->display('brand', array(
'content' => $result,
));
}
/**
*
* 店铺品类页面
* @author chengyao.guo
* @return mixed
*/
public function categoryAction()
{
$requestData = filter_input_array(INPUT_GET, array(
'shop_id' => FILTER_DEFAULT,
));
if (empty($requestData['shop_id'])) {
$this->go(SITE_MAIN);
}
$result = array();
$resource = ShopData::getShopCategory($requestData['shop_id'], Helpers::getChannelByCookie(), Helpers::getGenderByCookie());
if ($resource['code'] === 200) {
$result = ListModel::categoryData($resource['data']);
}
return $this->_view->display('category', array(
'productCategoryPage' => true,
'content' => $result,
));
}
/**
* 店铺简介页面
* @author chengyao.guo
* @return mixed
*/
public function introAction()
{
$requestData = filter_input_array(INPUT_GET, array(
'shop_id' => FILTER_DEFAULT,
));
if (empty($requestData['shop_id'])) {
$this->go(SITE_MAIN);
}
$result = array();
$resource = ShopData::getShopIntro($requestData['shop_id']);
if ($resource['code'] === 200) {
$result = $resource['data'];
}
return $this->_view->display('intro', array(
'content' => $result,
));
}
/**
* 店铺内全部商品页面
* @author chengyao.guo
* @return mixed
*/
public function allProductAction()
{
$result = array();
return $this->_view->display('allproduct', array(
'content' => $result,
));
}
/**
* 店铺分类品类页数据模拟
*
* @return array
*/
public function getCategoryContent()
{
return array(// 数据模拟
'class' => array(
array(
'name' => '上衣',
),
array(
'name' => '裤装',
),
array(
'name' => '鞋靴',
),
array(
'name' => '包类',
)
),
'category' => array(
array(
'subcategory' => array(
array(
'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',
'name' => '上衣衣1'
),
array(
'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',
'name' => '上衣衣2'
),
array(
'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',
'name' => '上衣衣3'
),
)
),
array(
'subcategory' => array(
array(
'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',
'name' => '裤装1'
),
array(
'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',
'name' => '裤装2'
),
array(
'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',
'name' => '裤装3'
),
)
),
array(
'subcategory' => array(
array(
'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',
'name' => '鞋靴1'
),
array(
'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',
'name' => '鞋靴2'
),
array(
'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',
'name' => '鞋靴3'
)
)
),
array(
'subcategory' => array(
array(
'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',
'name' => '包类1'
),
array(
'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',
'name' => '包类2'
),
array(
'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',
'name' => '包类3'
)
)
)
)
);
}
/**
* 店铺简介数据模拟
*
* @return array
*/
public function getIntroContent()
{
return array(// 数据模拟
);
}
}
... ...
... ... @@ -19,7 +19,7 @@ class ShopController extends AbstractAction
{
$data = array(
'branner-top' => '',
'branerImg' => '',
'goodList' => 'http://www.baidu.com',
'brands' => false,
'brandImg' => array(
... ...