Authored by hf

Merge branch 'develop' into test

... ... @@ -30,7 +30,7 @@ class Yohobuy
// const API_OLD = 'http://api2.open.yohobuy.com/';
/* 测试环境 */
const API_URL = 'http://testapi.yoho.cn:28078/';
const API_URL = 'http://testapi.yoho.cn:28078/';
const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_OLD = 'http://test2.open.yohobuy.com/';
... ...
... ... @@ -596,12 +596,12 @@ class Helpers
} elseif ($value['goods_type'] == 'gift' && !isset($value['isAdvanceBuy'])) {
$oneGoods['isGift'] = true;
$oneGoods['salesPrice'] = self::transPrice($value['sales_price']);
$oneGoods['price'] = self::transPrice($value['sale_price']);
$oneGoods['price'] = self::transPrice($value['last_price']);
} elseif ($value['goods_type'] == 'price_gift') {
$oneGoods['showCheckbox'] = true;
$oneGoods['isAdvanceBuy'] = true;
$oneGoods['salesPrice'] = self::transPrice($value['sales_price']);
$oneGoods['price'] = self::transPrice($value['sale_price']);
$oneGoods['price'] = self::transPrice($value['last_price']);
} else {
$oneGoods['showCheckbox'] = true;
}
... ...
... ... @@ -9,23 +9,76 @@ var $ = require('jquery'),
Hammer = require('yoho.hammer');
var chosePanel = require('./chose-panel'),
dialog = require('../me/dialog'),
tip = require('../plugin/tip');
var $cartContent = $('.cart-content');
var $cartContent = $('.cart-content'),
cartType = $('#cartType').val(),
hasShowCartPresellTip = false;
var navHammer,
advanceBuyHammer,
freebieHammer,
cartType = $('#cartType').val();
freebieHammer;
var hasChecked = $('.cart-content:not(.hide) .icon-cb-checked').length > 0 ? true : false; //是否有选中商品
function shouldSelectGift() {
var $freebie = $('.freebie');
if ($freebie.length <= 0) {
return false;
}
return true;
}
function shouldLowStocks() {
var $lowStocks = $('.low-stocks'),
result = false;
if ($lowStocks.length <= 0) {
return result;
}
$lowStocks.each(function(idx, item) {
if ($(item).parent().parent().parent().siblings('.checkbox').hasClass('icon-cb-checked')) {
result = true;
return false;
}
});
return result;
}
function showChooseGifDialog() {
dialog.showDialog({
dialogText: '您还未选择赠品,是否去选择赠品',
hasFooter: {
leftBtnText: '我不要赠品',
rightBtnText: '去选择'
}
}, function() {
window.location.href = $('.freebie').find('a').attr('href');
}, function() {
window.location.href = '/cart/index/orderEnsure?cartType=' + cartType;
});
}
require('./good');
lazyLoad($('img.lazy'));
if (typeof window.cookie === 'function' && 'y' === window.cookie('_hasShowCartPresellTip')) {
$('#presell-tip').removeClass('show').addClass('hide');
hasShowCartPresellTip = true;
} else {
$('#presell-tip').removeClass('hide').addClass('show');
}
if ('advance' === cartType) {
$cartContent.toggleClass('hide');
$('presell-cart-nav').addClass('active');
$('common-cart-nav').removeClass('active');
}
if ($('.cart-nav').length > 0) {
... ... @@ -39,8 +92,10 @@ if ($('.cart-nav').length > 0) {
if (cartType === 'ordinary') {
cartType = 'advance';
$('#cartType').val('advance');
} else {
cartType = 'ordinary';
$('#cartType').val('ordinary');
}
$this.siblings('.active').removeClass('active');
... ... @@ -55,9 +110,12 @@ if ($('.cart-nav').length > 0) {
$(window).trigger('scroll');
});
setTimeout(function() {
$('#presell-tip').addClass('hide');
}, 3000);
if (!hasShowCartPresellTip) {
setTimeout(function() {
$('#presell-tip').removeClass('show').addClass('hide');
window.setCookie('_hasShowCartPresellTip', 'y');
}, 3000);
}
}
if ($('.advance-buy').length > 0) {
... ... @@ -74,16 +132,12 @@ if ($('.freebie').length > 0) {
});
}
//$('.advance-buy').on('touchend', function() {
// window.location.href = '/cart/index/advanceBuy?cartType=' + cartType;
//});
//
//$('.freebie').on('touchend', function() {
// window.location.href = '/cart/index/gift?cartType=' + cartType;
//});
$('.btn-balance').on('touchend', function() {
if ($('.low-stocks').length > 0) {
if (shouldSelectGift()) {
showChooseGifDialog();
return false;
}
if (shouldLowStocks()) {
tip.show('库存不足无法结算');
return false;
}
... ... @@ -99,7 +153,7 @@ $('.chose').on('touchend', function() {
chosePanel.show();
});
if ($('.cart-zero').length > 0) {
if ($('.shopping-cart-good').length <= 0) {
require('../product/recommend-for-you');
}
... ...
... ... @@ -14,7 +14,6 @@ var dialog = require('../me/dialog'),
orderInfo = require('./order-info').orderInfo;
var $selectAllBtn = $('.balance .checkbox'),
cartType = $('#cartType').val(),
requesting = false;
ellipsis.init();
... ... @@ -43,7 +42,12 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
var goodsList = [],
goodInfo = {};
goodInfo.goods_type = cartType;
if (!$this.hasClass('icon-cb-checked') && $this.siblings('.info').find('.low-stocks').length > 0) {
tip.show('库存不足,无法购买');
return false;
}
goodInfo.goods_type = $('#cartType').val();
goodInfo.selected = $this.hasClass('icon-cb-checked') ? 'N' : 'Y';
goodInfo.product_sku = id;
goodInfo.buy_number = $good.find('.count').eq(0).text().trim().replace('×', '');
... ... @@ -62,7 +66,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
} else {
$this.removeClass('icon-checkbox').addClass('icon-cb-checked');
}
window.history.go(0);
window.location.href = '/cart/index/index?cartType=' + $('#cartType').val();
} else if (data.code === 400) {
tip.show('网络异常');
}
... ... @@ -186,7 +190,7 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) {
//全选按钮点击事件
$selectAllBtn.on('touchend', function() {
bottomCheckBoxHandeler($(this).hasClass('icon-cb-checked'), cartType, didUpdateAllGoodsCheckStatus);
bottomCheckBoxHandeler($(this).hasClass('icon-cb-checked'), $('#cartType').val(), didUpdateAllGoodsCheckStatus);
});
$('.down').on('touchend', function() {
... ...
... ... @@ -97,12 +97,6 @@ function orderCompute() {
if ($.type(res) !== 'object') {
window.location.reload();
} else {
/*if (res.order_amount) {
res.order_amount = (+res.order_amount).toFixed(2);
}
if (res.discount_amount) {
res.discount_amount = (+res.discount_amount).toFixed(2);
}*/
if (res.last_order_amount) {
res.last_order_amount = (+res.last_order_amount).toFixed(2);
}
... ... @@ -128,6 +122,10 @@ function submitOrder() {
var invoiceText = $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'),
msg = $('#msg').find('input').val() || orderInfo('msg');
if (orderInfo('deliveryId') === 2 && !$addressWrap.data('support')) {
tip.show('当前地址不支持顺丰快递');
return;
}
if (isSubmiting) {
return false;
}
... ...
... ... @@ -191,8 +191,8 @@ function getCouponDate() {
getCouponDate();
$(window).scroll(function() {
if ($(window).scrollTop() + $(window).height() > $('body').height() * 0.9) {
getCouponDate();
}
});
// $(window).scroll(function() {
// if ($(window).scrollTop() + $(window).height() > $('body').height() * 0.9) {
// getCouponDate();
// }
// });
... ...
... ... @@ -3,7 +3,8 @@
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/21
*/
var $ = require('jquery');
var $ = require('jquery'),
Hammer = require('yoho.hammer');
var $footer = $('#yoho-footer'),
$yohoPage = $('.yoho-page'),
... ... @@ -131,6 +132,8 @@ function reMarginFooter(fixedElement) {
var user = getUser();
var backToTopHammer;
rePosFooter(); //计算底部位置
if (user === 0) {
... ... @@ -151,10 +154,15 @@ function reMarginFooter(fixedElement) {
);
}
$op.find('.back-to-top').on('touchend', function() {
$(window).scrollTop(0);
return false;
});
if ($op.find('.back-to-top').length > 0) {
backToTopHammer = new Hammer($op.find('.back-to-top')[0]);
backToTopHammer.on('tap', function(e) {
$(window).scrollTop(0);
e.srcEvent.preventDefault();
return false;
});
}
$footer.removeClass('hide');
}());
... ...
... ... @@ -15,7 +15,7 @@ function downLoadApp() {
var appUrl = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445';
var clickedAt = new Date();
setTimeout(function () {
setTimeout(function() {
if ((new Date()) - clickedAt < 2000) {
window.location = appUrl;
}
... ...
... ... @@ -33,7 +33,7 @@ dialogTpl = '<div id="dialog-wrapper" class="dialog-wrapper">' +
dialogTemplate = Handlebars.compile(dialogTpl);
exports.showDialog = function(data, callback) {
exports.showDialog = function(data, callback, callbackForLeft) {
var dialogStr = dialogTemplate(data),
$dialogBox,
... ... @@ -76,6 +76,9 @@ exports.showDialog = function(data, callback) {
dialogWrapperHammer.on('tap', function(event) {
if ($(event.target).hasClass('dialog-left-btn')) {
if (typeof callbackForLeft === 'function') {
callbackForLeft();
}
$dialogWrapper.fadeOut();
} else if ($(event.target).hasClass('dialog-right-btn')) {
callback();
... ...
... ... @@ -28,6 +28,7 @@ function nextStep(url, mobileNo, areaCode) {
}
requested = true;
$btnNext.addClass('disable').html('绑定中...');
$.ajax({
type: 'POST',
... ... @@ -37,11 +38,13 @@ function nextStep(url, mobileNo, areaCode) {
areaCode: areaCode.replace('+', '')
},
success: function(res) {
console.log(res.data);
// console.log(res.data);
location.href = url;
},
error: function() {
tip.show('出错了,请重试!');
$btnNext.removeClass('disable').html('下一步');
requested = false;
}
});
... ... @@ -86,7 +89,8 @@ $btnNext.on('touchstart', function() {
nickname: nickname
},
success: function(res) {
console.log(res);
// console.log(res);
//res : {
// code: 'xxx',
... ...
... ... @@ -32,13 +32,16 @@ function showFooter() {
}, 200);
}
if ($('#goodsDiscount h1').length < 1) {
$('.dropdown').remove();
}
showFooter();
require('./like');
lazyLoad($('img.lazy'));
if ($('#goodsDiscount h1').length < 1) {
$('.dropdown').remove();
}
//顶部swiper
goodsSwiper = new Swiper('.banner-swiper', {
lazyLoading: true,
... ... @@ -100,4 +103,4 @@ if ($('.good-detail-page').length > 0) {
$('#yoho-footer').css('border-top', '1px solid #e0e0e0');
}
require('./like');
... ...
... ... @@ -19,6 +19,9 @@ $.ajax({
if (count > 99) {
count = '99+';
}
if (count === 0) {
$('.cart-count').remove();
}
$cart.find('.cart-count').html(count).removeClass('hide');
}
}
... ...
... ... @@ -185,7 +185,7 @@
height: pxToRem(60px);
color: #444;
background: #efefef;
font-size: pxToRem(16px);
font-size: pxToRem(24px);
line-height: 1;
outline: 0;
border: 0;
... ...
... ... @@ -61,7 +61,7 @@
position: relative;
margin-top: pxToRem(30px);
margin-bottom: pxToRem(30px);
font-size: pxToRem(14px);
font-size: pxToRem(28px);
line-height: 2;
color: #b0b0b0;
text-align: center;
... ...
... ... @@ -32,4 +32,10 @@
}
}
}
}
.deal_main{
margin: .5rem 3%;
font-size:1.2em;
widows: 94%;
overflow: hidden;
}
\ No newline at end of file
... ...
... ... @@ -20,15 +20,15 @@
{{#if cartNav}}
<ul class="cart-nav clearfix">
<li class="active">
<span>
<span id="common-cart-nav">
普通商品({{commonGoodsCount}})
</span>
</li>
<li>
<span>
<span id="presell-cart-nav">
预售商品({{presellGoodsCount}})
</span>
<div id="presell-tip" class="presell-tip">
<div id="presell-tip" class="presell-tip hide">
<div class="triangle"></div>
<p class="pt-content">预售商品点这里结算哦~</p>
</div>
... ...
... ... @@ -46,6 +46,9 @@
{{#if isAdvanceBuy}}
<span class="sale-price">¥{{salesPrice}}</span>
{{/if}}
{{#if isGift}}
<span class="sale-price">¥{{salesPrice}}</span>
{{/if}}
</p>
{{#if isVipPrice}}
<span class="vip">
... ...
... ... @@ -28,5 +28,5 @@
s.parentNode.insertBefore(hm, s);
})();
</script>
<script src="http://static.yohobuy.com/js/analytics/analysis.js"></script>
<script src="http://static.yohobuy.com/m/v1/js/om_code.js"></script>
<script src="http://static.yohobuy.com/js/analytics/analysis.js" async="async"></script>
<script src="http://static.yohobuy.com/m/v1/js/om_code.js" async="async"></script>
... ...
... ... @@ -867,6 +867,7 @@ class HomeController extends AbstractAction
$this->_view->display('help', array(
'iHelp' => Home\HelpModel::serviceInfo(),
'pageFooter' => true
));
}
... ... @@ -886,6 +887,7 @@ class HomeController extends AbstractAction
$this->_view->display('help-detail', array(
'iHelp' => Home\HelpModel::serviceDetail($code),
'pageFooter' => true
));
}
... ...
... ... @@ -346,7 +346,8 @@ class CartModel
$result['phoneNum'] = isset($address['mobile']) ? $address['mobile'] : $payReturn['delivery_address']['mobile'];
$result['area'] = isset($address['area']) ? $address['area'] : $payReturn['delivery_address']['area'];
$result['address'] = isset($address['address']) ? $address['address'] : $payReturn['delivery_address']['address'];
$result['isSupport'] = ($payReturn['delivery_address']['is_support'] === 'Y');
$isSupport = isset($address['is_support']) ? $address['is_support'] : $payReturn['delivery_address']['is_support'];
$result['isSupport'] = $isSupport === 'Y';
}
// 配送方式
... ...
... ... @@ -3,7 +3,6 @@
use Action\AbstractAction;
use LibModels\Wap\Guang\DetailData;
use LibModels\Wap\Product\ListData;
use LibModels\Wap\Guang\OptData;
use Plugin\Helpers;
/**
... ...