buy-bar.ts 1.5 KB

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