litian
2024-03-05 42cc31916c043f681c271efeb73394260e7d77aa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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,
    }, // 是否有库存
    isSlotButton: {
      type: Boolean,
      value: false,
    }, // 是否开启按钮插槽
    shopCartNum: {
      type: Number, // 购物车气泡数量
    },
    buttonType: {
      type: Number,
      value: 0,
    },
    minDiscountPrice: {
      type: String,
      value: '',
    },
    minSalePrice: {
      type: String,
      value: '',
    },
  },
 
  data: {
    fillPrice: false,
    shoppingCartGetId: null
  },
 
  methods: {
    toAddCart() {
      const { isStock } = this.properties;
      if (!isStock) return;
      this.triggerEvent('toAddCart');
      // let query = {
      //   start: 0,
      //   size: 999,
      //   filterList: [],
      //   searchList: []
      // }
      // app.MG.store.getShoppingCartProductList(query).then(res => {
      //   res.datas.forEach((item) => {
      //     console.log(item.saleMethod.id, 'item.saleMethod.id');
      //     this.setData({
      //       shoppingCartGetId: item.saleMethod.id
      //     })
 
      //   })
      // })
 
 
 
    },
 
    toBuyNow(e) {
      const { isStock } = this.properties;
      if (!isStock) return;
      this.triggerEvent('toBuyNow', e);
    },
 
    toNav(e) {
      const { url } = e.currentTarget.dataset;
      return this.triggerEvent('toNav', {
        e,
        url,
      });
    },
  },
});