Authored by Lynnic

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

... ... @@ -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;
... ...
... ... @@ -108,19 +108,14 @@ $page.on('touchstart', '.del-icon', function() {
success: function(data) {
if (data.code === 200) {
dialog.showDialog({
dialogText: '删除浏览记录成功',
autoHide: true,
fast: true
});
dialogText: '删除浏览记录成功',
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();
};
... ...
... ... @@ -3,7 +3,91 @@
* @author: 赵彪<bill.zhao@yoho.cn>
* @date: 2015/12/03
*/
var loading = require('../plugin/loading');
var $ = require('jquery');
var loading = require('../plugin/loading'),
tip = require('../plugin/tip'),
Hammer = require('yoho.hammer');
var theOrderCode = document.getElementById('ordercode').value;
var wxPayEl = document.getElementById('weixin'),
wxHammer = wxPayEl && new Hammer(wxPayEl);
var appIconPosition = {
baidu: '-2.7rem',
weixin: '-1.2rem',
QQ: '-5.4rem',
bank: '-4rem'
};
//隐藏微信分享选项
if (window.wx) {
wx.hideOptionMenu();
}
function onBridgeReady() {
document.addEventListener('WeixinJSBridgeReady', function() {
window.WeixinJSBridge && window.WeixinJSBridge.call('hideOptionMenu');
});
}
if (typeof WeixinJSBridge === undefined) {
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
} else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
}
onBridgeReady();
} else {
onBridgeReady();
}
//调用微信JS api 支付
function jsApiCall(orderCode, jsApiParameters) {
//防止重复操作弹框
window.WeixinJSBridge && window.WeixinJSBridge.invoke(
'getBrandWCPayRequest',
jsApiParameters,
function(res) {
window.location.href = '/home/orders/detail?order_code=' + orderCode;
}
);
}
//微信支付
function callpay(orderCode) {
var jsApiParameters;
if (typeof WeixinJSBridge === undefined) {
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
} else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', jsApiCall);
document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
}
} else {
$.ajax({
type: 'GET',
url: '/shopping/pay/wechatwapapi?order_code=' + orderCode,
dataType: 'json',
success: function(res) {
if (res.code === 200) {
jsApiParameters = res.data.jsApiParameters;
jsApiCall(orderCode, jsApiParameters);
} else {
tip.show('微信支付调取失败');
}
},
error: function() {
tip.show('请刷新本页面,完成微信支付');
}
});
}
}
function isWXOpen() {
var ua = navigator.userAgent.toLowerCase();
... ... @@ -16,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;
}
});
... ... @@ -32,47 +116,37 @@ function handleForWX() {
}
}
function setIcon(div, appName) {
if (appName.indexOf('百度') !== -1) {
div.style.backgroundPositionY = '-2.7rem';
return false;
}
if (appName.indexOf('微信') !== -1) {
div.style.backgroundPositionY = '-1.2rem';
return false;
}
if (appName.indexOf('银联') !== -1) {
div.style.backgroundPositionY = '-4rem';
return false;
}
if (appName.indexOf('QQ') !== -1) {
div.style.backgroundPositionY = '-5.4rem';
return false;
}
function setAppIcon(el, position) {
$(el).css('background-position-y', position);
}
function loadIcon() {
var boxs = document.getElementsByClassName('box');
var div = null;
var appName = null;
[].forEach.call(boxs, function(box, index) {
div = box.getElementsByClassName('icon')[0].getElementsByTagName('div')[0];
if (div) {
appName = box.getElementsByClassName('app')[0].innerHTML;
setIcon(div, appName);
var $boxs = $('.box');
var $div = null;
var appid = null;
$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]);
}
}
});
}
function showPage() {
var pageList = document.getElementsByClassName('payapp-list')[0];
var $pageList = $('.payapp-list');
$pageList.css('visibility', 'visible');
}
pageList.style.visibility = 'visible';
if (wxHammer) {
wxHammer.on('tap', function() {
callpay(theOrderCode);
});
}
function main() {
... ...
... ... @@ -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: '网络错误~'
});
});
}
});
... ...
... ... @@ -38,11 +38,14 @@ function hotrank(page, sort, tabId, notab) {
}
} else {
$('.no-result').remove();
$('.rank-main').remove();
if (page === 1) {
$('.rank-main').remove();
}
$('#hotRank').append(data);
}
lazyLoad($('img.lazy'));
$('.rank-main ul li:gt(2)').find('.item-content i').removeClass('top');
$('.rank-main ul li:gt(9)').find('.item-content i').removeClass('top');
winH = $(window).height();
if ($('.rank-main').length !== 0) {
$('#yoho-footer').css('position', 'static');
... ...
... ... @@ -47,14 +47,15 @@
font-size: 50px;
}
p{
width: 55.517241%;
width: 59.517241%;
height: auto;
padding: 0 5% 18em / $pxConvertRem;
margin: 0 3% 16em / $pxConvertRem;
float: left;
&:first-of-type{
padding-top: 0.75rem;
margin-top: 0.75rem;
font-size: 18px;
height: 76rem / $pxConvertRem;
height: auto;
min-height: 42px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
... ...
... ... @@ -310,7 +310,6 @@
line-height: pxToRem(65px);
text-align: center;
font-size: pxToRem(22px);
color: #fff;
.price-discount {
span {
... ...
... ... @@ -54,6 +54,8 @@
margin: (15rem / $pxConvertRem) 0 0 !important;
padding: 0 !important;
width: 9.5rem;
max-height: 72rem / $pxConvertRem;
overflow: hidden;
line-height: 36rem / $pxConvertRem;
color: #444;
font-size: 28rem / $pxConvertRem;
... ...
{{> 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}}
... ...
{{#coupons}}
<div class="employ-main" style="background-image:url('{{coupon_pic}}')">
<div class="employ-main">
<span>{{ money}}</span>
<p class="coupon-name">{{ coupon_name}}</p>
<p>有效期:{{ couponValidity}}</p>
... ...
{{> layout/header}}
<div class="pay-page yoho-page">
{{#if orderCode}}
<input id='ordercode' type="hidden" value="{{orderCode}}">
{{/if}}
<div class="payapp-list">
{{# payAppInfo}}
{{# payAppInfo}}
{{#if payLink}}
<a href="{{payLink}}">
<div class="box">
{{/if}}
<div class="box" id="{{appId}}">
<div class="icon">
{{#if appIcon}}
<img src="{{appIcon}}" alt="app图标">
... ... @@ -21,7 +26,9 @@
</div>
<div class="iconfont">&#xe604</div>
</div>
{{#if payLink}}
</a>
{{/if}}
{{/ payAppInfo}}
</div>
</div>
... ...
... ... @@ -21,7 +21,7 @@
</div>
<div class="item-content">
<i class="rank-icon top">{{rank}}</i>
<h2 {{# active}}class="hasActive"{{/ active}}>{{name}}</h2>
<h2 {{# sales_phrase}}class="hasActive"{{/ sales_phrase}}>{{name}}</h2>
{{# active}}
<p>{{.}}</p>
{{/ active}}
... ...
<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>
... ...
... ... @@ -642,7 +642,7 @@ class HomeController extends AbstractAction
$this->auditJumpLogin();
$backUrl = Helpers::url('/home');
$this->setTitle('我的订单');
$this->setNavHeader('我的订单', $backUrl);
... ... @@ -780,13 +780,14 @@ class HomeController extends AbstractAction
$this->setTitle('支付中心');
$this->setNavHeader('支付中心');
$orderCode = $this->get('order_code');
if (empty($orderCode)) {
$this->error();
}
$this->_view->display('pay', array(
'payCenterPage' => true,
'payAppInfo' => array(
0 => array(
'appIcon' => '',
... ... @@ -806,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
));
}
... ...
... ... @@ -251,7 +251,7 @@ class UserModel
$product['link'] = isset($one['goods'][0]) ? Helpers::url('/product/pro_' . $one['product_id'] . '_' . $one['goods'][0]['id'] . '/' . $one['cnAlphabet'] . '.html') : '';
$product['imgUrl'] = (isset($one['default_images']) && !empty($one['default_images'])) ? Images::getImageUrl($one['default_images'], 235, 314) : '';
$product['price'] = !empty($one['market_price']) ? '¥' . $one['market_price'] : 0;
$product['discount'] = !empty($one['sales_price']) ? '¥' . $one['sales_price'] : 0;
$product['discount'] = ($one['market_price'] > $one['sales_price']) ? '¥' . $one['sales_price'] : false;
$brand['productList'][] = $product;
}
... ...
... ... @@ -23,16 +23,16 @@ class NewsaleModel
/* 男生频道取新品到着及折扣专区数据的位置码 */
const CODE_TOP_NEW_BOYS = '3cf2c1be5217fbab6009ce83959e1e12';
const CODE_TOP_SALE_BOYS = 'e9c9be32d72e2906d404a72ee24cb523';
const CODE_TOP_SALE_BOYS = '153180b9a88c0b565848850c523bb637';
/* 女生频道取新品到着及折扣专区数据的位置码 */
const CODE_TOP_NEW_GIRLS = '1cf7f9f10e2a2670e73d05c568793ad9';
const CODE_TOP_SALE_GIRLS = '785c0e6aab746949073c4ffb9d5106ac';
const CODE_TOP_SALE_GIRLS = '0b2d133419a0f7c381306fd3522365e1';
/* 潮童频道取新品到着及折扣专区数据的位置码 */
const CODE_TOP_NEW_KIDS = '57457adececa6c748b29c90cad0ae940';
const CODE_TOP_SALE_KIDS = 'ad1bb67a6007819c86f737d74172fd2e';
const CODE_TOP_SALE_KIDS = 'de23648d28ee1e8a3f087a9dbac506f8';
/* 创意生活频道取新品到着及折扣专区数据的位置码 */
const CODE_TOP_NEW_LIFESTYLE = '04953a61cbf1db426a681e55d496d2fe';
const CODE_TOP_SALE_LIFESTYLE = '8132c7db3adbeb7b0d0002de9691c753';
const CODE_TOP_SALE_LIFESTYLE = '01269e498ff5b07756e0733ec0e88c75';
/**
* 获取新品到着的焦点图资源数据
... ... @@ -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 ' ';
... ...