coupon.js 932 Bytes
// components/coupon/coupon.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    data: {
      type: Object
    },
    type: {
      type:Number,
      value: 1,
      observer: function (newVal, oldVal) { 
      }
    },
    showBtn: {
      type: Boolean,
      value: true
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    touch(e) {
      let id = e.currentTarget.dataset.id;
      let index = e.currentTarget.dataset.index;
      let activityId = e.currentTarget.dataset.activityid;
      if(index == 1) {
        this.triggerEvent('toUse', {id, activityId})
      } else {
        this.triggerEvent('receive', {id, activityId})
      }
    },
    goDetail(e) {
      let id = e.currentTarget.dataset.id
      let receiveStatus = e.currentTarget.dataset.status
      this.triggerEvent('goDetail', { id, receiveStatus})
    }
  }
})