give.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. const util =require('../../utils/util.js')
  2. const app = getApp()
  3. Page({
  4. data: {
  5. info:{},
  6. phone:'',
  7. id:''
  8. },
  9. onLoad: function (options) {
  10. this.setData({id:options.id})
  11. this.getInfo()
  12. },
  13. inputChange(e){
  14. this.setData({phone:e.detail.value})
  15. },
  16. getInfo(){//成长卡领取详情
  17. let that = this;
  18. util.ajax({
  19. func: "v2/growthCard/receiveStatus",
  20. data: { "id":that.data.id },
  21. load: false
  22. }, function (res) {
  23. if (res.code == 0) {
  24. that.setData({info:res.data})
  25. } else {
  26. util.showTips(res.reason);
  27. }
  28. });
  29. },
  30. submit(){//成长卡领取
  31. let that = this;
  32. if(util.isPhone(this.data.phone)){
  33. util.showTips("请输入正确的手机号");
  34. return false
  35. }
  36. util.ajax({
  37. func: "v2/growthCard/receive",
  38. data: {"phone": that.data.phone,"id":that.data.id},
  39. }, function (res) {
  40. if (res.code == 0) {
  41. wx.navigateTo({
  42. url: '/pages/growthCard/result?status=' +res.data.status
  43. })
  44. } else {
  45. util.showTips(res.reason);
  46. }
  47. });
  48. }
  49. })