Authored by xuqi

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

... ... @@ -182,17 +182,19 @@ class NewsaleData
* 获取热销排行榜商品数据
*
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* $param integer $channel 1表示男,2表示女,3表示潮童,4表示创意生活
* @param string|null $sort 品类ID查询参数
* @param integer|null $tab_id Tab的ID
* @param integer $limit 查询返回的最大限制数, 默认为50
* @param integer $page 分页第几页, 默认第1页
* @return array 新品到着商品数据
*/
public static function getTopProducts($gender, $sort = null, $tab_id = null, $limit = 50, $page = 1)
public static function getTopProducts($gender, $channel, $sort = null, $tab_id = null, $limit = 50, $page = 1)
{
$param = Yohobuy::param();
$param['method'] = 'app.search.top';
$param['gender'] = $gender;
$param['yh_channel'] = $gender;
!empty($sort) && $param['sort'] = $sort;
!empty($tab_id) && $param['tab_id'] = $tab_id;
$param['page'] = $page;
... ...
... ... @@ -144,6 +144,7 @@ class SearchData
$param = array();
$param['status'] = 1; // 是否上架,1表示在架,2表示不在
$param['sales'] = 'Y'; // 只搜索销售的产品
$param['stocknumber'] = 1; // 过滤掉已售罄的商品
// $param['needFilter'] = 1; // 是否需要返回筛选条件
if (!isset($condition['order'])) {
$param['order'] = $orderMaps['s_t_desc'];
... ...
... ... @@ -129,10 +129,10 @@ function searchResult() {
brandHtml.push('<p><a href="' + brand.url + '">' + brand.name);
if (brand.isNew) {
brandHtml.push('<i class="icon-hot">HOT</i>');
brandHtml.push('<i class="icon-new">NEW</i>');
}
if (brand.isHot) {
brandHtml.push('<i class="icon-new">NEW</i>');
brandHtml.push('<i class="icon-hot">HOT</i>');
}
brandHtml.push('</a></p>');
});
... ...
... ... @@ -6,6 +6,7 @@
var $ = require('jquery');
var loading = require('../plugin/loading'),
tip = require('../plugin/tip'),
Hammer = require('yoho.hammer');
var theOrderCode = document.getElementById('ordercode').value;
... ... @@ -17,7 +18,7 @@ var appIconPosition = {
baidu: '-2.7rem',
weixin: '-1.2rem',
QQ: '-5.4rem',
bank: '-4'
bank: '-4rem'
};
//隐藏微信分享选项
... ... @@ -77,11 +78,11 @@ function callpay(orderCode) {
jsApiParameters = res.data.jsApiParameters;
jsApiCall(orderCode, jsApiParameters);
} else {
alert('微信支付调取失败');
tip.show('微信支付调取失败');
}
},
error: function() {
alert('请刷新本页面,完成微信支付');
tip.show('请刷新本页面,完成微信支付');
}
});
}
... ... @@ -99,11 +100,11 @@ function isWXOpen() {
}
function hideWeChatPay() {
var payApps = document.getElementsByClassName('app');
var $payApps = $('.app');
[].forEach.call(payApps, function(app, index) {
if (app.innerHTML.indexOf('微信') !== -1) {
app.parentNode.style.display = 'none';
$payApps.each(function(idx, app) {
if ($(app).attr('id') === 'weixin') {
$(app).parent().css('display', 'none');
return false;
}
});
... ... @@ -117,29 +118,29 @@ function handleForWX() {
function setAppIcon(el, position) {
el.style.backgroundPositionY = position;
$(el).css('background-position-y', position);
}
function loadIcon() {
var boxs = document.getElementsByClassName('box');
var div = null;
var $boxs = $('.box');
var $div = null;
var appid = null;
[].forEach.call(boxs, function(box, index) {
div = box.getElementsByClassName('icon')[0].getElementsByTagName('div')[0];
if (div) {
appid = box.getAttribute('id');
$boxs.each(function(idx, box) {
$div = $(box).find('.icon').find('div');
if ($div.length > 0) {
appid = $(box).attr('id');
if (appid !== 'alipay') {
setAppIcon(div, appIconPosition[appid]);
setAppIcon($div, appIconPosition[appid]);
}
}
});
}
function showPage() {
var pageList = document.getElementsByClassName('payapp-list')[0];
var $pageList = $('.payapp-list');
pageList.style.visibility = 'visible';
$pageList.css('visibility', 'visible');
}
if (wxHammer) {
... ...
... ... @@ -64,11 +64,21 @@ lazyLoad();
headerNavHammer = new Hammer(document.getElementById('yoho-header'));
headerNavHammer.on('tap', function(e) {
var suggestText = $('#suggest-textarea').val();
var suggestText = $('#suggest-textarea').val(),
textReg = /\S+/;
if ($(e.target).hasClass('nav-btn')) {
if (!textReg.test(suggestText)) {
diaLog.showDialog({
autoHide: true,
dialogText: '意见不能为空'
});
return;
}
$.ajax({
method: 'post',
url: '/home/savesuggest',
... ... @@ -85,10 +95,18 @@ headerNavHammer.on('tap', function(e) {
setTimeout(function() {
location.pathname = 'home/suggest';
}, 2000);
} else {
diaLog.showDialog({
autoHide: true,
dialogText: '提交失败~'
});
}
}).fail(function() {
//TODO
diaLog.showDialog({
autoHide: true,
dialogText: '网络错误~'
});
});
}
});
... ...
... ... @@ -16,7 +16,9 @@ var consultFooterEle = document.getElementById('consult-content-footer'),
navtabHammer = navtabEle && new Hammer(navtabEle),
gotoConsultEle = document.getElementById('goto-consult'),
gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle);
gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle),
$gotoConsult = $('#goto-consult');
... ... @@ -77,4 +79,22 @@ if (gotoConsultHammer) {
gotoConsultHammer.on('tap', function() {
location.href = $(gotoConsultEle).find('a').attr('href');
});
}
\ No newline at end of file
}
function fixConsultBar() {
if ($(window).scrollTop() > $('#yoho-header').outerHeight()) {
$gotoConsult.css('position', 'fixed');
$gotoConsult.css('top', '0');
} else {
$gotoConsult.css('position', 'static');
}
}
//滚动时顶部固定 我要咨询
function scrollHandler() {
fixConsultBar();
}
$(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
... ...
... ... @@ -15,7 +15,10 @@ var goodsSwiper,
var goodsDiscountEl = document.getElementById('goodsDiscount'),
goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl);
var $cart = $('.cart-bar');
var $cart = $('.cart-bar'),
$goodsSubtitle = $('.goodsSubtitle'),
divH,
$goodsSubtitleSpan;
require('./desc');
require('./comments-consults');
... ... @@ -82,4 +85,12 @@ $.ajax({
}
});
//限制goodsSubtitle为两行
if ($goodsSubtitle[0]) {
divH = $goodsSubtitle.height();
$goodsSubtitleSpan = $goodsSubtitle.find('span');
while ($goodsSubtitleSpan.outerHeight() > divH) {
$goodsSubtitleSpan.text($goodsSubtitleSpan.text().replace(/(\s)*([a-zA-Z0-9]+|\W)(\.\.\.)?$/, '...'));
}
}
require('./like');
... ...
... ... @@ -41,6 +41,8 @@
.goods-consults-page {
background-color: #f0f0f0;
.goto-consult {
width: 100%;
box-sizing:border-box;
padding: 0 pxToRem(28px);
height: pxToRem(120px);
background-color: #ffffff;
... ...
... ... @@ -211,14 +211,19 @@ $basicBtnC:#eb0313;
background-color: #515150;
}
.goodsSubtitle {
min-height: pxToRem(87px);
height: pxToRem(88px);
font-size: pxToRem(24px);
line-height: pxToRem(36px);
color: $subFontC;
padding-left: pxToRem(28px);
padding-right: pxToRem(28px);
padding-top: pxToRem(14px);
border-bottom: 1px solid $borderC;
background-color: #f4f4f4;
span{
display: block;
line-height: pxToRem(36px);
margin: 0;
}
}
.price-date {
// width: 100%;
... ... @@ -253,8 +258,7 @@ $basicBtnC:#eb0313;
line-height: pxToRem(88px);
}
}
.goodsName,
.goodsSubtitle {
.goodsName {
// width: 100%;
display: table;
span {
... ...
{{> layout/header}}
<div class="brand-page yoho-page">
{{# channel}}
<div class="newbrand-search">
<div class="search-box clearfix">
<div class="search-box clearfix">
<a href="{{searchUrl}}" >
<input type="text" class="search-input" placeholder="查找品牌" readonly="true">
<i class="search-icon iconfont">&#xe60f;</i>
... ... @@ -40,4 +42,6 @@
{{/ list}}
</div>
{{/ brandList}}
{{/channel}}
{{> layout/footer}}
... ...
<div class="hot-brands">
{{> home/floor_header}}
{{^ brandPage}}
{{> home/floor_header}}
{{/ brandPage}}
<div class="brands-swiper">
<ul class="brands-list swiper-wrapper clearfix">
{{# list}}
... ... @@ -12,4 +14,4 @@
{{/ list}}
</ul>
</div>
</div>
\ No newline at end of file
</div>
... ...
... ... @@ -785,7 +785,7 @@ class HomeController extends AbstractAction
if (empty($orderCode)) {
$this->error();
}
$this->_view->display('pay', array(
'payCenterPage' => true,
'payAppInfo' => array(
... ... @@ -807,7 +807,7 @@ class HomeController extends AbstractAction
),
),
'orderCode' => $orderCode,
'hasWxShare' => strpos($this->_request->server('HTTP_USER_AGENT', ''), 'MicroMessenger') !== false
'hasWxShare' => strpos($this->server('HTTP_USER_AGENT', ''), 'MicroMessenger') !== false
));
}
... ...
... ... @@ -43,6 +43,7 @@ class ClassModel
break;
}
$genderArr = array('boy' => '1,3', 'girl' => '2,3', 'kids' => '1,2,3', 'lifestyle' => '1,2,3');
$oneClass = array();
$item = array();
foreach ($data['data'] as $k => $v) {
... ... @@ -59,7 +60,8 @@ class ClassModel
'id' => $item['id'],
'url' => Helpers::url('/', array(
'sort' => $item['id'],
'sort_name' => $item['name']), 'list')
'sort_name' => $item['name'],
'gender' => $genderArr[$k]), 'list')
);
$subitem = array();
... ... @@ -69,7 +71,8 @@ class ClassModel
$subitem['id'] = $value['relation_parameter']['sort'];
$subitem['url'] = Helpers::url('/', array(
'sort' => $value['relation_parameter']['sort'],
'sort_name' => $value['category_name']
'sort_name' => $value['category_name'],
'gender' => $genderArr[$k]
), 'list');
$item['sub'][] = $subitem;
}
... ...
... ... @@ -179,6 +179,9 @@ class IndexModel
}
}
// 分页需要参数
$data['guang']['gender'] = $gender;
// 显示底部
$data['pageFooter'] = true;
... ...
... ... @@ -102,7 +102,7 @@ class DetailModel
if (isset($baseInfo['promotionBoList'])) {
$build = array();
foreach ($baseInfo['promotionBoList'] as $value) {
$build['text'] = $value['promotionTitle'];
$build['text'] = '【' . $value['promotionType'] . '】' . $value['promotionTitle'];
$result['goodsDiscount']['list'][] = $build;
}
}
... ... @@ -165,26 +165,31 @@ class DetailModel
foreach ($baseInfo['goodsList'] as $value) {
$colorId = intval($value['colorId']);
// 商品按颜色进行分类分组
foreach ($value['goodsImagesList'] as $goods) {
$goodsList[$goods['goodsId']] = $colorId;
$goodsGroup[$colorId][] = array(
'goodsId' => $goods['goodsId'],
'img' => $goods['imageUrl'],
);
$colorGroup[$colorId] = array(
'colorId' => $colorId,
'colorName' => $value['colorName'],
'colorImage' => Helpers::getImageUrl($value['colorImage'], 60, 60),
);
}
if (isset($value['goodsImagesList'])) {
foreach ($value['goodsImagesList'] as $goods) {
$goodsList[$goods['goodsId']] = $colorId;
$goodsGroup[$colorId][] = array(
'goodsId' => $goods['goodsId'],
'img' => $goods['imageUrl'],
);
$colorGroup[$colorId] = array(
'colorId' => $colorId,
'colorName' => $value['colorName'],
'colorImage' => Helpers::getImageUrl($value['colorImage'], 60, 60),
);
}
}
// 商品的尺码列表
foreach ($value['goodsSizeBoList'] as $size) {
$sizeGroup[$colorId] = array(
'sizeName' => $size['sizeName'],
'sizeSku' => $size['goodsSizeSkuId'],
'sizeStorage' => $size['goodsSizeStorageNum'],
);
}
if (isset($value['goodsSizeBoList'])) {
foreach ($value['goodsSizeBoList'] as $size) {
$sizeGroup[$colorId] = array(
'sizeName' => $size['sizeName'],
'sizeSku' => $size['goodsSizeSkuId'],
'sizeStorage' => $size['goodsSizeStorageNum'],
);
}
}
}
// 商品图
... ...
... ... @@ -230,6 +230,7 @@ class NewsaleModel
* 筛选出来的热销排行榜商品数据处理
*
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* $param integer $channel 1表示男,2表示女,3表示潮童,4表示创意生活
* @param string|null $sort 品类ID查询参数
* @param integer|null $tab_id Tab的ID
* @param boolean $notab 时候返回顶部tab的数据,默认返回
... ... @@ -237,11 +238,11 @@ class NewsaleModel
* @param integer $page 分页第几页
* @return array 处理之后的数据
*/
public static function selectTopData($gender, $sort, $tab_id, $notab, $limit, $page)
public static function selectTopData($gender, $channel, $sort, $tab_id, $notab, $limit, $page)
{
$result = array();
$data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page);
$data = NewsaleData::getTopProducts($gender, $channel, $sort, $tab_id, $limit, $page);
if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) {
$result = NewSaleProcess::topData($data['data'], $notab, $limit, $page);
... ...
... ... @@ -11,7 +11,7 @@ class BrandController extends AbstractAction
/**
* 品牌一览
*
*
* @param string gender 老版本中使用的参数, 做兼容判断
* @param int channel 1表示男生频道, 2表示女生频道, 3表示潮童频道, 4表示创意生活频道
*/
... ... @@ -41,12 +41,15 @@ class BrandController extends AbstractAction
}
// 渲染模板
$this->_view->display('index', Category\BrandModel::getBrandByChannel($channel));
$this->_view->display('index', array(
'brandPage' => true,
'channel' => Category\BrandModel::getBrandByChannel($channel)
));
}
/**
* 品牌一览搜索页
*
*
* @param string gender 老版本中使用的参数, 做兼容判断
* @param int channel 1表示男生频道, 2表示女生频道, 3表示潮童频道, 4表示创意生活频道
*/
... ...
... ... @@ -110,7 +110,8 @@ class NewsaleController extends AbstractAction
// 获取性别
$gender = Helpers::getGenderByCookie();
$result = \Product\NewsaleModel::selectTopData($gender, $sort, $tab_id, $notab, $limit, $page);
$channel = Helpers::getChannelByCookie();
$result = \Product\NewsaleModel::selectTopData($gender, $channel, $sort, $tab_id, $notab, $limit, $page);
}
if (empty($result)) {
echo ' ';
... ...