审查视图

pages/index/periodicReviews/periodicReviews.js 5.2 KB
刘晓艳 authored
1
// pages/index/periodicReviews/periodicReviews.js
刘晓艳 authored
2
const app = getApp()
刘晓艳 authored
3 4 5 6 7 8
Page({

  /**
   * 页面的初始数据
   */
  data: {
刘晓艳 authored
9 10
    KeyWord: '',
    vip_state:false
刘晓艳 authored
11
  },
刘晓艳 authored
12
  
刘晓艳 authored
13 14 15 16 17
  //设置搜索关键词
  setkeyword(e) {
    this.setData({
      KeyWord: e.detail.value
    })
LXY authored
18
    
刘晓艳 authored
19 20
  },
刘晓艳 authored
21 22
  //
  goData() {
LXY authored
23
    this.getInfo()
刘晓艳 authored
24 25
  },
刘晓艳 authored
26 27 28 29 30
  //家庭保单汇总表
  summaryList(e) {
    var num = e.currentTarget.dataset.num
    var index = e.currentTarget.dataset.index
    var allinfo = JSON.stringify(e.currentTarget.dataset.allinfo)
刘晓艳 authored
31 32 33 34
  
    this.setData({
      allinfo: allinfo
    })
刘晓艳 authored
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
    var mid = e.currentTarget.dataset.mid
    if (mid == 1) {
      this.setData({
        mainid: mid
      })
    }
    if (num == 0) {
      wx.showToast({
        title: '您还没有保单,请添加!',
        icon: 'none',
      })
    } else {
      wx.navigateTo({
        url: '../summaryList/summaryList?allinfo=' + allinfo,
      })
    }
  },

  //保单列表
  policyList(e) {
    wx.navigateTo({
刘晓艳 authored
56
      url: '/pages/index/personalPolicyList/personalPolicyList?DefId=' + e.currentTarget.id,
刘晓艳 authored
57 58 59 60 61 62 63 64 65 66 67 68
    })
  },

  //保单管理
  PolicyManage(e) {
    wx.navigateTo({
      url: '../policyManage/policyManage?FamilyId=' + e.currentTarget.dataset.familyid
    })
  },

  //报告列表
  reportList(e) {
刘晓艳 authored
69
    var allinfo = JSON.stringify(e.currentTarget.dataset.allinfo)
刘晓艳 authored
70
    wx.navigateTo({
刘晓艳 authored
71
      url: '../reportList/reportList?FamilyId=' + e.currentTarget.dataset.familyid+'&allinfo='+allinfo,
刘晓艳 authored
72 73 74 75
    })
  },

  //
刘晓艳 authored
76
  getInfo() {
刘晓艳 authored
77 78 79 80
    let that = this;
    let url = 'counselor/familylist';
    let param = {
      UserId: app.globalData.UserId,
LXY authored
81
      Status: '', //固定传1
刘晓艳 authored
82 83 84
      KeyWord: that.data.KeyWord
    }
    app.post(url, param).then((res) => {
刘晓艳 authored
85
      console.log(res)
刘晓艳 authored
86
      if (res.data.code == 200) {
刘晓艳 authored
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
        that.setData({
          list: res.data.data.list,
          KeyWord: '',
          // vip_state: true
        })
        // if (res.data.data.type == '-13') {
        //   wx.showToast({
        //     title: '会员到期,请充值',
        //     icon: 'none',
        //     duration: 2000,
        //     success: function() {}
        //   }, 2000)
        //   that.setData({
        //     vip_state: false
        //   })
        // } else if (res.data.data.type == '-12') {
        //   wx.showToast({
        //     title: '您已经被禁用,请联系管理员',
        //     icon: 'none',
        //     success: function() {
        //       setTimeout(function() {
        //         wx.navigateTo({
        //           url: '/pages/index/index',
        //         })
        //       }, 2000)
        //     }
        //   }, 2000)
        //   that.setData({
        //     vip_state: false
        //   })
        // } else if (res.data.data.type == '-11') {
        //   wx.showToast({
        //     title: '您的权限不足',
        //     icon: 'none',
        //     success: function() {
        //       setTimeout(function() {
        //         wx.navigateTo({
        //           url: '/pages/index/index',
        //         })
        //       })
        //     }
        //   }, 2000)
        //   that.setData({
        //     vip_state: false
        //   })
        // } else {
        //   that.setData({
        //     list: res.data.data.list,
        //     KeyWord: '',
        //     vip_state: true
        //   })
        // }
      }
    }).catch((errMsg) => {
      console.log(errMsg)
    })

  },

  //获取客户管理页面信息
  getData() {
    let that = this;
    let url = 'pubilc/UserType';
    let param = {
      UserId: app.globalData.UserId,
    }
    app.post(url, param).then((res) => {
      console.log(res)
      if (res.data.code == 200) {
        if (res.data.data.type == '5') {
刘晓艳 authored
157 158
          wx.showToast({
            title: '会员到期,请充值',
刘晓艳 authored
159
            icon: 'none'
刘晓艳 authored
160 161 162
          }, 2000)
          that.setData({
            vip_state: false
刘晓艳 authored
163
          })
刘晓艳 authored
164
        } else if (res.data.data.type == '2') {
刘晓艳 authored
165 166
          wx.showToast({
            title: '您的权限不足',
刘晓艳 authored
167
            icon: 'none'
刘晓艳 authored
168
          }, 2000)
刘晓艳 authored
169 170 171
          that.setData({
            vip_state: false
          })
刘晓艳 authored
172 173
        } else {
          that.setData({
刘晓艳 authored
174
            vip_state: true
刘晓艳 authored
175
          })
176 177 178 179 180
          // if (res.data.data.list[0].users[0].cid != '') {
          //   that.setData({
          //     cid: res.data.data.list[0].users[0].cid,
          //   })
          // }
刘晓艳 authored
181 182 183
        }
      }
    }).catch((errMsg) => {
刘晓艳 authored
184
      // console.log(errMsg)
刘晓艳 authored
185 186 187 188 189 190 191 192
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    this.getData()
刘晓艳 authored
193
    this.getInfo()
刘晓艳 authored
194 195 196 197 198 199 200 201 202 203 204 205 206
  },

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

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {
刘晓艳 authored
207
    this.getData()
刘晓艳 authored
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
  },

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

  },

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

  },

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

  },

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

  },

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

  }
})