123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- var http = require('../../utils/http.js');
- var util = require('../../utils/util.js');
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- item: Object,
- type: Number,
- order: Boolean,
- canUse: Boolean,
- index: Number,
- showTimeType: Number,
- },
- /**
- * 组件的初始数据
- */
- data: {
- stsType: 4
- },
- // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
- attached: function() {
- //console.log(this.data.item);
- },
- /**
- * 组件的方法列表
- */
- methods: {
- receiveCoupon() {
- util.checkAuthInfo(() => {
- var couponId = this.data.item.couponId;
- http.request({
- url: "/p/myCoupon/receive",
- method: "POST",
- data: couponId,
- callBack: () => {
- var coupon = this.data.item;
- coupon.canReceive = false;
- this.setData({
- item: coupon
- })
- }
- })
- })
- },
- checkCoupon(e) {
- // this.triggerEvent('checkCoupon', this.data.index);
- this.triggerEvent('checkCoupon', {
- couponId: e.currentTarget.dataset.couponid
- });
- console.log(e.currentTarget.dataset.couponid)
- },
- /**
- * 立即使用
- */
- useCoupon() {
- var url = '/pages/prod-classify/prod-classify?sts=' + this.data.stsType;
- var id = this.data.item.couponId;
- var title = "优惠券活动商品";
- if (id) {
- url += "&tagid=" + id + "&title=" + title;
- }
- wx.navigateTo({
- url: url
- })
- },
- }
- })
|