闫增涛
2024-02-23 fdfb3ca757ecd6c396632ed276ff354671d3a7e5
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
86
87
Component({
  options: {
    addGlobalClass: true,
    multipleSlots: true,
  },
 
  externalClasses: ['coupon-class'],
 
  properties: {
    mask: {
      type: Boolean,
      value: false, // 是否添加遮罩
    },
    superposable: {
      type: Boolean,
      value: false, // 是否可叠加
    },
    type: {
      type: String,
      value: '', // 优惠券类型:CouponType
    },
    value: {
      type: String,
      value: '', // 优惠金额
    },
    tag: {
      type: String,
      value: '', // 优惠标签,优惠券名字标签,img
    },
    desc: {
      type: String,
      value: '', // 优惠金额描述,金额下方
    },
    title: {
      type: String, // 优惠券名称
      value: '',
    },
    timeLimit: {
      type: String, // 优惠券时限
      value: '',
    },
    ruleDesc: {
      type: String, // 优惠券适用规则描述
      value: '',
    },
    currency: {
      type: String,
      value: '¥', // 优惠货币
    },
    status: {
      type: String,
      value: 'default',
    },
    image: {
      type: String,
      value: '',
    },
  },
 
  data: {
    CouponType: {
      MJ_COUPON: 1,
      ZK_COUPON: 2,
      MJF_COUPON: 3,
      GIFT_COUPON: 4,
    },
    theme: 'primary',
  },
 
  observers: {
    status: function (value) {
      let theme = 'primary';
      // 已过期或已使用的券 颜色置灰
      if (value === 'useless' || value === 'disabled') {
        theme = 'weak';
      }
 
      this.setData({ theme });
    },
  },
 
  attached() {
    this.setData({
      color: `color${this.properties.colorStyle}`,
    });
  },
});