Feat(商品):1、库存为0时,加入购物车及立即购买变成灰色;2、库存为0时,相应规格右上角显示缺货标签,并且该缺货规格为灰色不可点击状态

This commit is contained in:
lifizer
2024-03-06 17:55:33 +08:00
parent 855ad17ed2
commit b92e043c77
4 changed files with 85 additions and 20 deletions
+36 -14
View File
@@ -292,8 +292,11 @@
<image class="logo" :src="systemStore.image" mode="scaleToFill"/>
{{ systemStore.name }}
</view>
<view class="value flex ai-center" style="color:#DA0000" @click="goStore">进店逛逛
<uni-icons type="right" size="12" color="#DA0000"></uni-icons>
<view
class="flex ai-center store-btn"
@click="goStore"
>
进店逛逛
</view>
</view>
@@ -437,17 +440,36 @@
</view>
<view class="bnt acea-row row-middle row-right"
style="background: transparent !important;border-radius: 0 !important;">
<view class="btn-car" :class="{'btn-car-disabled':isOpen === true && attr.productSelect.stock === 0}"
@click="joinCart">加入购物车
<view
class="bnt acea-row row-middle row-right"
style="background: transparent !important;border-radius: 0 !important;"
>
<view
class="btn-car"
:class="{
'btn-car-disabled': attr.productSelect.stock === 0
}"
@click="joinCart"
>
加入购物车
</view>
<view class="btn-buy" :class="{'btn-buy-disabled':isOpen === true && attr.productSelect.stock === 0}"
@click="tapBuy">立即购买
<view
class="btn-buy"
:class="{
'btn-buy-disabled': attr.productSelect.stock === 0
}"
@click="tapBuy"
>
立即购买
</view>
</view>
</view>
<ProductWindow v-on:changeFun="changeFun" :attr="attr" :cartNum="cart_num"/>
<ProductWindow
v-on:changeFun="changeFun"
:attr="attr"
:product-value="productValue"
:cartNum="cart_num"
/>
<StorePoster v-on:setPosterImageStatus="setPosterImageStatus" :posterImageStatus="posterImageStatus"
:posterData="posterData" :goodId="id"></StorePoster>
<ShareInfo v-on:setShareInfoStatus="setShareInfoStatus" :shareInfoStatus="shareInfoStatus"></ShareInfo>
@@ -1175,13 +1197,13 @@ export default {
},
// 点击加入购物车按钮
joinCart: function () {
if (this.isOpen === true && this.attr.productSelect.stock === 0) return;
if (this.attr.productSelect.stock === 0) return;
//0=加入购物车
this.goCat(0);
},
//立即购买;
tapBuy: function () {
if (this.isOpen === true && this.attr.productSelect.stock === 0) return;
if (this.attr.productSelect.stock === 0) return;
// 1=直接购买
this.goCat(1);
},
@@ -1580,8 +1602,8 @@ export default {
}
.btn-car-disabled {
border: 2rpx solid #D0D0D0;
color: #D0D0D0;
border: 2rpx solid #707070;
color: #707070;
}
.btn-buy {
@@ -1594,7 +1616,7 @@ export default {
}
.btn-buy-disabled {
background: #D0D0D0;
background: #9D9D9D;
}
}