index.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. Component({
  2. externalClasses: ['wr-sold-out', 'wr-class'],
  3. options: { multipleSlots: true },
  4. properties: {
  5. soldout: {
  6. // 商品是否下架
  7. type: Boolean,
  8. value: false,
  9. },
  10. jumpArray: {
  11. type: Array,
  12. value: [],
  13. },
  14. isStock: {
  15. type: Boolean,
  16. value: true,
  17. }, // 是否有库存
  18. isSlotButton: {
  19. type: Boolean,
  20. value: false,
  21. }, // 是否开启按钮插槽
  22. shopCartNum: {
  23. type: Number, // 购物车气泡数量
  24. },
  25. buttonType: {
  26. type: Number,
  27. value: 0,
  28. },
  29. minDiscountPrice: {
  30. type: String,
  31. value: '',
  32. },
  33. minSalePrice: {
  34. type: String,
  35. value: '',
  36. },
  37. },
  38. data: {
  39. fillPrice: false,
  40. },
  41. methods: {
  42. toAddCart() {
  43. const { isStock } = this.properties;
  44. if (!isStock) return;
  45. this.triggerEvent('toAddCart');
  46. },
  47. toBuyNow(e) {
  48. const { isStock } = this.properties;
  49. if (!isStock) return;
  50. this.triggerEvent('toBuyNow', e);
  51. },
  52. toNav(e) {
  53. const { url } = e.currentTarget.dataset;
  54. return this.triggerEvent('toNav', {
  55. e,
  56. url,
  57. });
  58. },
  59. },
  60. });