恢复商品和详情页面
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
Component({
|
||||
externalClasses: ['wr-class'],
|
||||
|
||||
options: { multipleSlots: true },
|
||||
|
||||
properties: {
|
||||
soldout: {
|
||||
// 商品是否下架
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
isStock: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
}, // 是否有库存
|
||||
isSlotButton: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
}, // 是否开启按钮插槽
|
||||
buttonType: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
toBuyNow(e) {
|
||||
const { isStock, soldout } = this.properties;
|
||||
if (soldout || !isStock) return;
|
||||
this.triggerEvent('toBuyNow', e);
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<view class="footer-cont wr-class">
|
||||
<block wx:if="{{buttonType === 1}}">
|
||||
<view
|
||||
class="bar-buy {{soldout || !isStock ? 'bar-buy-disabled' : ''}}"
|
||||
hover-class="{{soldout || !isStock ? '' : 'bar-buy--hover'}}"
|
||||
hover-stay-time="60"
|
||||
bindtap="toBuyNow"
|
||||
>
|
||||
{{soldout ? '商品已下架' : (!isStock ? '商品已售罄' : '立即购买')}}
|
||||
</view>
|
||||
</block>
|
||||
<block wx:if="{{isSlotButton}}">
|
||||
<slot name="buyButton" />
|
||||
</block>
|
||||
</view>
|
||||
@@ -0,0 +1,31 @@
|
||||
.footer-cont {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16rpx 24rpx;
|
||||
background-color: var(--bg-card);
|
||||
}
|
||||
|
||||
.bar-buy {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 88rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: var(--text-inverse);
|
||||
background: var(--brand-gradient);
|
||||
border-radius: var(--radius-round);
|
||||
box-shadow: var(--shadow-brand);
|
||||
transition: opacity 0.16s ease;
|
||||
}
|
||||
|
||||
.bar-buy--hover {
|
||||
opacity: 0.88;
|
||||
}
|
||||
|
||||
.bar-buy-disabled {
|
||||
color: var(--text-disabled) !important;
|
||||
background: var(--bg-grey) !important;
|
||||
box-shadow: none;
|
||||
}
|
||||
Reference in New Issue
Block a user