Authored by Rock Zhang

Merge branch 'develop' into test

... ... @@ -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;
... ...
... ... @@ -109,18 +109,13 @@ $page.on('touchstart', '.del-icon', function() {
if (data.code === 200) {
dialog.showDialog({
dialogText: '删除浏览记录成功',
autoHide: true,
autoHide: 2000,
fast: true
});
setTimeout(function() {
window.history.go(0);
}, 1200);
}
},
complete: function() {
setTimeout(function() {
dialog.hideDialog();
}, 1500);
}
});
});
... ...
... ... @@ -37,6 +37,7 @@ exports.showDialog = function(data, callback) {
var dialogStr = dialogTemplate(data),
$dialogBox,
defaultHideDuraton,
dialogWrapperHammer;
$('.dialog-wrapper').remove();
... ... @@ -63,9 +64,13 @@ exports.showDialog = function(data, callback) {
//隐藏
if (data.autoHide) {
defaultHideDuraton = 1000;
if (data.autoHide > 1) {
defaultHideDuraton = data.autoHide;
}
setTimeout(function() {
$dialogWrapper.fadeOut();
}, 1000);
}, defaultHideDuraton);
}
dialogWrapperHammer.on('tap', function(event) {
... ... @@ -76,9 +81,5 @@ exports.showDialog = function(data, callback) {
callback();
}
});
};
exports.hideDialog = function() {
$dialogWrapper.fadeOut();
};
... ...
... ... @@ -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: '网络错误~'
});
});
}
});
... ...
... ... @@ -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
));
}
... ...
... ... @@ -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);
... ...
... ... @@ -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 ' ';
... ...