Commit c98bdc6f authored by Junling Bu's avatar Junling Bu
Browse files

update[litemall-wx]: 商品没有货时,显示“商品已售空”。

parent fca65981
......@@ -24,7 +24,8 @@ Page({
openAttr: false,
noCollectImage: '/static/images/icon_collect.png',
hasCollectImage: '/static/images/icon_collect_checked.png',
collectBackImage: '/static/images/icon_collect.png'
collectBackImage: '/static/images/icon_collect.png',
soldout: false
},
getGoodsInfo: function () {
let that = this;
......@@ -197,6 +198,9 @@ Page({
// 规格所对应的货品选择以后
let checkedProductArray = this.getCheckedProductItem(this.getCheckedSpecKey());
if (!checkedProductArray || checkedProductArray.length <= 0) {
this.setData({
soldout: true
});
console.error('规格所对应货品不存在');
return;
}
......@@ -204,21 +208,23 @@ Page({
let checkedProduct = checkedProductArray[0];
if (checkedProduct.goodsNumber > 0){
this.setData({
checkedSpecPrice: checkedProduct.retailPrice
checkedSpecPrice: checkedProduct.retailPrice,
soldout: false
});
}
else{
this.setData({
checkedSpecPrice: this.data.goods.retailPrice
checkedSpecPrice: this.data.goods.retailPrice,
soldout: true
});
}
}
else{
this.setData({
checkedSpecText: '规格数量选择',
checkedSpecPrice: this.data.goods.retailPrice
checkedSpecPrice: this.data.goods.retailPrice,
soldout: false
});
}
......
......@@ -138,10 +138,10 @@
<view class="box">
<text class="cart-count">{{cartGoodsCount}}</text>
<image bindtap="openCartPage" class="icon" src="/static/images/ic_menu_shoping_nor.png"></image>
</view>
</view>
<view class="c" bindtap="addFast">立即购买</view>
<view class="r" bindtap="addToCart">加入购物车</view>
<view class="c" bindtap="addFast" wx:if="{{!soldout}}">立即购买</view>
<view class="r" bindtap="addToCart" wx:if="{{!soldout}}">加入购物车</view>
<view class="n" wx:if="{{soldout}}">商品已售空</view>
</view>
</scroll-view>
\ No newline at end of file
......@@ -590,6 +590,17 @@
text-align: center;
color: #fff;
}
.bottom-btn .n{
border:1px solid #f4f4f4;
background: #f4f4f4;
float: left;
height: 100rpx;
line-height: 96rpx;
flex: 1;
text-align: center;
}
@import "../../lib/wxParse/wxParse.wxss";
.attr-pop{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment