index.js 881 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * Copyright (C) 2018-2019
  3. * All rights reserved, Designed By www.joolun.com
  4. * 注意:
  5. * 本软件为www.joolun.com开发研制,项目使用请保留此说明
  6. */
  7. const app = getApp()
  8. Component({
  9. properties: {
  10. couponInfo: {
  11. type: Object,
  12. value: {}
  13. },
  14. toUse: {
  15. type: Boolean,
  16. value: true
  17. }
  18. },
  19. data: {
  20. },
  21. methods: {
  22. couponUserSave(){
  23. app.api.couponUserSave({
  24. couponId: this.data.couponInfo.id
  25. })
  26. .then(res => {
  27. wx.showToast({
  28. title: '领取成功',
  29. icon: 'success',
  30. duration: 2000
  31. })
  32. let couponInfo = this.data.couponInfo
  33. couponInfo.couponUser = res.data
  34. this.setData({
  35. couponInfo: couponInfo
  36. })
  37. this.triggerEvent('receiveCoupon', couponInfo)
  38. })
  39. }
  40. }
  41. })