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
class="btn-car"
:class="{
'btn-car-disabled': attr.productSelect.stock === 0
'btn-car-disabled': (attr.productSelect.stock === 0 && attr.cartAttr) || storeInfo.stock === 0
}"
@click="joinCart"
>
@@ -344,7 +344,7 @@
<view
class="btn-buy"
:class="{
'btn-buy-disabled': attr.productSelect.stock === 0
'btn-buy-disabled': (attr.productSelect.stock === 0 && attr.cartAttr) || storeInfo.stock === 0
}"
@click="tapBuy"
>
@@ -1048,13 +1048,17 @@ export default {
},
// 点击加入购物车按钮
joinCart: function () {
if (this.attr.productSelect.stock === 0) return;
if ((this.attr.productSelect.stock === 0 && this.attr.cartAttr) || this.storeInfo.stock === 0) {
return
}
//0=加入购物车
this.goCat(0);
},
//立即购买;
tapBuy: function () {
if (this.attr.productSelect.stock === 0) return;
if ((this.attr.productSelect.stock === 0 && this.attr.cartAttr) || this.storeInfo.stock === 0) {
return
}
// 1=直接购买
this.goCat(1);
},