Authored by 梁志锋

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

... ... @@ -596,7 +596,7 @@ class Helpers
$oneGoods['appearDate'] = $value['expect_arrival_time'];
}
// 商品链接
if (isset($value['cn_alphabet']) ) {
if (isset($value['cn_alphabet'])) {
$oneGoods['url'] = self::url('/product/pro_' . $value['product_id'] . '_' . $value['goods_id'] . '/' . $value['cn_alphabet'] . '.html');
}
... ...
... ... @@ -8,7 +8,8 @@ var $ = require('jquery'),
lazyLoad = require('yoho.lazyload'),
Hammer = require('yoho.hammer');
var chosePanel = require('./chose-panel');
var chosePanel = require('./chose-panel'),
tip = require('../plugin/tip');
var $cartContent = $('.cart-content');
... ... @@ -46,7 +47,11 @@ if ($('.cart-nav').length > 0) {
}
$('.btn-balance').on('touchend', function() {
if($('.balance span').hasClass('icon-cb-checked')){
window.location.href = '/cart/index/orderEnsure?cartType=' + cartType;
} else {
tip.show('请先勾选商品~');
}
});
$('.chose').on('touchend', function() {
... ...
... ... @@ -52,7 +52,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
this.selected = properties.selected;
}
goodInfo.goods_type = getCartType();
goodInfo.goods_type = cartType;
goodInfo.selected = isSelected ? 'N' : 'Y';
goodInfo.product_sku = id;
goodInfo.buy_number = $good.find('.count').eq(0).text().trim().replace('×', '');
... ...
... ... @@ -16,9 +16,10 @@ var page = 1,
isGetData;
var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()),
conponNotAvaliableTmpl = Handlebars.compile($('#tmpl-coupon-not-avaliable').html()),
$newCoupon = $('#new-coupon');
// conponNotAvaliableTmpl = Handlebars.compile($('#tmpl-coupon-not-avaliable').html()),
ellipsis.init();
$newCoupon.on('submit', function() {
... ... @@ -54,6 +55,12 @@ $('#coupon-list').on('touchend', '.employ-main', function() {
orderInfo('couponValue', $this.data('coupon-value'));
});
$('body').on('touchend', '.not-use', function() {
orderInfo('couponCode', null);
orderInfo('couponValue', null);
});
$newCoupon.find('input').on('input', function() {
if ($(this).val() !== '') {
$newCoupon.find('.submit').css('background', '#444');
... ... @@ -109,15 +116,17 @@ function getCouponHandle(coupons) {
}
});
if (notAvailableCoupons.length) {
$('.not-avaliable-coupon-line').show();
}
$('#coupon-list').append(conponTmpl({
coupons: coupons
}));
$('#coupon-list-not').append(conponNotAvaliableTmpl({
notAvailableCoupons: notAvailableCoupons
}));
// 产品说,暂时不做不可使用的优惠券
// if (notAvailableCoupons.length) {
// $('.not-avaliable-coupon-line').show();
// }
// $('#coupon-list-not').append(conponNotAvaliableTmpl({
// notAvailableCoupons: notAvailableCoupons
// }));
window.rePosFooter();
}
... ...
... ... @@ -89,6 +89,10 @@
margin-left: 20rem / $pxConvertRem;
}
}
.name {
max-width: pxToRem(400px);
}
}
.sale-invoice {
... ...
... ... @@ -46,6 +46,17 @@
height: 0;
}
.not-use {
display: block;
width: pxToRem(560px);
margin: pxToRem(30px) auto;
text-align: center;
font-size: pxToRem(32px);
line-height: 2.5;
border: 1px solid #444;
@include border-radius(4px);
}
.not-avaliable-coupon-line {
position: relative;
margin-top: pxToRem(30px);
... ...
... ... @@ -45,11 +45,9 @@
<a href="/cart/index/selectCoupon">
<span class="title">优惠券</span>
{{# coupon}}
{{#if count}}
<span class="coupon-count">
{{count}}张可用
</span>
{{/if}}
{{#if value}}
<span class="used coupon-use">
... ...
... ... @@ -20,6 +20,7 @@
</a>
\{{/ notAvailable}}
\{{/coupons}}
<a class="not-use" href="/cart/index/orderEnsure">不使用任何优惠券</a>
</script>
<script id="tmpl-coupon-not-avaliable" type="text/tmpl">
\{{# notAvailableCoupons}}
... ...
... ... @@ -416,7 +416,7 @@ class CartModel
foreach ($payReturn['goods_list'] as $single) {
$oneGoods = array();
$oneGoods['id'] = $single['product_sku']; // TODO 未确定用哪个
$oneGoods['thumb'] = Images::getImageUrl($single['goods_images'], 120, 120);
$oneGoods['thumb'] = Images::getImageUrl($single['goods_images'], 120, 160);
$oneGoods['name'] = $single['product_name'];
$oneGoods['color'] = $single['color_name'];
$oneGoods['size'] = $single['size_name'];
... ...
... ... @@ -153,8 +153,9 @@ class DetailModel
// 商品信息
if (!empty($baseInfo['goodsList'])) {
$colorGroup = array();
$sizeList = array();
$sizeGroup = array();
$goodsGroup = array();
$sizeList = array();
$thumbImageList = array();
$colorStorageGroup = array(); // 颜色分组的库存总数集合, 多个之间用/分隔
$sizeStorageStr = ''; // 尺码库存总数集合, 多个之间用/分隔
... ... @@ -177,7 +178,7 @@ class DetailModel
// 商品的尺码列表
if (isset($value['goodsSizeBoList'])) {
foreach ($value['goodsSizeBoList'] as $size) {
$sizeList[] = array(
$sizeList[ $value['colorId'] ][] = array(
'id' => $size['id'],
'skuId' => $size['goodsSizeSkuId'],
'goodsId' => $size['goodsId'],
... ... @@ -189,7 +190,6 @@ class DetailModel
$sizeStorageStr .= $size['goodsSizeStorageNum'] . '/';
$colorStorageGroup[ $size['sizeName'] ][ $value['colorName'] ] = $size['goodsSizeStorageNum'];
}
}
// 颜色分组
$colorGroup[] = array(
... ... @@ -200,11 +200,11 @@ class DetailModel
'colorNum' => $colorStorageNum,
'sizeNumStr' => rtrim($sizeStorageStr, '/'),
);
}
// 缩略图
$thumbImageList[] = array('img' => Helpers::getImageUrl($value['colorImage'], 60, 60) );
// 统计尺码对应的各个颜色的库存量
foreach ($sizeList as &$sizeArr) {
$sizeArr['colorNumStr'] = implode('/', array_values($colorStorageGroup[ $sizeArr['name'] ]) );
}
... ... @@ -213,6 +213,11 @@ class DetailModel
$totalStorageNum += $colorStorageNum;
}
// 统计尺码对应的各个颜色的库存量
foreach ($colorGroup as $value) {
$sizeGroup[]['size'] = $sizeList[ $value['colorId'] ];
}
// 商品图: 多个
if (isset($goodsGroup[1])) {
foreach ($goodsGroup as $value) {
... ... @@ -247,7 +252,7 @@ class DetailModel
$result['cartInfo']['salePrice'] = isset($result['goodsPrice']['currentPrice']) ? $result['goodsPrice']['currentPrice'] : '';
$result['cartInfo']['totalNum'] = $totalStorageNum;
$result['cartInfo']['colors'] = $colorGroup;
$result['cartInfo']['sizes'] = $sizeList;
$result['cartInfo']['sizes'] = $sizeGroup;
}
// 非卖品
elseif ($notForSale) {
... ... @@ -469,6 +474,7 @@ class DetailModel
'</p>' => '',
'<img src=' => "<img class=\"lazy\" src=\"data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw==\" data-original=",
'<img border="0" src=' => "<img border=\"0\" class=\"lazy\" src=\"data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw==\" data-original=",
'.jpg' => '.jpg?imageMogr2/thumbnail/750x/quality/90',
)),
);
}
... ...