policyList.js 2.1 KB
// pages/PolicyList/PolicyList.js
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    policylist: [],
    DefId: '' //客户Id
  },

  makePhoneCall(e) {
    let that = this;
    var policylist = that.data.policylist
    var index = e.currentTarget.dataset.index
    var phoneNumber = policylist[index].umobile
    wx.makePhoneCall({
      phoneNumber: phoneNumber
    })
  },


  //
  listDetail(e) {
    var InId = e.currentTarget.dataset.id
    wx.navigateTo({
      url: '../policyListDetail/policyListDetail?InId=' + InId,
    })
  },

  // 保单列表接口调取
  policyList() {
    let that = this;
    let url = 'member/insurancelist'
    let params = {
      UserId: app.globalData.UserId
    }
    wx.showLoading({
      title: '加载中',
      success: function() {
        setTimeout(function() {
          app.post(url, params).then((res) => {
           var policylist=res.data.data.list
           for(var i in policylist){
             policylist[i].year_money = parseInt(policylist[i].year_money)
           }
            that.setData({
              policylist: policylist
            })
            console.log('policylist',that.data.policylist)
          })
        }, 100)
      }
    }, 3000)

  },



  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    let that = this;

    console.log(options.DefId);
    that.setData({
      DefId: options.DefId
    })

    this.policyList()
  },


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

  },

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

  },

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

  },

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

  },

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

  },

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

  },

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

  }
})