Authored by htoooth

fix js

... ... @@ -1138,6 +1138,9 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => {
// 秒杀商品
result.secKill = propOrigin('is_secKill', 'N');
// 量贩
result.bundleType = propOrigin('bundle_type', 0);
let requestApi = {
addition: _getProductAdditionInfoAsync(origin), // 预处理所有的数据
fav: _getProductFavoriteDataAsync(uid, result.productId), // 处理收藏喜欢数据
... ... @@ -1392,7 +1395,7 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => {
// 普通商品
result.bundle = {
count: 1,
type: 0
type: result.bundleType
};
}
... ...
... ... @@ -456,10 +456,18 @@
</div>
<div class="shoppingCar">
<div class="shoppingCar-btn">
<i class="iconfont">&#xe600;</i>
<span>加入购物车</span>
</div>
{{#if goodsInfo.soldOUt}}
<div class="shoppingCar-btn disable">
<i class="iconfont">&#xe61c;</i>
<span>已售罄</span>
</div>
{{^}}
<div class="shoppingCar-btn">
<i class="iconfont">&#xe600;</i>
<span>加入购物车</span>
</div>
{{/if}}
<div class="shoppingCar-nav">
<ul>
... ...
... ... @@ -41,6 +41,8 @@ var $main = $('.main'),
var maxStock = -1; // 记录当前选中的颜色-尺码的库存量,若为-1,代表未选择尺码
var $maxColor = null; // 记录当前选中的颜色
var $shoppingCarBtn = $('.shoppingCar-btn');
var SLIDETIME = 200;
var colTxt = {
... ... @@ -78,6 +80,21 @@ function isEmpty(el) {
return !$.trim(el.html());
}
function showSellOut() {
$shoppingCarBtn.addClass('disable')
.find('i').html('&#xe61c;').end()
.find('span').html('已售罄');
}
function showAddCart() {
$shoppingCarBtn.removeClass('disable')
.find('i').html('&#xe600;').end()
.find('span').html('加入购物车');
}
cartEvent.on('selling', showAddCart);
cartEvent.on('sellout', showSellOut);
require('../plugins/slider');
require('../common/center-slider');
... ...
... ... @@ -947,7 +947,7 @@
margin-left: 961px;
}
.shoppingCar{
.shoppingCar {
background-color: #f5f5f5;
float: left;
height: 240px;
... ... @@ -977,6 +977,13 @@
background: rgba(233, 38, 1, 0.8);
}
&.disable {
background: #ccc;
border: 1px solid #ccc;
color: white;
}
}
.shoppingCar-nav{
... ...