 
var util = require('../../utils/util.js')
const app = getApp();
Page({
  data: {
    calcDate: util.getToday(),
    isShow1: true,
    isShow2: true,
    isShow3: true,
    isShow4: true,
    isShow5: true,
    noData:'../../images/noData.png',
    dataListTips1: "暂无数据",
    dataListTips2: "暂无数据",
    dataListTips3: "暂无数据",
    dataListTips4: "暂无数据",
    dataListTips5: "暂无数据",
   
    customerId:"",

    // 拜访记录
    servicetable1: {
      getdataListParm: {
        name: 'getVisit',
        page: 1,
        offset: 1,
        pagecount: 10,
        returntype: 'Map',
        parammaps: { visitCode: "", customerId: "", groupId: "", visiterId: "", receiverName: "", beginDate: "", endDate: "" }
      },
      tableKey: 0,
      list: [],
      total: 0,
      listLoading: true,
      temp: {}
    },
    // 回访记录
    servicetable2: {
      getdataListParm: {
        name: 'getTelvisit',
        page: 1,
        offset: 1,
        pagecount: 10,
        returntype: 'Map',
        parammaps: { telVisitCode: "", customerId: "", groupId: "", visiterId: "", receiverId: "", typeIds: "", statusId: "", beginDate: "", endDate: "" }
      },
      tableKey: 0,
      list: [],
      total: 0,
      listLoading: true,
      temp: {}
    },

  
    servicetable3: {
      getdataListParm: {
        name: 'getRemote',
        page: 1,
        offset: 1,
        pagecount: 10,
        returntype: 'Map',
        parammaps: { customerId: "", groupId: "", employeeId: "", receiverName: "", beginDate: "", endDate: "" }
      },
      tableKey: 0,
      list: [],
      total: 0,
      listLoading: true,
      temp: {}
    },
    servicetable4: {
      getdataListParm: {
        name: 'getService',
        page: 1,
        offset: 1,
        pagecount: 10,
        returntype: 'Map',
        parammaps: { serviceCode: "", customerId: "", groupId: "", employeeId: "", servicetypeId: "", beginDate: "", endDate: "" }
      },
      tableKey: 0,
      list: [],
      total: 0,
      listLoading: true,
      temp: {}
    },
    servicetable5: {
      getdataListParm: {
        name: 'getComplaint',
        page: 1,
        offset: 1,
        pagecount: 10,
        returntype: 'Map',
        parammaps: { customerId: "", groupId: "", proposerId: "", respondentId: "", statusName: "", beginDate: "", endDate: "" }
      },
      tableKey: 0,
      list: [],
      total: 0,
      listLoading: true,
      temp: {}
    } 
    

  },

  onLoad: function (options) {
    var id = options.id;
    console.log(id)
    //获取编辑内容
    this.setData({
      ['servicetable1.getdataListParm.parammaps.customerId']: id,
      ['servicetable2.getdataListParm.parammaps.customerId']: id,
      ['servicetable3.getdataListParm.parammaps.customerId']: id,
      ['servicetable4.getdataListParm.parammaps.customerId']: id,
      ['servicetable5.getdataListParm.parammaps.customerId']: id,
      "customerId": id,
    })
    
     util.getDataByName(this.data.servicetable1.getdataListParm, this.getList1)
     util.getDataByName(this.data.servicetable2.getdataListParm, this.getList2)
     util.getDataByName(this.data.servicetable3.getdataListParm, this.getList3)
     util.getDataByName(this.data.servicetable4.getdataListParm, this.getList4)
     util.getDataByName(this.data.servicetable5.getdataListParm, this.getList5)
  },
 
  getList1:  function (res) {
    console.log('table数据======>', res.data.list)
    if (res.data.list !== null) {
      this.setData({
        isShow1: true,
        ['servicetable1.list']: res.data.list,
        ['servicetable1.pageNum']: res.data.pageNum,
        ['servicetable1.pageSize']: res.data.pageSize,
        ['servicetable1.total']: res.data.total
      })
    } else {
      this.setData({
        ['servicetable1.list']: [],
        isShow1: false,
        dataListTips1: "暂无数据"
      })
    }
  },
 
  getList2:  function (res) {
    console.log('table2数据======>', res.data.list)
    if (res.data.list !== null) {
      this.setData({
        isShow2: true,
        ['servicetable2.list']: res.data.list,
        ['servicetable2.pageNum']: res.data.pageNum,
        ['servicetable2.pageSize']: res.data.pageSize,
        ['servicetable2.total']: res.data.total
      })
    } else {
      this.setData({
        ['servicetable2.list']: [],
        isShow2: false,
        dataListTips2: "暂无数据"
      })
    }
  },

  getList3:  function (res) {
    console.log('table3数据======>', res.data.list)
    if (res.data.list !== null) {
      this.setData({
        isShow3: true,
        ['servicetable3.list']: res.data.list,
        ['servicetable3.pageNum']: res.data.pageNum,
        ['servicetable3.pageSize']: res.data.pageSize,
        ['servicetable3.total']: res.data.total
      })
    } else {
      this.setData({
        ['servicetable3.list']: [],
        isShow3: false,
        dataListTips3: "暂无数据"
      })
    }
  },

  getList4:  function (res) {
    console.log('table4数据======>', res.data.list)
    if (res.data.list !== null) {
      this.setData({
        isShow4: true,
        ['servicetable4.list']: res.data.list,
        ['servicetable4.pageNum']: res.data.pageNum,
        ['servicetable4.pageSize']: res.data.pageSize,
        ['servicetable4.total']: res.data.total
      })
    } else {
      this.setData({
        ['servicetable4.list']: [],
        isShow4: false,
        dataListTips4: "暂无数据"
      })
    }
  },
  getList5:  function (res) {
    console.log('table2数据======>', res.data.list)
    if (res.data.list !== null) {
      this.setData({
        isShow5: true,
        ['servicetable5.list']: res.data.list,
        ['servicetable5.pageNum']: res.data.pageNum,
        ['servicetable5.pageSize']: res.data.pageSize,
        ['servicetable5.total']: res.data.total
      })
    } else {
      this.setData({
        ['servicetable5.list']: [],
        isShow5: false,
        dataListTips5: "暂无数据"
      })
    }
  },

  //查看
  on_see_tap1: function (e) {
    var id = e.currentTarget.dataset.id;
    wx.navigateTo({ url:"../workbench/visitRecordSee/visitRecordSee?id=" + id})
  },
  on_see_tap2: function (e) {
    var id = e.currentTarget.dataset.id;
    wx.navigateTo({ url:"../workbench/telephoneFollowSee/telephoneFollowSee?id=" + id})
  },
  on_see_tap3: function (e) {
    
    var id = e.currentTarget.dataset.id;
    console.log(id )
    wx.navigateTo({ url:"../workbench/remoteServiceSee/remoteServiceSee?id=" + id})
  },
  on_see_tap4: function (e) {
    var id = e.currentTarget.dataset.id;
    wx.navigateTo({ url:"../workbench/siteServiceSee/siteServiceSee?id=" + id})
  },
  on_see_tap5: function (e) {
    var id = e.currentTarget.dataset.id;
    wx.navigateTo({ url:"../workbench/complaintRecordSee/complaintRecordSee?id=" + id})
  },
  
 


})