Authored by OF1706

gouwuche一些

... ... @@ -94,8 +94,8 @@ const formatCartGoods = (cartGoods, isAdvanceCart, inValid, isOffShelves, analys
if (goods.productNum > goods.storageNum) {
goods.isTipNoStore = true; // 是否在结算时候显示库存不足
goods.tipMessage = '库存不足';
} else if (goods.storageNum <= 2) {
goods.tipMessage = '余量有限';
} else if (goods.storageNum <= 3) {
goods.tipMessage = '仅剩'+goods.storageNum+'件';
}
} else { // 失效商品
goods.inValid = true;
... ...
... ... @@ -57,9 +57,9 @@
<div>{{productNum}}</div>
{{^}}
<div class="cart-num-cont">
<span class="minus"></span>
<span class="minus cart-num-btn"><i class="iconfont icon-minus"></i></span>
<input type="text" value="{{productNum}}" readonly="readonly"/>
<span class="plus"></span>
<span class="plus cart-num-btn"><i class="iconfont icon-plus"></i></span>
</div>
<p class="tip-message {{#isTipNoStore}}tipNoStore{{/isTipNoStore}}">{{tipMessage}}</p>
... ...
... ... @@ -102,13 +102,9 @@
<i class="sellOut iconfont">&#xe6e0;</i>已售罄
</button>
{{#if isFav}}
<button class="btn-favCount favAdd" data-role="fav-count"><i class="favCount iconfont coled">&#xe68f;</i>已收藏</button>
<button class="btn-favCount none favCancel" data-role="fav-count"><i class="favCount iconfont">&#xe68f;</i>收藏商品</button>
<button class="btn-favCount none favTip" data-role="fav-count"><i class="favCount iconfont coled">&#xe68f;</i>取消收藏</button>
<button class="btn-favCount favAdd" data-role="fav-count"><i class="favCount iconfont coled">&#xe68f;</i><em>已收藏</em></button>
{{else}}
<button class="btn-favCount favCancel" data-role="fav-count"><i class="favCount iconfont">&#xe68f;</i>收藏商品</button>
<button class="btn-favCount none favAdd" data-role="fav-count"><i class="favCount iconfont coled">&#xe68f;</i>已收藏</button>
<button class="btn-favCount none favTip" data-role="fav-count"><i class="favCount iconfont coled">&#xe68f;</i>取消收藏</button>
<button class="btn-favCount favCancel" data-role="fav-count"><i class="favCount iconfont">&#xe68f;</i><em>收藏商品</em></button>
{{/if}}
</div>
{{#if isView}}
... ...

40.4 KB | W: | H:

40.4 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
... ... @@ -220,6 +220,8 @@ Cart = {
var $this = $(this);
var $item = $this.closest('li[data-role="pitem"]');
var content = '<div><i class="iconfont">&#xe68e;</i>移入收藏</div><p>确定要将该商品从购物车中移入收藏夹吗?<br/>移入收藏后该商品将不在购物车中显示</p>';
var item = {
product_sku: $item.data('id'),
buy_number: $item.data('productnum'),
... ... @@ -230,7 +232,9 @@ Cart = {
return;
}
capi.cartItemDel(item);
new RConfirm(content,function(){
capi.cartItemDel(item,true);
});
},
toFavAll: function() {
... ...
... ... @@ -236,12 +236,18 @@ GoodsWinAction = {
}
},
//收藏
btnFav: function() {
var favBtn = $('[data-role="fav-count"]');
var $this = $(this);
var $goodsDetail = $this.closest('.detail-goods');
var pid = $goodsDetail.data('productid');
var colTxt = {
normal: '收藏商品',
coled: '已收藏',
hover: '取消收藏'
};
function tipFav(parent) {
... ... @@ -256,7 +262,6 @@ GoodsWinAction = {
if (favBtn.find('.favCount').hasClass('coled')) {
console.log('取消'+888);
console.log(pid);
capi.productCollect(pid,true).done(function(obj){
... ... @@ -264,14 +269,13 @@ GoodsWinAction = {
tipFav(pid);
return false;
}
// $favBtn.addClass('none');
// $favBtn.hasClass('favCancel').removeClass('none').show();
favBtn.mouseover(function(){
favBtn.html('<i class="favCount iconfont">&#xe68f;</i>收藏商品');
favBtn.find('.favCount').removeClass('coled');
favBtn.find('em').text(colTxt.normal);
favBtn.mouseenter(function(){
favBtn.find('em').text(colTxt.normal);
}).mouseleave(function(){
favBtn.html('<i class="favCount iconfont">&#xe68f;</i>收藏商品');
}).html('<i class="favCount iconfont">&#xe68f;</i>收藏商品');
event.stopPropagation();
favBtn.find('em').text(colTxt.normal);
});
}).fail(function(){
... ... @@ -282,7 +286,6 @@ GoodsWinAction = {
} else {
console.log('收藏'+9999);
console.log(pid);
capi.productCollect(pid).done(function(obj){
if(!obj && obj.code !== 200){
... ... @@ -290,14 +293,14 @@ GoodsWinAction = {
return false;
}
// $favBtn.addClass('none');
// $favBtn.hasClass('favAdd').removeClass('none').show();
favBtn.mouseover(function(){
favBtn.html('<i class="favCount iconfont coled">&#xe68f;</i>取消收藏').mouseleave(function(){
favBtn.html('<i class="favCount iconfont coled">&#xe68f;</i>已收藏');
});
}).html('<i class="favCount iconfont coled">&#xe68f;</i>已收藏');
event.stopPropagation();
favBtn.find('.favCount').addClass('coled');
favBtn.find('em').text(colTxt.coled);
favBtn.mouseenter(function(){
favBtn.find('em').text(colTxt.hover);
}).mouseleave(function(){
favBtn.find('em').text(colTxt.coled);
});
obj.stopPropagation();
}).fail(function(){
... ... @@ -321,6 +324,7 @@ GoodsWinAction = {
if ($curSize.length <= 0) {
$this.closest('.detail-info').find('.size-p-tip').show();
$this.closest('.detail-info').find('.submit').css('marginTop','0');
// new Alert('请选择尺码').show();
return false;
... ...
... ... @@ -397,13 +397,16 @@
box-sizing: border-box;
outline: none;
cursor: pointer;
i{
i {
width: 16px;
height: 16px;
display: inline-block;
vertical-align: top;
margin-right: 8px;
}
em {
font-weight: normal;
}
.favCount {
color: #b0b0b0;
&.coled {
... ...
... ... @@ -776,6 +776,7 @@
.dt {
width: 25px;
height: 35px;
cursor: pointer;
img {
width: 25px;
height: 35px;
... ... @@ -895,7 +896,7 @@
.minus {
position: absolute;
top: 0;
left: 0;
left: 1px;
}
input {
position: absolute;
... ... @@ -917,18 +918,40 @@
font-size: 15px;
border: 1px solid #e0e0e0;
}
span {
.cart-num-btn {
display: inline-block;
width: 31px;
width: 30px;
height: 30px;
border: 1px solid #e0e0e0;
background-color: #fff;
cursor: pointer;
font-size: 14px;
box-sizing: border-box;
}
.minus{
background: url(/cart/ico_minus.png);
.icon-minus {
font-size: 18px;
display: inline-block;
vertical-align: middle;
color: #b4b4b4;
text-stroke-width: .5px;
-webkit-text-stroke-width: .5px;
&:before {
content:'\e63c';
}
}
.plus{
background: url(/cart/ico_plus.png);
.icon-plus {
display: inline-block;
vertical-align: middle;
font-size: 17px;
color: #b4b4b4;
&:before {
content:'\e644';
}
}
.disabled {
i {
color: rgba(180,180,180,.3);
}
}
}
... ...