self_mall_xcx/pages/goods/details/components/buy-bar/index.js
2023-10-23 19:56:08 +08:00

82 lines
1.3 KiB
JavaScript

Component({
externalClasses: ['wr-sold-out', 'wr-class'],
options: {
multipleSlots: true
},
properties: {
soldout: {
// 商品是否下架
type: Boolean,
value: false,
},
jumpArray: {
type: Array,
value: [],
},
isStock: {
type: Boolean,
value: true,
}, // 是否有库存
isCollect: {
type: Boolean,
value: false,
}, // 是否收藏
isSlotButton: {
type: Boolean,
value: false,
}, // 是否开启按钮插槽
shopCartNum: {
type: Number, // 购物车气泡数量
},
buttonType: {
type: Number,
value: 0,
},
minDiscountPrice: {
type: String,
value: '',
},
minSalePrice: {
type: String,
value: '',
},
},
data: {
fillPrice: false,
},
methods: {
toAddCart() {
const {
isStock
} = this.properties;
if (!isStock) return;
this.triggerEvent('toAddCart');
},
toBuyNow(e) {
const {
isStock
} = this.properties;
if (!isStock) return;
this.triggerEvent('toBuyNow', e);
},
toNav(e) {
const {
url,
title
} = e.currentTarget.dataset;
return this.triggerEvent('toNav', {
e,
url,
title
});
},
},
});