Authored by hf

Merge branch 'develop' into test

... ... @@ -191,7 +191,7 @@ class Helpers
*/
public static function transPrice($price)
{
return (!empty($price) && !is_float($price)) ? $price . '.00' : number_format($price, 2, '.', '');
return number_format($price, 2, '.', '');
}
/**
... ...
... ... @@ -133,15 +133,16 @@ if ($('.freebie').length > 0) {
}
$('.btn-balance').on('touchend', function() {
if (shouldSelectGift()) {
showChooseGifDialog();
return false;
}
if (shouldLowStocks()) {
tip.show('库存不足无法结算');
return false;
}
if (shouldSelectGift()) {
showChooseGifDialog();
return false;
}
if (hasChecked) {
window.location.href = '/cart/index/orderEnsure?cartType=' + cartType;
} else {
... ...
... ... @@ -32,6 +32,7 @@ var $chosePanel = $('#chose-panel'),
queryString,
$yohoPage = $('.yoho-page');
//初始化购物车面板显示
function init() {
hasChooseColor = false;
... ... @@ -60,7 +61,19 @@ function checkColorSizeNum() {
return true;
}
function show(html, cb) {
var scrollPosition = [
document.documentElement.scrollLeft || document.body.scrollLeft,
document.documentElement.scrollTop || document.body.scrollTop
],
$html = $('html'); // it would make more sense to apply this to body, but IE7 won't have that
$html.data('scroll-position', scrollPosition);
$html.data('previous-overflow', $html.css('overflow'));
$html.css('overflow', 'hidden');
window.scrollTo(scrollPosition[0], scrollPosition[1]);
if (html) {
$chosePanel.html(html);
if ($('#promotionId').val() !== '') {
... ... @@ -76,6 +89,12 @@ function show(html, cb) {
//隐藏当前Panel
function hide() {
var $html = $('html'),
scrollPosition = $html.data('scroll-position');
// un-lock scroll position
$html.css('overflow', $html.data('previous-overflow'));
window.scrollTo(scrollPosition[0], scrollPosition[1]);
$('.chose-panel').hide();
}
... ...
... ... @@ -190,6 +190,10 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) {
//全选按钮点击事件
$selectAllBtn.on('touchend', function() {
if ($('.low-stocks').length > 0) {
tip.show('所选商品中含有库存不足的商品');
return false;
}
bottomCheckBoxHandeler($(this).hasClass('icon-cb-checked'), $('#cartType').val(), didUpdateAllGoodsCheckStatus);
});
... ...
... ... @@ -41,7 +41,7 @@ optHammer.on('tap', function(e) {
}
}).then(function(res) {
$('#dialog-wrapper').hide();
if (!res) {
if ($.type(res) !== 'object') {
return;
}
if (res.message) {
... ... @@ -70,7 +70,7 @@ optHammer.on('tap', function(e) {
}
}).then(function(res) {
$('#dialog-wrapper').hide();
if (!res) {
if ($.type(res) !== 'object') {
return;
}
if (res.message) {
... ...
... ... @@ -15,7 +15,7 @@
position: absolute;
top: 50%;
margin-top: -14rem / $pxConvertRem;
margin-left: 20rem / $pxConvertRem;
margin-left: 8rem / $pxConvertRem;
font-size: 28rem / $pxConvertRem;
&.icon-cb-checked {
... ... @@ -28,9 +28,9 @@
}
.few-tag{
width: 132rem / $pxConvertRem;
width: 148rem / $pxConvertRem;
position: absolute;
left: 100rem / $pxConvertRem;
left: 92rem / $pxConvertRem;
text-align: center;
top: 75%;
color: #fff;
... ... @@ -170,7 +170,7 @@
}
.icon-del {
right: 14rem / $pxConvertRem;
right: 20rem / $pxConvertRem;
}
.icon-edit {
... ...
... ... @@ -5,7 +5,7 @@
.icon-cb-checked:before { content: "\e61d"; }
.shopping-cart-page {
padding-bottom: 120rem / $pxConvertRem;
margin-bottom: 120rem / $pxConvertRem;
overflow-x: hidden;
background: #f0f0f0;
... ...
... ... @@ -137,6 +137,13 @@
color: #999;
}
}
.checkbox {
display: inline-block;
width: 80rem / $pxConvertRem;
text-align: center;
margin-right: -20rem / $pxConvertRem;
}
.coin-check {
float: right;
... ...
... ... @@ -63,6 +63,10 @@ class CartModel
// 调用接口获取购物车的数据
$cartData = CartData::cartData($uid, $shoppingKey);
// 当购物车为空时,用户也已经登录过, 再取一次
if (empty($cartData['data']) && is_numeric($uid) && !empty($shoppingKey)) {
$cartData = CartData::cartData(0, $shoppingKey);
}
// 处理普通购物车和预售购物车的数据
do {
... ... @@ -408,7 +412,7 @@ class CartModel
$oneGoods['name'] = $single['product_name'];
$oneGoods['color'] = $single['color_name'];
$oneGoods['size'] = $single['size_name'];
$oneGoods['price'] = Helpers::transPrice($single['sales_price']);
$oneGoods['price'] = Helpers::transPrice($single['last_price']);
$oneGoods['count'] = $single['buy_number'];
//gift=>是否赠品,advanceBuy=>是否加价购;
... ...