Fix(商品):[#1071]商品详情的立即购买,加入购物车两个按钮,只有在当前商品所有规格库存全部为0时,才变为灰色不可点击状态

This commit is contained in:
lifizer
2024-04-07 16:55:19 +08:00
parent ec0752a267
commit 6b2da9e91d
+8 -4
View File
@@ -335,7 +335,7 @@
<view <view
class="btn-car" class="btn-car"
:class="{ :class="{
'btn-car-disabled': attr.productSelect.stock === 0 'btn-car-disabled': (attr.productSelect.stock === 0 && attr.cartAttr) || storeInfo.stock === 0
}" }"
@click="joinCart" @click="joinCart"
> >
@@ -344,7 +344,7 @@
<view <view
class="btn-buy" class="btn-buy"
:class="{ :class="{
'btn-buy-disabled': attr.productSelect.stock === 0 'btn-buy-disabled': (attr.productSelect.stock === 0 && attr.cartAttr) || storeInfo.stock === 0
}" }"
@click="tapBuy" @click="tapBuy"
> >
@@ -1048,13 +1048,17 @@ export default {
}, },
// 点击加入购物车按钮 // 点击加入购物车按钮
joinCart: function () { joinCart: function () {
if (this.attr.productSelect.stock === 0) return; if ((this.attr.productSelect.stock === 0 && this.attr.cartAttr) || this.storeInfo.stock === 0) {
return
}
//0=加入购物车 //0=加入购物车
this.goCat(0); this.goCat(0);
}, },
//立即购买; //立即购买;
tapBuy: function () { tapBuy: function () {
if (this.attr.productSelect.stock === 0) return; if ((this.attr.productSelect.stock === 0 && this.attr.cartAttr) || this.storeInfo.stock === 0) {
return
}
// 1=直接购买 // 1=直接购买
this.goCat(1); this.goCat(1);
}, },