reportList.js 3.7 KB
// pages/reportList/reportList.js
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    FamilyId: '', //家庭组ID
    allinfo: [], //家庭保单详情
    mid: '',
    cid: '',
    medicalreportlist: [], //数据列表
    vip_state:false,
    type:false
  },

  showInfo() {
    wx.showModal({
      title: '提示',
      content: '请充值会员',
      cancelText: '暂不充值',
      confirmText: '立即充值',
      success(res) {
        console.log(res)
        if (res.confirm) {
          wx.navigateTo({
            url: '/pages/index/VipRecharge/VipRecharge',
          })
        }
      },
    })
  },
  
  // 体检报告列表接口调取
  medicalReportList() {
    let url = 'counselor/publishlist';
    let that = this;
    wx.showLoading({
      title: '加载中',
      success: function() {
        setTimeout(function() {
          app.post(url, {
            FamilyId: that.data.FamilyId,
            UserId: app.globalData.UserId
          }).then((res) => {
            console.log(res)
            if (res.data.code == 200) {
              that.setData({
                medicalreportlist: res.data.data.users
              })

              if (res.data.data.users==''){
                wx.showToast({
                  title: '暂无数据',
                  icon:'none'
                })
              }
            }
          }).catch((errMsg) => {
            console.log(errMsg)
          })
        }, 100)
      }
    },3000)

  },


  // 跳转查看家庭汇总表页
  summaryList(e) {
    console.log(e)
    var PublishId = e.currentTarget.dataset.id
    wx.navigateTo({
      url: '/pages/index/summaryList2/summaryList2?PublishId=' + PublishId,
    })
  },

  gettype(){
    let that = this;
    var url = 'pubilc/UserType';
    var params = {
     
      UserId: app.globalData.UserId
    }
    app.post(url, params).then((res) => {
      console.log(res);
      if(res.data.data.type==5){
        that.setData({
          type:true
        })
      }



    }).catch((err) => {

    })
  },
  xiugai(){
    // wx.showToast({
    //   title: '会员到期,请充值',
    //   icon: 'none'
    // }, 2000)

    wx.showModal({
      title: '提示',
      content: '请充值会员',
      cancelText: '暂不充值',
      confirmText: '立即充值',
      success(res) {
        console.log(res)
        if (res.confirm) {
          wx.navigateTo({
            url: '/pages/index/VipRecharge/VipRecharge',
          })
        }
      },
    })
  },


  // 跳转查看家庭汇总表页
  editInfo(e) {
    var PublishId = e.currentTarget.dataset.id
    var allinfo = this.data.allinfo
    wx.navigateTo({
      url: '/pages/index/summaryList/summaryList?PublishId=' + PublishId + '&allinfo=' + allinfo,
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    this.setData({
      FamilyId: options.FamilyId,
      allinfo: options.allinfo,
      vip_state: options.vip_state ? options.vip_state:false
    })
    this.medicalReportList()
    this.gettype()
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})