// pages/local/localHome/localhome.js
let app=getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    lineList:[],
    lineIndex:0,
    lineTeamList:[],
    toView:'oneday',
    site: {
      companyId: app.state.companyId,
      cityId: app.state.cityId,
      siteName: app.state.siteName,
    },
  },

  /**
   * 生命周期函数--监听页面加载
   */
  Scrolltap(e) {
    let color = e.target.dataset.index;
    this.setData({
      toView: color
    })
    },
  ChangeSite(val) {
    console.log(val.detail);
    this.setData({
      site: val.detail
    })
    this.onLoad();
  },
  onLoad: function (options) {
    let City = this.selectComponent('#CityComp');
    City.getCityList();
    this.GetLine();
  },
  
  ChangeSite(val) {
    this.setData({
      site: val.detail
    })
    this.onLoad();
  },
  GetLine() {
    let that = this;
    app.$apiJavaNew('/api/b2b/dayTrip/getLineItem', {}).then(res => {
      let lineList=res;
      
      if (lineList.length>0){
        let arr = lineList[0].lineTeamList;
        that.setData({
          lineTeamList: arr
        })
      }
      that.setData({
        lineList: lineList
      })
      console.log("lineTeamList", this.data.lineTeamList);


    }).catch(err => {
      wx.showToast({
        title: err.message,
        icon: 'none',
        duration: 1000
      })
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

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

  },

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

  },

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

  },

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

  },

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

  },

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

  }
})