coupon.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // pages/my/coupon/coupon.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. down: false,
  8. shopping: [
  9. {
  10. list: [
  11. 'sss',
  12. 'sss',
  13. 'sss',
  14. ],
  15. isExpire:false
  16. },
  17. {
  18. list: [
  19. 'sss',
  20. 'sss',
  21. 'sss',
  22. ],
  23. isExpire:true
  24. },
  25. ],
  26. isNum:false,
  27. code:''
  28. },
  29. /**
  30. * 生命周期函数--监听页面加载
  31. */
  32. onLoad: function (options) {
  33. },
  34. changeBtn(e) {
  35. console.log(e.detail);
  36. if (e.detail.value || e.detail.value != '') {
  37. this.setData({
  38. isNum:true
  39. })
  40. }else{
  41. this.setData({
  42. isNum:false
  43. })
  44. }
  45. },
  46. onReady: function () {
  47. this.toast = this.selectComponent("#toast");
  48. },
  49. listenerLogin: function () {
  50. this.toast.showToast('优惠券无效');
  51. },
  52. exchange(){
  53. if (!this.data.isNum) return
  54. this.listenerLogin()
  55. },
  56. clearValue(){
  57. this.setData({
  58. code:'',
  59. isNum:false
  60. })
  61. }
  62. })