东风启辰小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
2.2KB

  1. // pages/coupon/coupon.js
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. imgUrl: app.globalData.urlStatic,//图片路径
  9. friendOpenid:null,//朋友的openid
  10. countNum:0,
  11. pageShow:false,//是否显示页面
  12. },
  13. /**
  14. * 生命周期函数--监听页面加载
  15. */
  16. onLoad: function (options) {
  17. app.globalData.nowPage = 2;
  18. if (options.friendOpenid) {
  19. this.data.friendOpenid = options.friendOpenid;
  20. wx.setStorageSync("friendOpenid", options.friendOpenid);
  21. app.globalData.friendOpenid = options.friendOpenid;
  22. }
  23. if (app.globalData.openid) {
  24. this.getOrderInfo();
  25. } else {
  26. app.globalData.openidSuccessFuc = this.getOrderInfo;
  27. }
  28. },
  29. /**
  30. * 生命周期函数--监听页面初次渲染完成
  31. */
  32. onReady: function () {
  33. },
  34. /**
  35. * 生命周期函数--监听页面显示
  36. */
  37. onShow: function () {
  38. },
  39. /**
  40. * 生命周期函数--监听页面隐藏
  41. */
  42. onHide: function () {
  43. },
  44. /**
  45. * 生命周期函数--监听页面卸载
  46. */
  47. onUnload: function () {
  48. },
  49. /**
  50. * 页面相关事件处理函数--监听用户下拉动作
  51. */
  52. onPullDownRefresh: function () {
  53. },
  54. /**
  55. * 页面上拉触底事件的处理函数
  56. */
  57. onReachBottom: function () {
  58. },
  59. /**
  60. * 用户点击右上角分享
  61. */
  62. onShareAppMessage: function () {
  63. return app.sharePack();
  64. },
  65. receive: function () {//立即领取
  66. wx.reLaunch({
  67. url: '/pages/index/index',
  68. })
  69. },
  70. getOrderInfo: function () {//查询是否已注册
  71. app.wxRequest(app.globalData.urlRoot +"userInfo/getOrderInfo",{},res=>{
  72. if(res.code==200){
  73. if(res.data){
  74. wx.reLaunch({
  75. url: '/pages/index/index',
  76. })
  77. }else{
  78. this.setData({
  79. pageShow:true
  80. })
  81. this.getTotalOrder();
  82. }
  83. }
  84. },this)
  85. },
  86. getTotalOrder:function(){//获取预约人数
  87. app.wxRequest(app.globalData.urlRoot + "userInfo/getTotalOrder", {}, res => {
  88. if (res.code == 200) {
  89. if (res.data) {
  90. this.setData({
  91. countNum: res.data.total
  92. })
  93. }
  94. }
  95. }, this)
  96. }
  97. })